intro story Coast / Estuary

Coast / Estuary

Coastal systems are among the most dynamic physical systems on earth and are subject to a large variety of forces. The morphodynamic changes occurring to coastlines worldwide are of great interest and importance. These changes occur as a result of the erosion of sediments, its subsequent transport as bed load or suspended load, and eventual deposition. 
Estuaries are partly enclosed water bodies that have an open connection to the coast. Estuaries generally have one or more branching channels, intertidal mudflats and/or salt marshes. Intertidal areas are of high ecological importance and trap sediments (sands, silts, clays and organic matter).
Within the Delft3D modelling package a large variation of coastal and estuarine physical and chemical processes can be simulated. These include waves, tidal propagation, wind- or wave-induced water level setup, flow induced by salinity or temperature gradients, sand and mud transport, water quality and changing bathymetry (morphology). Delft3D can also be used operationally e.g. storm, surge and algal bloom forecasting. 
On this discussion page you can post questions, research discussions or just share your experience about modelling coastal and/or estuarine systems with Delft3D FM. 




Sub groups
D-Flow Flexible Mesh
Cohesive sediments & muddy systems



Message Boards

NaN in RHS segment after editing pripro.f in waq kernel

Rudy Schueder, modified 5 Years ago.

NaN in RHS segment after editing pripro.f in waq kernel

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

I have attempted to edit the pripro.f script in the waq kernel to include a CO2 limitation in DYNAMO similar to that seen in BLOOM. I have formulated PPROD in a modified way as follows:


where KmCO2 is a parameter that is conceptually equivalent to KCO2 in BLOOM. CO2 is a model output from pH_simp.

I have attached the modified script to this message. When I recompile the executable and try to run delwaq1+2 with this slightly different formulation, I get the error "NaN in RHS segment 1" at the first time step. I know it is something wrong with how I wrote pripro.f or gone about including KmCO2, because my simulation runs when I revert back to the original pripro.f. Right now I have simply included KmCO2 and a corresponding value in block #7 of the input file.

Have I missed a step necessary for editing existing WAQ processes? Something with the .dll or proc_def? Any guidance would be most appreciated.


Anonymous Anonymous, modified 5 Years ago.

RE: NaN in RHS segment after editing pripro.f in waq kernel (Answer)

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

You guessed it right. There is still some work to do on the proc_def side. This is because you tampered with the PMSA array in your code. What this PMSA array actually contains at runtime is defined by the process definition.

Here's a quick guide:

1. make sure you have built the proc_def tools: src\tools_gpl\waqpb\packages\waqpb_import and src\tools_gpl\waqpb\packages\waqpb_export
2. go to the process definition directory: d:\dev\oss\src\engines_gpl\waq\packages\waq_kernel\src\waq_tables\
3. run waqpb_export.bat, this will produce procesm.asc among other things
4. rename procesm.asc to proces.asc
5. edit proces.asc to redefine all processes using module pripro.f (GroMrt_Gre and GroMrt_Dia) (I have attached a proces.asc matching your changes to pripro.f)
6. run wapb_import.bat, this will translate the changes in proces.m to the csv tables (i.e. the actual process defenition database)
7. rerun waqpb_export.bat, this will read the modified csv tables and produce new proc_def.dat/def files as well as a new procem.asc, which should now be identical to the modified proces.m

Hope this helps (and works)

Rudy Schueder, modified 5 Years ago.

RE: NaN in RHS segment after editing pripro.f in waq kernel

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

I can not thank you enough, this worked remarkably well! For reference I have formulated the limitation in a slightly different way as per Beran and Kargi in Ecological Modelling (2005):

PPROD = DL * EFF * FNUT * TFUNG * PPMAX * KpH/(KpH+(10**ABS(OptpH-pH))-1)

Now that the method you have outlined is available, it will be possible for myself and others to make modifications to the source code in the future. I hope others find similar success.

Thanks again!