On Mon, Dec 31, 2012 at 10:04 AM, Stefan Schwarzer <sschwarzer@sschwarzer .net> wrote:
> > > > > RuntimeWarning: invalid value encountered in double_scalars if > (numerix.sqrt(numerix.sum(errorVector**2)) / error0) <= self.tolerance > Hi Stefan, I don't get the above warning. Which version of FiPy are you using and which solver? > > Now I want to set different initial concentration values for > different mesh points. How do I do this? > If you want to set values based on position, then use "mesh.cellCenters" or "mesh.x" and "mesh.y" to get the position of each cell. The ordering corresponds to the ordering for CellVariable values (as suggested by Salomen ) > > By reading some of the FiPy code in `meshVariable.py`, I > found out that I can pass an array as the `value` argument > of the `CellVariable` constructor, like this: > You can do this, but you have no idea how the CellVariable values correspond to position. There is no particular ordering of values in FiPybase on geometric position. > > def test(): > # Set up problem. > mesh = fipy.Grid2D(dx=1.0, dy=1.0, nx=10, ny=10) > initial_value = fipy.numerix.zeros((10, 10)) > initial_value[:3, :3] = 5 > CellVariables are flat arrays as far as geometry is concerned. The last index of a CellVariable always corresponds to the number of cells in the mesh. > > When I set the rank argument to 0 explicitly, as I > understand from the `_MeshVariable.__init__` docstring, I > still get the same traceback. (I understand the word > You will. The rank is to do with specifying vectors or tensors not how the grid is arranged. > "element" in the mentioned docstring as referring to the > concentration value in my case, which is a scalar.) I also > tried setting `elementShape` to `()` explicitly, but this > gives me > Won't work either. Try using Salomen's example. Does that meet your needs? > > > P. S.: I just found > > http://article.gmane.org/gmane.comp.python.fipy/2803 > > Is this the answer to my question? This just assigns random values independent of location. It is also concerned with interpolating between grids that are not necessarily aligned. Good luck. -- Daniel Wheeler
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
