Dear all,
I've checked out and installed the 2.1 branch and now I'm trying to
solve a simple time-independent PDE with a non-constant diffusion
tensor. The FAQ says that such diffusion terms can be created as follows:
>>> x, y = mesh.getCellCenters()
>>> DiffusionTerm([[[x**2, x * y], [-x * y, -y**2]]])
However, the following example leads to an error:
#!/usr/bin/env python2.6
from fipy import *
mesh = Grid2D(nx=5, ny=5)
var = CellVariable(mesh=mesh)
x, y = mesh.getCellCenters()
diff = DiffusionTerm([[[x**2, x * y], [-x * y, -y**2]]])
bc = FixedValue(faces=mesh.getExteriorFaces(), value=0)
diff.solve(var=var, boundaryConditions=bc)
The traceback is:
Traceback (most recent call last):
File "./bug.py", line 9, in <module>
diff.solve(var=var, boundaryConditions=bc)
File "/.../FiPy-2.1-py2.6.egg/fipy/terms/term.py", line 129, in solve
solver = self._prepareLinearSystem(var, solver, boundaryConditions, dt)
File "/.../FiPy-2.1-py2.6.egg/fipy/terms/term.py", line 111, in
_prepareLinearSystem
self.__buildMatrix(var, solver, boundaryConditions, dt)
File "/.../FiPy-2.1-py2.6.egg/fipy/terms/term.py", line 98, in
__buildMatrix
matrix, RHSvector = self._buildMatrix(var, solver._getMatrixClass(),
boundaryConditions, dt)
File "/.../FiPy-2.1-py2.6.egg/fipy/terms/diffusionTerm.py", line 321,
in _buildMatrix
coeff = self._getGeomCoeff(mesh)
File "/.../FiPy-2.1-py2.6.egg/fipy/terms/term.py", line 430, in
_getGeomCoeff
self.geomCoeff = self._calcGeomCoeff(mesh)
File "/.../FiPy-2.1-py2.6.egg/fipy/terms/diffusionTerm.py", line 205,
in _calcGeomCoeff
tmpBop = faceNormals.dot(coeff).dot(rotationTensor) *
mesh._getFaceAreas()
File "/.../FiPy-2.1-py2.6.egg/fipy/variables/meshVariable.py", line
290, in dot
return _MeshVariable.__dot(self, other,
self._OperatorVariableClass(baseClass))
File "/.../FiPy-2.1-py2.6.egg/fipy/variables/meshVariable.py", line
264, in __dot
opShape = opShape[:rankA-1] + opShape[rankA:]
TypeError: 'NoneType' object is unsubscriptable
What am I doing wrong?
My architecture is x86_64 and my operating system is Ubuntu Jaunty.
Regards,
Philipp