# gmsh and duplicate nodes in adjacent surfaces

 Register Blogs Members List Search Today's Posts Mark Forums Read

 July 23, 2015, 17:27 gmsh and duplicate nodes in adjacent surfaces #1 Member   hekseli Join Date: Mar 2013 Posts: 48 Rep Power: 5 Hey! As a simple case: make a structured box and add a smaller box on top of it, in a way that your cells are coinciding. In this way there will be 4 duplicate vertices at the vertex coordinates of the smaller box. Coherence functionality did not remove them. Compound Surfaces command did not work either...meshing does not work then. In general, what is the way to merge two adjacent volume blocks together, if their common surface is only a part of the other one?

 July 24, 2015, 07:47 #2 Senior Member   Join Date: Mar 2015 Posts: 225 Rep Power: 4 Hi, can you please post a minimal geo file which reproduces the problem? Best regards, Kate

 July 24, 2015, 08:17 #3 Member   hekseli Join Date: Mar 2013 Posts: 48 Rep Power: 5 Hey! Here's an example case. So small box on top of a larger box. In total there should be 36 vertices, but atm there are 40. Code: ```--------------------------------------------------- squareSide = 1; gridsize = 1; //Box 1 p01=newp; Point(p01) = {-squareSide/2, -squareSide/2,0,gridsize}; //Extrude line l[] = Extrude {gridsize,0,0}{ Point{p01}; Layers{1}; }; //Extrude Surface s[] = Extrude {0,gridsize,0}{ Line{l[1]}; Layers{1}; Recombine; }; //Extrude volume v[] = Extrude {0,0,gridsize}{ Surface{s[1]}; Layers{1}; Recombine; }; // Box 2 p01=newp; Point(p01) = {-squareSide/2-1 , -squareSide/2-1 ,gridsize,gridsize}; //Extrude line l[] = Extrude {3*gridsize,0,0}{ Point{p01}; Layers{3}; }; //Extrude Surface s[] = Extrude {0,3*gridsize,0}{ Line{l[1]}; Layers{3}; Recombine; }; //Extrude volume v[] = Extrude {0,0,gridsize}{ Surface{s[1]}; Layers{1}; Recombine; }; Coherence; -----------------------------------------------------------------------```

July 24, 2015, 08:35
#4
Senior Member

Join Date: Mar 2015
Posts: 225
Rep Power: 4
Quote:
 Originally Posted by heksel8i Hey! As a simple case: make a structured box and add a smaller box on top of it, in a way that your cells are coinciding. In this way there will be 4 duplicate vertices at the vertex coordinates of the smaller box. Coherence functionality did not remove them. Compound Surfaces command did not work either...meshing does not work then. In general, what is the way to merge two adjacent volume blocks together, if their common surface is only a part of the other one?
I had a look at the file. First of all, after 1D meshing, gmsh tells me we have 32 vertices and 56 elements and I don't know really how gmsh counts them. In my opinion there should be 16 vertices, 8 from box 1, 8 from box 2. Perhaps a more experienced user could shine a light on this.
By the way, meshing works perfectly on my machine (10 hexaeder).
Quote:
 Originally Posted by heksel8i Hey! Here's an example case. So small box on top of a larger box. In total there should be 36 vertices, but atm there are 40. Code: ```--------------------------------------------------- squareSide = 1; gridsize = 1; //Box 1 p01=newp; Point(p01) = {-squareSide/2, -squareSide/2,0,gridsize}; //Extrude line l[] = Extrude {gridsize,0,0}{ Point{p01}; Layers{1}; }; //Extrude Surface s[] = Extrude {0,gridsize,0}{ Line{l[1]}; Layers{1}; Recombine; }; //Extrude volume v[] = Extrude {0,0,gridsize}{ Surface{s[1]}; Layers{1}; Recombine; }; // Box 2 p01=newp; Point(p01) = {-squareSide/2-1 , -squareSide/2-1 ,gridsize,gridsize}; //Extrude line l[] = Extrude {3*gridsize,0,0}{ Point{p01}; Layers{3}; }; //Extrude Surface s[] = Extrude {0,3*gridsize,0}{ Line{l[1]}; Layers{3}; Recombine; }; //Extrude volume v[] = Extrude {0,0,gridsize}{ Surface{s[1]}; Layers{1}; Recombine; }; Coherence; -----------------------------------------------------------------------```
I am very interested in this topic and hope you keep us up to date!

Best regards,

Kate

 July 24, 2015, 08:51 #5 Member   hekseli Join Date: Mar 2013 Posts: 48 Rep Power: 5 I don't know either how the number of elements is really computed. Yes I get the right number of hexas too (10) but if you look at the vertex numbers from .msh file directly you see 40 vertices, even though there should be 36. So we have duplicates. With respect to OpenFoam e.g. this kind of mesh works fine and OF checkMesh doesn't complain but I don't feel comfy when I know that there are duplicate vertices!!!! Cheers

 July 24, 2015, 10:42 #6 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,521 Rep Power: 26 Hi, In mesh generated with Gmsh 2.9.2 vertices 33-36 have the same coordinates as vertices 5-8. And they appear as a result of meshing of two separate volumes. Since cell size of top cuboid is equal to the bottom one you have vertices that looks like duplicate yet belong to different meshes. In any case the problem has only theoretical value as when you start to define physical groups you ether will redo your mesh, or will be able to stitch overlapping physical surfaces. KateEisenhower likes this.

 July 24, 2015, 11:11 #7 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,521 Rep Power: 26 Hi, Update It is no just Coherence, it is Coherence Mesh, if you would like to remove duplicate entities from mesh. If you issue the command after generation of mesh, you will get the following in log: Code: ```Info : Removing duplicate mesh vertices... Info : Found 4 duplicate vertices Info : Removed 4 duplicate mesh vertices Info : Done removing duplicate mesh vertices``` and final mesh will contain 36 nodes: Code: ```\$Nodes 36 1 -0.5 -0.5 0 2 0.5 -0.5 0 ...``` heksel8i and KateEisenhower like this.

 July 27, 2015, 05:16 #8 Member   hekseli Join Date: Mar 2013 Posts: 48 Rep Power: 5 Hey again, just started to deal with this thing again after the weekend. Apparently the Coherence Mesh command in the end of the .geo file is not executed after the meshing (gmsh -3 test.geo) on the command line. So by issuing the command after the mesh generation you mean some kind of command execution outside .geo file? Maybe I could ask at the same time that if I would have that kind of pyramid shape .stl surface file and I would like to get structured mesh like above test code does, is it possible? This far the stl remeshing procedures what I have seen, give only unstructured grids. Direct access to stl surface and its transfinite properties is misty for me with respect to the simple surface topology. Cheers

 July 27, 2015, 06:21 #9 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,521 Rep Power: 26 Hi, You can generate mesh from geo file. So instead of gmsh -3 test.geo, you add "Mesh 3;" when you would like to generate mesh. The whole procedure should be something like: Code: ```... Mesh 3; // Generalte 3D mesh Coherence Mesh; // Remove duplicate entities Save "my-lovely-mesh.msh"; // Save mesh in MSH format``` I have never generated structured meshes from STL surface with Gmsh. But, in general, to generate hexagonal meshes with transfinite algorithm you need surfaces with 4 (or 5) angles. Since STL is a list of triangles, you need somehow to remesh it with quadrangles. Maybe Recombine Surface [1] command could do this, yet it depends on STL and desired quality of the mesh. 1. http://www.geuz.org/gmsh/doc/texinfo...-mesh-commands

 July 27, 2015, 06:39 #10 Member   hekseli Join Date: Mar 2013 Posts: 48 Rep Power: 5 Thanks! I haven't really found any examples nor experiences about structured meshes from stl's so indeed it is not a common approach.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post robyTKD Open Source Meshers: Gmsh, Netgen, CGNS, ... 1 July 13, 2016 11:27

All times are GMT -4. The time now is 11:16.