On Apr 7, 2010, at 4:56 PM, Igor wrote:
> I would like to create a 2D mesh shifted in one "coordinate" (Y) to > negative values, so I do: > mesh2D = Grid2D(dx = dx, dy = dy, nx = Xsteps, ny = Ysteps, > origin=((0,), (-5,))) > > however, I get: > TypeError: Grid2D() got an unexpected keyword argument 'origin' > > I read in help(Grid2D()) that origin is a parameter of Grid2D() (i.e., > parameter of the *constructor*) if I understood correctly. help(Grid2D()) returns help on the *object* created by calling the Grid2D *factory function*. help(Grid2D) (without the parentheses) returns help on the Grid2D factory function itself. The Grid2D factory function does not take an origin parameter. The first few lines of help(Grid2D()) are: Help on instance of UniformGrid2D in module fipy.meshes.numMesh.uniformGrid2D: class UniformGrid2D(fipy.meshes.numMesh.grid2D.Grid2D) fipy.meshes.grid2D.Grid2D is a function that examines the arguments and either returns a fipy.meshes.numMesh.grid2D.Grid2D object or, if the dx and dy spacings are single values, a fipy.meshes.numMesh.uniformGrid2D.UniformGrid2D object. The latter is *much* more efficient with memory use. Because of the way it all works, UniformGrid2D objects require an offset argument, but generic Grid2D objects do not and can simply be shifted after creating them. > How do I need to do the shift in 2D? I know that in 1D case I can > simply subtract the needed "shift" value, i.e.: > > mesh1D = Grid1D(dx = dx, nx = Xsteps) + (-Xmax/2.) same idea mesh2D = Grid2D(dx = dx, dy = dy, nx = Xsteps, ny = Ysteps) + ((0,), (-5,))
