how to extrude a surface to create a volume

Issue #31 resolved
Soroush r created an issue

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)

  1. Benjamin Dam Kehlet

    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.

  2. Soroush r 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.

  3. Benjamin Dam Kehlet

    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.

  4. Soroush r 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.

  5. Benjamin Dam Kehlet

    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 dolfin_plot_0.png

  6. Soroush r 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?

  7. Soroush r 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.

  8. Benjamin Dam Kehlet

    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

  9. Log in to comment