Skip to main content

Water areas

Water areas are where the 1D network carries the flow, so no 2D cells are kept there. Typically you refine along a watercourse and then cut the watercourse out: the small cells that remain follow its edge as closely as possible.

Cut out cell by cell

generate first makes the whole mesh and then removes cells with MeshKernel, exactly as the model-building workflow does (hydrolib’s mesh2d_clip): the water polygons are merged, each part is clipped with MeshKernel’s mesh deletion, and hanging edges are removed. The water removal rule decides which cells go:

Rule A cell is removed when MeshKernel option
"centre" (default) its circumcentre (triangle) or centroid lies in water FACES_WITH_INCLUDED_CIRCUMCENTERS
"inside" it lies completely in water INSIDE_NOT_INTERSECTED
"touches" it touches water INSIDE_AND_INTERSECTED
meshes = {
    rule: generate(
        domain,
        cell_size=16.0,
        refinement_areas=[(river.buffer(10), 2)],
        transition_rows=1,
        water_areas=[river],
        water_removal=rule,
        crs="EPSG:28992",
    )
    for rule in ("centre", "inside", "touches")
}
2026-11-26T12:18:04.380166 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/

MeshKernel keeps nodes and edges and derives the cells from them again, so a single removed cell whose neighbours all remain comes back. Assign bed levels after all changes to the mesh (see Use the mesh in D-HYDRO).

Small water areas stay cells

A water area of one or two cells would leave a small hole, a ring of at most six nodes. MeshKernel makes one cell of such a hole whenever it builds the cells from nodes and edges, as hydrolib’s mesh2d_from_netcdf and the D-HYDRO GUI do. That cell is often a hexagon that D-Flow FM rejects (“network is not orthogonal”), so generate and refine keep the original cells there. Larger water areas leave larger holes, which stay open. check reports holes that MeshKernel would close, also in meshes from other programs.

Holes in the domain

A hole in the domain is clipped the same way, with the same rule. An island inside a hole keeps its cells.

In the TOML file

water_removal = "centre"

[[water_areas]]
path = "model.gpkg"
layer = "water"