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

Roughness map files starting with a digit #105

Open CyprienBosserelle opened 5 months ago

CyprienBosserelle commented 5 months ago

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:

CyprienBosserelle commented 5 months ago

102