CyprienBosserelle / BG_Flood

Numerical model for simulating shallow water hydrodynamics on the GPU using an Adaptive Mesh Refinment type grid. The model was designed with the goal of simulating inundation (River, Storm surge or tsunami). The model uses a Block Uniform Quadtree approach that runs on the GPU but the adaptive/multi-resolution/AMR is being implemented and not yet operational. The core SWE engine and adaptivity has been inspired and taken from St Venant solver from Basilisk and the CUDA GPU memory model has been inspired by the work from Vacondio _et al._2017)
GNU General Public License v3.0
34 stars 15 forks source link

New Bnd + New Save method #110

Closed CyprienBosserelle closed 4 weeks ago

CyprienBosserelle commented 2 months ago

New Bnd and New save method

This PR superseeds 2 PR: #101 and #98 . They have been pre-merged to facilitate testing.

Save to file takes too long for many blocks

The problem

The current dev branch save each block independantly to the netcdf file. The bottleneck is the netcdf write function overhead which make writing large model (20000 blocks and more) quite slow.

The solution

To alleviate this needs a new function that combines all blocks in a single array (for each level/variable) and write the whole array at once to the netcdf file.

Hold on

While this will be faster, it is likely inefficient when there are few arrays in a level. Typically when the highest level has only a few block we would still be writing a full array.

Memory is cheap?

This will also be impossible if going to very high level where we won't be able to allocate memory to hold the highest level array.

The real solution

Something that combine both option above and decide what is the best compromise.

Collapse array

This may be a good time to introduce collapsing level to a single array and saving it to disk.

Other things

This branch also includes:

Using flux term for new boundary treatment

Proof of concept

Implementation

Testing

Docs

CyprienBosserelle commented 2 months ago

New save method

Added a new variable savebyblk input parameter. default is on if set to off it will save per level which is a lot faster but that require enough memory to allocate the full high res level.

CyprienBosserelle commented 2 months ago

Crash/Instability fixed: Waikanae instability example

In Waikanae with rain-on-grid the old absorbing boundary (type=3) would crash almost immediately if the boundary intersected Kapiti Island.

The crashing did not happen with type-2 boundary but tsunami like instability occured: image

The new boundary is very much stable with type=3: image