On Wed, Oct 14, 2009 at 3:08 PM, Kun-Dar Li <kun...@umich.edu> wrote: > > Hi Daniel, > > Thank you so much for your reply. Actually, I need a 2D variable, the same > mesh of x, y, in 3D mesh. The cell values of 3D mesh will depend on this 2D > variable. How can I create a 2D variable from 3D mesh by catching the > z-axial position, and expand 2D variable into 3D with regulations?
Something like this maybe. To put data from 3D mesh into a 2D mesh: x, y = var2D.getMesh().getCellCenters() var2D.setValue(var3D((x, y, cutPlaneZValue * numpy.ones(len(x))), order=1)) To put data from 2D mesh into 3D mesh: var3D.setValue(var2D(var3D.getMesh().getCellCenters()[:2], order=1)) I didn't test the above, but that is how it is advertised to work. -- Daniel Wheeler