I found the problem, although I don't quite understand it. If I do either X, Y = mesh.cellCenters
or X, Y = mesh.getCellCenters() then type(X) gives a numpy array and results in this error. However, if I do X, Y = mesh.cellCenters[0], mesh.cellCenters[1] or X, Y = mesh.getCellCenters()[0], mesh.getCellCenters()[1] then type(X) gives a fipy variable and the solver works properly. Something about the automatic unpacking makes these not equivalent as I had initially thought. Adam On 12/05/2012 12:07 PM, Adam Stone wrote: > I am interested in modeling a heat equation problem with a Gaussian > heat source, so I need a way to define a source as a function of X and > Y. A search turned up a previous 1D case from the older version in > which something like this was done: > > X = mesh.getCellCenters()[0] > eq = (TransientTerm() == DiffusionTerm() + X) > > However, when I try to do this I get the following error: > > "TypeError: The coefficient must be rank 0 for a rank 0 solution > variable." > > Did 3.0 change the way this works, or is the 2D case different, or > there a problem somewhere else that I'm missing? > > Thanks, > Adam > _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
