Gmsh Mesh#
Geometry#
We construct the geometry by first creating points, then connecting the points into curves, and finally the curves into surfaces. Fig. 130 shows the geometry and variables names of the vertices and curves.
Fig. 130 Geometry created in Gmsh for generating the finite-element mesh.
We construct curves from points (p_*) and surfaces from the curves (c_*).
The arrows indicate the direction (orientation) of the curves.#
Meshing using Python Script#
We use the Python script generate_gmsh.py to create the geometry and generate the mesh.
The script is structured identically to the one we used in examples/strikeslip-2d and examples/reverse-2d.
We create a class App that implements the functionality missing in gmsh_utils.GenerateMesh.
We must implement the create_geometry(), mark(), and generate_mesh() methods that are abstract in the GenerateMesh base class.
In this case the geometry is significantly more complex with arrays of points defining the top surface (topography and bathymetry) and the geometry of the slab.
We use the Gmsh MeshSize options to define a discretization size the grows slowly at a geometric rate with distance from the main fault.
# Generate a mesh with triangular cells and save it to `mesh_tri.msh` (default filename).
$ ./generate_gmsh.py --write
# Save as above but start the Gmsh graphical interface after saving the mesh.
$ ./generate_gmsh.py --write --gui
# Create only the geometry and start the Gmsh graphical interface.
$ ./generate_gmsh.py --geometry --gui
By default the Python script will generate a finite-element mesh with triangular cells and save it to the file mesh_tri.msh.
You can view the mesh using Gmsh either by using the --gui command line argument when you generate the mesh or running Gmsh from the command line and opening the file.
gmsh -open mesh_tri.msh
Fig. 131 Finite-element mesh with triangular cells generated by Gmsh.#