Nevermind, I figured it out.
Bjorn Hansen wrote:
Jonathan Guyer wrote:
For the DiffusionTerm, since you're dealing with a flux from one cell
to another, you can get somewhat better results if you evaluate R on
the faces between cells. In principle, you should just be able to do:
>>> DiffusionTerm(coeff=1. / mesh.getFaceCenters()[...,0])
but because of the default coordinate system, some values of R(faces)
will be zero, giving you an infinite diffusivity. Probably the
easiest way to deal with that is to offset your mesh when you create it:
>>> mesh = Grid2D(nx=?, ny=?, dx=?, dy=?) + (epsilon,0)
Hmm, that didn't work (I tried using DiffusionTerm and
ImplicitDiffusionTerm, same result.) Here's what I did:
>>> from fipy.meshes.grid2D import Grid2D
>>> from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm
>>>
>>> mesh = Grid2D(nx=4,ny=4,dx=1,dy=1) + (1e-20,0)
>>> R = mesh.getCellCenters()[...,0]
>>> z = mesh.getCellCenters()[...,1]
>>>
>>> dt = ImplicitDiffusionTerm(coeff=1. / mesh.getFaceCenters()[...,0])
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/bjorn/source/fipy/fipy/terms/diffusionTerm.py", line 100,
in __init__
raise TypeError, "The coefficient must be a FaceVariable,
CellVariable, or a scalar value."
TypeError: The coefficient must be a FaceVariable, CellVariable, or a
scalar value.
So I don't know how to make that 'coeff=1. /
mesh.getFaceCenters()[...,0]' be a FaceVariable. Help?
Thanks,
Bjorn
--
Bjørn Hansen
University of Washington
Redmond Plasma Physics Laboratory
14700 NE 95th Street, Suite 100
Redmond, WA 98052
425-881-7706 (Fax)425-882-9137