Sorry for the long wait for the reply. I don't think the last line is correct.

On Fri, Oct 23, 2009 at 1:17 PM, Kun-Dar Li <[email protected]> wrote:
>
> Hi Daniel,
>
> Thank you for spending  so much time on replying my question. I try to
> simplify my problem. Are the following right statements?
> -------------------------------------------------------
> mesh3D = Grid3D(dx, dy, dz, nx, ny, nz)
> mesh2D = Grid2D(dx, dy, nx, ny)
>
> var3D = CellVariable(mesh = mesh3D, value = random.random(nx * ny *nz))
> var2D = CellVariable(mesh = mesh2D)
>
> x3D, y3D, z3D =mesh3D.getCellCenters()
> x2D, y2D = mesh2D.getCellCenters()
>
> var2D.setValue(max([z3D, where=(var3D>0.5)]))

I am not sure what you are trying to achieve here. I don't think the
above statement is syntactically correct. Are you trying to set the
value of var2D to be a slice through var3D at the max value of z3D? In
that case you should try this.

var2D.setValue(var3D((x2D, y2D, numerix.ones * max(z3D))))

-- 
Daniel Wheeler

Reply via email to