On Tue, Dec 30, 2014 at 4:54 PM, Christopher Jones <[email protected]> wrote: > > Hello, > > I have looked through a lot of documentation and emails but I am not sure I > have correctly constructed the equation for heat flow in a conductor where > the source term and the coefficient of the diffusion term depend on the > dependent variable. > > \frac{\partial u}{\partial t} = D(u)\frac{\partial^2 u}{\partial x^2} + S(u) > > > > eq = fp.TransientTerm(coeff=1.0) == \ > fp.DiffusionTerm(coeff=(k[areas[0]] / (C[areas[0]] * > hx.DENSITY_CU))) + \ > fp.ImplicitSourceTerm(coeff=((r[areas[0]] * I ** 2) / (areas[0] ** 2 > * hx.DENSITY_CU * C[areas[0]]))) > > I have several sample areas that I use, hence the indexing of the > cellVariables, r, k, and C. I declare/initialize them like this: > > C = fp.CellVariable(value=hx.specific_heat2(u.value), name='Specific Heat', > mesh=mesh) > > Should this be a faceVariable?
No, you are using it in a source term so it needs to be a cell variable. However in the diffusion term you can pass C.faceValue as part of the coefficient to control the type of interpolation from cells to faces. > These temperature dependent variables are updated in my solution loop. The > loop algorithm is: > > Outer Loop: while elapsed time < final time: > > 1 updateOld > 2 solve (from Richards Equation email) > 3 update r, k, and C face variables > 4 update/show plot > > 5 Inner Loop: while residue > tolerance: > 1 sweep > 2 update r, k, and C face variables > End Inner Loop You don't need to update in the loop. FiPy takes care of that. See * http://www.ctcms.nist.gov/fipy/documentation/design.html#implementation * http://www.ctcms.nist.gov/fipy/fipy/generated/fipy.variables.html * http://mail.scipy.org/pipermail/numpy-discussion/2007-April/027288.html -- Daniel Wheeler _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
