On Jun 19, 2012, at 12:20 PM, Kendall Boniface wrote: > I am having a bit of trouble manipulating a 2D cylindrical mesh and was > wondering if anyone has any helpful advice?
> mesh = CylindricalGrid2D(dx=dx, dy=dy, nx=nx, ny=ny) + ((0.0046,),) > print mesh.getCellCenters() > > I want the z axis to go from 0 to 1.5 > The second term in the mesh line seems to translate the r AND z coordinates > outward when all I want it to do is translate the r coordinates. Is there a > way to do this the way I would like? The displacement should be a vector. You're trying to translate a 2D mesh by a 1D vector. As it happens, NumPy interprets that to mean displacing the r and z coordinates by the same amount, but what you want is mesh = CylindricalGrid2D(dx=dx, dy=dy, nx=nx, ny=ny) + ((0.0046,),(0.,)) > Is there a way to access the radial distances from the origin for every cell? > That isn't the best way to word the question, but to make it more clear, I > would like to be able to do something like: pi * (r_outer**2 - r_inner**2) > for each cell. I have tried as many of the mesh.get functions as I could get > my hands on, but haven't been successful yet. Can anyone suggest something > for me to use? A mesh.getFaceCenters()[..., mesh._getCellFaceIDs()] would get you an array of the coordinates of the faces for each cell. You'd probably have to do something with mesh._getFaceNormals() to figure out which are the "inner" and "outer" faces. For the actual calculation you present, though, it seems like mesh.getCellVolumes() is what you want. _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
