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.

** PLEASE TAG YOUR POST! **

 

 

Sub groups
D-Flow Flexible Mesh
DELWAQ

Cohesive sediments & muddy systems

 


« Back to DELWAQ

Numerical instability after 1 timestep

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Hi there,

I have probably a particular nasty issue to resolve... for a particular hydrodynamic grid I am using, which is imported from Telemac, I am getting numerical instability concentrated in shallow areas and eventually messing up the entire domain: if I use, e.g. solver 14: in this case the simulation completes ok, although the MON file shows a lot of problems and the solution is completely messed. Or if I use e.g. solver 15, I get a fairly immediate error that stops the Waq (2) simulation, in this case I get in the MON file:

ERROR: NaN in RHS of segment: 1

Since the numerical instability seemed to emanate from areas of the domain where the water depth was < 0.25 m, I also tried a hydrodynamic grid that forces water depths to always be > 0.25 m, but this did not resolve the issue. Is there a way to look into Delwaq's inner workings to see where the computational issue lies? (As it's probably a divide by 0 thing somewhere?) I've attached MON files for solver 14 (completes ok but solution is messed) and solver 15 (error at first timestep computation).

As a bit of further information, the numerical instability also causes the estimates of water depths of individual cells to be really messed up. I attach example plots of height vs time of "unstable" and "stable" cells, if the code is calculated using solver 14. For cells that are stacked on top of each other, they will either all be stable, or all be unstable, hence it seems its a water depth thing.

I want to point out that I am getting no problems running on a hydrodynamic grid provided with Delwaq (the grid used for the E Coli tutorial). Could there be some limitations on importation of Telemac grids into Delwaq related to shallow water areas and/or wetting and drying?

Many thanks for any insights,
Matthew
Attachments: SOLVER_14_MON.mon (10.5k), SOLVER_15_MON.mon (2.9k), Water_layer_heights.zip (238.3k)
RE: Numerical instability after 1 timestep
Answer (Unmark)
9/20/16 11:58 AMas a reply to Matthew Adams.
Hi Matthew,

We haven't done projects with TELEMAC for a while, so we don't know if everything is still up to date in the coupling between TELEMAC and Delwaq. I don't know if your model contains structures or recent new features of TELEMAC. That might be a source of trouble. But Delwaq seems to do oke with continuity during the first time steps with scheme 14, but gets unstable too. It could also be the the model is highly dynamic, or contains (many) dry cells? What is the nature of your study area? Dry fall is know for being a cause of instability in Delwaq, also when coupled with Delft3D.

Things you could try:

- try scheme 21/22
- decrease the time step
- run without processes to check if the instability comes from the processes (run delwaq1 from the command prompt with the -np switch, or when using the GUI, make a copy of the sub-file, and remove the processes mentioned in there, and import that sub-file in a copy of your set up).
- add a minimum volume to the volume file for the whole period. Therefore you would need to read the minimum volume of each cell, and then see how much you need to add to raise that minimum to the required minimum, and add it to the whole time series of volumes so the mass balance stays correct (sum Q will still equal Vt+dt - Vt if you increas them both with the same value). Attached is a small example program that can do this. The hyd-file should mention the name of the volume file (could be different for TELEMAC). You can create a copy of the hyd-file with the name of the new volume file and use it in the GUI, or mention the new name in the delwaq inp-file.

If you want to delve into solver 15, look for subroutine dlwqnf. Al numerical solvers in Delwaq are named dlwqn*

greetings,
Michel
Attachments: volmin.f (3.3k)
RE: Numerical instability after 1 timestep
Answer (Unmark)
9/21/16 7:22 AMas a reply to Michelle Jeuken.
Hi Michel,

Thanks for your prompt response. I have gone through your suggestions - see comments below:


- try scheme 21/22
Gets the same result as solver 15..... "ERROR: NaN in RHS of segment: 1"

- decrease the time step
For schemes 21 and 22, still gets the same result as solver 15... (see above)

- run without processes to check if the instability comes from the processes (run delwaq1 from the command prompt with the -np switch, or when using the GUI, make a copy of the sub-file, and remove the processes mentioned in there, and import that sub-file in a copy of your set up).
I ran the model using scheme 21 with only continuity (no processes)... it made it half way through the simulation before crashing (MON file attached).

Update: running model using scheme 21 with only continuity (no processes) AND reduced timestep ... made it all the way through the simulation (MON file attached). In this model run, continuity values at the final timestep are mostly 1 throughout the domain but in a couple of locations they are as low as -1.5 and as high as 2.

- add a minimum volume to the volume file for the whole period. Therefore you would need to read the minimum volume of each cell, and then see how much you need to add to raise that minimum to the required minimum, and add it to the whole time series of volumes so the mass balance stays correct (sum Q will still equal Vt+dt - Vt if you increas them both with the same value). Attached is a small example program that can do this. The hyd-file should mention the name of the volume file (could be different for TELEMAC). You can create a copy of the hyd-file with the name of the new volume file and use it in the GUI, or mention the new name in the delwaq inp-file.
The HYD file does mention the name of the volume file (*.dwq, 11MB file size). I'm not sure how to integrate the volmin.f code into this?

If you want to delve into solver 15, look for subroutine dlwqnf. Al numerical solvers in Delwaq are named dlwqn*
In my DWQ build there doesn't seem to be a file titled dlwqn*.*. However, I wasn't too concerned with the solver method, rather if there was a way to view the output of DWQ calculations to narrow down the issue, if the issue is not clear from the MON file. But hopefully this may not be needed to isolate the problem?

If you have any suggestions based on outcomes above so far, let me know.

Thanks!
Matthew
Attachments: SCHEME_21_CONTINUITY_ONLY.mon (5.4k), SCHEME_21_CONTINUITY_ONLY_REDUCED_TIMESTEP.mon (60.0k)
RE: Numerical instability after 1 timestep
Answer (Unmark)
9/22/16 2:46 AMas a reply to Matthew Adams.
Update: I've attached the same MON files as previous post, but now with "Iteration Report" switched on. Hopefully that provides some more insights.
Attachments: SCHEME_21_CONTINUITY_ONLY_ITERATION_REPORT_INCLUDED.mon (10.8k), SCHEME_21_CONTINUITY_ONLY_REDUCED_TIMESTEP_ITERATION_REPORT_INCLUDED.mon (100.4k)
RE: Numerical instability after 1 timestep
Answer (Unmark)
9/22/16 12:57 PMas a reply to Matthew Adams.
Hm, when I look at SCHEME_21_CONTINUITY_ONLY_REDUCED_TIMESTEP.mon or SCHEME_21_CONTINUITY_ONLY_REDUCED_TIMESTEP_ITERATION_REPORT_INCLUDED.mon, I don't see any problems any more... Have you tried with all substances and no processes?

The fortran code is a stand alone example program to fix the volumes. You do not have to integrate it into Delwaq, but have to compile it a a separate program to manipulate the volumes file..