[Netgen] Mesh generation for Embedded Geometry

I have some geometry with some line embedded in surface (2D) or surface embedded in volume (3D).

Does Netgen also support this kind of features? Is there any one can share some examples?

In Gmsh, these embedded geometry can be defined as follows:

1 /*********************************************************************
    2  *
    3  *  Gmsh tutorial 15
    4  *
    5  *  Embedded points, lines and surfaces
    6  *
    7  *********************************************************************/
    8 
    9 // We start one again by including the first tutorial:
   10 Include "t1.geo";
   11 
   12 // We change the mesh size to generate coarser mesh
   13 lc = lc * 4;
   14 Characteristic Length {1:4} = lc;
   15 
   16 // We define a new point
   17 Point(5) = {0.02, 0.02, 0, lc};
   18 
   19 // One can force this point to be included ("embedded") in the 2D mesh, using
   20 // the "Point In Surface" command:
   21 Point{5} In Surface{1};
   22 
   23 // In the same way, one can force a curve to be embedded in the 2D mesh using
   24 // the "Line in Surface" command:
   25 Point(6) = {0.02, 0.12, 0, lc};
   26 Point(7) = {0.04, 0.18, 0, lc};
   27 Line(5) = {6, 7};
   28 Line{5} In Surface{1};
   29 
   30 // One can also embed points and lines in a volume using the "Line/Point In
   31 // Volume" commands:
   32 Extrude {0, 0, 0.1}{ Surface {1}; }
   33 
   34 p = newp;
   35 Point(p) = {0.07, 0.15, 0.025, lc};
   36 Point{p} In Volume {1};
   37 
   38 l = newl;
   39 Point(p+1) = {0.025, 0.15, 0.025, lc};
   40 Line(l) = {7, p+1};
   41 Line{l} In Volume {1};
   42 
   43 // Finally, one can also embed a surface in a volume using the "Surface In
   44 // Volume" command:
   45 Point(p+2) = {0.02, 0.12, 0.05, lc};
   46 Point(p+3) = {0.04, 0.12, 0.05, lc};
   47 Point(p+4) = {0.04, 0.18, 0.05, lc};
   48 Point(p+5) = {0.02, 0.18, 0.05, lc};
   49 Line(l+1) = {p+2, p+3};
   50 Line(l+2) = {p+3, p+4};
   51 Line(l+3) = {p+4, p+5};
   52 Line(l+4) = {p+5, p+2};
   53 ll = newll;
   54 Line Loop(ll) = {l+1:l+4};
   55 s = news;
   56 Plane Surface(s) = {ll};
   57 Surface{s} In Volume{1};

Thanks,
Bin

Attachment: t15.geo

Attachment: t1.geo

Hi,

yes you can embed lines. You just have to add the line with “leftdomain=rightdomain”.

geom.Append(["line",pid1,pid2],leftdomain=1,rightdomain=1,maxh=0.025) # left- and rightdomain have to be the same!!!


Best
Christoph

Attachment: embeddedline.jpg

Attachment: embeddedline_2018-06-20.py

Thanks for your quick reply. That’s looks nice!

My final goal is to generate 3D mesh for intersecting planes and embed it into a cube.


(
https://ngsolve.org/media/kunena/attachments/919/GmshInput_gmsh.geo)
Gmsh input *.geo file which is just 3 plane and 6 intersection line segments.

I have used “Line in Surface” and “Surface in Volume” to mesh such geometry. Is there any suggestion to finish the same type of mesh in Netgen? If so, could you give a example to mesh two intersecting 3D planes?

BTW, I can used ReadGmsh() in Netgen as follows, but it seems there is no way to extract it geometry and re-mesh it using Netgen.

ngmesh=readgmsh.ReadGmsh('GmshInput_gmsh')
ngmesh.Save("Gmsh_Fracture.vol")

Thanks,
Bin

Attachment: GmshInput_gmsh_2018-06-20.geo