Mesh creation
4 min read
Mesh project
The first step is to create a mesh project, which will be used for 2D horizontal groundwater flow and transport calculation.
If THYRSIS is activated, there must be a Thyrsis menu in the main QGIS toolbar. To create a new mesh project, click on : Thyrsis > New > Mesh...
Figure 2 :

Figure 2 New mesh creation
Note
THYRSIS will use the current projection to create the mesh database. Change the projection in QGIS to be sure you are using the right projection. In this tutorial, all data are projected in EPSG: 27572 (Extended Lambert II)
You must first fulfill the path where the mesh database will be saved. The ~/.thyrsis/mesh
directory is the right place to save the database for a later use by THYRSIS but another place can be chosen temporarily. The database must be named like SITE_MODEL.mesh.sqlite
, where:
SITE is the site name - created and saved in the
sites.sqlite
database if it doesn’t exist,MODEL is the model name - a model is composed of a mesh and of several hydrogeological parameters and fields.
Here we will call it SACLAY_TUTORIAL, to indicate that it is a mesh model based on the SACLAY site and that it is the TUTORIAL mesh model. At the same time, THYRSIS will create a QGIS project (.qgs file). At the end your mesh directory should be like Figure 3.

Figure 3 Mesh directory
A background layer is useful for locating the project environment. For example, OpenStreetMap can be opened through the QGIS browser menu Figure 4.

Figure 4 QGIS canvas with OSM layer
You can also add a river layer, which will be useful for delimiting the project area. For the tutorial, we provide a river.gpkg
file. Click on Layer>Add Layer>Add Vector Layer and add the river layer Figure 5.

Figure 5 Add Vector Layer
At last, two rasters are needed for the mesh project creation:
a digital elevation model (DEM), named
mnt.tif
a “wall” raster of the aquifer substratum’s altitude, named
mur.tif
To add them, click on Layer > Add Layer > Add Raster Layer
.
We recommend you to put the background layer and the raster layers below the other layers. You can also add some transparency in your DEM symbology properties. Your canvas should look like.

Figure 6 QGIS canvas with DEM layer
Don’t forget to save your project (CTRL + S
or click on Project > Save
)
Meshing
The next step is the 2D mesh creation.
The contours layer must be defined first. It is a layer of polylines with the followings attributes :
groupe : group name of the contour,
nom : contour name,
longueur_element : element length, which defines the mesh density in the neighbourhood of the contour,
potentiel_impose : 1 if the contour corresponds to an imposed potential boundary condition, 0 or NULL otherwise.
Warning
To create the contours, enable the snapping tools of QGIS, and select the active layer option. It is necessary to create true topological layer with closed contours.

Figure 7 Enabling snapping
Then select the contours layer, click on the editing button,

Figure 8 Editing contours layer
and activate the Add Line Feature (Figure 9).

Figure 9 Adding line feature on the contours layer
For the tutorial, we want to create a mesh for the Plateau de Saclay. We recommand you to create 4 contours :
a north contour on the river,
an east contour between the two rivers,
a south contour on the river,
a west contour perpendicular to the north and south rivers.
All contours must be included within the DEM and wall raster extents. For each validated contour, the windows of Figure 10 opens.

Figure 10 Contours layer’s attributes
The field longueur_element must be filled and the field potentiel_impose must be set to 1 if the contour corresponds to an imposed potential boundary condition.
Nested contours can be created in order to define several meshing zones.
Because it is not possible to use snapping on itself (QGIS limitation), a closed contour must be created by defining first an almost closed contour, then using snapping and the QGIS node tool to move the last vertex on the first one.
Save the contours layer. THYRSIS will populate the domaines layer with polygons obtained from the contours layer.
If no polygon is created in the domaines layer, there is probably a topological error with non closing contours.
Your canvas should look like Figure 11, with similar contours attributes.

Figure 11 QGIS canvas after validating the contours layer
Finally use the Mesh button (Figure 12) in the THYRSIS toolbar to create the mesh.

Figure 12 Mesh button
The window of Figure 13 opens.

Figure 13 Mesh dialog
Verify the layers and launch the mesh creation. The noeuds and mailles layers will be updated and the altitude and altitude_mur layers created.
You should obtain the QGIS canvas of Figure 14.

Figure 14 QGIS canvas with mesh result