BG_Flood  0.8
Documentation (Work-in-progress)
Testing.cu File Reference
#include "Testing.h"
Include dependency graph for Testing.cu:

Functions

template<class T >
bool Testing (Param XParam, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g)
 
template bool Testing< float > (Param XParam, Forcing< float > XForcing, Model< float > XModel, Model< float > XModel_g)
 
template bool Testing< double > (Param XParam, Forcing< float > XForcing, Model< double > XModel, Model< double > XModel_g)
 
template<class T >
bool GaussianHumptest (T zsnit, int gpu, bool compare)
 
template bool GaussianHumptest< float > (float zsnit, int gpu, bool compare)
 
template bool GaussianHumptest< double > (double zsnit, int gpu, bool compare)
 
template<class T >
bool Rivertest (T zsnit, int gpu)
 
template bool Rivertest< float > (float zsnit, int gpu)
 
template bool Rivertest< double > (double zsnit, int gpu)
 
template<class T >
bool MassConserveSteepSlope (T zsnit, int gpu)
 
template bool MassConserveSteepSlope< float > (float zsnit, int gpu)
 
template bool MassConserveSteepSlope< double > (double zsnit, int gpu)
 
template<class T >
bool reductiontest (Param XParam, Model< T > XModel, Model< T > XModel_g)
 
template bool reductiontest< float > (Param XParam, Model< float > XModel, Model< float > XModel_g)
 
template bool reductiontest< double > (Param XParam, Model< double > XModel, Model< double > XModel_g)
 
template<class T >
bool CPUGPUtest (Param XParam, Model< T > XModel, Model< T > XModel_g)
 
template<class T >
ValleyBathy (T x, T y, T slope, T center)
 create V shape Valley basin More...
 
template<class T >
ThackerBathy (T x, T y, T L, T D)
 create a parabolic bassin More...
 
template<class T >
bool ThackerLakeAtRest (Param XParam, T zsinit)
 
template bool ThackerLakeAtRest< float > (Param XParam, float zsinit)
 
template bool ThackerLakeAtRest< double > (Param XParam, double zsinit)
 
template<class T >
bool RiverVolumeAdapt (Param XParam, T maxslope)
 
template<class T >
bool RiverVolumeAdapt (Param XParam, T slope, bool bottop, bool flip)
 Simulate a river flowing in a steep valley and heck the Volume conservation. More...
 
template<class T >
bool testboundaries (Param XParam, T maxslope)
 
template<class T >
bool RiverOnBoundary (Param XParam, T slope, int Dir, int Bound_type)
 
template<class T >
bool LakeAtRest (Param XParam, Model< T > XModel)
 
template<class T >
void testButtingerX (Param XParam, int ib, int ix, int iy, Model< T > XModel)
 
template<class T >
void testkurganovX (Param XParam, int ib, int ix, int iy, Model< T > XModel)
 
template<class T >
bool Raintest (T zsnit, int gpu, float alpha)
 
bool Raintestinput (int gpu)
 
template<class T >
std::vector< float > Raintestmap (int gpu, int dimf, T zinit)
 
template std::vector< float > Raintestmap< float > (int gpu, int dimf, float Zsinit)
 
template std::vector< float > Raintestmap< double > (int gpu, int dimf, double Zsinit)
 
template<class T >
bool ZoneOutputTest (int nzones, T zsinit)
 
template bool ZoneOutputTest< float > (int nzones, float zsinit)
 
template bool ZoneOutputTest< double > (int nzones, double zsinit)
 
template<class T >
bool Rainlossestest (T zsinit, int gpu, float alpha)
 
template<class T >
int TestGradientSpeed (Param XParam, Model< T > XModel, Model< T > XModel_g)
 
template<class T >
bool TestHaloSpeed (Param XParam, Model< T > XModel, Model< T > XModel_g)
 
template<class T >
int TestInstability (Param XParam, Model< T > XModel, Model< T > XModel_g)
 
template<class T >
int TestFirsthalfstep (Param XParam, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g)
 
template<class T >
int Testzbinit (Param XParam, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g)
 
template<class T >
Forcing< float > MakValleyBathy (Param XParam, T slope, bool bottop, bool flip)
 
void alloc_init2Darray (float **arr, int NX, int NY)
 
void init3Darray (float ***arr, int rows, int cols, int depths)
 
template<class T >
void fillrandom (Param XParam, BlockP< T > XBlock, T *z)
 
template void fillrandom< float > (Param XParam, BlockP< float > XBlock, float *z)
 
template void fillrandom< double > (Param XParam, BlockP< double > XBlock, double *z)
 
template<class T >
void fillgauss (Param XParam, BlockP< T > XBlock, T amp, T *z)
 
template void fillgauss< float > (Param XParam, BlockP< float > XBlock, float amp, float *z)
 
template void fillgauss< double > (Param XParam, BlockP< double > XBlock, double amp, double *z)
 
template<class T >
void TestingOutput (Param XParam, Model< T > XModel)
 
template void TestingOutput< float > (Param XParam, Model< float > XModel)
 
template void TestingOutput< double > (Param XParam, Model< double > XModel)
 
template<class T >
void copyID2var (Param XParam, BlockP< T > XBlock, T *z)
 
template void copyID2var< float > (Param XParam, BlockP< float > XBlock, float *z)
 
template void copyID2var< double > (Param XParam, BlockP< double > XBlock, double *z)
 
template<class T >
void copyBlockinfo2var (Param XParam, BlockP< T > XBlock, int *blkinfo, T *z)
 
template void copyBlockinfo2var< float > (Param XParam, BlockP< float > XBlock, int *blkinfo, float *z)
 
template void copyBlockinfo2var< double > (Param XParam, BlockP< double > XBlock, int *blkinfo, double *z)
 
template<class T >
void CompareCPUvsGPU (Param XParam, Model< T > XModel, Model< T > XModel_g, std::vector< std::string > varlist, bool checkhalo)
 
template void CompareCPUvsGPU< float > (Param XParam, Model< float > XModel, Model< float > XModel_g, std::vector< std::string > varlist, bool checkhalo)
 
template void CompareCPUvsGPU< double > (Param XParam, Model< double > XModel, Model< double > XModel_g, std::vector< std::string > varlist, bool checkhalo)
 
template<class T >
void diffdh (Param XParam, BlockP< T > XBlock, T *input, T *output, T *shuffle)
 
template<class T >
void diffSource (Param XParam, BlockP< T > XBlock, T *Fqux, T *Su, T *output)
 
template<class T >
void diffArray (Param XParam, BlockP< T > XBlock, std::string varname, bool checkhalo, T *cpu, T *gpu, T *dummy, T *out)
 

Function Documentation

◆ alloc_init2Darray()

void alloc_init2Darray ( float **  arr,
int  NX,
int  NY 
)

This function allocates and fills a 2D array with zero values

◆ CompareCPUvsGPU()

template<class T >
void CompareCPUvsGPU ( Param  XParam,
Model< T >  XModel,
Model< T >  XModel_g,
std::vector< std::string >  varlist,
bool  checkhalo 
)

This function compares the Valiables 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

◆ CompareCPUvsGPU< double >()

template void CompareCPUvsGPU< double > ( Param  XParam,
Model< double >  XModel,
Model< double >  XModel_g,
std::vector< std::string >  varlist,
bool  checkhalo 
)

◆ CompareCPUvsGPU< float >()

template void CompareCPUvsGPU< float > ( Param  XParam,
Model< float >  XModel,
Model< float >  XModel_g,
std::vector< std::string >  varlist,
bool  checkhalo 
)

◆ copyBlockinfo2var()

template<class T >
void copyBlockinfo2var ( Param  XParam,
BlockP< T >  XBlock,
int *  blkinfo,
T *  z 
)

This function copies blick 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

◆ copyBlockinfo2var< double >()

template void copyBlockinfo2var< double > ( Param  XParam,
BlockP< double >  XBlock,
int *  blkinfo,
double *  z 
)

◆ copyBlockinfo2var< float >()

template void copyBlockinfo2var< float > ( Param  XParam,
BlockP< float >  XBlock,
int *  blkinfo,
float *  z 
)

◆ copyID2var()

template<class T >
void copyID2var ( Param  XParam,
BlockP< T >  XBlock,
T *  z 
)

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

◆ copyID2var< double >()

template void copyID2var< double > ( Param  XParam,
BlockP< double >  XBlock,
double *  z 
)

◆ copyID2var< float >()

template void copyID2var< float > ( Param  XParam,
BlockP< float >  XBlock,
float *  z 
)

◆ CPUGPUtest()

template<class T >
bool CPUGPUtest ( Param  XParam,
Model< T >  XModel,
Model< T >  XModel_g 
)

◆ diffArray()

template<class T >
void diffArray ( Param  XParam,
BlockP< T >  XBlock,
std::string  varname,
bool  checkhalo,
T *  cpu,
T *  gpu,
T *  dummy,
T *  out 
)

◆ diffdh()

template<class T >
void diffdh ( Param  XParam,
BlockP< T >  XBlock,
T *  input,
T *  output,
T *  shuffle 
)

This function Calculates The difference in left and right flux terms. This function is quite useful when checking for Lake-at-Rest states This function requires a preallocated output and a shuffle (right side term) CPU pointers to save the result of teh calculation

◆ diffSource()

template<class T >
void diffSource ( Param  XParam,
BlockP< T >  XBlock,
T *  Fqux,
T *  Su,
T *  output 
)

This function Calculate The source term of the equation. This function is quite useful when checking for Lake-at-Rest states This function requires an outputCPU pointers to save the result of teh calculation

◆ fillgauss()

template<class T >
void fillgauss ( Param  XParam,
BlockP< T >  XBlock,
amp,
T *  z 
)

This function fill an array with a gaussian bump

borrowed/adapted from Basilisk test (?)

◆ fillgauss< double >()

template void fillgauss< double > ( Param  XParam,
BlockP< double >  XBlock,
double  amp,
double *  z 
)

◆ fillgauss< float >()

template void fillgauss< float > ( Param  XParam,
BlockP< float >  XBlock,
float  amp,
float *  z 
)

◆ fillrandom()

template<class T >
void fillrandom ( Param  XParam,
BlockP< T >  XBlock,
T *  z 
)

This function fill an array with random values (0 - 1)

◆ fillrandom< double >()

template void fillrandom< double > ( Param  XParam,
BlockP< double >  XBlock,
double *  z 
)

◆ fillrandom< float >()

template void fillrandom< float > ( Param  XParam,
BlockP< float >  XBlock,
float *  z 
)

◆ GaussianHumptest()

template<class T >
bool GaussianHumptest ( zsnit,
int  gpu,
bool  compare 
)

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)

◆ GaussianHumptest< double >()

template bool GaussianHumptest< double > ( double  zsnit,
int  gpu,
bool  compare 
)

◆ GaussianHumptest< float >()

template bool GaussianHumptest< float > ( float  zsnit,
int  gpu,
bool  compare 
)

◆ init3Darray()

void init3Darray ( float ***  arr,
int  rows,
int  cols,
int  depths 
)

This function fill a 3D array with zero values

◆ LakeAtRest()

template<class T >
bool LakeAtRest ( Param  XParam,
Model< T >  XModel 
)

This function simulates the first predictive step and check whether the lake at rest is preserved otherwise it prints out to screen the cells (and neighbour) where the test fails

◆ MakValleyBathy()

template<class T >
Forcing<float> MakValleyBathy ( Param  XParam,
slope,
bool  bottop,
bool  flip 
)

◆ MassConserveSteepSlope()

template<class T >
bool MassConserveSteepSlope ( zsnit,
int  gpu 
)

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

◆ MassConserveSteepSlope< double >()

template bool MassConserveSteepSlope< double > ( double  zsnit,
int  gpu 
)

◆ MassConserveSteepSlope< float >()

template bool MassConserveSteepSlope< float > ( float  zsnit,
int  gpu 
)

◆ Rainlossestest()

template<class T >
bool Rainlossestest ( zsnit,
int  gpu,
float  alpha 
)

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)

◆ Raintest()

template<class T >
bool Raintest ( zsnit,
int  gpu,
float  alpha 
)

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

◆ Raintestinput()

bool Raintestinput ( int  gpu)

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).

◆ Raintestmap()

template<class T >
std::vector<float> Raintestmap ( int  gpu,
int  dimf,
zinit 
)

\fnstd::vector<float> Raintestmap(int gpu, int dimf, T zinit)

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

◆ Raintestmap< double >()

template std::vector<float> Raintestmap< double > ( int  gpu,
int  dimf,
double  Zsinit 
)

◆ Raintestmap< float >()

template std::vector<float> Raintestmap< float > ( int  gpu,
int  dimf,
float  Zsinit 
)

◆ reductiontest()

template<class T >
T reductiontest ( Param  XParam,
Model< T >  XModel,
Model< T >  XModel_g 
)

Test the algorithm for reducing the global time step on the user grid layout

◆ reductiontest< double >()

template bool reductiontest< double > ( Param  XParam,
Model< double >  XModel,
Model< double >  XModel_g 
)

◆ reductiontest< float >()

template bool reductiontest< float > ( Param  XParam,
Model< float >  XModel,
Model< float >  XModel_g 
)

◆ RiverOnBoundary()

template<class T >
bool RiverOnBoundary ( Param  XParam,
slope,
int  Dir,
int  Bound_type 
)

◆ Rivertest()

template<class T >
bool Rivertest ( zsnit,
int  gpu 
)

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

◆ Rivertest< double >()

template bool Rivertest< double > ( double  zsnit,
int  gpu 
)

◆ Rivertest< float >()

template bool Rivertest< float > ( float  zsnit,
int  gpu 
)

◆ RiverVolumeAdapt() [1/2]

template<class T >
bool RiverVolumeAdapt ( Param  XParam,
maxslope 
)

◆ RiverVolumeAdapt() [2/2]

template<class T >
bool RiverVolumeAdapt ( Param  XParam,
slope,
bool  bottop,
bool  flip 
)

Simulate a river flowing in a steep valley and heck the Volume conservation.

This function creates a dry steep valley topography to a given level and run the model for a while and checks that the Volume matches the theory.

The function can test the water volume for 4 scenario each time:

  • left to right: bottop=false & flip=true;
  • right to left: bottop=false & flip=false;
  • bottom to top: bottop=true & flip=true;
  • top to bottom: bottop=true & flip=false;

The function inherits the adaptation set in XParam so needs to be rerun to accnout for the different scenarios:

  • uniform level
  • flow from coasrse to fine
  • flow from fine to coarse This is done in the higher level wrapping function

◆ testboundaries()

template<class T >
bool testboundaries ( Param  XParam,
maxslope 
)

◆ testButtingerX()

template<class T >
void testButtingerX ( Param  XParam,
int  ib,
int  ix,
int  iy,
Model< T >  XModel 
)

This function goes through the Buttinger scheme but instead of the normal output just prints all teh usefull values This function is/was used in the lake-at-rest verification

See also: void testkurganovX(Param XParam, int ib, int ix, int iy, Model<T> XModel)

◆ TestFirsthalfstep()

template<class T >
int TestFirsthalfstep ( Param  XParam,
Forcing< float >  XForcing,
Model< T >  XModel,
Model< T >  XModel_g 
)

◆ TestGradientSpeed()

template<class T >
void TestGradientSpeed ( Param  XParam,
Model< T >  XModel,
Model< T >  XModel_g 
)

This function fill an array with random values (0 - 1)

This function test the spped and accuracy of a new gradient function gradient are only calculated for zb but assigned to different gradient variable for storage

◆ TestHaloSpeed()

template<class T >
bool TestHaloSpeed ( Param  XParam,
Model< T >  XModel,
Model< T >  XModel_g 
)

◆ Testing()

template<class T >
bool Testing ( Param  XParam,
Forcing< float >  XForcing,
Model< T >  XModel,
Model< T >  XModel_g 
)

◆ Testing< double >()

template bool Testing< double > ( Param  XParam,
Forcing< float >  XForcing,
Model< double >  XModel,
Model< double >  XModel_g 
)

◆ Testing< float >()

template bool Testing< float > ( Param  XParam,
Forcing< float >  XForcing,
Model< float >  XModel,
Model< float >  XModel_g 
)

◆ TestingOutput()

template<class T >
TestingOutput ( Param  XParam,
Model< T >  XModel 
)

OUTDATED?

◆ TestingOutput< double >()

template void TestingOutput< double > ( Param  XParam,
Model< double >  XModel 
)

◆ TestingOutput< float >()

template void TestingOutput< float > ( Param  XParam,
Model< float >  XModel 
)

◆ TestInstability()

template<class T >
int TestInstability ( Param  XParam,
Model< T >  XModel,
Model< T >  XModel_g 
)

◆ testkurganovX()

template<class T >
void testkurganovX ( Param  XParam,
int  ib,
int  ix,
int  iy,
Model< T >  XModel 
)

This function goes through the Kurganov scheme but instead of the normal output just prints all teh usefull values This function is/was used in the lake-at-rest verification

◆ Testzbinit()

template<class T >
int Testzbinit ( Param  XParam,
Forcing< float >  XForcing,
Model< T >  XModel,
Model< T >  XModel_g 
)

◆ ThackerBathy()

template<class T >
T ThackerBathy ( x,
y,
L,
D 
)

create a parabolic bassin

This function creates a parabolic bassin. The function returns a single value of the bassin

Borrowed from Buttinger et al. 2019.

Reference

Buttinger-Kreuzhuber, A., Horváth, Z., Noelle, S., Blöschl, G., and Waser, J.: A fast second-order shallow water scheme on two-dimensional structured grids over abrupt topography, Advances in water resources, 127, 89–108, 2019.

◆ ThackerLakeAtRest()

template<class T >
bool ThackerLakeAtRest ( Param  XParam,
zsinit 
)

◆ ThackerLakeAtRest< double >()

template bool ThackerLakeAtRest< double > ( Param  XParam,
double  zsinit 
)

◆ ThackerLakeAtRest< float >()

template bool ThackerLakeAtRest< float > ( Param  XParam,
float  zsinit 
)

◆ ValleyBathy()

template<class T >
T ValleyBathy ( x,
y,
slope,
center 
)

create V shape Valley basin

This function creates a simple V shape Valley basin

◆ ZoneOutputTest()

template<class T >
bool testzoneOutDef ZoneOutputTest ( int  nzones,
zsinit 
)

This function test the zoned output for a basic configuration

This function test the spped and accuracy of a new gradient function gradient are only calculated for zb but assigned to different gradient variable for storage

◆ ZoneOutputTest< double >()

template bool ZoneOutputTest< double > ( int  nzones,
double  zsinit 
)

◆ ZoneOutputTest< float >()

template bool ZoneOutputTest< float > ( int  nzones,
float  zsinit 
)