General - Overview GMSH
General - Overview GMSH
1
Some background
2
Some background
3
What is Gmsh?
4
∼ 20 years of Gmsh development in 1 minute
A warm thank you to all the contributors!
A little bit of history
• Gmsh was started in 1996, as a side project
• 1998: First public release
• 2003: Open Sourced under GNU GPL
• 2006: OpenCASCADE integration (Gmsh 2)
• 2009: IJNME paper and switch to CMake
• 2012: Curvilinear meshing and quad meshing
• 2013: Homology and ONELAB solver interface
• 2015: Multi-Threaded 1D and 2D meshing (coarse-grained)
• 2017: Boolean operations and switch to Git (Gmsh 3)
• 2018: C++, C, Python and Julia API (Gmsh 4)
• 2019: Multi-Threaded 3D meshing (fine-grained), robust STL remeshing
• 2021: GmshFEM, Quasi-structured quad meshing
6
Strategic choices
7
Strategic choices
• Community infrastructure
• Our own (using GitLab) to enable public/private parts
(https://gitlab.onelab.info/gmsh/gmsh)
• Continuous integration and delivery (CI/CD) of Gmsh app and Gmsh SDK
on Windows, Linux and macOS
• Web site (https://gmsh.info) with documentation, tutorials, etc.
• Scientific aspects of algorithms detailed in journal papers
• Licensing
• Gmsh is distributed under the GNU General Public License v2 or later, with
exceptions to allow for easier linking with external libraries
• We double-license to enable embedding in commercial codes
8
Basic concepts
9
Basic concepts
The goal is to deal with very different underlying data representations in a
transparent manner
10
Geometry module
11
Geometry module
• Model entities are topological entities, i.e., they only deal with adjacencies in
the model; a bi-directional data structure represents the graph of adjacencies
G0i
G1i
G2i
G3i
• Any model is able to build its list of adjacencies of any dimension using local
operations
• The BRep is extended with non-manifold features: adjacent entities, and
embedded (internal) entities
• Model entities can be either CAD entities (e.g. from the built-in or
OpenCASCADE kernel) or discrete entities (defined by a mesh, e.g. STL)
12
Geometry module
The geometry of a CAD model entity depends on the solid modeler kernel for its
underlying representation. Solid modelers usually provide a parametrization of
the shapes, i.e., a mapping:
p ∈ Rd 7→ x ∈ R3
1. The geometry of a model point G0i is simply its 3-D location xi = (xi , yi , zi )
2. The geometry of a model curve G1i is its underlying curve Ci with its
parametrization p(t) ∈ Ci , t ∈ [t1 , t2 ]
3. The geometry of a model surface G2i is its underlying surface Si with its
parametrization p(u, v) ∈ Si
4. The geometry associated to a model volume is R3
13
Geometry module
15
Geometry module
Discrete model entities are defined by a mesh (e.g. STL):
• They can be equipped with a geometry through a reparametrization
procedure
• The parametrization is then used for meshing, in exactly the same way as for
CAD entities
16
Mesh module
17
Mesh module
18
Mesh module
• Mesh data is made of elements (points, lines, triangles, quadrangles,
tetrahedra, hexahedra, ...) defined by an ordered list of their nodes
• Elements and nodes are stored (classified) in the model entity they
discretize:
• A model point will thus contain a mesh element of type point, as well as a
mesh node
• A model curve will contain line elements as well as its interior nodes, while
its boundary nodes will be stored in the bounding model points
• A model surface will contain triangular and/or quadrangular elements and all
the nodes not classified on its boundary or on its embedded entities (curves
and points)
• A model volume will contain tetrahedra, hexahedra, etc. and all the nodes
not classified on its boundary or on its embedded entities (surfaces, curves
and points)
19
Mesh module
20
Solver module
21
Solver module
22
Post-processing module
23
Post-processing module
• Cuts, iso-curves and vectors
• Elevation maps
• Streamlines
• Adaptive high-order visualization
24
Recent developments
25
Constructive Solid Geometry
https://en.wikipedia.org/wiki/Constructive_solid_geometry
26
Constructive Solid Geometry
SetFactory ( " OpenCASCADE " ); // use OpenCASCADE kernel
Sphere (2) = {0 ,0 ,0 , Rt };
B ool e a nI nt ers ection (3) = { Volume {1}; Delete ; }{ Volume {2}; Delete ; };
// delete object and tool
Cylinder (4) = { -2* R ,0 ,0 , 4* R ,0 ,0 , Rs };
Cylinder (5) = {0 , -2* R ,0 , 0 ,4* R ,0 , Rs };
Cylinder (6) = {0 ,0 , -2* R , 0 ,0 ,4* R , Rs };
27
Constructive Solid Geometry
gmsh/examples/boolean/boolean.geo
28
Constructive Solid Geometry
SetFactory ( " OpenCASCADE " );
DefineConstant [
z = {16 , Name " Parameters / z position of box " }
sph = {0 , Choices {0 ,1} , Name " Parameters / Add sphere ? " }
];
If ( sph )
b () += 3;
Sphere ( b (1)) = {0 ,150 ,0 , 20};
EndIf
29
Constructive Solid Geometry
gmsh/examples/boolean/import.geo
30
Constructive Solid Geometry
31
Application Programming Interface
32
Application Programming Interface
33
Application Programming Interface
Same boolean example as before, but using the Python API:
import gmsh
gmsh . initialize ()
gmsh . model . add ( " boolean " )
gmsh/examples/api/boolean.py
34
Application Programming Interface
... or using the C++ API:
# include < gmsh .h >
std :: vector < std :: pair < int , int > > ov ;
std :: vector < std :: vector < std :: pair < int , int > > > ovv ;
gmsh :: model :: occ :: addBox ( -R , -R , -R , 2* R ,2* R ,2* R , 1);
gmsh :: model :: occ :: addSphere (0 ,0 ,0 , Rt , 2);
gmsh :: model :: occ :: intersect ({{3 , 1}} , {{3 , 2}} , ov , ovv , 3);
gmsh :: model :: occ :: addCylinder ( -2* R ,0 ,0 , 4* R ,0 ,0 , Rs , 4);
gmsh :: model :: occ :: addCylinder (0 , -2* R ,0 , 0 ,4* R ,0 , Rs , 5);
gmsh :: model :: occ :: addCylinder (0 ,0 , -2* R , 0 ,0 ,4* R , Rs , 6);
gmsh :: model :: occ :: fuse ({{3 , 4} , {3 , 5}} , {{3 , 6}} , ov , ovv , 7);
gmsh :: model :: occ :: cut ({{3 , 3}} , {{3 , 7}} , ov , ovv , 8);
gmsh/examples/api/boolean.cpp
35
Application Programming Interface
36
Application Programming Interface
In order to make this API easy to use, we publish a binary Software Development
Toolkit (SDK):
• Continuously delivered (for each commit in master), like the Gmsh app
• Contains the dynamic Gmsh library together with the corresponding C++/C
header files, and Python and Julia modules
37
Multi-Threaded meshing
You need to download the latest development snapshots to test this, or recompile
the source code with -DENABLE OPENMP=1; then e.g. gmsh file.geo -3 -nt
8 -algo hxt
38
Multi-Threaded meshing
42
Robust STL remeshing
43
Robust STL remeshing
Remeshing
45
Robust STL remeshing
46
Robust STL remeshing
47
Robust STL remeshing
CT scan of an artery: 101 patches created, most because of the large aspect ratio
48
Robust STL remeshing
50
Quasi-structured quad meshing
New experimental algorithm by [M. Reberol et al. 2021] that has just landed in
the development version
52
Quasi-structured quad meshing
53
Quasi-structured quad meshing
The final quad mesh is very similar to the one obtained with the global
parametrization approach and has the same number of irregular vertices
54
Quasi-structured quad meshing
55
Conclusions and perspectives
56
Post-Scriptum
57