Please note that for running DFlow-FM from Delft-FEWS only a pre-adapter is needed (a post-adapter is not needed).
D-Flow FM pre-adapter
Model pre-adapter for running D-Flow FM (D-Flow Flexible Mesh) model from Delft-FEWS.
For information about the D-Flow FM model see http://oss.deltares.nl/web/delft3d/d-flow-flexible-mesh
For the D-Flow FM user manual, D-Flow FM technical reference manual and other relevant manuals, see:
http://content.oss.deltares.nl/delft3d/manuals/D-Flow_FM_User_Manual.pdf
http://content.oss.deltares.nl/delft3d/manuals/D-Flow_FM_Technical_Reference.pdf
http://content.oss.deltares.nl/delft3d/manuals/
Usage: DFlowFMPreAdapter <netcdf run file pathname relative to current working directory>
Class name: nl.deltares.dflowfm.DFlowFMPreAdapter
Properties
model_id | (required) | Identifier of the model. This should be the first part of the .mdu file name. This is used to find the relevant .mdu file(s) and restart .nc file(s), as described below. |
---|---|---|
mdu_file | Deprecated. Do not use. | Pathname of the mdu file to update. This should be either an absolute path or a path relative to the workDir specified in the netcdf run file. |
input_grid_files_to_convert | (optional) Deprecated. The latest version of D-Flow FM can directly read grid NetCDF files that are exported from Delft-FEWS. This works for the parameters wind, pressure, rainfall, radiation, temperature and humidity. Therefore converting grid files is not needed anymore. | One or more pathnames of netcdf files with input grid data that should be converted. The pathnames should be separated by semi-colons (;). Each pathname should be either an absolute path or a path relative to the workDir specified in the netcdf run file. |
Notes for users
- For all files that are written by this adapter, if the file to be written already exists, then it will be overwritten.
- This program assumes that the model always runs in time zone GMT.
- This program writes log messages to a log file called dflowfm_pre_adapter_log.txt in the workDir specified in the netcdf run file.
D-Flow FM Pre-adapter activities
The pre-adapter uses the information in the specified netcdf run file as input for its actions.
Update MDU file(s)
In the found mdu file(s) the following entries will be updated automatically (no tags needed):
TStart | Start time of the model run, in units of Tunit relative to RefDate. |
---|---|
TStop | End time of the model run, in units of Tunit relative to RefDate. |
RestartFile | Either * pathname of the input state file relative to the MDU file if the input state file is not empty (warm state start) or * empty string if the input state file is an empty dummy file of 0 bytes length (cold state start) or * empty string if there is no input state file at all (cold state start). |
RestartDateTime | The restart time, this is set equal to the start time of the model run. |
RstInterval | Interval (in seconds) for writing *_rst.nc restart files. |
Notes for users
The mdu file(s) to update should be in the workDir specified in the netcdf run file. This program only supports:
a single mdu file with file name format <model_id>.mdu or
Valid example: gtsm.mdu(in case of domain decomposition) one mdu file for each partition with file name format <model_id>_<partition_number>.mdu
Valid example: gtsm_0000.mdugtsm_0001.mdugtsm_0002.mdu
The restart file: In case of a warm state start, there should be exactly one input state file (restart file) for each mdu file. This program only supports a single input state file with file name format
<model_id>_rst.nc , or
Valid example: gtsm_rst.nc<model_id>_<timestamp>_rst.nc
Valid example: gtsm_rst.ncgtsm_20160407_140000_rst.nc(in case of domain decomposition) one input state file for each partition with file name format
<model_id>_<partition_number>_rst.nc, or
Valid example: gtsm_0001_rst.nc<model_id>_<partition_number>_<timestamp>_rst.nc
Valid example: gtsm_0001_20160407_140000_rst.nc
Convert input grid time series (optional)
The netcdf file(s) specified in the property "input_grid_files_to_convert" will be converted to files in arcinfo/curvi format. Each netcdf file will be converted to a file with the same path and name as the netcdf file but with a different extension (.amu, .amv or .amp). If the property "input_grid_files_to_convert" is not specified, then this step does nothing.
Notes for users
Each netcdf file should contain only one variable with grid data. A netcdf file with multiple variables with grid data results in an error. The extension of the created file depends on the name of the variable in the netcdf file as follows:
netcdf variable name extension x_wind .amu y_wind .amv air_pressure .amp precipitation not supported by DFlowFM (for rainfall DFlowFM can use the netcdf file directly) any other name not supported by DFlowFM For example the original file input/x_wind.nc is converted to input/x_wind.amu
The format (meteo_on_equidistant_grid/meteo_on_curvilinear_grid) of each of the created files depends on whether there is an auxiliary grid file present for that file. To use an auxiliary grid file for a given netcdf file, it must have the same path and name as the netcdf file, but a different extension (.grd). If an auxiliary grid file is present, then the netcdf file will be converted to a curvi file of type meteo_on_curvilinear_grid that refers to the auxiliary grid file. Otherwise it will be converted to an arcinfo file of type meteo_on_equidistant_grid. For rectangular and curvilinear grids there must always be an auxiliary grid file present, otherwise an error is given. For regular grids no auxiliary grid file is needed.
grid type auxiliary grid (.grd) file needed type of created file regular no arcinfo file of type meteo_on_equidistant_grid rectangular yes curvi file of type meteo_on_curvilinear_grid curvilinear yes curvi file of type meteo_on_curvilinear_grid - The order of the grid cell values in the arcinfo/curvi grid file created by this adapter depend on the type of grid (regular/rectangular/curvilinear). For regular grids (arcinfo meteo_on_equidistant_grid file format or curvi meteo_on_curvilinear_grid file format) the grid cells are always ordered per row from left to right, starting with the upper row of the grid. For rectangular grids (curvi meteo_on_curvilinear_grid file format) the grid cells are always ordered per row from left to right, starting with the upper row of the grid. For curvilinear grids (curvi meteo_on_curvilinear_grid file format) the grid cells are always in the same order as in the netcdf file, which depends in turn on the order of the grid cells in the corresponding grid definition in Delft-FEWS (if the file was exported from Delft-FEWS). If an auxiliary grid (.grd) file is used, then the grid cell coordinates in the .grd file must be in the same order as the grid cell values in the corresponding curvi file. The easiest way to accomplish this is to run the adapter once, then check the order of the grid cell values in the created curvi file(s), then manually make sure that the grid cell coordinates in the corresponding .grd file(s) are in the right order.
The coordinate system for the coordinates in an arcinfo meteo_on_equidistant_grid file created by this adapter depends on the coordinate system used in the netcdf file, which depends in turn on the coordinate system (geodatum) in the corresponding grid definition in Delft-FEWS (if the file was exported from Delft-FEWS). Need to manually make sure that this is the same coordinate system as the coordinate system used by the model.
System requirements
- This program needs Java version 8 or higher.
- This program needs the following Java libraries:
- commons-httpclient-3.0.1.jar
- Delft_Util.jar (revision 60330)
- grib-8.0.jar
- log4j-1.2.14.jar
- netcdf-4.2.jar
- slf4j-api-1.5.6.jar
- slf4j-log4j12-1.5.6.jar
- TimeSeriesImport.jar (revision 60330)
Configuration example
Please note that for running DFlow-FM from Delft-FEWS only a pre-adapter is needed (a post-adapter is not needed).
Single domain D-Flow FM model
Example of a FEWS general adapter configuration that uses the DFlow-FM adapter.
<?xml version="1.0" encoding="UTF-8"?> <generalAdapterRun xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/generalAdapterRun.xsd"> <general> <rootDir>$REGION_HOME$\Modules\dflowfm</rootDir> <workDir>%ROOT_DIR%</workDir> <exportDir>%ROOT_DIR%\dflowfm_curacao\input</exportDir> <exportDataSetDir>$REGION_HOME$\Modules</exportDataSetDir> <exportIdMap>IdExport_DFlowFM</exportIdMap> <importDir>%ROOT_DIR%\dflowfm_curacao\output</importDir> <importIdMap>IdImport_DFlowFM</importIdMap> <dumpFileDir>$GA_DUMPFILEDIR$</dumpFileDir> <dumpDir>%ROOT_DIR%\dflowfm_curacao\dump</dumpDir> <diagnosticFile>%ROOT_DIR%\dummy.xml</diagnosticFile> <missVal>-999.</missVal> <!-- Take care this should be the timezone the computer is running in --> <timeZone> <timeZoneOffset>-04:00</timeZoneOffset> </timeZone> <endDateTimeFormat>yyyyMMdd_HHmmss</endDateTimeFormat> </general> <activities> <startUpActivities> <purgeActivity> <filter>%ROOT_DIR%\dflowfm_curacao\output\*.*</filter> </purgeActivity> <purgeActivity> <filter>%ROOT_DIR%\dflowfm_curacao\input\*.*</filter> </purgeActivity> </startUpActivities> <exportActivities> <exportStateActivity> <moduleInstanceId>DFlowFM_curacao_Historical</moduleInstanceId> <stateExportDir>%ROOT_DIR%\dflowfm_curacao\instate</stateExportDir> <stateSelection> <warmState> <stateSearchPeriod unit="hour" start="-23" end="-2"/> </warmState> </stateSelection> </exportStateActivity> <exportNetcdfActivity> <exportFile>air_pressure.nc</exportFile> <timeSeriesSets> <timeSeriesSet> <moduleInstanceId>WFLOW_curacao_GA_Historical</moduleInstanceId> <valueType>grid</valueType> <parameterId>P.specific</parameterId> <locationId>wflow_curacao</locationId> <timeSeriesType>simulated historical</timeSeriesType> <timeStep unit="hour" multiplier="1"/> <relativeViewPeriod unit="hour" end="0"/> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> </timeSeriesSets> </exportNetcdfActivity> <exportNetcdfRunFileActivity> <description>This run file is passed as argument to DFLOWFM pre adapter</description> <exportFile>%WORK_DIR%\run_info.nc</exportFile> <properties> <string key="model_id" value="dflowfm_curacao\curacao"/> <string key="input_grid_files_to_convert" value="%ROOT_DIR%\dflowfm_curacao\input\x_wind.nc;%ROOT_DIR%\dflowfm_curacao\input\air_pressure.nc"/> </properties> </exportNetcdfRunFileActivity> </exportActivities> <executeActivities> <executeActivity> <description>DFlowFM pre adapter</description> <command> <className>nl.deltares.dflowfm.DFlowFMPreAdapter</className> <binDir>adapter</binDir> </command> <arguments> <argument>%WORK_DIR%\run_info.nc</argument> </arguments> <logFile> <file>%WORK_DIR%\dflowfm_pre_adapter_log.txt</file> <errorLinePattern>*ERROR*</errorLinePattern> <warningLinePattern>*WARN*</warningLinePattern> <infoLinePattern>*INFO*</infoLinePattern> <debugLinePattern>*DEBUG*</debugLinePattern> </logFile> <timeOut>99999999</timeOut> <ignoreDiagnostics>true</ignoreDiagnostics> </executeActivity> <executeActivity> <description>Run DFLOWFM</description> <command> <executable>bin\unstruc.exe</executable> </command> <arguments> <argument>--autostartstop</argument> <argument>dflowfm_curacao\curacao.mdu</argument> </arguments> <logFile> <file>%WORK_DIR%\dflowfm_curacao\curacao.dia</file> <errorLinePattern>*ERROR*</errorLinePattern> <warningLinePattern>*WARNING*</warningLinePattern> <debugLinePattern>*INFO*</debugLinePattern> <debugLinePattern>*DEBUG*</debugLinePattern> </logFile> <timeOut>44200000</timeOut> <ignoreDiagnostics>true</ignoreDiagnostics> </executeActivity> </executeActivities> <importActivities> <importStateActivity> <stateFile> <importFile>%WORK_DIR%\dflowfm_curacao\output\curacao_%END_DATE_TIME%_rst.nc</importFile> <relativeExportFile>curacao_%END_DATE_TIME%_rst.nc</relativeExportFile> </stateFile> </importStateActivity> <importNetcdfActivity> <importFile>%WORK_DIR%\dflowfm_curacao\output\curacao_map.nc</importFile> <timeSeriesSets> <timeSeriesSet> <moduleInstanceId>DFlowFM_curacao_Historical</moduleInstanceId> <valueType>grid</valueType> <parameterId>H.sim</parameterId> <locationId>DFlowFM_Curacao</locationId> <timeSeriesType>simulated historical</timeSeriesType> <timeStep unit="nonequidistant"/> <readWriteMode>add originals</readWriteMode> </timeSeriesSet> </timeSeriesSets> </importNetcdfActivity> </importActivities> </activities> </generalAdapterRun>
Multi domain D-Flow FM model
Example of changes to the config when dealing with a D-Flow FM model with multiple domains.
<?xml version="1.0" encoding="UTF-8"?>