FiPy only supports solving for scalar (rank 0) CellVariable fields at this point.
See http://www.ctcms.nist.gov/fipy/examples/flow/generated/examples.flow.stokesCavity.html for an example of solving for a vector field. On Oct 18, 2011, at 7:04 PM, [email protected] wrote: > I'm having problems with a rank-1 CellVariable. This seems to the minimum > code that reproduces the error: > > import fipy as fp > import numpy as np > W, H = 1.0, 1.0 > nx, ny = 3, 3 > dx, dy = W/nx, H/ny > mesh = fp.PeriodicGrid2DLeftRight(nx=nx, ny=ny, dx=dx, dy=dy) > V = fp.CellVariable( > mesh = mesh, > rank = 1) > V_eq = fp.DiffusionTerm(coeff=1.) > V_eq.solve(var=V, solver=fp.LinearLUSolver()) > print V > > The error is: > > Traceback (most recent call last): > File "<stdin>", line 18, in <module> > File "/usr/local/lib/python2.6/dist-packages/fipy/terms/term.py", line 131, > in solve > solver._solve() > File > "/usr/local/lib/python2.6/dist-packages/fipy/solvers/pysparse/pysparseSolver.py", > line 62, in _solve > self._solve_(self.matrix, array, self.RHSvector) > File > "/usr/local/lib/python2.6/dist-packages/fipy/solvers/pysparse/linearLUSolver.py", > line 86, in _solve_ > error0 = numerix.sqrt(numerix.sum((L * x - b)**2)) > File > "/usr/local/lib/python2.6/dist-packages/fipy/matrices/pysparseMatrix.py", > line 172, in __mul__ > raise TypeError > TypeError > > Plowing into this, there appears to be some sort of shape problem between "L" > and "x" whose origin I cannot divine. In this example, L is a 9x9 matrix and > x is 2x9. > > I'm sure I'm being dumb, but I'm 4 hours in, so I figured I should ask for > help. Thanks in advance. > > Best Regards, > Angus Hendrick > > <ATT00001..c> _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy]
