Tutorial 3: 2D flow model over sloped terrain with multiple rasters
In this tutorial, we will build a basic 2D flow model in mountainous terrain using 3Di. We will edit an existing sqlite, and this tutorial will introduce friction and infiltration rasters. These rasters have been highly simplified for the purpose of this tutorial. As with any other component of the tutorials, the data and outcomes cannot be used to draw conclusions of the real-world location that was the inspiration for this tutorial. At the end of this tutorial, you will have a basic working model that you can run on the 3Di live site.
The selected area is that of Lake Mead in the USA. The lake is enclosed between the mountains of Nevada, Utah, and Arizona. The area contains strong elevation differences and steep slopes, which changes the hydrodynamics. Specifically, the standard assumption that the variation in water level is much smaller than the variation in bed level does not hold in this terrain. Therefore, different settings are required, which will be explored in this tutorial.
You will learn the following skills in this tutorial:
Edit an existing .sqlite from the model database.
Insight in the relevant settings for sloping terrain.
Couple a friction raster to your 3Di-model.
Couple an infiltration raster to your 3Di-model.
Before you start, please make sure to:
Install the 3Di Modeller Interface. Please see Installation manual for instructions.
Install the 3Di toolbox in the Modeller Interface. Please see Plugin Installation for instructions.
Gain access to the 3Di web portal. Please see the Login to the Live Site for instructions.
Download the starter pack for this tutorial, which includes a partially completed .sqlite-database and rasters (DEM, friction, infiltration, infiltration capacity) for Lake Mead here.
Model initialisation
Model preparation
Unpack the starter package and save the contents into a folder. You should have a partially configured .sqlite, and a folder named “raster”. The raster folder contains a DEM, a friction map, an infiltration map, and an infiltration capacity map. The partially configured .sqlite already has all the mandatory settings.

Loading the model in the 3Di Modeller Interface
Our model must be imported in the 3Di Modeller Interface to view and modify its contents. The model can be loaded via the 3Di toolbar (part of the 3Di toolbox plug in) by following these steps:
Open the 3Di Modeller Interface.
Create a new project.
In the figure below; Select the select 3Di results button on the 3Di Toolbar (white database icon). [1]
Select load in the model section, and select the Lake_Mead.sqlite database provided with this tutorial. The load button may not be visible on all screens and zoom settings. It can help to enlarge the pop-up window. [2]
You should now see the 3Di model as part of your Modeller Interface layers. [3]

Now load the rasters into Modeller Interface to view your data.
Set the project coordinate system to EPSG:32612 (UTM zone 12N) in the bottom right of your window. If you are asked to choose a conversion, select a conversion that is valid for Utah, USA. [1]
Add the add the DEM via Layer > Add layer > Add raster layer. Now select Mead_DEM.tif from the “raster” folder. [2]
Repeat the previous step to add the friction raster named Mead_friction.tif, the infiltration raster named Mead_infiltration.tif, and the infiltration capacity raster Mead_infiltration_capacity.tif.
You can also do this by dragging the .tif files from their folder into the Modeller Interface screen.

Fig. 37 Empty LP_burrows.sqlite and DEM loaded into the 3Di Modeller Interface and projected on a google satellite background map.
Model building
Set the model name
As a first step, let us set the name for the model. This is contained in the global settings table. Rename the model via the following steps
Right-click the v2_global_settings table. [1]
Select Open attribute table. [2]

Select Switch to form view in the bottom right corner. [1]
Select Toggle editing mode in the top left corner. [2]
Set the name to “Tutorial_2D_slope”. [3]

This name will be displayed in the 3Di Live Site, once you start a simulation. Keep the global settings open on editing mode for the next step.
Add rasters to the model
This tutorial includes four rasters: the digital elevation model (DEM), the friction raster, and the infiltration rasters.
The DEM is mandatory for every model. The friction and infiltration rasters are among the most commonly used data sets for 3Di models. The friction raster controls the bottom resistance of the bottom to the flow. The infiltration raster controls the infiltration rate of surface water into the soil. Finally, the infiltration capacity raster sets the capacity of the soil to store water.
The DEM and the friction raster must be added through the global settings, contained in the v2_global_settings table. Continue to modify this table.
Select the tab Terrain information. [1]
Add the DEM file by adding “raster/Mead_DEM.tif” to the field “dem_file”. The part “raster/” is a relative path with respect to the .sqlite. It denotes that the DEM is stored in the raster folder. [2]
Set the epsg_code to “32612”. [3]
Add the friction file by adding “raster/Mead_friction.tif” to the field “frict_coef_file”. [4]
Set the frict_coef to 0. This global value will not be used in the model, as we have defined a spatially varying friction raster for the full domain. [5]
The coefficients in the friction raster are Manning coefficients. Check that this matches the field “frict_type”. [6]
Unselect Toggle editing mode in the top left corner (see [2] in the image above), and save changes. You can now close the pop-up window.

The infiltration raster and infiltration capacity raster control the spatially varying infiltration rate in mm/day and the maximum infiltration capacity in mm respectively for each grid cell. They are added to the model via the infiltration settings, which are contained in the v2_simple_infiltration table.
Right-click the v2_simple_infiltration table. [1]
Select Open attribute table.
Select Switch to form view. [2]
Select Toggle editing mode. [3]
Add the infiltration raster by adding “raster/Mead_infiltration.tif” to the field “infiltration_rate_file”. [4]
Add the infiltration capacity raster by adding “raster/Mead_infiltration_capacity.tif” to the field “max_infiltration_capacity_file”. [5]
Set the infiltration rate to 0. This global infiltration rate is overwritten by the spatially varying infiltration raster. [6]
Unselect Toggle editing mode, and save changes. You can now close the pop-up window.

You now have a model with a spatially varying elevation, friction, and infiltration, but the model settings are representative for flat areas.
Modify the settings for mountain environments
3Di must be configured differently for areas with steep slopes than for flat areas,
due to the strong variations in water level that may occur within a grid cell (see Limiters for a technical description).
We will modify the settings file, which was created for a flat area, such that it can be applied to sloping areas instead.
Here we will only discuss the settings that must be changed.
A full overview of all settings can be found at the database overview
First, we will set the numerical settings. Modify the numerical settings via the v2_numerical_settings table.
Right-click the v2_numerical_settings table.
Select Open attribute table.
Select Switch to form view. [1]
Select Toggle editing mode. [2]
Select the tab “Limiters”. [3]
Set the limiter values as in the table below. [4]
Setting |
Value |
Comments |
---|---|---|
limiter_grad_1d |
1 |
|
limiter_grad_2d |
0 |
|
limiter_slope_crossectional_area_2d |
3 |
For sloped areas |
limiter_slope_friction_2d |
1 |
For sloped areas |

Select the tab “Thresholds”
Set the thin_water_layer_definition to 0.3. This value is in meters.
Select the tab “Miscellaneous”
Set the frict_shallow_water_correction to 3.
Second, we will change how infiltration is computed in the model. In flat areas, infiltration is typically computed in the wet subgrid cells only. This method does not work in mountainous terrain, where the elevation differences within a cell are large. Therefore, the infiltration will be computed over the whole surface. This is implemented through the “infiltration_surface_option”. Documentation on the infiltration settings can be found at Infiltration.
Right-click the v2_simple_infiltration table.
Select Open attribute table.
Select Switch to form view. [1]
Select Toggle editing mode. [2]
Set the infiltration_surface_option to 1. [3]

Complete the location-specific settings
Lake Made is a large lake with an area of 640 km2 at maximum capacity. This leads to an extensive model domain of approximately 90 by 110 km. The grid and the output settings are adjusted to account for the large model domain. The initial water level will also be modified to match the elevation of the lake.
First, we will set the grid cell size and the table step size to improve the calculation speed of the model. The grid cell size will be set to 400 m in accordance with the large domain. The table step size controls at which vertical resolution properties (other than elevation) are translated from the subgrid domain to the computational domain. A table step size of 10 m is selected for this model. This is very coarse for a typical 3Di model, but it is justified here due to the large elevation differences at the subgrid level. Both properties are part of the global settings.
Right-click the v2_global_settings table.
Select Open attribute table.
Select Switch to form view. [1]
Select Toggle editing mode. [2]
Select the tab “Grid”. [3]
Set the grid_space to 400. This value is in meters. [4]
Set the table_step_size to 10. This value is in meters. [5]
Keep the global settings table open.

According to our elevation map, Lake Mead is located at around 340m above sea level. The deepest point of Lake Mead has a depth of 160 m at full capacity. Therefore, we set the initial water level at 500m.
Select the tab “Terrain Information”.
Set the initial_waterlevel to 500. This value is in meters.
Keep the global settings table open
The discharge of precipitation into Lake Mead takes a long time due to the large model domain. The number of time steps and the time between model outputs is increased to reflect the slow time scale. More time steps and a larger output time step are selected to account for the slower drainage.
Select the tab “Time”.
Set the nr_timesteps to 1440. This amounts to a model duration of 12 h, as the time step is 30 s.
Set the output_time_step to 900. This value is in seconds.
Save you changes.
The aggregation time step is also set to 900 s. This has already been set correctly in your .sqlite.
With the completion of the location-specific settings, we have built a basic working 2D flow model for mountainous terrain.
Model validation
A short description of the model validation is given here. A comprehensive guide with visual support is provided in Tutorial 1 (Post-processing) and for a general guide see Checking the model schematisation.
Verify the model rasters using the raster checker
Before sending our model to the web portal, it is important to validate that our model contains no errors. The raster checker is part of the 3Di toolbox and performs 18 checks to verify the quality of the DEM. The raster checker checks all the rasters that are included in the model. These are the DEM, the friction raster, the infiltration raster and the infiltration capacity raster. In order to use the raster checker, follow these steps:
Select the commands for working with 3Di models button. On the right of your screen, a tab “3Di” will open. [1]
Expand the “Step 1 – Check data” line and click on the raster checker. [2]
In the pop-up screen, select ‘spatialite: Lake_Mead’ and click OK. [3]

The following screen will appear:

Verify the model schematisation using the schematisation checker
The second validation that we have to perform before sending the model to the web portal is that of the model schematisation. For this, we use the schematisation checker. It checks the model tables for many possible errors that cause the model to crash when you want to compile the model. In order to check your model schematisation, follow steps a and b from the previous step, but now select schematisation checker. Again, select ‘spatialite:Lake_Mead’ and select the destination for the output file. Select Run.
The output file is an excel file in which all the warnings and errors that were found are listed. You may get the error “Value in v2_aggregation_settings.aggregation_in_space should be of the type integer”. This is a known error in the schematisation checker, which will be removed in a future update. If you get this error, you can ignore it.
If you do not get any further warnings or errors, your model is successfully validated and is ready to upload to the web portal.
Model activation
A short description of the model activation is given here. A comprehensive guidance with visual support is provided in Tutorial 2 (model_activation).
Upload your model
See Uploading the Schematisation for how to upload your model.
The model is now also available on the 3Di Livesite and the management screens.
Run your model
You have now build a 2D flow model for mountainous terrain from scratch! You can now run your model via the 3Di Live Site (Login to the Live Site) or via the 3Di Modeller Interface (Using the Modeller Interface). It will be available under the name you gave it.

Fig. 38 The final model on the 3Di live site. The initial water level can be seen in dark blue through the grid.