Jonathan, Thank you very much for you help. It wouldn't be the first time I've over complicated a system. I understand how you set up the system a little bit better now. I had set things up the way I had before because I had expected to expand the system a bit. I was hoping to do the following:
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. 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: image.png] in FiPy? 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. 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. 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? Again, thank you so much for your help and I hope I haven't taken up too much of your time. Thank you, Dan On Mon, Apr 8, 2019 at 5:37 PM Guyer, Jonathan E. Dr. (Fed) via fipy < [email protected]> wrote: > You're over-complicating things trying to have three different > temperatures. There's one temperature in three different domains, with > different material properties in each domain. FiPy (and physics) takes care > of matching fluxes for you at the internal boundaries. > > > The changes I made are at > https://gist.github.com/guyer/d86ee6f085e9832df781286099a73800/revisions > > The primary changes I made: > > - I defined three domains, `air`, `wall`, and `PCM`, and then defined `T`, > `rho`, `Cp`, and `k` to have different values in those different domains. > > - sweeps are for getting better convergence of non-linear equations. > Your equations are linear and from your usage you want time steps, not > sweeps. > See: > https://www.ctcms.nist.gov/fipy/documentation/FAQ.html#iterations-timesteps-and-sweeps-oh-my > > - Internal boundary conditions need to be defined very differently (see: > https://www.ctcms.nist.gov/fipy/documentation/USAGE.html#applying-internal-boundary-conditions > ) > Importantly, you don't need internal boundary conditions. > > - All field variables and coefficients should be floats, not integers. > > > Note: Your wall thickness `tw = 0.001` is smaller than your grid spacing > `dx = 0.061 / 50 = 0.00122`, your your numerics will be terrible. Increase > your wall thickness or decrease your grid size. > > > On Apr 8, 2019, at 2:44 PM, Daniel DeSantis <[email protected]> wrote: > > > > Hello, > > > > I am trying to model heat diffusion through a wall using FiPy. > Essentially, hot air on one side of the wall would heat the wall, and the > wall would subsequently heat a phase change material on the other side (See > picture below). The eventual goal would be to have the phase change > material properties change as the heat increases. I am having a few issues > with setting boundary conditions however. > > > > The goal of the model would be to have the heat flux at the wall be > equal to the heat flux of the fluid on each respective side. Further, the > heat flux of one of the fluids (a phase change material) would be 0 at the > side not in contact with the wall. (I've included a copy of my FiPy code as > is, and a series of equations and boundary conditions below). > > > > Right now, the temperature for the air and wall are staying constant, > while the phase change material temperature drops. I think how I've defined > the boundary conditions are to blame, but I'm not sure what I'm doing > wrong. Any help here would be greatly appreciated. > > > > Thank you, > > > > -- > > Daniel DeSantis > > > > <image.png> > > <image.png> > > <image.png> > > <image.png> > > > > > <PCM_thermal_v0-SendOut.py>_______________________________________________ > > fipy mailing list > > [email protected] > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > -- Daniel DeSantis
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
