Download Software header

Creating a simple Delft3D FM model

Creating a simple Delft3D FM model

These are the steps to create a simple Delft3D FM model using DeltaShell (the Graphical User Interface) 2023.02.


Add a New Model to the Project:


Select a Flow Flexible Mesh Model:


Open the grid editor: 


Create a rectangular grid 1000 m long, 300 m wide of square cells of 10x10 m with the origin at (0,0):


Convert the grid to unstructured format:


Save the project and exit the grid editor.


Add 2 open boundaries to the west (upstream) and east (downstream):


Inspect the General settings and leave the default values. This implies:

  • Modelling 1 day.
  • Bed level = -5 m AD.
  • Initial water level = 0 m AD.
  • Friction considering Manning with roughness height = 0.023 s/m^(1/3)


Add discharge upstream boundary condition:


Set a constant discharge equal to 1500 m^3/s spaning the whole simulation time:


Add a water level downstream boundary condition. Activate both support points and set a constant value equal to 0 m AD for the whole simulation period:


You can run the model and explore the results in the GUI:



 

Running file-based

For modifying as running several simulations, it is useful to run file-based. To this end, export the model as DIMR in an empty folder:

Give a name (e.g., <dimr_config.xml>) to the DIMR configuration file. 

In the folder you have selected you will the DIMR configuration file and a folder <dflowfm> with the input. All the input can be explored and modified with a text editor, except for the grid, which is in NetCDF format. 


Create a batch file (in Windows) at the same level as the DIMR configuration file to run the model file-based. The batch file should contain one single line calling the kernel. If you have not changed the default installation path and the DIMR configuration file is called <dimr_config.xml> batch file should contain this line:

call "c:\Program Files\Deltares\Delft3D FM Suite 2023.02 HM\plugins\DeltaShell.Dimr\kernels\x64\dimr\scripts\run_dimr.bat"

Modify the path that points to <run_dimr.bat> in case you have changed the installation folder.

Pass as argument to <run_dimr.bat> (i.e., add after it) the name of the DIMR configuration file if you have named it other than <dimr_config.xml>. 


Run the model by executing (clicking) on the batch file. Output is written directly in folder <dflowfm/output> and can be explored while the simulation is running.


Explore the output using QuickPlot. Load the map-file and try to make a longitudinal section. Use the grid view.



 

Create a sloping bed

The bed level in the previous run was constant. Here we input a sloping bed level. 

Create an xyz-file with bed level and initial water level. We will triangulate the given points to the grid. We want to provide as x and y coordinates the grid points for maximum control (i.e., the value we provide will be the value at the grid point). In Matlab the script could be (there are more efficient ways, but this is the clearest):

%% input

h=5; %initial flow depth everywhere [m]
x0=0; %x origin [m]
y0=0; %y origin [m]
dx=10; %space step in x direction [m]
dy=10; %space step in y direction [m]
L=1000; %domain length [m]
B=300; %width [m]
slope=1e-4; %slope [-]

%% calculation

etab0=-h; %bed level at downstream end [m AD]
x_v=x0:dx:L;
y_v=y0:dy:B;

nx=numel(x_v);
ny=numel(y_v);
nc=nx*ny;
xyz_etab=NaN(nc,3);

kc=0;
for kx=1:nx
    for ky=1:ny
        kc=kc+1;
        xyz_etab(kc,1)=x_v(kx);
        xyz_etab(kc,2)=y_v(ky);
        xyz_etab(kc,3)=etab0+(L-x_v(kx))*slope;
    end
end

xyz_etaw=xyz_etab+[zeros(nc,1),zeros(nc,1),ones(nc,1).*h];

%% write

writematrix(xyz_etab,'etab.xyz','delimiter',' ','FileType','text')
writematrix(xyz_etaw,'etaw.xyz','delimiter',' ','FileType','text')

 

Two file are created:

  • <etab.xyz> containing the bed level 
  • <etaw.xyz> containing the initial water level

Create an input file referring to these file and name it e.g. <ini.ini>:

[General]
fileVersion = 2.00
fileType = iniField

[Initial]
quantity = bedlevel
dataFile = etab.xyz
dataFileType = sample
interpolationMethod = triangulation

[Initial]
quantity = waterlevel
dataFile = etaw.xyz
dataFileType = sample
interpolationMethod = triangulation

Save the initial-condition file and the bed-level and water-level files at the same level as the mdu-file. 


Refer to the initial-condition file in the mdu-file by adding the following line under the [geometry] block:

IniFieldFile                      = ini.ini


 

Files

The DeltaShell project as well as two simulations with constant and sloping bed level can be accessed in the repository. See how to access the repository here

ncr_footer