intro story DELWAQ


DELWAQ is the engine of the D-Water Quality and D-Ecology programmes of the Delft3D suite. It is based on a rich library from which relevant substances and processes can be selected to quickly put water and sediment quality models together.

The processes library covers many aspects of water quality and ecology, from basic tracers, dissolved oxygen, nutrients, organic matter, inorganic suspended matter, heavy metals, bacteria and organic micro-pollutants, to complex algae and macrophyte dynamics. High performance solvers enable the simulation of long periods, often required to capture the full cycles of the processes being modelled.

The finite volume approach underlying DELWAQ allows it to be coupled to both the structured grid hydrodynamics of the current Delft3D-FLOW engine and the upcoming D-Flow Flexible Mesh engine (1D-2D-3D) of the Delft3D Flexible Mesh Suite (or even other models such as TELEMAC).

'DELWAQ in open source' is our invitation to all leading experts to collaborate in further development and research in the field of water quality, ecology and morphology using Delft3D. Feel free to post your DELWAQ related questions or comments in this dedicated forum space. If you are new to DELWAQ, the tutorial (in the user manual) is a good place to start. A list of DELWAQ related publications is available here.




Sub groups
D-Flow Flexible Mesh

Cohesive sediments & muddy systems


Message Boards

Changing an existing process in ECO process library

Martin Schueder, modified 6 Years ago.

Changing an existing process in ECO process library

Padawan Posts: 52 Join Date: 10/8/13 Recent Posts

I would like to introduce an additional limitation to algae growth in DELWAQ and am currently using a BLOOM configuration. I want the growth rate of algae types to be proportional to a function of pH where f(pH) = KpH/(KpH + 10^(Optimum_pH-pH)-1). What I am unsure of is when I go to the Open PLCT, chose to edit the process BLOOM_P, add in the items KpH and Optimum_pH, and generate the fortran .f90 code to change the formulation for growth rate to include f(pH), all other fluxes from BLOOM_P are empty. I have not been able to find the original D40BLO.f90 file in the source code, and thus cannot simply copy into my new version of D40BLO.f90 the flux formulations for all of the other fluxes in BLOOM_P that I have not changed (excluding dProdAlg, which I want to change).

I know how to add a new process to the existing process library and incorporate it in a substance file for a Water Quality simulation, but I am not able to see how I would change the existing code to accommodate, for instance, this new pH limitation. I am thinking if I knew the code for all of the existing fluxes in BLOOM_P that seem to have be overwritten when D40BLO.f90 is “re-generated” using the GUI, I could rewrite all of the fluxes in their original form and simply change the formulation for dProdAlg. If so I would be able to make a new .dll and proc_def.dat. Is there any chance these flux formulations are available somewhere? For reference I have included the required fluxes below, with my new output Lim_pH included at the bottom.

***** Insert your code here *****
dCaut = ??????
dNaut = ??????
dPaut = ??????
dSIaut = ??????
dDetCMort = ??????
dDetNMort = ??????
dDetPMort = ??????
dDetSiMort = ??????
dOOCMort = ??????
dOONMort = ??????
dOOPMort = ??????
dOOSiMort = ??????
dCUpt = ??????
dNH4Upt = ??????
dNO3Upt = ??????
dPO4Upt = ??????
dSIUpt = ??????
dDetNUpt = ??????
dDetPUpt = ??????
dFixNUpt = ??????
dDetCUpt = ??????
dPrProdOxy = ??????
dProdAlg = ??????
dMortAlg = ??????
ReqDin = ??????
FracUptNH4 = ??????
BOD5/infPH = ??????
Limit Chlo = ??????
Limit nit = ??????
Limit pho = ??????
Limit sil = ??????
Limit e = ??????
Limit gro = ??????
Limit mor = ??????
fPPtot = ??????
fResptot = ??????
fFixNUpt = ??????
Lim_IN = ??????
Lim_IP = ??????
Lim_Si = ??????
Lim_IC = ??????
Lim_DetN = ??????
Lim_DetP = ??????
Lim_FixN = ??????
Lim_dummy = ??????
Lim_inhib = ??????
Lim_light = ??????
RcPPALG = ??????
RcMrtALG = ??????
Lim_GALG = ??????
Lim_MALG = ??????
Lim_pH = ??????

Thank you,

Anonymous Anonymous, modified 6 Years ago.

RE: Changing an existing process in ECO process library

Jedi Master Posts: 333 Join Date: 7/30/20 Recent Posts
Hi Martin,

The file you were looking for, d40blo.f, is located in:


You can relate the order of the input and output items in the source code to what you see in the Open PLCT.

Let us know if you run into anything else.
Martin Schueder, modified 6 Years ago.

RE: Changing an existing process in ECO process library

Padawan Posts: 52 Join Date: 10/8/13 Recent Posts
Hi Christophe,

Thank you for the quick reply! I admit that I have a limited understanding of the Fortran language, and as such cannot find the flux formulations in d40blo.f that are needed in D40BLO.f90. I can see some similarities in the structure of the two scripts, but I believe the .f file uses arrays for species/type fluxes

! FL(IFPROD) NTYP_A Primary production per type (g/m3/d)
! FL(IFMORT) NTYP_A Mortality per type (g/m3/d)
! FL(IFAUTO) 4 Autolysis fluxes per nutrient (g/m3/d)
! (C, N, P, Si)
! FL(IFDETR) 4 Detritus production per nutrient
! (C, N, P, Si) (g/m3/d)
! FL(IFOOXP) 4 OOx production
! (C, N, P, Si) (g/m3/d)
! FL(IFUPTA) 5 Uptake of nutrients
! (CO2, NH4, NO3, PO4, SiOx) (g/m3/d)

and the .f90 file does not and has a distinct flux for each differential:

real(4) dCaut ! F autolysis flux of carbon (gC/m3/d)
real(4) dNaut ! F autolysis flux of nitrogen (gN/m3/d)
real(4) dPaut ! F autolysis flux of PO4 (gP/m3/d)
real(4) dSIaut ! F autolysis flux of silicate (gSi/m3/d)
real(4) dDetCMort ! F production of DetC by mortality (gC/m3/d)
real(4) dDetNMort ! F production of DetN by mortality (gN/m3/d)
real(4) dDetPMort ! F production of DetP by mortality (gP/m3/d)
real(4) dDetSiMort ! F production of DetSi by mortality (gSi/m3/d)
real(4) dOOCMort ! F production of OOC by mortality (gC/m3/d)
real(4) dOONMort ! F production of OON by mortality (gN/m3/d)
real(4) dOOPMort ! F production of OOP by mortality (gP/m3/d)
real(4) dOOSiMort ! F production of OOSi by mortality (gSi/m3/d)
real(4) dCUpt ! F uptake of carbon by algae growth (gC/m3/d)
real(4) dNH4Upt ! F NH4 uptake by algae growth (gN/m3/d)
real(4) dNO3Upt ! F uptake of NO3 by algae growth (gN/m3/d)
real(4) dPO4Upt ! F PO4 uptake by algae growth (gP/m3/d)
real(4) dSIUpt ! F Si uptake by algae growth (gSi/m3/d)
real(4) dDetNUpt ! F uptake of DetN by heterotroph algae growth (gN/m3/d)
real(4) dDetPUpt ! F uptake of DetP by heterotroph algae growth (gP/m3/d)
real(4) dFixNUpt ! F uptake of nitrogen by fixation (gN/m3/d)
real(4) dDetCUpt ! F uptake of DetC by heterotroph algae growth (gC/m3/d)
real(4) dPrProdOxy ! F uptake of carbon by algae growth (gC/m3/d)
real(4) dProdAlg ! F production of algae type (gC/m3/d)
real(4) dMortAlg ! F mortality of algae type (gC/m3/d)

The mathematical formulations are not visible as far as I can tell in the .f file whereas they are explicitly visible (albeit they are empty) in the .f90 file. The fluxes in the .f file are mentioned only in the comments Ln 73 - Ln 81 and not explicitly defined elsewhere. Is there somewhere where the mathematical formulations for these fluxes/differential equations are available? I see that the .f90 and .f files are very different and perhaps I am not thinking about it the correct way.

I have attached D40BLO.f90 and d40blo.f in case they might be useful.

Thank you for your help,

Anonymous Anonymous, modified 6 Years ago.

RE: Changing an existing process in ECO process library

Jedi Master Posts: 333 Join Date: 7/30/20 Recent Posts
Hi Martin,

BLOOM used to be a model on it's own before being integrated as a D-WAQ process, hence why it is one the most complex processes. In d40blo.f, you can see that several other functions are called. One that may be of interest for you is BLPRIM, which computes primary production. This function and many others are defined in a special directory:


As you will see, finding your way in this code base will cost some time. Our BLOOM expert will be able to tell where you best add your custom code. He's not available today however, so keep an eye on this thread. You should have an answer later this week.
Anonymous Anonymous, modified 6 Years ago.

RE: Changing an existing process in ECO process library

Jedi Master Posts: 333 Join Date: 7/30/20 Recent Posts
On behalf of Hand Los:

Dear Martin,

You pose an interesting question but before going into details about the code, we would like to inform you about some conceptual issues.

You should always keep in mind that BLOOM deals with limitations differently than traditional Monod type models. Your suggestion to lower the (maximum) growth rate as a function of pH therefor could be implemented, but would not be our recommended method. In BLOOM all potentially limiting factors are formulated in the form of linear constraints relating the biomass of each algal type multiplied by some (stoichiometric) factor to an available total amount. If some potential limitation is irrelevant to some types, these factors are put to zero and hence this constraint will never be limiting to those types (see for instance the 0.0 values for Si/C ratios for non-diatoms). Among the existing constraints, the energy constraint presently reflects the true theoretically maximum biomass under ideal conditions (nothing else being limited). Adopting your proposal to lower the growth rates will automatically lower the energy constraint and as a matter of fact also the growth constraint of the affected types as well. As a result you will more frequently observe an energy and/or growth limitation in your output, biomasses will be lower, but you will not have a Limit_pH factor as your code example suggests and the energy constraint no longer reflects the theoretical maximum.

Given that you want to implement pH affects, it might be interesting for you to know that we have fairly recently (last months of 2014) extended BLOOM with an option for carbon limitation (so as a nutrient constraint) in which the available amount of carbon is calculated as a function of pH. So here we do not directly manipulate the growth rate, but in agreement to BLOOM’s concept add a potential limitation, which depending on the pH might delimit the biomass of phytoplankton types due to carbon limitation. We don’t change the growth rate, we change the availability of Carbon: changes in pH -> changes in Carbon availability -> (possibly) Carbon limitation. This new code is now available to all users. Could this be of help to you or perhaps even solve your problem?!

Kind regards,

Hans Los
Martin Schueder, modified 6 Years ago.

RE: Changing an existing process in ECO process library

Padawan Posts: 52 Join Date: 10/8/13 Recent Posts
Hi Hans,

Thank you for your quick reply and conceptual description, it was very helpful! I am interested in the code you describe, but would like to make sure I do not already have the feature installed.

Firstly, I recompiled all of the source code on November 11, 2014. I believe that in my current version there is what is described as KCO2, the linear CO2 limitation constant, above which the overall growth rate is unaffected, and below which the overall growth rate is scaled and decreases linearly between TIC=KCO2 and TIC=0 from 1 --> 0.

Currently, the motivation for implementing a pH limitation is that I am not seeing much of an effect on growth at very low CO2 concentrations (I am assuming this is the CO2 output from pH_simp and not SpecCarb). For instance, day over day my algae (Greens and Ulva) continue to increase biomass even at CO2 < 0.005 gC/m3 (Ulva is photo-inhibited by Green biomass). This causes the pH to rise to 14. I currently have KCO2 = 2 gC/m3. This is an arbitrary value I chose based on the default of 1 gC/m3. I would think the growth rate would be inhibited well above CO2< 0.005.

Is it the problem that perhaps my KCO2 is too low? You are correct that I am truly trying to model CO2 limitation through my pH limitation, but I had found pH limitation in literature in my field and took this as my first approach.

If I do not posses the code you speak of, I would be most interested in obtaining it! Additionally to your point about some limitation not being relevant to certain algae types; I have not been able to find much information regarding the algae types and their physiology/limitations in BLOOM. Could you please direct me to a source if you know of one?

Thank you very much for your time and I have enjoyed reading your numerous publications regarding BLOOM.