On May 12, 2012, at 9:44 AM, Matej Svejda wrote: > I'm using FiPy to solve a Convection Diffusion Reaction Equation (one > spacial dimension, plus time). I want my source to: > > da^2(H(a, t)) * P(a, t) > > Where da^2(H(a,t)) is the second special derivative of a function H (a > known function and NOT the function I'm solving for) and P the > function I'm solving for. Both are represented as CellVariable.
I think this is covered in http://www.ctcms.nist.gov/fipy/documentation/FAQ.html#how-do-i-represent-a-term-that-doesn-t-involve-the-dependent-variable > I have tried to write: H.getGrad().getGrad() * P but the ranks don't > match (H has rank-0 and H.getGrad().getGrad() has rank-3). H.getGrad().getGrad() should be rank-2 (and that's what I get with both FiPy 2.1 and trunk/) > I don't get > why the rank is increased when I take the gradient of a function that > is defined on a 1-d mesh. Any ideas? The gradient of a scalar is a vector. The gradient of a vector is a rank-2 tensor. The dimensionality doesn't matter. Working in 1D can often mislead like this. \nabla^2 H is not equivalent to \nabla(\nabla H). It is equivalent to \nabla\cdot(\nabla H), and in FiPy you do that with H.getFaceGrad().getDivergence() _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
