[mesh]#

The mesh engine and the sizes it meshes the model with.

  • mesh [table] · optional · 26 user keys, 9 dev or expert
  • Start a file: hmp config template --modules mesh (download it), then hmp check file.toml. Minimal file
[mesh]
# engine = "regular"Mesh engine: 'regular' (one quadrilateral cell per DEM pixel, or per cell_size), 'triangle' (triangles that follow the lines), 'voronoi' (polygons around generators) or 'catchment' (the catchment as one polygon cell, for a global model, read only by a solver that names it).
Path
mesh.engine
More

A string and not a closed choice, since an installed third-party engine is named the same way.

Accepted
string
Example
"regular", "triangle", "voronoi"
# cell_size = ‹number›Cell size in metres, the side of the square of the same mean area as the cells, whatever the engine: a domain of area A gets about A / cell_size^2 cells, and a regular, a triangle and a voronoi cell of this size have about the same area. m > 0
Path
mesh.cell_size
More

It is the side of the regular grid cells and the background size of the triangle and voronoi engines. Unset, the DEM pixel size, which is the pixel of geographic.catchment.dem_resolution when that key is set, else the pixel of the DEM file. It is the last of the three sizes and reads none of them back: it changes the cells and not the surface that was delineated.

Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# river_cell_size = ‹number›Cell size in metres along the rivers, the side of the square of the same mean area as the cells, as cell_size. m > 0 only if engine = "triangle" | "voronoi"
Path
mesh.river_cell_size
More

Unset, the DEM pixel size; never finer than the DEM pixel.

Accepted
number
Valid range
> 0 (refused outside)
Unit
m
Only if
engine = "triangle" | "voronoi"
# river_band = ‹number›Distance in metres from a river over which the cell size grows back to cell_size. m > 0 only if engine = "triangle" | "voronoi"
Path
mesh.river_band
More

Unset, twice cell_size.

Accepted
number
Valid range
> 0 (refused outside)
Unit
m
Only if
engine = "triangle" | "voronoi"
# seed = 0Seed of the random draws of an engine; one seed gives one mesh. - >= 0 dev
Path
mesh.seed
Accepted
integer
Valid range
>= 0 (refused outside)
Unit
-
# outside_factor = 2.0Cell size outside the catchment, as a multiple of cell_size; the cells there have about outside_factor^2 times the area of a cell_size cell. - >= 1 dev
Path
mesh.outside_factor
Accepted
number
Valid range
>= 1 (refused outside)
Unit
-
# transition_distance = 500.0Distance in meters outside the catchment over which the cell size grows to its outside value. m >= 0 dev
Path
mesh.transition_distance
Accepted
number
Valid range
>= 0 (refused outside)
Unit
m
# max_slope = 0.5Largest growth of the cell size per meter of distance, which bounds the size ratio of two neighbors. m/m ]0, 1] dev
Path
mesh.max_slope
Accepted
number
Valid range
]0, 1] (refused outside)
Unit
m/m
# gap_cells = 2.0Cells across the gap between two face lines (lake shores, barriers, geology contacts, catchment boundary) or between one and the domain outline: the cell size there, with the meaning of cell_size, is the gap divided by this number, never finer than the DEM pixel. cells >= 0 only if engine = "triangle" | "voronoi" dev
Path
mesh.gap_cells
More

0 switches it off.

Accepted
number
Valid range
>= 0 (refused outside)
Unit
cells
Only if
engine = "triangle" | "voronoi"

mesh.engine engine “regular” “regular” “triangle” “voronoi” Mesh engine: ‘regular’ (one quadrilateral cell per DEM pixel, or per cell_size), ‘triangle’ (triangles that follow the lines), ‘voronoi’ (polygons around generators) or ‘catchment’ (the catchment as one polygon cell, for a global model, read only by a solver that names it). A string and not a closed choice, since an installed third-party engine is named the same way. mesh.cell_size cell_size not set m Cell size in metres, the side of the square of the same mean area as the cells, whatever the engine: a domain of area A gets about A / cell_size^2 cells, and a regular, a triangle and a voronoi cell of this size have about the same area. It is the side of the regular grid cells and the background size of the triangle and voronoi engines. Unset, the DEM pixel size, which is the pixel of geographic.catchment.dem_resolution when that key is set, else the pixel of the DEM file. It is the last of the three sizes and reads none of them back: it changes the cells and not the surface that was delineated. mesh.river_cell_size river_cell_size not set m Cell size in metres along the rivers, the side of the square of the same mean area as the cells, as cell_size. Unset, the DEM pixel size; never finer than the DEM pixel. mesh.river_band river_band not set m Distance in metres from a river over which the cell size grows back to cell_size. Unset, twice cell_size. mesh.seed seed 0 - Seed of the random draws of an engine; one seed gives one mesh. mesh.outside_factor outside_factor 2.0 - Cell size outside the catchment, as a multiple of cell_size; the cells there have about outside_factor^2 times the area of a cell_size cell. mesh.transition_distance transition_distance 500.0 m Distance in meters outside the catchment over which the cell size grows to its outside value. mesh.max_slope max_slope 0.5 m/m Largest growth of the cell size per meter of distance, which bounds the size ratio of two neighbors. mesh.gap_cells gap_cells 2.0 cells Cells across the gap between two face lines (lake shores, barriers, geology contacts, catchment boundary) or between one and the domain outline: the cell size there, with the meaning of cell_size, is the gap divided by this number, never finer than the DEM pixel. 0 switches it off.

[[mesh.refinement_zone]]#

One zone of local refinement: a vector layer, or where a field passes a threshold.

Repeat the table: one [[mesh.refinement_zone]] block per item.

cell_size = 20.0Target cell size, in metres, inside the zone: the side of the square of the same mean area as the cells, as mesh.cell_size. required m > 0 example value
Path
mesh.refinement_zone.cell_size
See
mesh.cell_size
Accepted
number
Valid range
> 0 (refused outside)
Unit
m
Example
20.0
# path = "inputs/refinement_zone.gpkg"Vector layer (gpkg / shp / GeoJSON) of polygons (zones) and/or points or lines (corridors). example value
Path
mesh.refinement_zone.path
More

A relative path is read from the project root, and workspace:<name> reads data/refinement_zone/<name> of the workspace. Give path or where, not both.

Accepted
path
Example
"inputs/refinement_zone.gpkg", "workspace:refinement_zone.gpkg"
Workspace file
workspace:<name> reads data/refinement_zone/<name> of the workspace, and workspace:. the folder itself
# where = "height_above_stream"The field whose threshold draws the zone, on the pixels of the DEM, instead of a vector layer. example value
Path
mesh.refinement_zone.where
More

The zone is the set of pixels where the field is below the value of below, or above the value of above. Give path or where, not both.

Values
  • "height_above_stream" : Height in metres of the ground above the stream it drains to, computed from the DEM and the river network traced from it ([geographic.river_network]). The mapped network never enters. Takes below.
  • "watertable_depth" : Depth in metres of the water table below the ground in the run named by run, at any of its time steps: its minimum over time is compared to below, its maximum to above.
  • "seepage" : Drain outflow per cell area, in mm/d, in the run named by run, at any of its time steps: its maximum over time is compared to above, its minimum to below.
Accepted
"height_above_stream" | "watertable_depth" | "seepage"
Example
"height_above_stream", "watertable_depth", "seepage"
# below = 2.0The zone holds the pixels where the field of where is below this value: metres for height_above_stream and watertable_depth, mm/d for seepage. m, or mm/d for seepage > 0 example value
Path
mesh.refinement_zone.below
Accepted
number
Valid range
> 0 (refused outside)
Unit
m, or mm/d for seepage
Example
2.0
# above = 0.5The zone holds the pixels where the field of where is above this value: metres for watertable_depth, mm/d for seepage. m, or mm/d for seepage >= 0 example value
Path
mesh.refinement_zone.above
More

Not read for height_above_stream.

Accepted
number
Valid range
>= 0 (refused outside)
Unit
m, or mm/d for seepage
Example
0.5
# run = "nancon_coarse"The earlier run of this project whose field draws the zone, for watertable_depth and seepage: its name, with or without its _vN (the latest version without), or its full sim_id. example value
Path
mesh.refinement_zone.run
More

The run must be sealed and hold the field. The mesh then depends on that run: its sim_id enters the mesh request and the product key.

Accepted
string
Example
"nancon_coarse"
# buffer = ‹number›Distance in metres over which the size grows back to the background size outside the zone, and corridor half-width for the point and line features of a layer. m > 0
Path
mesh.refinement_zone.buffer
More

When omitted, derives 2 * cell_size. Must be >= cell_size so a corridor holds at least one target cell.

Accepted
number
Valid range
> 0 (refused outside)
Unit
m

mesh.refinement_zone.path path not set “inputs/refinement_zone.gpkg” “workspace:refinement_zone.gpkg” Vector layer (gpkg / shp / GeoJSON) of polygons (zones) and/or points or lines (corridors). A relative path is read from the project root, and workspace:<name> reads data/refinement_zone/<name> of the workspace. Give path or where, not both. mesh.refinement_zone.where where not set height_above_stream watertable_depth seepage height_above_stream Height in metres of the ground above the stream it drains to, computed from the DEM and the river network traced from it ([geographic.river_network]). The mapped network never enters. Takes below. watertable_depth Depth in metres of the water table below the ground in the run named by run, at any of its time steps: its minimum over time is compared to below, its maximum to above. seepage Drain outflow per cell area, in mm/d, in the run named by run, at any of its time steps: its maximum over time is compared to above, its minimum to below. “height_above_stream” “watertable_depth” “seepage” The field whose threshold draws the zone, on the pixels of the DEM, instead of a vector layer. The zone is the set of pixels where the field is below the value of below, or above the value of above. Give path or where, not both. mesh.refinement_zone.below below not set 2.0 m, or mm/d for seepage The zone holds the pixels where the field of where is below this value: metres for height_above_stream and watertable_depth, mm/d for seepage. mesh.refinement_zone.above above not set 0.5 m, or mm/d for seepage The zone holds the pixels where the field of where is above this value: metres for watertable_depth, mm/d for seepage. Not read for height_above_stream. mesh.refinement_zone.run run not set “nancon_coarse” The earlier run of this project whose field draws the zone, for watertable_depth and seepage: its name, with or without its _vN (the latest version without), or its full sim_id. The run must be sealed and hold the field. The mesh then depends on that run: its sim_id enters the mesh request and the product key. mesh.refinement_zone.cell_size cell_size 20.0 m Target cell size, in metres, inside the zone: the side of the square of the same mean area as the cells, as mesh.cell_size. mesh.refinement_zone.buffer buffer not set m Distance in metres over which the size grows back to the background size outside the zone, and corridor half-width for the point and line features of a layer. When omitted, derives 2 * cell_size. Must be >= cell_size so a corridor holds at least one target cell.

[mesh.lake_refinement]#

Local mesh-refinement targets for the lake shoreline and the hydraulic structures.

enabled = ‹true | false›Whether the mesh is refined on the lake shore and the structures. false keeps the table in the file and reads it as absent: the mesh keeps its own cell size there. required
Path
mesh.lake_refinement.enabled
More

Required, so the table never switches itself on.

Accepted
true | false
# cell_size = 40.0Target cell size, in metres, in the lake shoreline band: the side of the square of the same mean area as the cells, as mesh.cell_size. m > 0
Path
mesh.lake_refinement.cell_size
See
mesh.cell_size
Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# shoreline_band = ‹number›Half-width, in metres, of the refined band around the lake shoreline. m > 0
Path
mesh.lake_refinement.shoreline_band
More

When omitted, derives 2 * cell_size. Must be >= cell_size so the band holds at least one target cell (a thinner band would slip between the size-field sampling nodes).

Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# buffer = 200.0Transition distance, in meters, over which the lake sizes ramp back to global. m >= 0
Path
mesh.lake_refinement.buffer
Accepted
number
Valid range
>= 0 (refused outside)
Unit
m
# interior_size = ‹number›Optional target cell size, in metres, inside the whole lake footprint (marnage / bathymetry resolution), with the meaning of mesh.cell_size. m > 0
Path
mesh.lake_refinement.interior_size
More

When omitted, the interior keeps the background size.

See
mesh.cell_size
Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# dam_cell_size = 30.0Target cell size, in metres, in the hydraulic-structure zones (cutoff wall, sill), with the meaning of mesh.cell_size. m > 0
Path
mesh.lake_refinement.dam_cell_size
See
mesh.cell_size
Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# dam_buffer = 150.0Base half-width, in metres, of the structure refinement corridors; also the radius of the optional dam-outlet disk. m > 0
Path
mesh.lake_refinement.dam_buffer
Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# hfb_buffer = ‹number›Half-width, in metres, of the refined zone around the dam cutoff wall (HFB). m > 0
Path
mesh.lake_refinement.hfb_buffer
More

The zone covers the lake outlet area. When omitted, derives 2 * dam_buffer. Must be >= dam_cell_size so the zone holds at least one target cell.

Accepted
number
Valid range
> 0 (refused outside)
Unit
m
# dam_outlet_disk = ‹true | false›Refine a disk of radius dam_buffer around the dam / catchment outlet.
Path
mesh.lake_refinement.dam_outlet_disk
More

None (auto) emits the disk unless a cutoff-wall zone overlaps it: the widened HFB zone then already covers the outlet.

Accepted
true | false

mesh.lake_refinement.enabled enabled Whether the mesh is refined on the lake shore and the structures. false keeps the table in the file and reads it as absent: the mesh keeps its own cell size there. Required, so the table never switches itself on. mesh.lake_refinement.cell_size cell_size 40.0 m Target cell size, in metres, in the lake shoreline band: the side of the square of the same mean area as the cells, as mesh.cell_size. mesh.lake_refinement.shoreline_band shoreline_band not set m Half-width, in metres, of the refined band around the lake shoreline. When omitted, derives 2 * cell_size. Must be >= cell_size so the band holds at least one target cell (a thinner band would slip between the size-field sampling nodes). mesh.lake_refinement.buffer buffer 200.0 m Transition distance, in meters, over which the lake sizes ramp back to global. mesh.lake_refinement.interior_size interior_size not set m Optional target cell size, in metres, inside the whole lake footprint (marnage / bathymetry resolution), with the meaning of mesh.cell_size. When omitted, the interior keeps the background size. mesh.lake_refinement.dam_cell_size dam_cell_size 30.0 m Target cell size, in metres, in the hydraulic-structure zones (cutoff wall, sill), with the meaning of mesh.cell_size. mesh.lake_refinement.dam_buffer dam_buffer 150.0 m Base half-width, in metres, of the structure refinement corridors; also the radius of the optional dam-outlet disk. mesh.lake_refinement.hfb_buffer hfb_buffer not set m Half-width, in metres, of the refined zone around the dam cutoff wall (HFB). The zone covers the lake outlet area. When omitted, derives 2 * dam_buffer. Must be >= dam_cell_size so the zone holds at least one target cell. mesh.lake_refinement.dam_outlet_disk dam_outlet_disk not set Refine a disk of radius dam_buffer around the dam / catchment outlet. None (auto) emits the disk unless a cutoff-wall zone overlaps it: the widened HFB zone then already covers the outlet.

[mesh.families]#

What the mesh does on each family of lines.

# rivers = "cell"How the mesh follows the river network traced from the DEM.
Path
mesh.families.rivers
Values
  • "cell" : The cells along each river form an ordered chain, from upstream to downstream; the river size applies along it.
  • "none" : The mesh ignores the rivers.
Accepted
"cell" | "none"
# geology = "face"How the mesh follows the contacts between the zones of the vector geology map that a flow parameter reads.
Path
mesh.families.geology
Values
  • "face" : Cell faces lie on the contacts between geology zones.
  • "none" : The mesh ignores the geology contacts.
Accepted
"face" | "none"
# lakes = "face"How the mesh follows the shore of each lake of the flow model.
Path
mesh.families.lakes
Values
  • "face" : Cell faces lie on the lake shores.
  • "none" : The mesh ignores the lake shores.
Accepted
"face" | "none"
# barriers = "face"How the mesh follows the flow barriers: the cutoff wall of each lake that declares one, and the lines of [flow.sinks_sources.flow_barriers].
Path
mesh.families.barriers
See
flow.sinks_sources.flow_barriers
Values
  • "face" : Cell faces lie on each barrier line, wings and free ends included, and the HFB rows go on them. The regular engine takes the staircase of faces the line crosses.
  • "none" : The mesh ignores the barriers; the HFB rows go on the faces each line crosses.
Accepted
"face" | "none"
# watershed_boundary = "none"How the mesh follows the boundary of the catchment inside the domain.
Path
mesh.families.watershed_boundary
Values
  • "face" : Cell faces lie on the catchment boundary.
  • "none" : The mesh ignores the catchment boundary.
Accepted
"face" | "none"

mesh.families.rivers rivers “cell” cell none cell The cells along each river form an ordered chain, from upstream to downstream; the river size applies along it. none The mesh ignores the rivers. How the mesh follows the river network traced from the DEM. mesh.families.geology geology “face” face none face Cell faces lie on the contacts between geology zones. none The mesh ignores the geology contacts. How the mesh follows the contacts between the zones of the vector geology map that a flow parameter reads. mesh.families.lakes lakes “face” face none face Cell faces lie on the lake shores. none The mesh ignores the lake shores. How the mesh follows the shore of each lake of the flow model. mesh.families.barriers barriers “face” face none face Cell faces lie on each barrier line, wings and free ends included, and the HFB rows go on them. The regular engine takes the staircase of faces the line crosses. none The mesh ignores the barriers; the HFB rows go on the faces each line crosses. How the mesh follows the flow barriers: the cutoff wall of each lake that declares one, and the lines of [flow.sinks_sources.flow_barriers]. mesh.families.watershed_boundary watershed_boundary “none” face none none The mesh ignores the catchment boundary. face Cell faces lie on the catchment boundary. How the mesh follows the boundary of the catchment inside the domain.

[mesh.triangle]#

The triangulation the triangle engine generates, or the file both engines read.

[mesh.triangle]
# path = "mesh/catchment.msh"Existing gmsh .msh file (format 2.2) to read instead of generating a triangulation, relative to the project root (the folder of project.toml). example value
Path
mesh.triangle.path
More

The line families are derived on the mesh read.

Accepted
path
Example
"mesh/catchment.msh"
# algorithm = "delaunay"Two-dimensional gmsh algorithm that generates the triangles of the triangle engine. dev
Path
mesh.triangle.algorithm
More

The voronoi engine does not triangulate and ignores it.

Values
  • "delaunay" : Gmsh Delaunay (algorithm 5): fast and robust.
  • "frontal" : Gmsh frontal-Delaunay (algorithm 6): better shaped triangles.
  • "meshadapt" : Gmsh MeshAdapt (algorithm 1): for complex curved boundaries.
Accepted
"delaunay" | "frontal" | "meshadapt"

mesh.triangle.path path not set “mesh/catchment.msh” Existing gmsh .msh file (format 2.2) to read instead of generating a triangulation, relative to the project root (the folder of project.toml). The line families are derived on the mesh read. mesh.triangle.algorithm algorithm “delaunay” delaunay frontal meshadapt delaunay Gmsh Delaunay (algorithm 5): fast and robust. frontal Gmsh frontal-Delaunay (algorithm 6): better shaped triangles. meshadapt Gmsh MeshAdapt (algorithm 1): for complex curved boundaries. Two-dimensional gmsh algorithm that generates the triangles of the triangle engine. The voronoi engine does not triangulate and ignores it.

[mesh.voronoi] dev#

Settings of the voronoi engine.

[mesh.voronoi]
# seeds = ‹"generated" | "triangulation"›Where the generators of the Voronoi cells come from. dev
Path
mesh.voronoi.seeds
More

Unset, they are the vertices of the triangulation read from [mesh.triangle] path when a path is given, and generated by the engine otherwise.

Values
  • "generated" : The engine places the generators itself: along the rivers, in mirror pairs on the face lines, on the boundary, and freely from the size field.
  • "triangulation" : The vertices of the triangulation read from [mesh.triangle] path are the generators.
Accepted
"generated" | "triangulation"
# lloyd_tolerance = 0.01Stop of the Lloyd relaxation of the generated generators: the root mean square of the displacements of the free generators in one iteration, as a share of their local cell size. - > 0 dev
Path
mesh.voronoi.lloyd_tolerance
More

The relaxation also stops after 25 iterations, and the mesh QA reports whether the tolerance was reached and the largest displacement.

Accepted
number
Valid range
> 0 (refused outside)
Unit
-

mesh.voronoi.seeds seeds not set generated triangulation generated The engine places the generators itself: along the rivers, in mirror pairs on the face lines, on the boundary, and freely from the size field. triangulation The vertices of the triangulation read from [mesh.triangle] path are the generators. Where the generators of the Voronoi cells come from. Unset, they are the vertices of the triangulation read from [mesh.triangle] path when a path is given, and generated by the engine otherwise. mesh.voronoi.lloyd_tolerance lloyd_tolerance 0.01 - Stop of the Lloyd relaxation of the generated generators: the root mean square of the displacements of the free generators in one iteration, as a share of their local cell size. The relaxation also stops after 25 iterations, and the mesh QA reports whether the tolerance was reached and the largest displacement.

[mesh.regular] dev#

A regular grid given by its shape rather than by a cell size.

shape = [60, 60]Number of rows and columns [nrow, ncol] of the grid over the DEM extent; the cells are rectangular when the extent is not square. required cells dev example value
Path
mesh.regular.shape
Accepted
list of integer
Unit
cells
Example
[60, 60]

mesh.regular.shape shape [60, 60] cells Number of rows and columns [nrow, ncol] of the grid over the DEM extent; the cells are rectangular when the extent is not square.