On Wed, Jul 18, 2018 at 4:36 PM, Daniel DeSantis <desan...@gmail.com> wrote: > > > If I wanted to run this in a cylindrical coordinate grid, the equation would > become: > > > Can I just call the following in FiPy to account for this coordinate system > change?: > > mesh = CylindricalGrid1D(nx = 100.,Lx = 1., dx = 1./100.)
Yes, that should work. There is a bug (see https://github.com/usnistgov/fipy/issues/547) when calculating gradients, but I don't think that applies to diffusion terms. Jon, is that correct? > If not, how do I account for the dependent variable when it is not in the > differential? Essentially, how do can I put lambda/r in the coefficient etc.? You can multiply through by r and then split the transient term into an implicit TransientTerm and a source term. It gives an extra source term that is dependent on the time step. > 2) Is the correct way to add a source term simply to write something like: > > eq = TransientTerm() == DiffusionTerm() + S > > or > > eq = TransientTerm() == DiffusionTerm() + ImplicitSourceTerm(S)? Either one. ImplicitSourceTerm implies that the source term is "var * S", not "S" only, but the "var" is the variable that you're solving for. To use ImplicitSourceTerm the S should be negative. In your case, the source does not depend on temperature so you can't use an ImplicitSourceTerm. > 3) Regarding boundary conditions, I am trying to use a boundary condition > that has my dependent variable (T) in the boundary condition. The condition > is dT/dr = h(T - Tc), where Tc is a constant. Would this be the correct way > to do that? I'm mostly inquiring about writing the dependent variable as > T.faceValue... > > T.faceGrad.constrain(h*(T.faceValue - Tc), mesh.facesLeft) I think that should work. Test it carefully. It's never obvious to me what the sign should be. Don't trust it though. -- Daniel Wheeler _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]