On Mon, Sep 1, 2008 at 3:15 PM, Zhiwen Liang <[EMAIL PROTECTED]> wrote: > Dear Fipy developers and users, > Thanks again for solving my last problem. This is the most powerful forum I > have ever been involved. > I do not know if this is an known issue, but I found it very slow to assign > fipy variables as elements of the numerix array. Please see below. > from fipy import * > import fipy.tools.numerix as numerix > mesh=Grid3D(nx=10,ny=10,nz=10) > Dx=CellVariable(mesh=mesh,value=1.) > Dy=CellVariable(mesh=mesh,value=2.) > Dz=CellVariable(mesh=mesh,value=3.) > zeros=CellVariable(mesh=mesh,value=0.) > Ds=numerix.array(((Dx,zeros,zeros),(zeros,Dy,zeros),(zeros,zeros,Dz))) > The last line of the above code took 3.5 second while the rest of the code > only took 0.002 second, using my laptop. I > define the "Ds" in the code in order to use it as the anisotropic > coefficient in the DiffusionTerm.
Probably best to create a rank two CellVariable and assign the values by indexing like this Ds = CellVariable(mesh=mesh, value=0., rank=2) Ds[0, 0] = 1. Ds[1, 1] = 2. Ds[2, 2] = 3. -- Daniel Wheeler
