Versions Compared

Key

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

...

The Delft-FEWS DIMR-adapter requires a fixed folder structure:

dimr_binsub-folder with binaries for the DIMR-software.
dimr_modelsub-folder with DIMR-files that describe the SOBEK3 model.
fews-dimr-adapter-binsub-folder with binaries for the fews adapter that communicates with the DIMR.
Inputsub-folder with input files requried to run the model.
Logssub-folder for the log-files that are created during the model run.

 


Follow the steps below to set-up a DIMR model folder in your Delft-FEWS system. Step 1 can be skipped when updating an existing model.

...

Info
titleStep 4: download the contents of the fews-dimr-adapter-bin folder

The DIMR and Delft-FEWS are communicating through the fews adapter. This adapter is part of Delft-FEWS and must be downloaded from the builddpcbuild.deltares.nl:

  • httphttps://builddpcbuild.deltares.nl/project.html/FewsDevelopment?projectId=FewsDevelopment&tab=projectOverviewprojectTab=overview
  • Be sure the get the adapter from the environment corresponding to your FEWS version (click on to view other version)
  • Select the latest stable version (or the Delft-FEWS development version): FEWS – Development > install adapters > artifacts > fews-dimr-adapter-bin.XXXXX.zip.
  • Put all these unzipped files in the folder fews-dimr-adapter-bin

...

Code Block
languagexml
titlePI-run.xml
<?xml version="1.0" encoding="UTF-8"?>
<Run xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews/PI" xsi:schemaLocation="http://www.wldelft.nl/fews/PI http://fews.wldelft.nl/schemas/version1.0/pi-schemas/pi_run.xsd" version="1.5">
    <timeZone>0.0</timeZone>
    <startDateTime date="2017-03-26" time="06:00:00"/>
    <endDateTime date="2017-03-29" time="06:00:00"/>
    <time0 date="2017-03-26" time="06:00:00"/>
    <workDir>X:\XXX\DimrPreAdapterTest\piRunFile1d2dRTC\dimr_model</workDir>
    <inputTimeSeriesFile>X:\XXX\piRunFile1d2dRTC\Input\export_pi_flow1d.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>X:\XXX\piRunFile1d2dRTC\Input\export_pi_fm.xml</inputTimeSeriesFile>
    <inputTimeSeriesFile>X:\XXX\piRunFile1d2dRTC\Input\export_pi_fbc.xml</inputTimeSeriesFile>
    <outputDiagnosticFile>notUsed.xml</outputDiagnosticFile>
    <properties>
		<!-- Reference to dimr configuration file, relative to parent directory of the/this pi-run.xml file -->
		<!-- This file will be read to see which components of the dimr are used and find references to .md1d, .mdu, flow1d2d.ini and/or fbc runtime config -->
        <string key="dimrConfigFile" value="../dimr_config.xml"/>
        <!-- Specify which of the above time series xml files is meant for flow1d --> 
        <string key="piFileForFlow1d" value="inputTimeSeriesFile-1"/>
        <!-- Overwrite RstInterval value in the .mdu file with this property --> 
        <string key="restartIntervalForFm" value="600"/>
        <!-- Specify which of the above time series xml files is meant for FM --> 
        <string key="piFileForFm" value="inputTimeSeriesFile-2"/>
        <!-- Specify which of the above time series xml files is meant for FBC (rtc1) --> 
        <string key="piFileForFbc" value="inputTimeSeriesFile-3"/>
        <!-- Will write the pi time series values for fbc as binary in timeseries_import.bin-->
        <string key="piTimeSeriesAsBin" value="true"/>
		<!-- Will convert the specified boundary  </properties>
</Run>

The dimr configuration file will be read to find the components that are being used so it knows which files need to be changed.

NetCDF file to ASCII write the pi time series values for fbc as binary in timeseries_import.bin-->
		<string key="dWaveNetcdfBoundaryFileToConvert" value="input/boundary.nc"/>
		<!-- Optional settings for conversion of boundary file to ASCII, values shown here are default-->
        <string key="dWaveBoundaryFilePrefix" value="WW3_"/>
		<string key="dWaveBoundaryFileNumberOfCopies" value="3"/>


    </properties>
</Run>


Important: the adapter doesn't support timezones. Therefore, the timezone in the General Adapter should be set at +00:00 and the timezones in the model too. This means for example for D-Flow FM that in the mdu file the Tzone property is set to 0.

Important: if the exported timeseries from the GA are exceeding the T0 (like in case of RR is often the case with daily evaporation timeseries), use the <ignoreRunPeriod> option in the export timeseries activity to ignore the timeseries that exceed the T0. This ensures that the modelstate is imported into FEWS on the proper time (in most cases T0) instead of the last timestamp. See also 05 General Adapter Module - DELFT-FEWS Documentation - Deltares Public Wiki

The dimr configuration file will be read to find the components that are being used so it knows which files need to be changed.

Code Block
languagexml
titledimr_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<dimrConfig xsi:schemaLocation="http://schemas.deltares.nl/dimr http://content.oss.deltares.nl/schemas/dimr-1.0.xsd" xmlns="http://schemas.deltares.nl/dimr" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <documentation>
    <fileVersion>1.00</fileVersion>
    <createdBy>Deltares, Coupling Team</createdBy>
    <creationDate>2018-07-07T14:49:48.9157275Z</creationDate>
  <control>
    <parallel>
      <startGroup>
        <time>1 60 2678500</time>
        <coupler name="1d2d_to_rtc"/>
        <start name="real-time control"/>
        <coupler name="rtc_to_1d2d"/>
      </startGroup>
      <start name="1d2d"/>
    </parallel>
  </control>
  <component name="real-time control">
    <library>FBCTools_BMI</library>
    <workingDir>rtc</workingDir>
    <inputFile>.</inputFile>
  </component>
  <component name="1d2d">
    <library>flow1d2d</library>
    <workingDir>1d2dcoupler</workingDir>
    <inputFile>1d2d.ini</inputFile>
  </component>
  <coupler name="rtc_to_1d2d">
    <sourceComponent>real-time control</sourceComponent>
    <targetComponent>1d2d<
Code Block
languagexml
titledimr_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<dimrConfig xsi:schemaLocation="http://schemas.deltares.nl/dimr http://content.oss.deltares.nl/schemas/dimr-1.0.xsd" xmlns="http://schemas.deltares.nl/dimr" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <documentation>
    <fileVersion>1.00</fileVersion>
    <createdBy>Deltares, Coupling Team</createdBy>
    <creationDate>2018-07-07T14:49:48.9157275Z</creationDate>
  <control>
    <parallel>
      <startGroup>
        <time>1 60 2678500</time>
        <coupler name="1d2d_to_rtc"/>
        <start name="real-time control"/>
        <coupler name="rtc_to_1d2d"/>
      </startGroup>
      <start name="1d2d"/>
    </parallel>
  </control>
  <component name="real-time control">
    <library>FBCTools_BMI</library>
    <workingDir>rtc</workingDir>
    <inputFile>.</inputFile>
  </component>
  <component name="1d2d">
    <library>flow1d2d</library>
    <workingDir>1d2dcoupler</workingDir>
    <inputFile>1d2d.ini</inputFile>
  </component>
  <coupler name="rtc_to_1d2d">
    <sourceComponent>real-time control</sourceComponent>
    <targetComponent>1d2d</targetComponent>
    <item>
      <sourceName>output_Langel_zu_Crest level (s)</sourceName>
      <targetName>water flow 1d/weirs/Langel_zu/structure_crest_level</targetName>
    </item>
    <item>
      <sourceName>output_02_Wehr_Duis~~1_Crest level (s)</sourceName>
      <targetName>water flow 1d/weirs/02_Wehr_Duis~~1/structure_crest_level</targetName>
    </item>
  </coupler>
  <coupler name="1d2d_to_rtc">
    <sourceComponent>1d2d</sourceComponent>
    <targetComponent>real-time control</targetComponent>
    <item>
      <sourceName>water flow 1d/observations/P<sourceName>output_Langel/water_level<_zu_Crest level (s)</sourceName>
      <targetName>input_P_Langel_Water level (op)<<targetName>water flow 1d/weirs/Langel_zu/structure_crest_level</targetName>
    </item>
    <item>
      <sourceName>water flow 1d/observations/RuhrOWDuisburg/water_level</sourceName>
<sourceName>output_02_Wehr_Duis~~1_Crest level (s)</sourceName>
      <targetName>water  <targetName>input_RuhrOWDuisburg_Water level (op)<flow 1d/weirs/02_Wehr_Duis~~1/structure_crest_level</targetName>
    </item>
  </coupler>
</dimrConfig>


Also when the <time> element is present within <control> <parallel> <startGroup> its contents will be replaced with the appropriate values.

 

FBC component

Will be used if library "FBCTools_BMI" is configured as component within the dimr config file

Code Block
languagexml
titleFBC component
  <component name="real-time control  <coupler name="1d2d_to_rtc">
    <library>FBCTools_BMI<<sourceComponent>1d2d</library>sourceComponent>
    <targetComponent>real-time <workingDir>rtc<control</workingDir>targetComponent>
    <!-- Look hardcoded for  rtcRuntimeConfig.xml -->
    <inputFile>.</inputFile>
  </component>

It will look for the hardcoded file name rtcRuntimeConfig.xml in working directory relative to the parent dir of dimr config file.

It will replace start date and end date in rtcRuntimeConfig.xml with the appropriate values.

It will look for the hardcoded file name timeseries_import.xml in the working dir and insert all timeseries from the time series file configured by "piFileForFbc" (or the first time series xml if there is only 1) by matching headers.

...

<item>
      <sourceName>water flow 1d/observations/P_Langel/water_level</sourceName>
      <targetName>input_P_Langel_Water level (op)</targetName>
    </item>
    <item>
      <sourceName>water flow 1d/observations/RuhrOWDuisburg/water_level</sourceName>
      <targetName>input_RuhrOWDuisburg_Water level (op)</targetName>
    </item>
  </coupler>
</dimrConfig>


Also when the <time> element is present within <control> <parallel> <startGroup> its contents will be replaced with the appropriate values.


FBC component

Will be used if library "dflowfmFBCTools_BMI" is configured as configured as component within the dimr config file

Code Block
languagexml
titleDFlowFM FBC component
  <component name="dflowFMreal-time control">
    <library>dflowfm<<library>FBCTools_BMI</library>
    <workingDir>fm<<workingDir>rtc</workingDir>
     <inputFile>mackay.mdu<<!-- Look hardcoded for  rtcRuntimeConfig.xml -->
    <inputFile>.</inputFile>
  </component>

It will look for the .mdu file hardcoded file name rtcRuntimeConfig.xml in working directory relative to the parent dir of dimr config file.

It will read "ExtForceFileNew" value.

Code Block
titleFind .ext file
[external forcing]
ExtForceFile      =
ExtForceFileNew   = FlowFM_bnd.ext

It will look for .ext file relative to .mdu file parent directory and extract all "forcingfile" properties from it.

Code Block
titleFind .bc files
[boundary]
quantity       = waterlevelbnd
locationfile   = mackay_bnd.pli
forcingfile    = mackay_bnd.bc

[boundary]
quantity       = rainfall
locationfile   = mackay_ugrid_wgs84_net.nc
forcingfile    = ..\input\mackay_rain.bc

Insert all timeseries from "piFileForFm" (or the first time series xml if there is only 1)  into all .bc files (relative to .ext file parent dir) by matching headers.

In the .mdu file itself it will replace Tstart, Tstop and RstInterval with the appropriate values.

RstInterval can be overwritten by a property in the run info file called "restartIntervalForFm"

 

DFlow1D component

Will be used if library "cf_dll" is configured as component within the dimr config file

Code Block
languagexml
titleFlow1D component
  <component name="Hydrodynamics">
    <library>cf_dll</library>
    <workingDir>dflow1d</workingDir>
    <inputFile>Hydrodynamics.md1d</inputFile>
  </component>

It will look for the .md1d file in working directory relative to the parent dir of dimr config file.

It will replace StartTime and StopTime with the appropriate values.

It will look for "boundCondFile" to find .bc file (relative to .md1d file parent dir) and insert all timeseries from "piFileForFlow1d" (or the first time series xml if there is only 1) by matching headers.

 

Flow1D2D component

Will be used if library "flow1d2d" is configured

Code Block
languagexml
titleFlow1D2D component
  <component name="1d2d">
    <library>flow1d2d</library>
    <workingDir>1d2dcoupler</workingDir>
    <!-- Will be read to find references to .md1d and. mdu file-->
    <inputFile>1d2d.ini</inputFile>
  </component>

It will look for the .ini file in working directory relative to the parent dir of dimr config file.

 

Code Block
title1D2D ini
[Model]
    type                  = Flow1D              
    name                  = water flow 1d       
    directory             = ..\dflow1d          
    modelDefinitionFile   = water flow 1d.md1d  

[Model]
    type                  = FlowFM              
    name                  = FlowFM              
    directory             = ..\dflowfm          
    modelDefinitionFile   = FlowFM.mdu

It will extract .md1d file (with directory and model definition file relative to parent dir of the .ini file) by looking for model = Flow1D

It will extract .mdu file (with directory and model definition file relative to parent dir of the .ini file) by looking for model = FlowFM

replace start date and end date in rtcRuntimeConfig.xml with the appropriate values.

It will look for the hardcoded file name timeseries_import.xml in the working dir and insert all timeseries from the time series file configured by "piFileForFbc" (or the first time series xml if there is only 1) by matching headers.

DFlowFM component

Will be used if library "dflowfm" is configured as component within the dimr config file

Code Block
languagexml
titleDFlowFM component
  <component name="dflowFM">
    <library>dflowfm</library>
    <workingDir>fm</workingDir>
    <inputFile>mackay.mdu</inputFile>
  </component>

It will look for the .mdu file in working directory relative to the parent dir of dimr config file.

It will read "ExtForceFileNew" value and "ExtForceFile" specifically for wind forcing.

Code Block
titleFind .ext file
[external forcing]
ExtForceFile      =
ExtForceFileNew   = FlowFM_bnd.ext

It will look for .ext file relative to .mdu file parent directory and extract all "forcingfile" properties from it.

Code Block
titleFind .bc files
[boundary]
quantity       = waterlevelbnd
locationfile   = mackay_bnd.pli
forcingfile    = mackay_bnd.bc

[boundary]
quantity       = rainfall
locationfile   = mackay_ugrid_wgs84_net.nc
forcingfile    = ..\input\mackay_rain.bc



[lateral]
Id             = MA_2.20_R_Beek_Berwinne
Type           = discharge
locationType   = 2d
numCoordinates = 1
xCoordinates   = 175903.0000
yCoordinates   = 307314.0000
discharge      = Maas_D4118_lat.bc

Insert all timeseries from "piFileForFm" (or the first time series xml if there is only 1)  into all .bc files (relative to .ext file parent dir) by matching headers. 

Since 2020.02, it also parses the [lateral] section in the .mdu file, uses the value of the Type property to find the .bc file (in the above case the value of Type is discharge, and discharge points to the Maas_D4118_lat.bc file). The times series with locationIds which match the Id property are inserted in the identified .bc file.

Other parameters like wind, precipitation and atmospheric pressure can be supplied by FEWS only for 2D using a netcdf export directly to the file-location the model expects the nc-file to be. In the model you can use the old-style ext format file (in mdu keyword ExtForceFile) to use these netcdf-files. How to do this can be found in the D-Flow FM manual.

Since 2022.02 there is support for windxy tim files. Only 1 timeseries for windspeed and 1 for winddirection are supported in the pi xml file. The adapter looks at the parameterIds "Windspeed" and "Winddirection" and replaces the whole tim file with the values from these timeseries including new timesteps referenced to the refdate in the mdu file. It is advised to set METHOD=7 in the .ext file for wind timeseries.

In the .mdu file itself it will replace Tstart, Tstop and RstInterval with the appropriate values.

RstInterval can be overwritten by a property in the run info file called "restartIntervalForFm"


rr_dll component

Will be used if library "rr_dll" is configured as component within the dimr config file:

Code Block
languagexml
titleDFlowFM component
  <component name="DRR">
    <library>rr_dll</library>
    <workingDir>rr</workingDir>
    <inputFile>Sobek_3b.fnm</inputFile>
  </component>

It will look in the working dir for DELFT_3B.INI and will update the StartTime and EndTime variables of the [TimeSettings] section according to the start and end time from the run info file. Thus, the content would look like the following extracted example:

Code Block
languagexml
titleDFlowFM component
[TimeSettings]
EvaporationFromHrs=7
EvaporationToHrs=19
PeriodFromEvent=0
TimestepSize=900
StartTime='2021/05/06;11:00:00'
EndTime='2021/05/09;00:00:00'
 

Precipitation, evapotranspiration and temperature can be supplied using netcdf-files exported from FEWS with the proper IDs related to the catchmentname/weatherstation in the model. In order to use the netcdf-file data in the model, you have to change both the DELFT_3B.ini and the sobek_3b.fnm files. See code snippets below.

Code Block
titleDELFT_3B.ini (add at end of \[Options\] block)
GenerateNetCdfOutput = -1
GenerateHisOutput = 0
MeteoNetCdfInput = -1
PrecipitationNetCdfSeriesId = RAINFALL  (note: you need to reference the netcdf variable id here that holds the precipitation data)
EvaporationNetCdfSeriesId = E
TemperatureNetCdfSeriesId = RAINFALL


Code Block
titlesobek_3b.fnm (add to end of line)
'Precipitation_RR.nc'             *125. Optional meteo NetCdf timeseries inputfile rainfall
'Evaporation_RR.nc'               *126. Optional meteo NetCdf timeseries inputfile evaporation
'Precipitation_RR.nc'               *127. Optional meteo NetCdf timeseries inputfile temperature (only for RR-HBV)

Important: notice that the above snippet starts at number 125. You need the lines till 125 in the sobek_3b.fnm file for it to work. If you are missing the lines for numbers 121 till 124, see the snippet below to add them. Another very important step after adding the lines is to make an empty file in the rr model directory called CacheFile.txt. If this file doesn't exists, this could lead the model to use infinity precipitation values!

Code Block
'wqrtc.his'                               *121. coupling WQ salt RTC
'BoundaryConditions.bc'                           *122. RR Boundary conditions file for SOBEK3
'ASCIIRestartOpenDA.txt'                          *123. Optional RR ASCII restart (test) for OpenDA
'CacheFile.txt'                   *124. Optional LGSI cachefile

DFlow1D component (Sobek 3)

Will be used if library "cf_dll" is configured as component within the dimr config file

Code Block
languagexml
titleFlow1D component
  <component name="Hydrodynamics">
    <library>cf_dll</library>
    <workingDir>dflow1d</workingDir>
    <inputFile>Hydrodynamics.md1d</inputFile>
  </component>

It will look for the .md1d file in working directory relative to the parent dir of dimr config file.

It will replace StartTime and StopTime with the appropriate values.

It will look for "boundCondFile" to find .bc file (relative to .md1d file parent dir) and insert all timeseries from "piFileForFlow1d" (or the first time series xml if there is only 1) by matching headers.


Flow1D2D component

Will be used if library "flow1d2d" is configured

Code Block
languagexml
titleFlow1D2D component
  <component name="1d2d">
    <library>flow1d2d</library>
    <workingDir>1d2dcoupler</workingDir>
    <!-- Will be read to find references to .md1d and. mdu file-->
    <inputFile>1d2d.ini</inputFile>
  </component>

It will look for the .ini file in working directory relative to the parent dir of dimr config file.


Code Block
title1D2D ini
[Model]
    type                  = Flow1D              
    name                  = water flow 1d       
    directory             = ..\dflow1d          
    modelDefinitionFile   = water flow 1d.md1d  

[Model]
    type                  = FlowFM              
    name                  = FlowFM              
    directory             = ..\dflowfm          
    modelDefinitionFile   = FlowFM.mdu

It will extract .md1d file (with directory and model definition file relative to parent dir of the .ini file) by looking for model = Flow1D

It will extract .mdu file (with directory and model definition file relative to parent dir of the .ini file) by looking for model = FlowFM

It will process the .md1d and .mdu file the same way as described in DFlow1D and DFlowFM component


D-Waves component

Will be used if library "wave" is configured

Code Block
languagexml
titleFlow1D2D component
  <component name="1d2d">
	<library>wave</library>
	<workingDir>wave</workingDir>
	<inputFile>stmartin.mdw</inputFile>
  </component>

It will look for the .mdw file in working directory relative to the parent dir of dimr config file.

At this point the DIMR adapter only performs a conversion of the boundary conditions NetCDF file to ASCII format. The relative path of the netCDF file to convert must be provided in the PI runinfo file using the dWaveNetcdfBoundaryFileToConvert property as shown in the example runinfo file above. Two additional properties are provided, to summarize:

  • dWaveNetcdfBoundaryFileToConvert = relative path of the boundary conditions netCdf file
  • dWaveBoundaryFilePrefix = prefix for the filenames of the output ASCII files, the default prefix is  "WW3_"
  • dWaveBoundaryFileNumberOfCopies = the number of file copies to provide for each boundary, the default number is 3


Installing and running the Delft3D-FM model on Windows and Linux

A Delft3D-FM model can be run on Windows and LINUX. Installation of the model binaries on Windows and Linux can be straight forward when simple models are run on single VM's. A typical Delft-FEWS configuration solution can be the following.

  • Create a ModuleDataSet "D3D_bin_Windows.zip" with the Windows binaries
  • Create a ModuleDataSet "D3D_bin_Linux.zip" with the Linux binaries
  • Create a ModuleDataSet "D3D_bin_adapter.zip" with the Delft3D Dimr Java Adapter
  • In your fss_windows_clientConfig.xml file add a line:  <autoExportModuleDataSet name="D3D_bin_Windows" exportDir="Modules"/>
  • In your fss_linux_clientConfig.xml file add a line: <autoExportModuleDataSet name="D3D_bin_Linux" exportDir="Modules"/>
  • In your Windows and Linux clientConfig.xml file add a line:  <autoExportModuleDataSet name="D3D_bin_adapter" exportDir="Modules"/>
  • In your Delft-FEWS General Adapter executeActivity element, start the Delft3D model with the following command  <executable>%REGION_HOME%/Modules/Delft3DFM/bin_delft3dfm/$D3D_MODEL_EXE$</executable>
  • In your fss_linux_global.properties add a line: D3D_MODEL_EXE=/bin/run_dimr.sh
  • In your fss_windows_global.properties add a line: D3D_MODEL_EXE=dimr\\scripts\\run_dimr.bat

When a Delft-FEWS FSS is started the clientConfig.xml file automatically unzips the correct Delft3D-FM binaries to your \Modules folder ( \Delft3DFM). When the Delft3D-FM model is started in a workflow from the General Adapter the correct script is started to run the DIMR.It will process the .md1d and .mdu file the same way as described in DFlow1D and DFlowFM component