HydroMT and DELWAQ settings

HydroMT can help you prepare models for DELWAQ but is specifically suited for the generic version between D-Emission and D-Water Quality. In this advanced topic, we detailed what are the steps to best make use of HydroMT for this specific version of DELWAQ.

For this case, we take a simplified example: Total Nitrogen (TN) released by households.

Background information

Instead of using a (previous) version of D-Emissions that can deal with multiple substances, a mew version dealing with single substances only has been introduced. This was done for two reasons:

  1. It dramatically reduces the complexity of the code

  2. It significantly reduces the runtime per substance

Moreover, the new D-Emissions version no longer allows/requires editing of the Processes Library Tables (proces.asc) by (expert) users, which proved too error prone in practice. As a consequence of the above, the combined use of D-Emissions and D-Water Quality now requires (in case of a multiple substance water quality simulation) the connection of multiple emission output files generated by individual D-Emissions runs (for each of the substances) to a single D-Water Quality simulation.

The new single substance D-Emissions model writes its emission data into two files, always called:

  • outdata_em.bin

  • outdata_em.txt

In the case that multiple D-Emissions model runs are carried out, e.g. for total nitrogen (TN) and total phosphorus (TP), it is up to the user to manage these files and avoid that the results for TP overwrite those for TN. This can easily be done in a batch script using the following commandlines:

copy outdata_em.txt %1_em.txt
copy outdata_em.bin %1_em.bin
erase outdata_em.txt
erase outdata_em.bin

#where %1 matches the run-id equal to the input filename, %1.inp

D-Water Quality is equipped with a series of processes able to read these files and translate them into the appropriate state variables (e.g. NH4, NO3, PON1 etc. for TN; AAP, PO4, POP1 for TP). This allows D-Water Quality to simulate their fate in the surface water using standard processes from the library.

This series of processes is called EM_xxx and is currently still embedded in an open processes library dll. This implies that they need to be manually merged into the D-Water Quality proc_def file. After correct functioning has been demonstrated, integration with the standard open source version of D-Water Quality is foreseen.

Every individual EM_xxx process extracts by default its EM data from the following files, assumed to be present in the working directory:

  • xxx_em.bin

  • xxx_em.txt

Alternatively, these filenames can be read from a file assumed to be present in the working directory:

  • xxx_em.def

The functionality to distribute the emission data over several state variables (also known as “USEFOR” functionality) is included in the EM_xxx process. Input can be provided by the user in the regular way.

In order to connect a D-Water Quality simulation to one or more D-Emissions runs, the following steps need to be taken.

Let XXX be the variable for which D-Emissions has calculated emissions. The user must:

  • Ascertain that xxx_em.bin and xxx_em.txt (D-Emissions output files) are present in the run directory

  • OR Ascertain that xxx_em.def, a file holding references to xxx_em.bin and xxx_em.txt, is present in the run directory

  • Activate the relevant process in block 7 of the input file:

CONSTANTS Active_EM_xxx DATA 1
  • Optionally, include the relevant input items for this process.

The table below lists the currently available options for xxx, and the equivalent definitions.

xxx

EM files

WQ process

Input to WQ process

BOD

BOD_em.bin and BOD_em.txt OR BOD_em.def

EM_BOD

n.a. (all emissions to CBODu)

TNI

TNI_em.bin and TNI_em.txt OR TNI_em.def

EM_TNI

TNItoNH4, TNItoNO3, TNItoPON1, TNItoPON2, TNItoDON

TPH

TPH_em.bin and TPH_em.txt OR TPH_em.def

EM_TPH

TPHtoPO4, TPHtoAAP, TPHtoPOP1, TPHtoPOP2, TPHtoDOP

TSS

TSS_em.bin and TSS_em.txt OR TSS_em.def

EM_TSS

TSStoIM1, TSStoIM2, TSStoIM3

COL

COL_em.bin and COL_em.txt OR COL_em.def

EM_COL

COLtoEColi, COLtoFColi, COLtoTColi

TRA

TRA_em.bin and TRA_em.txt OR TRA_em.def

EM_TRA

n.a. (all emissions to cTR1)

So, for illustration, to set up a model for nitrogen and phosphorus, the user has to provide:

  • Input files TNI_em.bin and TNI_em.txt plus TPH_em.bin and TPH_em.txt.

  • Alternatively, TNI_em.def and TPH_em.def, holding references to the above files.

  • Activation of the relevant process in block 7 of the input file:

CONSTANTS Active_EM_TNI DATA 1
CONSTANTS Active_EM_TPH DATA 1
  • Definition of the “USEFOR” constants to subdivide total N and P over state variables, also in block 7 of the input file:

CONSTANTS TNItoNH4 DATA 0.2
CONSTANTS TNItoNO3 DATA 0.4
CONSTANTS TNItoPON1 DATA 0.4

CONSTANTS TPHtoPO4 DATA 0.5
CONSTANTS TPHtoAAP DATA 0.4
CONSTANTS TPHtoPOP1 DATA 0.1

Note

As a simplification, in this tutorial we will model our emitted domestic Nitrogen as a tracer TRA to avoid complexity of nutrients modelling and their processes.

Emissions modelling with D-Emission

The first step in solving or mitigating many water quality and health problems, is to get a quantitative overview of the emissions of substances causing such problems. D-Emissions provides a perfect tool to assess the quantity and spatial distribution of the emitted substances in the catchment. Because it simulates the true cause-effect chain, it provides predictive power and allows for “what if” scenarios driven by policy projections and implemented measures.

D-Emissions is a library of the Delwaq software which, in combination with rainfall-runoff and hydraulic modules (e.g. wflow), may form an integral catchment model.

In this section, we will detail the full steps to prepare and run D-Emissions models:

  • Choose the substance(s) of interest and their relevant sources (based on available data)

  • Setup the EM model (from wflow) and emission data using HydroMT

  • Edit the EM run info

  • Run D-Emissions (EM-Plugin).

Selection of substance(s) and sources

The very first part of preparing a water quality model is to define which substances and which emission sources you wish to include in the model.

When a substance is chosen, the sources (or losses) the user wants to consider can be defined (e.g.: atmospheric deposition, domestic, agriculture…). The sources and their emission releases are then quantified or initialized based on available data. There are two types of sources in D-Emissions:

  • Type A: direct substance release rates by the source (usually in g/day, e.g. atmospheric deposition)

  • Type B: substance release rates based on a locator: for example a domestic source can be charaterized by the locator population (in cap) and its emission factor (in g/cap/day).

Then in D-Emissions, the substances can enter the catchment via different receptors that are:

  • Sewage system

  • Paved areas

  • Unpaved areas

  • Stormwater system

  • Surface waters directly

  • Soil

When substances reach the receptors, they can then undergo several processes such as burial or removal by treatment in a WWTP before reaching the final receptors of D-Emissions, the surface waters and the soil. The full processes included the D-Emissions model are represented in the scheme below:

../_images/d-emission-pathways.png

As modelling of several substances with multiple sources and processes can be complex, the D-Emissions model has been designed to model each substance one-by-one. This implies that in order to model several substances, the D-Emissions model needs to be run several times.

For the rest of this topic, we focus on one substance Total Nitrogen (TN) released by one source: households.

Preparing the EM model with HydroMT

D-Emissions (Delwaq) is an unstructured model and composed of unordered segments. D-Emissions segments represent one environmental layer unit (eg open water, soil..). The direction of the flows in D-Emissions between each segment is defined in the pointer file. This pointer file defines not only the direction of lateral flows between segments (eg discharge), but also the direction of vertical flows (flows between the different layers/compartments of a single geographic cell). This means that external flows into / out of a segment (for example precipitation from the atmosphere) are defined in the pointer as flows between a segment and a boundary (for precipitation the boundary is the atmosphere).

By only modelling substances one-by-one, the generic D-Emissions version only considers one environment layer which is the emission or substance layer. As D-Emissions does not deal with fate and transport (no lateral flux between segments), there is then no need to define either a pointer or a boundary file. In essence, D-Emissions calculates the various emitted loads per wflow cell.

To build an EM model with HydroMT you can use the ** build command line ** to prepare all the different ** components ** of your model. Below is an example .ini file for the Total Nitrogen (TN) released by households example.

As a reminder, for an EM model, the required hydrological data (from wflow_output in our example) is:

  • precipitation

  • the amount of the precipitation that infiltrates into the soil from unpaved areas

  • the amount of the precipation that goes directly to surface runoff from paved areas

  • the amount of the precipation that goes directly to surface runoff from unpaved areas

[global]
mtype             = EM                    # type of Delwaq model ['EM', 'WQ']
data_libs         = [local_sources.yml]                    # add optional paths to data yml files

[setup_basemaps]
include_soil      = False                 # add a soil compartment in addition to the surface waters

[setup_monitoring]
mon_points        = None                  # monitoring points ['None', 'segments', 'path to station location', 'source in DataCatalog']
mon_areas         = compartments          # monitoring areas ['None', 'compartments', 'subcatch']

[setup_hydrology_forcing]
hydro_forcing_fn  = wflow_output          # source name of the hydrological forcing in the yaml file
starttime         = 2010-02-03 00:00:00   # start time of the Delwaq run
endtime           = 2010-02-10 00:00:00   # end time of the Delwaq run
timestepsecs      = 86400                 # model timestep in seconds
add_volume_offset = True                  # add a one-timestep offset to the volume data in the hydrological forcing file compared to the flows

[setup_emission_raster]
emission_fn       = GHS-POP_2015
scale_method      = average
fillna_method     = zero
area_division     = True

Note

In this version of EM, the the amount of the precipitation that **infiltrates* into the soil from unpaved areas* is dealt with as a sink, since the WQ version does not yet contain a Soil compartment.

Editing the EM run information

In order to run the EM-Plugin of DELWAQ, an input file is used to set up all the relevant run information such as substances and processes to include, run time information, data and model parameters to use etc. This is set up in a .inp file. A template of such a file, for an EM run, is shown below.

The input file is separated into 10 input blocks each requiring different type of information. You can find more info on what is expected where in the Delwaq input file documentation. In short, the ten blocks are:

  • B1: Identification, selected substances

  • B2: Timers, integration, monitoring

  • B3: Grid and values of the volumes

  • B4: Hydrodynamic data

  • B5: Open boundary conditions

  • B6: Loads and withdrawals

  • B7: Process steering

  • B8: Initial conditions

  • B9: Model output

  • B10: Statistical output

With hydroMT, different files were prepared containing information that can be directly linked and included in this input file. These are:

  • The different files in the config folder: each filename has a prefix containing the block number it should be inserted in (ex: B1_timestamp.inc).

  • Emission and other grid data stored in staticdata folder

  • Time-dependant data such as hydrological fluxes stored in dynamicdata folder.

Depending on their format (binary or ASCII), the files can be included in the input file using the following syntax.

  • For ASCII files: keyword INCLUDE + path/to/ascii

INCLUDE 'config\B1_timestamp.inc'
  • For binary files: keywords ALL BINARY_FILE + path/to/binary

ALL BINARY_FILE 'dynamicdata\hydrology.bin'

In the template below, all (mandatory) files produced by HydroMT have been added and linked. Some explanations on the specificities of the settings for the one-substance D-Emissions model:

  • In block 1, you can see that in the one-substance D-Emissions model, instead of the substances (nitrogen, TSS…), we model the emission receptors compartments in a specific order. With this, emission modelling can be more generic, run time faster and there is no need to update the procdef tables for each D-Emissions model case.

;Nr     Name
1       Sew
2       Pav
3       Unp
4       Stw
5       Sfw
6       Soi
  • The different emission sources are defined in block 7. Currently, in the one-substance D-Emissions model, one type A source and three type B sources can be defined. All names respect a certain convention (EV_A01, EV_B01). The user should also define to which receptor (from block 1) the source emission goes to. Here is an example for a type B source :

; source Type B01
PARAMETERS EV_B01        ALL BINARY_FILE 'staticdata\GHS-POP_2015.dat' ; locator/EV variable type B    (cap)
CONSTANTS  EF_B01           DATA 2.2          ; emission factor                                        (Kg/d/cap)
CONSTANTS  B01toSew         DATA 1.0          ; released fraction receptor                             (-)
CONSTANTS  B01toPav         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toUnp         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toSoi         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toStw         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toSfw         DATA 0.0          ; released fraction receptor                             (-)
  • All unused type A and/or B sources should still be listed in the input file with zero data:

; source Types NOT USED
CONSTANTS  EV_A01        DATA 0.
CONSTANTS  EV_B02        DATA 0.
CONSTANTS  EV_B03        DATA 0.

Note

The unit of emission factor EF is kg/d/X, where X is the emission unit provided in the Emission Variable EV, e.g. capita for Population. Here the EF factor was set to a constant dummy value but you can use HydroMT to prepare and distribute ‘real’ values from local/global data.

999 80 ';'
;DELWAQ_VERSION_4.910                        		; Delwaq version number
;PRINT_OUTPUT_OPTION_2                       		; Debug level

; TEMPLATE FILE FOR EMISSION DISAGGREGATION
; First input block
'Demo Emission Model linked to WFLOW for TN'
' '
' '
INCLUDE 'config\B1_timestamp.inc'

 6    0

;Nr      Name        
1       Sew      ;   
2       Pav      ;    
3       Unp      ;   
4       Stw  
5       Sfw  
6       Soi  
#1;

;###############################################################################
; Second input block
  1 'DDHHMMSS' 'DDHHMMSS'  ; system clock
;INCLUDE 'config\B2_sysclock.inc'

     1.03                      ; integration option 
   BAL_NOLUMPPROCESSES
   BAL_NOLUMPLOADS
   BAL_NOLUMPTRANSPORT
   BAL_NOSUPPRESSSPACE
   BAL_NOSUPPRESSTIME

INCLUDE 'config\B2_timers.inc'

 1                                                 	; Monitoring areas in this file

INCLUDE 'config\B2_nrofmon.inc'
INCLUDE 'config\B2_monareas.inc'
INCLUDE 'config\B2_stations.inc'

 2                                                 	; No monitoring cross areas

INCLUDE 'config\B2_outputtimes.inc'

#2;
;###############################################################################
; Third input block

INCLUDE 'config\B3_nrofseg.inc'


      2                     ; grid layout not used
      
;      0                     ; constant property arrays
;      0                     ; time varying property arrays
INCLUDE 'config\B3_attributes.inc'


 
      1                     ; volumes in this file
      2                     ; constant with defaults
      1.0                   ; scale factor
      1.0                   ; default volume
      0                     ; overrides

#3;
;###############################################################################
; Fourth input block
; 
1 0 0 ; nr of exchanges
      0                     ; # of dispersion arrays
      0                     ; # of velocity arrays
      1                     ; first form is used for input
      1                     ; exchange pointers in this file
0 0 0 0

 
      1                     ; dispersions in this file
     1.0      1.0     1.0   ; scale factors in 3 directions
     0.0      0.0     0.0   ; values in 3 directions
      1                     ; areas in this file
      2                     ; constant, defaults
     1.0      1.0           ; scale and value
      0
      
      1                     ; flows in this file
      2                     ; constant, defaults
     1.0      0.0           ; scale and value
      0
     
      0                     ; constant length
     1.0                    ; scale factor
     1.0      1.0     1.0   ; values in 3 directions

#4;
;###############################################################################
; Fifth input block, water quality calculation
;INCLUDE 'config\B5_boundlist.inc'

#5;
;###############################################################################
; Sixth input block, Dry Waste Loads block
; Number of loads (dummy value)
0							; Number of loads

#6;
;###############################################################################
; Seventh input block


CONSTANTS  'Nothreads'       DATA  0                  ; Multicore
CONSTANTS Only_Active        DATA  1
CONSTANTS Active_EM_GSS      DATA  1

; geometry

INCLUDE 'config\B7_geometry-parameters.inc'
ALL BINARY_FILE 'config\B7_geometry.bin'

; hydrology

INCLUDE 'config\B7_hydrology.inc'
ALL BINARY_FILE 'dynamicdata\hydrology.bin'

; infrastructure

CONSTANTS  SewLeakage      DATA 0.0         ; sewer leakage                                          (%)                 

; source atmospheric deposition

CONSTANTS  EF_DDp        DATA 0.0          ; dry deposition rate                                    (g/m2/d)            
CONSTANTS  EF_WDp        DATA 0.0          ; wet deposition rate                                    (g/m3)              

; source SEWAGE (Type B01)

PARAMETERS EV_B01        ALL BINARY_FILE 'staticdata\GHS-POP_2015.dat' ; locator/EV variable type B    (cap)                
CONSTANTS  EF_B01           DATA 2.2          ; emission factor                                        (Kg/d/cap)           
; the below comes from a supportive project specific process
CONSTANTS  B01toSew         DATA 1.0          ; released fraction receptor                             (-)                 
CONSTANTS  B01toPav         DATA 0.0          ; released fraction receptor                             (-)                 
CONSTANTS  B01toUnp         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toSoi         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toStw         DATA 0.0          ; released fraction receptor                             (-)
CONSTANTS  B01toSfw         DATA 0.0          ; released fraction receptor                             (-)                     

; source Types NOT USED

CONSTANTS  EV_A01        DATA 0.    
CONSTANTS  EV_B02        DATA 0.    
CONSTANTS  EV_B03        DATA 0.    

; fate & transport

CONSTANTS  DecPav        DATA 0.0          ; decay rate paved                                       (/d)                
CONSTANTS  DecUnp        DATA 0.0          ; decay rate unpaved                                     (/d)                
CONSTANTS  KdUnpa        DATA 0.5          ; fraction of bound vs unbound                           (-)                 

; preprocessing

PARAMETERS Streamordr ALL BINARY_FILE 'staticdata\streamorder.dat'

#7
;###############################################################################
; Eighth input block

INITIALS  Sew Pav Unp Stw Sfw Soi
DEFAULTS  6*0.0

 
#8
;###############################################################################
; Ninth input block
 1                                           		; Conditions follow in this file
 1                                           		; Monitor-file
 0                                           		; Grid-file
 1                                                      ; His
 1                                                      ; Map
 
 ; Binary/Nefis and History/Map
 1                                           		; switch on  binary History file
 1                                           		; switch on  binary Map     file
 0                                           		; switch off Nefis  History file
 0                                           		; switch off Nefis  Map     file
#9
;###############################################################################
; Tenth input block

#10

Running D-Emission

In order to run delwaq for D-Emissions, we need to include the EM-Plugin to the run. Delwaq is also run via command lines using two executables, one that reads and process all the information and data in the input file delwaq1.exe, and one that runs Delwaq with this data delwaq2.exe. The command line also include the path to the input file (espace.inp) and to specific libraries in the EM-Plugin (or D-Emissions plugin). Here is an example:

erase *.wrk

REM Read input
..\Delwaq\bin\delwaq1.exe espace.inp -A -p..\EM-Plugin\Tables\proc_def

REM Simulate
..\Delwaq\bin\delwaq2.exe espace.inp -openpb..\EM-Plugin\x64\Release\D3Dwaq_OpenPL.dll
pause

Water quality modelling with D-Water Quality

The D-Water Quality module simulates the far- and mid-field water and sediment quality due to a variety of transport and water quality processes. To accommodate these, it includes several advection diffusion solvers and an extensive library of standardized process formulations with the user-selected substances. Default processes allow to simulate for instance the decay of BOD and nitrification, elementary growth of algae and nutrient cycling, exchange of substances with the atmosphere, adsorption and desorption of contaminant substances and the deposition and resuspension of particles and adsorbed substances to and from the bed. D-Water Quality is a module of the DELWAQ software which, in combination with rainfall-runoff and hydraulic modules (e.g. wflow), and the D-Emission module, may form an integral catchment model.

In this section, we will detail the steps to run a D-Water Quality model using HydroMT and inputs from D-Emission:

  • Choose the substance(s) of interest and their relevant processes in surface waters

  • Setup the WQ model (from wflow) using HydroMT

  • Edit the WQ run info

  • Include the outputs from D-Emissions

  • Run D-Water Quality (WQ-Plugin)

Selection of substance(s) and processes

When setting-up D-Emission, we decided to model the substance Total Nitrogen (TN) emitted by households. As TN is a quite complex substance with many processes and interactions with different forms of Nitrogen molecule, in the following tutorials, as a simplified example, we will model Total Nitrogen (TN) as a simple constant tracer cTR.

For more information on available processes per substances, see the Delwaq documentation:

Preparing the WQ model with HydroMT

D-Water Quality (Delwaq) is an unstructured model and composed of unordered segments. D-Water Quality segments represent one environmental layer unit (eg open water, soil..). The direction of the flows in Delwaq between each segment is defined in the pointer file. This pointer file defines not only the direction of lateral flows between segments (eg discharge), but also the direction of vertical flows (flows between the different layers/compartments of a single geographic cell). This means that external flows into / out of a segment (for example precipitation from the atmosphere) are defined in the pointer as flows between a segment and a boundary (for precipitation the boundary is the atmosphere).

Compared to D-Emission, lateral transport of the substance in the surface water between Delwaq segments is considered and a pointer file is then necessary.

To build an WQ model with HydroMT you can use the ** build command line ** to prepare all the different ** components ** of your model. Below is an example ini file for the Total Nitrogen (TN) released by households example.

As a reminder, for a WQ model, the required hydrological data (from wflow_output in our example) is:

  • surface runoff

  • surface water volumes

  • total water entering the surface waters (e.g. precipitation, exfiltration from the soil, evaporation…) in order to close the surface water mass balance

[global]
mtype             = WQ                   # type of Delwaq model ['EM', 'WQ']
data_libs         = ['local_sources.yml'] # add optional paths to data yml files

[setup_basemaps]
include_soil      = False                # add a soil compartment in addition to the surface waters

[setup_monitoring]
mon_points        = segments             # monitoring points ['None', 'segments', 'path to station location', 'source in DataCatalog']
mon_areas         = compartments         # monitoring areas ['None', 'compartments', 'subcatch']

[setup_hydrology_forcing]
hydro_forcing_fn  = wflow_output         # source name of the hydrological forcing in the yaml file
starttime         = 2010-02-03 00:00:00  # start time of the Delwaq run
endtime           = 2010-02-10 00:00:00  # end time of the Delwaq run
timestepsecs      = 86400                # model timestep in seconds
add_volume_offset = true                 # add a one-timestep offset to the volume data in the hydrological forcing file compared to the flows

Note

In some cases, you may require some additional GIS data in order to run a WQ model, for example, when you do not need to run the D-Emission model beforehand, but include point sources that emit pollutants into the surface water directly. When this is the case, you can still use the various [setup_emission_*] components of hydroMT_delwaq.

Editing the WQ run information

In order to run the WQ-Plugin of DELWAQ, an input file is used to set up all the relevant run information such as substances and processes to include, run time information, data and model parameters to use etc. This is set up in a .inp file. A template of such a file, for an WQ run, is shown below.

The input file is separated into 10 input blocks each requiring different type of information. You can find more info on what is expected where in the Delwaq input file documentation. In short, the ten blocks are:

  • B1: Identification, selected substances

  • B2: Timers, integration, monitoring

  • B3: Grid and values of the volumes

  • B4: Hydrodynamic data

  • B5: Open boundary conditions

  • B6: Loads and withdrawals

  • B7: Process steering

  • B8: Initial conditions

  • B9: Model output

  • B10: Statistical output

With hydroMT, different files were prepared containing information that can be directly linked and included in this input file. These are:

  • The different files in the config folder: each filename has a prefix containing the block number it should be inserted in (ex: B1_timestamp.inc).

  • Emission and other grid data stored in staticdata folder

  • Time-dependant data such as hydrological fluxes stored in dynamicdata folder.

Depending on their format (binary or ASCII), the files can be included in the input file using the following syntax.

  • For ASCII files: keyword INCLUDE + path/to/ascii

INCLUDE 'config\B1_timestamp.inc'
  • For binary files: keywords ALL BINARY_FILE + path/to/binary

ALL BINARY_FILE 'dynamicdata\hydrology.bin'

In the template below, all (mandatory) files produced by HydroMT have been added and linked. Some explanations on the specificities of the settings for the D-Water Quality linked to one-substance D-Emissions models:

  • In block 1, you can see that we are going to model TN as a tracer for simplification (less expert processes to define). The generic name for a tracer in Delwaq is cTR1:

;Nr      Name
1       cTR1
  • The boundary conditions and initial concentrations of our substance cTR1 needs to be defined in block 5 and 8 respectively and can be initialized with zero:

ITEM BD_1    CONCENTRATIONS cTR1 DATA 0.0
#5
INITIALS  cTR1 DEFAULTS  0.0
#8
  • The link of our tracer TRA with D-Emissions output and to the relevant process is activated in block 7 of the input file (1st line), the 2nd line is added to map all of the emitted tracer Tra to a conservative tracer substance cTR1 (Note: not used in this tutorial, but EM also supports to simulate a decayable tracer dTR1, which requires to also define decay rates):

CONSTANTS Active_EM_TRA DATA 1
CONSTANTS TratocTR1     DATA 1.0
999 80 ';'
;DELWAQ_VERSION_4.910                        		; Delwaq version number
;PRINT_OUTPUT_OPTION_2                       		; Debug level

; TEMPLATE FILE FOR EMISSION DISAGGREGATION
; First input block
'Demo Emission Model linked to WFLOW '
' '
' '
INCLUDE 'config\B1_timestamp.inc'

 1    0

;Nr      Name        
1       cTR1      ;   
#1;

;###############################################################################
; Second input block
  86400  'DDHHMMSS' 'DDHHMMSS'  ; system clock

    15.73                      ; integration option 
   BAL_NOLUMPPROCESSES
   BAL_NOLUMPLOADS
   BAL_NOLUMPTRANSPORT
   BAL_NOSUPPRESSSPACE
   BAL_NOSUPPRESSTIME

INCLUDE 'config\B2_timers.inc'




 1                                                 	; Monitoring areas in this file

INCLUDE 'config\B2_nrofmon.inc'
INCLUDE 'config\B2_stations.inc'
INCLUDE 'config\B2_monareas.inc'

 2                                                 	; No monitoring cross areas

INCLUDE 'config\B2_outputtimes.inc'



#2;
;###############################################################################
; Third input block

; Name of coordinates file - conforming to UGRID conventions
UGRID 'config\B3_waqgeom.nc'

INCLUDE 'config\B3_nrofseg.inc'


      2                     ; grid layout not used
      
;      0                     ; constant property arrays
;      0                     ; time varying property arrays
INCLUDE 'config\B3_attributes.inc'


 
      -2                     ; volumes in external file
'dynamicdata\volume.dat'

#3;
;###############################################################################
; Fourth input block
; 
INCLUDE 'config\B4_nrofexch.inc'

      0                     ; # of dispersion arrays
      0                     ; # of velocity arrays
      1                     ; first form is used for input
      1                     ; exchange pointers in this file
INCLUDE 'config\B4_pointer.inc'

 
      1                     ; dispersions in this file
     1.0      1.0     1.0   ; scale factors in 3 directions
     0.0      0.0     0.0   ; values in 3 directions
     
      1                     ; areas in this file
      2                     ; constant, defaults
     1.0      1.0           ; scale and value
      0
      
     -2                     ; flows in binary file
'dynamicdata\flow.dat'      
     
      0                     ; constant length
     1.0                    ; scale factor
     1.0      1.0     1.0   ; values in 3 directions


#4;
;###############################################################################
; Fifth input block, water quality calculation

INCLUDE 'config\B5_boundlist.inc'

0                     					; no Tatcher-Harleman time lags

ITEM BD_1    CONCENTRATIONS cTR1 DATA 0.0



#5;
;###############################################################################
; Sixth input block, Dry Waste Loads block
; Number of loads (dummy value)
0							; Number of loads

#6;
;###############################################################################
; Seventh input block

CONSTANTS  'Nothreads'       DATA  1                  ; Multicore
CONSTANTS Only_Active        DATA  1
CONSTANTS Active_EM_TRA      DATA  1
CONSTANTS TratocTR1           DATA  1.0
CONSTANTS MaxIter            DATA  100000
CONSTANTS Tolerance          DATA  1E-12
CONSTANTS Dry_THresh         DATA  0.0
CONSTANTS 'iteration report' DATA  0.0

; geometry

PARAMETERS Surf ALL BINARY_FILE 'staticdata\surface.dat'

#7
;###############################################################################
; Eighth input block

INITIALS  cTR1 DEFAULTS  0.0

 
#8
;###############################################################################
; Ninth input block
 1                                           		; Conditions follow in this file
 1                                           		; Monitor-file
 0                                           		; Grid-file
 1                                                      ; His
 1                                                      ; Map
         
 
 ; Binary/Nefis and History/Map
 1                                           		; switch on  binary History file
 1                                           		; switch on  binary Map     file
 1                                           		; switch off Nefis  History file
 1                                           		; switch off Nefis  Map     file
#9
;###############################################################################
; Tenth input block

period 'year2018'
   suffix     ' yr18'
   start-time '2017/12/31-00:00:00'
   stop-time  '2018/12/31-00:00:00'
end-period

output-operation 'STADSC'
   substance 'cTR1'
   suffix    ''
end-output-operation


#10

Running D-Water Quality

In order to run delwaq for D-Water Quality, we need to include the WQ-Plugin to the run. Delwaq is also run via command lines using two executables, one that reads and process all the information and data in the input file delwaq1.exe, and one that runs Delwaq with this data delwaq2.exe. The command line also include the path to the input file (delwaq.inp) and to

specific libraries in the WQ-Plugin (or D-Water Quality plugin). You can also notice that there is no direct link to the outdata_em files either in the delwaq.inp or in the run-WQ-tra.bat files. This is why respecting the naming conventions of either xxx_em.bin and xxx_em.txt or xxx_em.def are mandatory.

erase *.wrk

REM Read input
..\Delwaq\bin\delwaq1.exe delwaq.inp -A -p..\WQ-Plugin\Tables-Integral\proc_def

REM Simulate
..\Delwaq\bin\delwaq2.exe delwaq.inp -openpb..\WQ-Plugin\x64\Release\D3Dwaq_OpenPL.dll
pause