Jon, Thank you again for your advice. I'm guessing you discovered the mesh problem by visualizing the grid. I will have to remember that for future projects. I will also strongly consider a new boundary condition for the center line of the cylinder.
Thank you, Dan On Mon, Apr 22, 2019 at 11:57 AM Guyer, Jonathan E. Dr. (Fed) via fipy < fipy@nist.gov> wrote: > Daniel - > > Two things going on here: > > - Your constraint is being applied at the tip of the wedge of the > cylindrical coordinates. Since this "face" has no area, that Dirichlet > condition doesn't generate any flux in or out of the domain. Offsetting the > cylinder slightly from the origin resolves this: > > mesh = CylindricalGrid1D(Lr = L,nr=nx) + [[L/nx]] > > I recommend giving some thought as to whether it even makes sense to apply > a Dirichlet condition along the centerline of a cylinder. > > - Because you've introduced coefficients which change with temperature, > your equation is now nonlinear and so sweeping is required (2 is apparently > enough). At each time step, execute: > > for sweep in range(2): > res = eq.sweep(dt=dt) > > rho.setValue(rho_l,where = PCM & (T>350) ) > k.setValue(k_l,where = PCM & (T>350)) > Cp.setValue(Cp_l,where = PCM & (T>350)) > > With these changes, the evolution seems generally similar to your Grid1D > case. > > - Jon > > > On Apr 15, 2019, at 1:28 PM, Daniel DeSantis <desan...@gmail.com> wrote: > > > > Jonathan, > > > > I have just a few follow up questions. Namely, regarding to working > within cylindrical coordinates. If I switch the mesh to cylindrical, it > seems the temperature profile never changes, unless I go to extremely small > time steps. That strikes me as odd. What do you think? > > > > Also, the shifting profile seems to reverse, with the left boundary > condition dropping to ~300K over time while in Cartesian coordinates, the > temperature rises to 600K over time (a result I would expect). I've > included a copy of the work with the changes you've suggested previously. > If you look at lines 23/24, you can toggle the cylindrical grid on and off, > and in lines 30-34, I've included options for the time steps that work for > each respective coordinate system. Do you have any suggestions? > > > > Finally, in reference to the velocity I would like to incorporate, I > understand the difference between Cell Variables and Face Variables, but > why is the rank of the velocity -1? What does the Face Variable rank > indicate? > > > > Thank you, > > Dan > > > > On Thu, Apr 11, 2019 at 8:14 AM Guyer, Jonathan E. Dr. (Fed) via fipy < > fipy@nist.gov> wrote: > > > > > > > On Apr 10, 2019, at 4:42 PM, Daniel DeSantis <desan...@gmail.com> > wrote: > > > > > > 1) Set a different Cp, rho, and k in just the PCM domain when the > temperature in that domain crosses over a certain melt temperature (350K). > I tried an if statement inside the solving loop and I think that has > worked, based on some print testing I did in the loop. I just wanted to get > your opinion and see if that was the right way to go. > > > > Seems reasonable, as long as you're calling `.setValue()` and not > redefining Cp, rho, and k. > > > > In fact, I wouldn't use an `if`: > > > > >>> for step in range(steps): > > ... T.updateOld() > > ... eq.solve(dt=dt) > > ... rho.setValue(rho_melt, where=PCM & (T > 350)) > > > > > > > 2) I'd like to move this to cylindrical coordinates with the lengths > being radii. I'm not sure if the cylindrical grid is working though. And if > it isn't, is there a way to convert the diffusion equation into something > that would solve the problem in Cartesian? More specifically, how would you > write an appropriate equation for the heat transfer of a radial system in > Cartesian coordinates? In short, how would you write this: > > > <image.png> > > > in FiPy? > > > > The CylindricalGrids work fine, except for taking the gradient of the > field, which is an unusual need. > > > > > > > > 3) Ideally, I would move this to a 2D system which is the most > confusing to me. In a 2D system, heat would be transmitted radially while > air would be flowing axially. The air would cool as it passes through the > tube. The diffusion term in the axial direction would be significantly > lower than the convection term. Can I use the same heat transfer equation > you've suggested slightly modified? I would guess the equation to be > something like this: > > > > > > eq = TransientTerm(coeff = rho*Cp,var = T) + > PowerLawConvectionTerm(coeff=rho*Cp*v,var = T) == DiffusionTerm(coeff=k,var > = T) > > > > > > s.t. v = velocity of the air. > > > > Looks OK > > > > > I would also think that I would have to set the value of v to 0 at the > wall and beyond, which means v would be a CellVariable like rho and k. > > > > Actually, v should be a rank-1 FaceVariable. > > > > Anisotropic diffusion is supported in FiPy (see > https://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.anisotropy.html), > but are you really sure you have lower axial diffusivity? It seems to me > more likely that transport is simply dominated by axial flow. > > > > > I also guess this equation would be subject to any changes that would > be made in question 2, regarding writing a cylindrical equation in a > cartesian system. What do you think? > > > > Use a CylindricalGrid and don't change the equation at all. > > > > > Again, thank you so much for your help and I hope I haven't taken up > too much of your time. > > > > Happy to help. > > > > > > _______________________________________________ > > fipy mailing list > > fipy@nist.gov > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > > > -- > > Daniel DeSantis > > > > > > <PCM_thermal_v2-SendOut.py> > > > _______________________________________________ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > -- Daniel DeSantis
_______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]