CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] gmsh and duplicate nodes in adjacent surfaces (https://www.cfd-online.com/Forums/openfoam-meshing/157247-gmsh-duplicate-nodes-adjacent-surfaces.html)

heksel8i July 23, 2015 17:27

gmsh and duplicate nodes in adjacent surfaces
 
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?

KateEisenhower July 24, 2015 07:47

Hi,

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

Best regards,

Kate

heksel8i July 24, 2015 08:17

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;


-----------------------------------------------------------------------


KateEisenhower July 24, 2015 08:35

Quote:

Originally Posted by heksel8i (Post 556746)
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 (Post 556835)
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

heksel8i July 24, 2015 08:51

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

alexeym July 24, 2015 10:42

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.

alexeym July 24, 2015 11:11

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 July 27, 2015 05:16

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

alexeym July 27, 2015 06:21

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

heksel8i July 27, 2015 06:39

Thanks!

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

vachan October 26, 2019 05:13

Quote:

Originally Posted by alexeym (Post 557130)
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.


All times are GMT -4. The time now is 23:15.