This seems to be a common issue here... I think the diffusion 1D example on the website may soon comment on this. The correct equation for conservation of thermal energy is that the time rate of change of the enthalpy is related to the divergence of the flux. Enthalpy is related to rho * cp * T, and flux of enthalpy is related to k * grad(T). Thus, the correct way to do this is something more like
TransientTerm(coeff=rho * cp) == DiffusionTerm(coeff=k) + Source Best, Ray On Thu, Jan 8, 2015 at 4:40 PM, Christopher Jones <[email protected]> wrote: > Thank you for the insight. > > The coefficient for the diffusion term is > > thermal conductivity / (density * specific heat) > > where thermal conductivity and specific heat are both non linearly > temperature dependent. Thermal conductivity is approximated by > 10^(a(u)/b(u)) where a and b are polynomials in u. > > Specific heat is approximated by a piece-wise defined cubic spline in > u/100. > > So, just to be sure, would you recommend using the chain rule as given in > your first reply? (DiffusionTerm(coeff=A) + A.grad.dot(u.grad)) > > Thanks again, > Chris > > > > > Chris Jones > > *Project Electrical Engineer* > > [email protected] | 603-601-3340 > > > > > *ANTAYA* *SCIENCE & TECHNOLOGY* > > 7A Merrill Industrial Drive > > Hampton, NH 03842 > > 603-601-7474 > > > This message may contain information that is confidential, privileged or > otherwise protected from disclosure. If you are not the intended recipient, > you are hereby notified that any use, disclosure, dissemination, > distribution, or copying of this message, or any attachments, is strictly > prohibited. If you have received this message in error, please advise the > sender by reply e-mail, and delete the message and any attachments. Thank > you. > > On Thu, Jan 8, 2015 at 2:05 PM, Guyer, Jonathan E. Dr. < > [email protected]> wrote: > >> >> On Jan 8, 2015, at 10:30 AM, Christopher Jones <[email protected]> >> wrote: >> >> > I am modelling nonlinear heat conduction using time steps and sweeps. >> > >> > Basic equation is: >> > >> > du/dt = A(u) * d2u/dx2 + S(x, t) >> > >> > where u(x, t) >> > >> > I have functions written for A(u), the DiffusionTerm coefficient, and >> S(x, t), the ImplicitSourceTerm. I implement them with the following >> snippet: >> > >> > eq = TransientTerm() == DiffusionTerm(coeff=A) + >> ImplicitSourceTerm(coeff=S) >> >> >> DiffusionTerm represents d/dx(A(u) * du/dx) (or, more rigorously, >> nabla\cdot(A(u) \nabla u)). >> >> If your functional form *really* is A(u) * d2u/dx2, then you need to run >> the chain rule to obtain \nabla\cdot(A(u) \nabla u) - \nabla A(u) \cdot >> \nabla u, which equates to DiffusionTerm(coeff=A) + A.grad.dot(u.grad). It >> is rare, however for this to be needed. The form of DiffusionTerm (with A >> inside the first derivative) is the one almost invariably encountered. >> >> > S is really the whole source term, not the coefficient, so have I coded >> this correctly? >> >> Raymond has already pointed out the linearity of ImplicitSourceTerm. If >> your source is linear in u, then using +ImplicitSourceTerm(coeff=S1) is >> more efficient than using +S1*u. If your source isn't linear in u, then >> don't worry about it and write the source explicitly. >> >> > I have declared A as a FaceVariable (because diffusion happens from >> cell to cell, and S as a CellVariable, is this correct? >> >> Yes. >> >> > Since S depends on t as well, I created a Variable t. I then created a >> small function and included it with S with this snippet: >> > >> > B = 50 * numerix.exp(-t) >> > >> > S.setValue(B) >> >> > >> > After sweeping, I increment the elapsed time and then t, with >> > >> > t.setValue(elapsedTime) >> > >> > I can print B's value to see that it does decay. >> >> .setValue() sets the instantaneous value of S. S won't change with >> further changes in t. >> >> Skip B and just write >> >> S = 50 * numerix.exp(-t) >> >> >> >> _______________________________________________ >> 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 ] > >
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
