Hi, I am using Gmsh in my C++ gas modelling code and I think that Gmsh is great!
Now I am dealing with OpenCascade (OCC). The task is to cut geometry and to generate adaptive mesh around it.
OCC cut function works ok but I have problem to set correct mesh size.
When I add points, I set the mesh size that depends on the gas density near the point.
After cut the tags of the old points are changed and some new points appear.
The old points have correct mesh size but the mesh size of the new points is default.
Here are my questions:
How can be set mesh size to the new points?
Is it possible to get the mesh size of the point in gmsh::model::occ:: or in gmsh::model::?
Is it possible to get the point coordinates in occ similar to gmsh::model::getValue?
I attached the example code.
Best Regards, Kiril Shterev
Thank You!!!
Best Regards, Kiril
You could do getEntities(0) and getValue() before and after and compare, but indeed it's a bit clumsy. I will add mesh::getSizes() to make it easier to see which points don't have any mesh size constraint.
It will be useful. When you will add this function?
For geometrical entities, you can use
getBoundary()
orgetAdjacencies()
. At the mesh level simply get the elements: you can then reconstruct the node to element mapping easily using e.g. anstd::map
.
Mesh elements are oriented according to the orientation of the underlying geometrical entity. There's nothing predefined to get the "normal to the boundary line (element) that point to the mesh region": you'll need to reconstruct that on your own.
I will think about this.
How can be set mesh size to the new points?
You can use mesh::setSize(). See e.g. tutorial 16.
OK I can set using mesh::setSize(), but how to distinguish new points from old?
And some related for me questions:
Is it possible to get the line (element) connected to the new points or the opposite (the point connected to the line)?
How to get the normal to the boundary line (element) that point to the mesh region?
Hi, I am using Gmsh in my C++ gas modelling code and I think that Gmsh is great!
Now I am dealing with OpenCascade (OCC). The task is to cut geometry and to generate adaptive mesh around it.
OCC cut function works ok but I have problem to set correct mesh size.
When I add points, I set the mesh size that depends on the gas density near the point.
After cut the tags of the old points are changed and some new points appear.
The old points have correct mesh size but the mesh size of the new points is default.
Here are my questions:
How can be set mesh size to the new points?
Is it possible to get the mesh size of the point in gmsh::model::occ:: or in gmsh::model::?
Is it possible to get the point coordinates in occ similar to gmsh::model::getValue?
I attached the example code.
Best Regards, Kiril Shterev
I found that C++ API generate(2) slightly increases memory usage but continuously when is used repeatedly. The memory increases for 2000 calls of API generate(2) from 168.9MB (Virt) and 67.4MB (Res) to 175.0MB (Virt) and 73.1MB (Res). This is a problem when the code generates mesh contentiously and it is working for days. For a couple of days memory grows up to ~4GB. When such a code has to work for weeks or months, the memory growing will make code unusable.
The memory increases when:
for(int Iter = 0; Iter < 1000000; Iter++) { gmsh::model::mesh::generate(2); }
for(int Iter = 0; Iter < 1000000; Iter++) { gmsh::initialize(); //Some code ...
gmsh::model::mesh::generate(2);
//Other code ...
gmsh::finalize();
}
gmsh::initialize();
for(int Iter = 0; Iter < 1000000; Iter++) { gmsh::clear(); //Some code ...
gmsh::model::mesh::generate(2);
//Other code ...
}
gmsh::finalize();
I used example gmsh/demos/api/t1.cpp to demonstrate the issue. The examples were tested on two versions of gmsh: 3.0.7 and 4.0.6. Both versions were build from source on Debian 8.11 with kernel 3.16.59-1.
Best Regards,
Kiril Shterev
I found that C++ API generate(2) slightly increases memory usage but continuously when is used repeatedly. The memory increases for 2000 calls of API generate(2) from 168.9MB (Virt) and 67.4MB (Res) to 175.0MB (Virt) and 73.1MB (Res). This is a problem when the code generates mesh contentiously and it is working for days. For a couple of days memory grows up to ~4GB. When such a code has to work for weeks or months, the memory growing will make code unusable.
The memory increases when:
for(int Iter = 0; Iter < 1000000; Iter++) { gmsh::model::mesh::generate(2); }
for(int Iter = 0; Iter < 1000000; Iter++) { gmsh::initialize(); //Some code ...
gmsh::model::mesh::generate(2);
//Other code ...
gmsh::finalize();
}
gmsh::initialize();
for(int Iter = 0; Iter < 1000000; Iter++) { gmsh::clear(); //Some code ...
gmsh::model::mesh::generate(2);
//Other code ...
}
gmsh::finalize();
I used example gmsh/demos/api/t1.cpp to demonstrate the issue. The examples were tested on two versions of gmsh: 3.0.7 and 4.0.6. Both versions were build from source on Debian 8.11 with kernel 3.16.59-1.
Best Regards,
Kiril Shterev