On May 12, 2009, at 11:00 AM, A.S.Reeve wrote:

Is there a simple way to calculate the change in mass stored in a cell
over a single time step?

Unless I'm missing something, I think this is just (mass - mass.getOld()), isn't it?


I'm trying to do this using a flux assigned
to a FaceVariable with the operations (kond and head are CellVaribles):

flux=-head.getFaceGrad()*kond.getHarmonicFaceValue()
flux.getDivergence()

This seems to work at internal cells but I'm having trouble sorting this out at cells with fixedValue boundary condtions assigned to one of their faces. How does one seperate changes in storage in these cells from influx
across face with a fixedValue conditions? Does the divergence operator
in FiPy lump these two terms (storage and flux across face) together in
these cells?

Neither the gradient nor divergence operators see boundary conditions by default. This is on our to-do list. There is a workaround for the gradient, though, which we originally wrote up for Zhiwen Liang, and which has since been included in FiPy 2.0. You would write:

>>> from fipy.variables.fixedBCFaceGradVariable import _FixedBCFaceGradVariable >>> flux=-_FixedBCFaceGradVariable(head, boundaryConditions=???)*kond.getHarmonicFaceValue()

where the boundaryConditions argument takes the same tuple that you pass to solve. The divergence should be fine.

That being said, I don't think you need any of this for this particular task.

Reply via email to