Thanks Jon. Your new class is so helpful! I have another question, is it possible to save the mesh to the disk for future use? Actually I tried to use >>> mesh=mesh1+mesh2 >>> tools.dump.write(mesh,filename='mesh')
but then after I read the mesh in using tools.dump.read, there is an error when I impose boundary conditions. raise IndexError, 'Face list has interior faces' IndexError: Face list has interior faces There is no error when I get the mesh directly. Thank you for your help, Tim On Tue, Oct 20, 2009 at 1:07 PM, Jonathan Guyer <[email protected]> wrote: > > > On Oct 20, 2009, at 10:34 AM, weasky wrote: > >> I checked with Gmsh, it seems it can only produce the unstructured >> mesh for cylinder? Is it possible to generate beautiful wedge shape >> mesh in Gmsh? > > Probably, but I don't know how to do it. > >> or I can just create two rectangle meshes in Gmsh, then import it into >> Fipy, but then How can I transfer it into the cylindricalGrid2D mesh? > > Actually, I think your best bet may be to subclass CylindricalGrid2D to have > the changes in diameter that you want. Hmmm... actually, that won't quite > work because CylindricalGrid2D inherits from Grid2D and your t-shaped > geometry isn't a Grid2D anymore. > > > I think the following would work: > > from fipy.meshes.numMesh.mesh2D import Mesh2D > > class Cylinderizer(Mesh2D): > def __init__(self, mesh): > Mesh2D.__init__(self, > mesh.getVertexCoords(), > mesh.faceVertexIDs, > mesh.cellFaceIDs) > > def _getFaceAreas(self): > return Mesh2D._getFaceAreas(self) * self.getFaceCenters()[0] > > def getCellVolumes(self): > return Mesh2D.getCellVolumes(self) * self.getCellCenters()[0] > > > Then you call it with: > > mesh = Cylinderizer(Grid2D(nx=2, ny=3) + (Grid2D(nx=5, ny=2) + ((0,), > (3,)))) > > >> Sorry, this may be off-topic. But hopefully you have much more >> experience in Gmsh.... > > Not really. In our work, we don't actually tend to do much with mesh > geometry. > > >
