null

Message Boards

Numerical instability after 1 timestep

MA
Matthew Adams, modified 3 Years ago.

Numerical instability after 1 timestep

Youngling Posts: 19 Join Date: 8/20/15 Recent Posts
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
Michel Jeuken, modified 3 Years ago.

RE: Numerical instability after 1 timestep

Jedi Knight Posts: 156 Join Date: 1/21/13 Recent Posts
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:

MA
Matthew Adams, modified 3 Years ago.

RE: Numerical instability after 1 timestep

Youngling Posts: 19 Join Date: 8/20/15 Recent Posts
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
MA
Matthew Adams, modified 3 Years ago.

RE: Numerical instability after 1 timestep

Youngling Posts: 19 Join Date: 8/20/15 Recent Posts
Update: I've attached the same MON files as previous post, but now with "Iteration Report" switched on. Hopefully that provides some more insights.
Michel Jeuken, modified 3 Years ago.

RE: Numerical instability after 1 timestep (Answer)

Jedi Knight Posts: 156 Join Date: 1/21/13 Recent Posts
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..