Explaining the D-Emission - D-Water Quality coupling#

HydroMT can help you prepare models for DELWAQ and uses a generic single substance version of D-Emission that can be coupled with D-Water Quality. The single substance D-Emissions model writes its emission data into two files, always called:

  • outdata_em.bin

  • outdata_em.txt

In this advanced topic, we detailed what are the steps to best make use of HydroMT for this specific version of DELWAQ.

Note

Instead of using a multiple substance version of D-Emissions that can deal more than one substance (within one model setup), a new more generic version dealing with a single substance 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.

Linking multiple D-Emissions models with D-Water Quality#

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.