CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] gmsh and duplicate nodes in adjacent surfaces

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

Like Tree3Likes
  • 1 Post By alexeym
  • 2 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2015, 17:27
Default gmsh and duplicate nodes in adjacent surfaces
  #1
Member
 
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13
heksel8i is on a distinguished road
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?
heksel8i is offline   Reply With Quote

Old   July 24, 2015, 07:47
Default
  #2
Senior Member
 
Join Date: Mar 2015
Posts: 250
Rep Power: 12
KateEisenhower is on a distinguished road
Hi,

can you please post a minimal geo file which reproduces the problem?

Best regards,

Kate
KateEisenhower is offline   Reply With Quote

Old   July 24, 2015, 08:17
Default
  #3
Member
 
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13
heksel8i is on a distinguished road
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;


-----------------------------------------------------------------------
heksel8i is offline   Reply With Quote

Old   July 24, 2015, 08:35
Default
  #4
Senior Member
 
Join Date: Mar 2015
Posts: 250
Rep Power: 12
KateEisenhower is on a distinguished road
Quote:
Originally Posted by heksel8i View Post
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 View Post
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
KateEisenhower is offline   Reply With Quote

Old   July 24, 2015, 08:51
Default
  #5
Member
 
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13
heksel8i is on a distinguished road
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
heksel8i is offline   Reply With Quote

Old   July 24, 2015, 10:42
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
alexeym is offline   Reply With Quote

Old   July 24, 2015, 11:11
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
alexeym is offline   Reply With Quote

Old   July 27, 2015, 05:16
Default
  #8
Member
 
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13
heksel8i is on a distinguished road
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
heksel8i is offline   Reply With Quote

Old   July 27, 2015, 06:21
Default
  #9
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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
alexeym is offline   Reply With Quote

Old   July 27, 2015, 06:39
Default
  #10
Member
 
hekseli
Join Date: Mar 2013
Posts: 49
Rep Power: 13
heksel8i is on a distinguished road
Thanks!

I haven't really found any examples nor experiences about structured meshes from stl's so indeed it is not a common approach.
heksel8i is offline   Reply With Quote

Old   October 26, 2019, 05:13
Default
  #11
New Member
 
Vachan Potluri
Join Date: Jul 2017
Posts: 29
Rep Power: 8
vachan is on a distinguished road
Quote:
Originally Posted by alexeym View Post
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

Hi Alexey,


I was having a problem with gmshToFoam producing extra default faces (openfoam 7). My 2D mesh is a combination of 3 extrusions and the faces at extrusion interfaces were duplicated. Using
Code:
Coherence Mesh;
I was able to solve my problem.
vachan is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Cgns support for gmsh robyTKD OpenFOAM Meshing & Mesh Conversion 1 July 13, 2016 11:27


All times are GMT -4. The time now is 05:07.