diff --git a/hydrolib/core/dflowfm/net/models.py b/hydrolib/core/dflowfm/net/models.py index f5c13e24a..7a622ee59 100644 --- a/hydrolib/core/dflowfm/net/models.py +++ b/hydrolib/core/dflowfm/net/models.py @@ -167,17 +167,22 @@ def create_rectilinear(self, extent: tuple, dx: float, dy: float) -> None: """ xmin, ymin, xmax, ymax = extent - - # Generate mesh - mesh2d_input = mk.Mesh2dFactory.create( - rows=int((ymax - ymin) / dy), - columns=int((xmax - xmin) / dx), - origin_x=xmin, - origin_y=ymin, - spacing_x=dx, - spacing_y=dy, - ) - + + rows = int((ymax - ymin) / dy) + columns = int((xmax - xmin) / dx) + + params = mk.MakeGridParameters(num_columns=columns, + num_rows=rows, + origin_x=xmin, + origin_y=ymin, + block_size_x=dx, + block_size_y=dy) + + mesh2d_input = mk.MeshKernel() + mesh2d_input.curvilinear_compute_rectangular_grid(params) + mesh2d_input.curvilinear_convert_to_mesh2d() #convert to ugrid/mesh2d + mesh2d_input = mesh2d_input.mesh2d_get() + # Process self._process(mesh2d_input) diff --git a/tests/dflowfm/test_net.py b/tests/dflowfm/test_net.py index b05ab1141..9801123fd 100644 --- a/tests/dflowfm/test_net.py +++ b/tests/dflowfm/test_net.py @@ -177,6 +177,7 @@ def test_create_2d(): @pytest.mark.parametrize( "deletemeshoption,inside,nnodes,nedgenodes", [ + #TODO: update expected values for nnodes/nedgenodes (DeleteMeshOption.INSIDE_NOT_INTERSECTED, False, 28, 90), (DeleteMeshOption.INSIDE_AND_INTERSECTED, False, 23, 72), (DeleteMeshOption.INSIDE_NOT_INTERSECTED, True, 23, 72),