null

Message Boards

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

RS
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:

PPROD = DL * EFF * FNUT * TFUNG * PPMAX * CO2/KmCO2

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.

Regards,

Rudy
CT
Christophe Thiange, modified 5 Years ago.

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

Jedi Knight Posts: 125 Join Date: 11/15/12 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)

Christophe
RS
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!

Rudy