On Jun 5, 2009, at 9:25 AM, Mike Atkins wrote:

The problem is right here. Instead of using the cell centers, you should be using the face centers. Try using something like this:

pos = mesh.getFaceCenters()
eq1 = 0 == ExponentialConvectionTerm(coeff = pos)\
     + ImplicitDiffusionTerm(coeff=a)

This is absolutely correct. Just as a point of clarification, the ConvectionTerm *will* automatically interpolate a rank-1 CellVariable to be a rank-1 FaceVariable, but getCellCenters() does not return a CellVariable for historical reasons. It's just an array that happens to have the shape of a rank-1 CellVariable, whereas getFaceCenters() returns an array with the shape of a rank-1 FaceVariable. If the shape is exactly right, FiPy will accept it, but we found that making any further assumptions about arrays that were not the expected shape caused more problems than it solved.

In the future, getCellCenters() and getFaceCenters() will return proper MeshVariables, and so this issue will go away.

In the interim, it's probably easiest if you do something like:

  pos = FaceVariable(mesh=mesh, value=mesh.getFaceCenters(), rank=1)

Reply via email to