how to extrude a surface to create a volume
Hello there,
I am very new to mshr, and I have a question about extruding a 2D surface to a 3D volume.
I am trying to make a 3D mesh of a glacier drainage basin. That is, I have coordinates of the points that define the boundaries of the basin. So after having them in CCW order, I called the Polygon function and created a polygon of the surface, e.g. geometry = Polygon(_CCWpoints). Then I generated the mesh by having this polygon by running
meshing_domain = CSGCGALDomain2D(geometry) m = generate_mesh(geometry, 16, "cgal")
that creates the 2D mesh of the map view of the basin. So, now I would like to add the third dimension, which is the thickness of the ice in my problem, to the already-created 2D surface mesh. I figured that GMSH has an Extrude command that does something like this, but I could not find this in MSHR.
I would appreciate if anyone can help. Hope the complete tutorial will be available soon.
thanks, Soroush
Comments (12)
-
-
reporter Thanks Ben. Looking forward.
-
I am pushing the code to this branch: https://bitbucket.org/fenics-project/mshr/branch/benjamik/extrude-2d The suggested interface looks something like this
g = Extrude2D(any_2d_primitive, z_value) mesh = generate_mesh(g, resolution)
So any 2D geometry can be made a 3D geometry by simply "thickening" it in the z direction. Is it something like this you had in mind?
-
And by the way: If this look ok, I can probably finish it tonight.
-
reporter Thanks a lot Ben. I tried it right now, but seems like I cannot import mshr at this time, probably I have messed up my shared libraries directory. I will fix this and try your Extrude2D function and let you know as soon as possible. Thanks again.
-
Uh, there is a major bug (I'm actually surprised that it worked in my simple test case). I will fix that later today and let you know.
-
reporter I tried it now with the polygon 2d primitive, and as you know it didn't work. I will try it again once you let me know.
btw, I assume that I have to update the mshr module to be able to use the recent corrections, shall I just update my FEniCS to do so? Please let me know.
-
I have pushed a fix now. Please try it out.
This code
g2d = mshr.Circle(Point(0,0), 1.2) g3d = mshr.Extrude2D(g2d, .2) m = mshr.generate_mesh(g3d, 15)
now gives this mesh
-
reporter I updated FEniCS with PPA, but seems like mshr is not updated, it tells me that mshr does not have the attribute Extrude2D. What shall I do to update the mshr functions?
-
reporter Hey Ben, when I try to clone your .git repository and install from your source code, running cmake gives me the error that GMP is not installed. I installed GMP separately, but I still cannot run the cmake in the source code from your repository. Regardless, I thought that CGAL and all its dependencies (including GMP) will be automatically added upon installing FEniCS. Please advise. Thanks.
-
Hi. Sorry about this late reply. Yes, if you have had a working FEniCS (including mshr) then you have GMP installed. However, if you didn't install the earlier version from source, then maybe you haven't got the GMP header files. Try install a developer version of GMP (on debian/ubuntu this means somethin like "sudo apt-get install libgmp-dev"). Anyway, I have pushed this to the master branch now. This means you can use the fenics-install-sh script to install a developer version of all the FEniCS components: http://fenicsproject.org/download/#installation-from-source-fenics-install-sh
-
- changed status to resolved
This functionality has been in mshr for a while now, so I'm marking this as resolved.
- Log in to comment
mshr is not currently capable of doing that, but is has been on the TODO list for a long time and should be easy to implement. I'll take a look later tonight.