Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Het is ook mogelijk een driehoekig grid te genereren:

Code Block
Defdef mesh2d_add_triangular(
    network: Network, polygon: Union[Polygon, MultiPolygon], edge_length: float = None
) -> None:
    """Add triangular mesh to existing network. An orthogonal mesh is generated by the
    meshkernel, which likely means that the given geometry is not completely filled. The
    triangle discretization is determined based on the coordinates on the boundary of the
    provided geometry. Giving an edge_length will discretize the polygon for you, but
    you can also do this yourself.

    Args:
        network (Network): Network object to which the mesh is added
        polygon (Union[Polygon, MultiPolygon]): Geometry within which the mesh is generated
        edge_length (float, optional): Distance for which the polygon boundary is discretized (by approximation). Defaults to None.
    """

...

Het is mogelijk het grid lokaal binnen een gegeven polygoon een aantal stappen te verfijnen. Zo kan een 40x40 grid lokaal verfijnd worden naar een 20x20 grid, 10x10 grid, etc.

Code Block

def mesh2d_refine(
    network: Network, polygon: Union[Polygon, MultiPolygon], steps: int
) -> None:
    """Refine mesh 2d within (list of) polygon or multipolygon, with a certain
    number of refinement steps.

    Args:
        network (Network): Network for which the mesh is clipped
        polygon (Union[GeometryList, Union[Polygon, MultiPolygon]]): Polygon within which the mesh is clipped
        steps (int): Number of steps in the refinement
    """

...

Code Block
mesh.mesh2d_add_rectilinear(network, rectangle, dx=1, dy=1)
clipgeo = MultiPolygon([box(-6, -1, -4, 2), box(4, 5, 7.2, 7.2)])
mesh.mesh2d_clip(network, clipgeo, deletemeshoption=1, inside=True)

Code Block
multipolygon = MultiPolygon([box(0, 0, 10, 10), box(12, 2, 19, 9)])
mesh.mesh2d_add_rectilinear(network, multipolygon, dx=1, dy=1)
river = LineString(np.c_[x, np.sin(x / 3) + 5]).buffer(0.5)
refinement = river.buffer(1)
mesh.mesh2d_refine(network, refinement, steps=1)
mesh.mesh2d_clip(network=network, polygon=GeometryList.from_geometry(river))
Image RemovedImage Added