Skip to content

Initial Conditions

Saved state💡

Provide the initial conditions of the simulation via a saved-state.

POST /simulations/{simulation_pk}/initial/saved_state/

Parameter Type Description
saved_state string id of the saved state

To see the available saved-states of the threedimodel, see saved-states. The id of the saved-state should refer to a previously created saved-state with either the stable-threshold or timed event.

1D Predefined Water Level💡

Start the simulation with predefined 1D water levels.

POST /simulations/{simulation_pk}/initial/1d_water_level/predefined/

Use the initial 1D water levels as defined in your sqlite model database, more precisely, the initial_waterlevel column of the v2_connection_nodes table.

No input data

This resource does not accept any input data. Just pass it an empty json body {}

from threedi_api_client.api import ThreediApi
from threedi_api_client.versions import V3Api

with ThreediApi() as api_client:
    api_client: V3Api
    api_client.simulations_initial1d_water_level_predefined_create(
        <simulation_id>, data={}
    )

2D Water Level Raster💡

Start the simulation with initial water levels for the 2D domain.

POST /simulations/{simulation_pk}/initial/2d_water_level/raster/

The water levels are derived from the initial_waterlevel_file raster by using the given aggregation method. The resulting levels are applied to the predefined nodes subset "2D_OPEN_WATER" as described in the threedigrid documentation.

Parameter Type Description
initial_waterlevel string ID of the initial_waterlevel_file raster of the threedimodel the simulation has been created with.
aggregation_method string Either mean, max or min.

from threedi_api_client.api import ThreediApi
from threedi_api_client.versions import V3Api
from threedi_api_client.openapi.models import TwoDWaterRaster

with ThreediApi() as api_client:
    api_client: V3Api

    data = TwoDWaterRaster(
        simulation=<simulation id>,
        initial_waterlevel=<raster id>,
        aggregation_method=<min, max or mean>
    )

    # Apply initial water level raster
    api_client.simulations_initial2d_water_level_raster_create(
        simulation_pk=<sim_id>, data
    )