Git Product home page Git Product logo

cyprienbosserelle / bg_flood Goto Github PK

View Code? Open in Web Editor NEW
31.0 9.0 15.0 188.09 MB

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)

License: GNU General Public License v3.0

Cuda 59.58% C++ 39.02% Makefile 0.51% Julia 0.08% CMake 0.78% C 0.02%
gpu tsunami flood inundation storm surge rain river adaptive

bg_flood's People

Contributors

aliceharang avatar chrisdjscott avatar cyprienbosserelle avatar github-actions[bot] avatar tinyendian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bg_flood's Issues

Some Netcdf Files are not read properly

Using a externally provided DEM. BG_Flood did not read the z variable content properly. It did with GMT and was ok after I did a grdmath operation.

File info:
image

Warm start

Initial water level should be based on initial water level at forcing bnd. Somehow this no longer works in the new code version.

Point output not working

Point output is not working properly:

  • location of output is wrong

  • Not very efficient way of extracting the points

Boundary blocks

Model needs to implement the boundar condition only on blocks that are flagged as bnd.

right now it applies on the block that fall on the edges by searching through all the blocks which are the bnd ones.

it would be ,more efficient to doe this search once and for all at the start of the model and allpy the boundary at specified blocks.. (easy to implement)

also this should allow for more creative way of setting up boundaries

Initialisation of XModel.evolv.h

The initialisation of XModel.evolv.h seems to present an error. When using the "permissive-" option during the compilation (on VS19), a non-realistic number is returned (observed in Test 1).

Add explicit roughness length

Now is taken into account in an implicit post advection step... as in Basilisk. It should be fairly easy to implement as an explicit step in the update scheme as a source term as in Vacondio...

Roughness map files starting with a digit

The issue

Users cannot use roughness map if the file name starts with a digit

Why

Roughness map can be used using the same keyword as constant values. This is helpful in many situation where one doesn't have to remember a different keywords for maps or cst values.

However BG_Flood has to determine whether the user input is a file or a number. At the moment the code checks whether the first character is a number. If not it must be a file!

if (!parametervalue.empty())
	{
		if (std::isdigit(parametervalue[0]) == false)
		{
			forcing.cf = readfileinfo(parametervalue, forcing.cf);
		}
	}

It is a problem

When the user forgets about the quirk above and use a digit in the first character of the file this becomes a silent issue where a value not intended is used for roughness.

Solution?

change the std::isdigit(parametervalue[0]) == false to:

  • NOT (all characters are digits (or "."))
  • any character that is not "." is non-digit
  • more than one non-digit character

Resetmax option to check

I got an error after adding the resetmax option:
image
The code was running before and nothing else have been modify (apart from the output file name).
This is the full param file:
image
image

Add support for a CRS to be encoded in the output files

Up to you how you do this, but I think it is important that BG-FLOOD can produce netCDF files with a CRS specified. This could either be:

  • Done always - either from a default, or one of the other two options
  • Done sometimes - i.e if the user specified a CRS an input in the parameter file
  • Done sometimes - i.e. if the input DEM has a defined CRS

I'd lean to option 1 (always to it) or option 3 (take the CRS from the DEM)

Using "time" and not "t" as time variable in input netcdf

At present, when dealing with input multi-temporal rasters (e.g., rain), BGFlood requires the time coordinate of the netcdf file to be called "time", and crashes if it is called "t" (with the message that it cannot find the variable).
It would be useful if either the code allowed using "t", or if this instruction on preparing inputs was clearly stated in the wiki.

I came across this bug because of using my own matlab script to prepare the netcdf input.

Here, my Matlab script as it did not work:

args={ "int",["x", "y", "t"], [length(xp), length(yp), 2], 'nc_float',intensity_output};
axisdef = {"x", length(xp), 'nc_float', xp';
"y", length(yp), 'nc_float', yp';
"t", 2, 'nc_float', times};
ncdfsave_last(ncdffile, args, axisdef, DeflateLevel);

Here, an amended version that worked (where "t" has been replaced by "time" in two instances).

args={ "int",["x", "y", "time"], [length(xp), length(yp), 2], 'nc_float',intensity_output};
axisdef = {"x", length(xp), 'nc_float', xp';
"y", length(yp), 'nc_float', yp';
"time", 2, 'nc_float', times};
ncdfsave_last(ncdffile, args, axisdef, DeflateLevel);

Add timestep as map output

Discuss the possibility and use to add time-step as map output (to identify possible errors in DEM/roughness and decrease computation time)

No check on aoi polygon sanity

If BG_Flood doesn't find the specified AOI file or if the aoi file is empty then BG_Flood uses an empty polygon to define the domain which leads to a model with no blocks and then overflow crash. which is not right.
Need to add sanity checks in that part of the code

Error creating netCDF output file when the input DEM y axis is flipped.

Error - including the x/y min and max dimensions that show the flip. I can send through an example DEM for testing.

Adjusted model domain (xo/xmax/yo/ymax):
        1423704.610000/1432504.610000/4989598.950000/4983038.950000
         Initial resolution (level 0) = 10.000000

Initializing mesh
        Initial number of blocks: 0; Will be allocating 0 in memory.

Initial condition:
        Cold start

Model setup complete
#################################
Initialising model main loop
Create netCDF output file...
HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 13476:
  #000: C:\ci\hdf5_1545244154871\work\src\H5D.c line 145 in H5Dcreate2(): unable to create dataset
    major: Dataset
    minor: Unable to initialize object
  #001: C:\ci\hdf5_1545244154871\work\src\H5Dint.c line 326 in H5D__create_named(): unable to create and link to dataset
    major: Dataset
    minor: Unable to initialize object
  #002: C:\ci\hdf5_1545244154871\work\src\H5L.c line 1572 in H5L_link_object(): unable to create new link to object
    major: Links
    minor: Unable to initialize object
  #003: C:\ci\hdf5_1545244154871\work\src\H5L.c line 1813 in H5L__create_real(): can't insert link
    major: Links
    minor: Unable to insert object
  #004: C:\ci\hdf5_1545244154871\work\src\H5Gtraverse.c line 851 in H5G_traverse(): internal path traversal failed
    major: Symbol table
    minor: Object not found
  #005: C:\ci\hdf5_1545244154871\work\src\H5Gtraverse.c line 627 in H5G__traverse_real(): traversal operator failed
    major: Symbol table
    minor: Callback failed
  #006: C:\ci\hdf5_1545244154871\work\src\H5L.c line 1619 in H5L__link_cb(): unable to create object
    major: Links
    minor: Unable to initialize object
  #007: C:\ci\hdf5_1545244154871\work\src\H5Oint.c line 2645 in H5O_obj_create(): unable to open object
    major: Object header
    minor: Can't open object
  #008: C:\ci\hdf5_1545244154871\work\src\H5Doh.c line 300 in H5O__dset_create(): unable to create dataset
    major: Dataset
    minor: Unable to initialize object
  #009: C:\ci\hdf5_1545244154871\work\src\H5Dint.c line 1012 in H5D__create(): can't copy dataspace
    major: Dataset
    minor: Unable to initialize object
  #010: C:\ci\hdf5_1545244154871\work\src\H5Dint.c line 649 in H5D__init_space(): can't cache dataspace info
    major: Dataset
    minor: Unable to copy object
  #011: C:\ci\hdf5_1545244154871\work\src\H5Dint.c line 612 in H5D__cache_dataspace_info(): unable to get the next power of 2
    major: Dataset
    minor: Can't get value
Netcdf NetCDF: HDF error

Issue about compiling BG_Flood

Dear Sir:
Now I use gcc-5.0, cuda-9.0 and CMAKE-3.19 to compile BG_Flood, but I failed. Could you please give me some hints? Thanks!

Totaltime

It seems totaltime cannot be initiated . I.e. totaltime =0 at model start even when specified otherwise in bg_param.txt

No output if outputtimestep = endtime for large values

This behavior have been observed on the Westport testcase, for "outputtimestep" = 400 000.0.
For an "endtime" of 400 000.0 or 400 001.0, no final output was produce.
With same configuration and "outputtimestep" = 5.0 / "endtime" = 5.0, a final output was produce.

Remove spurious velocities in nearly dry high slopes

In steep slopes with rain on grid lead to high velocities breaking the C-properties of the model. This can be tamed by applying a limiter or a damping factor to the flux term.
Vacondio et al. apply a flux damping as uhc=uh*sqrt(2)/sqrt(1+max((1,(hlim/h)^4));
This seem pretty crude to me... but was proposed by kurganov and Petrova (2007).

Cyp

TSnode frequency output

Hi Cyp,

Kindly requesting if a timestep frequency can be specified for the TSnode outputs. It's a minor thing really.
I observed that running an outtimestep=600sec (10min), the TSOfile has an output approximately every 0.1sec. So not really a pressing issue to resolve.

Thanks,
Jud

River outside domain

When user specify a river injection outside the model domain it cause the model to crash.

Add a sanity check on the keyword

It might be usefull for new users to add a warning as a sanity check if a keyword is found in the input file but no resulting in a command for the code.

TSOutput

Timeseries output doesn't seem to work (on GPU?)

Endtime error

  • Endtime default value not used (release and debugg)
  • Endtime user defined value not used (release)
    Simple test with only bathy, dx and/or endtime.

Optimised GPU code (i.e. compiled without -G) leads to significant result difference compared with the CPU code

While the debug code seems fine the release code (while much faster) has a relatively large error. this could be due to some code reordering by the compiler and/or an error due to a out-of bound memory access.

Most of the error could also be due to the timestep being slightly different and cumulating an unreported error from the code reordering.

Need to find this error before moving on to an adaptive type model.

ABS 1D BND not fully working

Working only for water level that is stable?

Needs a full test suite to verify what does and doesn't work.

uumean is forced to 0.0 in the function thus imposing a forced no mean flux along the boundary which is completelly imcompatible with bnd with variable condition.

How is that going to work with horizontal discharge of RIver along the boundary?

Add bridges

Add functionality to include the additional energy losses associated with flow impacting a bridge deck of defined elevation and location. Bridge deck changes flow by:

  1. Additional energy losses
  2. Reduced flow area (depending on deck thickness?)

May want to consider other types of hydraulic structure at the same time such as sluices/gates (energy losses?) or sub-grid scale bridge peirs/constrictions (reduced "effective area") of cells.

Looking at how other existing models handle these features would be a good starting point.

Bottom boundary wall

This should have been tested before. but i get unexpected strong flow out of my wall boundaries. Not happening with a right boundary.... There should be a sanity test on all boundaries...

Slow runtimes with boundary forcing caused by slow texture fetch

The problem

Slow runtimes with boundary forcing caused by slow texture fetch.
Using a large file as input to the boundary.

GPU total runtime with full bnd total runtime with no bnd total runtime with trimmed bnd
QP620 207 s 80 s 95 s
A100 128 s 14 s 31 s

possible solutions

Easy but limited effectiveness

  1. automatically trim out bnd values outside of the model running period. (easy in appearance but need to move the texture allocation away )

More tricky

  • Use a moving windows of texture value
  • Implement an out of texture technique. It seems overkill to use texture when in reality we are doing simple 1D interpolations. holding interpolation weights in memory might make this supper fast and totally independent of size of the (trim) boundary array.

Check the modification of the ParametersList-py.md

The update of the ParametersList-py.md file by the action is made on the master branch. This is useful but the development branch happens to have an old version of this file, not up-to-date to the code located on this branch.
Would it be possible to modify the actions function to update both branches?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.