File Testing.h
Go to the source code of this file
#include "General.h"
#include "Param.h"
#include "Write_txtlog.h"
#include "ReadInput.h"
#include "ReadForcing.h"
#include "Util_CPU.h"
#include "Arrays.h"
#include "Forcing.h"
#include "Mesh.h"
#include "Setup_GPU.h"
#include "Mainloop.h"
#include "FlowCPU.h"
#include "FlowGPU.h"
#include "Adaptation.h"
#include "utctime.h"
Public Functions
Type | Name |
---|---|
void | CompareCPUvsGPU (Param XParam, Model< T > XModel, Model< T > XModel_g, std::vector< std::string > varlist, bool checkhalo) Compares the Variables in a CPU model and a GPU models This function is quite useful when checking both are identical enough one needs to provide a list (vector<string>) of variable to check. |
bool | GaussianHumptest (T zsnit, int gpu, bool compare) Gaussian hump propagation test. |
bool | MassConserveSteepSlope (T zsnit, int gpu) River inflow mass conservation test on steep slope. |
bool | Rainlossestest (T zsnit, int gpu, float alpha) Test the Initial and Continuous losses implementation This function tests the Initial Losses and Continuous Losses implementation a plain domain, under constant rain. The function creates its own model setup and mesh independantly to what the user inputs. This starts with a initial water level (zsinit=0.0 is dry) and runs for 1s comparing results every 0.1s (that is approx 20 steps) |
bool | Raintest (T zsnit, int gpu, float alpha, int engine) Test the rain input and mass conservation This function tests the mass conservation of the spacial injection (used to model rain on grid) The function creates its own model setup and mesh independantly to what the user inputs. This starts with a initial water level (zsnit=0.0 is dry) and runs for 0.1s before comparing results with zsnit=0.1 that is approx 20 steps. |
bool | Raintestinput (int gpu) Test the rain input options This function tests the different inputs for rain forcing. This test is based on the paper Aureli2020, the 3 slopes test with regional rain. The experiment has been presented in Iwagaki1955. The first test compares a time varying rain input using a uniform time serie forcing and a time varying 2D field (with same value). The second test check the 3D rain forcing (comparing it to expected values). |
std::vector< float > | Raintestmap (int gpu, int dimf, T zinit) Test the rain input options and return the flux at the bottom of the slope This function return the flux at the bottom of the 3 part slope for different types of rain forcings using the test case based on Iwagaki1955. |
bool | Rivertest (T zsnit, int gpu) River inflow mass conservation test. |
bool | TestFlexibleOutputTimes (int gpu, T ref, int scenario) Test the reading of flexible output times. |
bool | TestMultiBathyRough (int gpu, T ref, int secnario) Test the reading of multiple bathymetry and roughness files. |
bool | Testing (Param XParam, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g) Wrapping function for all the inbuilt test This function is the entry point to other function below. |
void | TestingOutput (Param XParam, Model< T > XModel) OUTDATED ?Test the output functions of the model OUTDATED? This function tests the output functions of the model by running a simple simulation and writing the output to a netcdf file. |
bool | ZoneOutputTest (int nzones, T zsinit) Test the zoned output This function test the zoned output for a basic configuration. |
void | copyBlockinfo2var (Param XParam, BlockP< T > XBlock, int * blkinfo, T * z) Copies block info to an output variable This function copies block info to an output variable This function is somewhat useful when checking bugs in the mesh refinement or coarsening one needs to provide a pointer(z) allocated on the CPU to store the clockinfo This fonction only works on CPU. |
void | copyID2var (Param XParam, BlockP< T > XBlock, T * z) Copies block ID to an output variable This function copies block info to an output variable This function is somewhat useful when checking bugs in the mesh refinement or coarsening one needs to provide a pointer(z) allocated on the CPU to store the clockinfo This fonction only works on CPU. |
bool | testboundaries (Param XParam, T maxslope) |
Public Functions Documentation
function CompareCPUvsGPU
Compares the Variables in a CPU model and a GPU models This function is quite useful when checking both are identical enough one needs to provide a list (vector<string>) of variable to check.
template<class T>
void CompareCPUvsGPU (
Param XParam,
Model < T > XModel,
Model < T > XModel_g,
std::vector< std::string > varlist,
bool checkhalo
)
!
Parameters:
XParam
Model parametersXModel
Model structure (CPU)XModel_g
Model structure (GPU)varlist
List of variable names to check (as in OutputVarMap)checkhalo
true if halo cells should be checked, false otherwise
function GaussianHumptest
Gaussian hump propagation test.
!
This function tests the full hydrodynamics model and compares the results with pre-conmputed (Hard wired) values The function creates it own model setup and mesh independantly to what the user might want to do The setup consist of a centrally located gaussian hump radiating away The test stops at an arbitrary time to compare with 8 values extracted from a identical run in basilisk This function also compares the result of the GPU and CPU code (until they diverge)
Parameters:
zsnit
Initial water surface elevation at the centre of the domaingpu
GPU device number to use (-1 for CPU only)compare
If true, compare GPU and CPU results (GPU required)
Returns:
true if the test passed (results within 1e-6 of reference values)
function MassConserveSteepSlope
River inflow mass conservation test on steep slope.
!
This function tests the mass conservation of the vertical injection (used for rivers) The function creates it own model setup and mesh independantly to what the user might want to do This starts with a initial water level (zsnit=0 is dry) and runs for 0.1s before comparing results with zsnit=0.1 that is approx 20 steps
Parameters:
zsnit
Initial water surface elevation at the centre of the domaingpu
GPU device number to use (-1 for CPU only)
Returns:
true if the test passed (mass conservation within 5%)
function Rainlossestest
Test the Initial and Continuous losses implementation This function tests the Initial Losses and Continuous Losses implementation a plain domain, under constant rain. The function creates its own model setup and mesh independantly to what the user inputs. This starts with a initial water level (zsinit=0.0 is dry) and runs for 1s comparing results every 0.1s (that is approx 20 steps)
!
Parameters:
zsinit
Initial water levelgpu
GPU device to use (or -1 for CPU)alpha
Tolerance for the test (relative error)
Returns:
true if test passed
function Raintest
Test the rain input and mass conservation This function tests the mass conservation of the spacial injection (used to model rain on grid) The function creates its own model setup and mesh independantly to what the user inputs. This starts with a initial water level (zsnit=0.0 is dry) and runs for 0.1s before comparing results with zsnit=0.1 that is approx 20 steps.
!
Parameters:
zsnit
Initial water levelgpu
GPU device to use (or -1 for CPU)alpha
Slope of the bathymetry in %engine
Engine to use (0=non-hydrostatic, 1=hydrostatic)
Returns:
true if test passed
function Raintestinput
Test the rain input options This function tests the different inputs for rain forcing. This test is based on the paper Aureli2020, the 3 slopes test with regional rain. The experiment has been presented in Iwagaki1955. The first test compares a time varying rain input using a uniform time serie forcing and a time varying 2D field (with same value). The second test check the 3D rain forcing (comparing it to expected values).
!
Parameters:
gpu
GPU device to use (or -1 for CPU)
Returns:
true if test passed
function Raintestmap
Test the rain input options and return the flux at the bottom of the slope This function return the flux at the bottom of the 3 part slope for different types of rain forcings using the test case based on Iwagaki1955.
! \fnstdvector<float> Raintestmap(int gpu, int dimf, T zinit)
Parameters:
gpu
GPU device to use (or -1 for CPU)dimf
Dimension of the rain forcing (1=uniform, 3=2zinit
Initial water level
Returns:
vector of flux at the bottom of the slope
function Rivertest
River inflow mass conservation test.
!
This function tests the mass conservation of the vertical injection (used for rivers) The function creates it own model setup and mesh independantly to what the user might want to do This starts with a initial water level (zsnit=0 is dry) and runs for 0.1s before comparing results with zsnit=0.1 that is approx 20 steps
Parameters:
zsnit
Initial water surface elevation at the centre of the domaingpu
GPU device number to use (-1 for CPU only)
Returns:
true if the test is successful (mass is conserved within 0.1% of the theoretical value)
function TestFlexibleOutputTimes
Test the reading of flexible output times.
This function creates a case set-up with a param file, read it. It tests the reading and default values used for times outputs. It checks the vectors for time outputs.
Parameters:
gpu
GPU to use (-1 for CPU only)ref
Reference elevation for the bathymetry filesscenario
Scenario to test (not used here but could be used to test different input cases)
Returns:
true if test passed (i.e. the model runs without crashing and gives a reasonable result)
function TestMultiBathyRough
Test the reading of multiple bathymetry and roughness files.
!
This function creates bathy and roughtness files and tests their reading (and interpolation) The objectif is particularly to test multi bathy/roughness inputs and value/file input.
Parameters:
gpu
GPU to use (-1 for CPU only)ref
Reference elevation for the bathymetry filesscenario
Scenario to test (0: R1 in the middle of the domain, 1: R1 covering the whole domain)
Returns:
true if test passed (i.e. the model runs without crashing and gives a reasonable result)
function Testing
Wrapping function for all the inbuilt test This function is the entry point to other function below.
template<class T>
bool Testing (
Param XParam,
Forcing < float > XForcing,
Model < T > XModel,
Model < T > XModel_g
)
Test 0 is a gausian hump propagating on a flat uniorm cartesian mesh (both GPU and CPU version tested) Test 1 is vertical discharge on a flat uniorm cartesian mesh (GPU or CPU version) Test 2 Gaussian wave on Cartesian grid (same as test 0): CPU vs GPU (GPU required) Test 3 Test Reduction algorithm Test 4 Boundary condition test Test 5 Lake at rest test for Ardusse/kurganov reconstruction/scheme Test 6 Mass conservation on a slope Test 7 Mass conservation with rain fall on grid Test 8 Rain Map forcing (comparison map and Time Serie and test case with slope and non-uniform rain map) Test 9 Zoned output (test zoned outputs with adaptative grid) Test 10 Initial Loss / Continuous Loss on a slope, under uniform rain Test 11 Wet/dry Instability test with Conserve Elevation Test 12 Calendar time to second conversion Test 13 Multi bathy and roughness map input Test 14 Test AOI bnds aswall to start with Test 15 Flexible times reading
Test 99 Run all the test with test number < 99.
The following test are not independant, they are tools to check or debug a personnal case Test 998 Compare resuts between the CPU and GPU Flow functions (GPU required) Test 999 Run the main loop and engine in debug mode
Parameters:
XParam
Simulation parametersXForcing
Forcing data structureXModel
Host model data structureXModel_g
Device model data structure
Returns:
true if all the tests passed
function TestingOutput
OUTDATED ?Test the output functions of the model OUTDATED? This function tests the output functions of the model by running a simple simulation and writing the output to a netcdf file.
!
Parameters:
function ZoneOutputTest
Test the zoned output This function test the zoned output for a basic configuration.
!
Parameters:
nzones
Number of zones to test (1 or 3)zsinit
Initial water level
Returns:
true if test passed
function copyBlockinfo2var
Copies block info to an output variable This function copies block info to an output variable This function is somewhat useful when checking bugs in the mesh refinement or coarsening one needs to provide a pointer(z) allocated on the CPU to store the clockinfo This fonction only works on CPU.
template<class T>
void copyBlockinfo2var (
Param XParam,
BlockP < T > XBlock,
int * blkinfo,
T * z
)
!
Parameters:
XParam
Model parameters (only nblk, blkwidth, xo, yo, xmax, ymax and dx are used)XBlock
Block parameters (only active is used)blkinfo
Block information array (CPU)z
Array to fill
function copyID2var
Copies block ID to an output variable This function copies block info to an output variable This function is somewhat useful when checking bugs in the mesh refinement or coarsening one needs to provide a pointer(z) allocated on the CPU to store the clockinfo This fonction only works on CPU.
!
Parameters:
XParam
Model parameters (only nblk, blkwidth, xo, yo, xmax, ymax and dx are used)XBlock
Block parameters (only active is used)z
Array to fill
function testboundaries
The documentation for this class was generated from the following file src/Testing.h