File Testing.cu
FileList > src > Testing.cu
Go to the source code of this file
#include "Testing.h"
Public Functions
| Type | Name |
|---|---|
| bool | CPUGPUtest (Param XParam, Model< T > XModel, Model< T > XModel_g) |
| 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. |
| template void | CompareCPUvsGPU< double > (Param XParam, Model< double > XModel, Model< double > 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) |
| bool | GaussianHumptest (T zsnit, int gpu, bool compare) Gaussian hump propagation test. |
| template bool | GaussianHumptest< double > (double zsnit, int gpu, bool compare) |
| template bool | GaussianHumptest< float > (float zsnit, int gpu, bool compare) |
| bool | LakeAtRest (Param XParam, Model< T > XModel) Test the lake at rest condition 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. |
| Forcing< float > | MakValleyBathy (Param XParam, T slope, bool bottop, bool flip) Creates a valley bathymetry This function creates a valley bathymetry with a given slope and center It also adds a wall around the domain to avoid boundary effects. |
| bool | MassConserveSteepSlope (T zsnit, int gpu) River inflow mass conservation test on steep slope. |
| template bool | MassConserveSteepSlope< double > (double zsnit, int gpu) |
| template bool | MassConserveSteepSlope< float > (float zsnit, int gpu) |
| bool | Rainlossestest (T zsinit, 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. |
| template std::vector< float > | Raintestmap< double > (int gpu, int dimf, double Zsinit) |
| template std::vector< float > | Raintestmap< float > (int gpu, int dimf, float Zsinit) |
| bool | RiverOnBoundary (Param XParam, T slope, int Dir, int Bound_type) |
| bool | RiverVolumeAdapt (Param XParam, T maxslope) |
| bool | RiverVolumeAdapt (Param XParam, T slope, bool bottop, bool flip) Simulate a river flowing in a steep valley and heck the Volume conservation. |
| bool | Rivertest (T zsnit, int gpu) River inflow mass conservation test. |
| template bool | Rivertest< double > (double zsnit, int gpu) |
| template bool | Rivertest< float > (float zsnit, int gpu) |
| int | TestAIObnd (Param XParam, Model< T > XModel, Model< T > XModel_g, bool bottop, bool flip, bool withaoi) Test the aoibnd option of the model This function tests the aoibnd option of the model on a valley domain with a small amount of water 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 20s. |
| void | TestFirsthalfstep (Param XParam, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g) Test the first half step of the model This function tests the first half step of the model on a sloping domain with a small amount of water 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. |
| bool | TestFlexibleOutputTimes (int gpu, T ref, int scenario) Test the reading of flexible output times. |
| int | TestGradientSpeed (Param XParam, Model< T > XModel, Model< T > XModel_g) Test the speed of different gradient functions This function fill an array with random values (0 - 1) |
| bool | TestHaloSpeed (Param XParam, Model< T > XModel, Model< T > XModel_g) Test the speed of different halo filling functions This function test the speed and accuracy of a new gradient function gradient are only calculated for zb but assigned to different gradient variable for storage. |
| int | TestInstability (Param XParam, Model< T > XModel, Model< T > XModel_g) Test the stability of the model This function tests the stability of the model on a sloping domain with a small amount of water 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. |
| bool | TestMultiBathyRough (int gpu, T ref, int scenario) Test the reading of multiple bathymetry and roughness files. |
| int | TestPinMem (Param XParam, Model< T > XModel, Model< T > XModel_g) Test the pin memory allocation and transfer between CPU and GPU This function allocates a pinned memory array on the CPU, fills it with values, transfers it to the GPU, modifies it there, and transfers it back to the CPU. It then checks that the values have been correctly modified. |
| template int | TestPinMem< double > (Param XParam, Model< double > XModel, Model< double > XModel_g) |
| template int | TestPinMem< float > (Param XParam, Model< float > XModel, Model< float > XModel_g) |
| 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. |
| template bool | Testing< double > (Param XParam, Forcing< float > XForcing, Model< double > XModel, Model< double > XModel_g) |
| template bool | Testing< float > (Param XParam, Forcing< float > XForcing, Model< float > XModel, Model< float > XModel_g) |
| 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. |
| template void | TestingOutput< double > (Param XParam, Model< double > XModel) |
| template void | TestingOutput< float > (Param XParam, Model< float > XModel) |
| void | Testzbinit (Param XParam, Forcing< float > XForcing, Model< T > XModel, Model< T > XModel_g) Test the zbinit option of the model This function tests the zbinit option of the model on a sloping domain with a small amount of water 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. |
| T | ThackerBathy (T x, T y, T L, T D) create a parabolic bassin |
| bool | ThackerLakeAtRest (Param XParam, T zsinit) Simulate the Lake-at-rest in a parabolic bassin. |
| template bool | ThackerLakeAtRest< double > (Param XParam, double zsinit) |
| template bool | ThackerLakeAtRest< float > (Param XParam, float zsinit) |
| T | ValleyBathy (T x, T y, T slope, T center) create V shape Valley basin |
| bool | ZoneOutputTest (int nzones, T zsinit) Test the zoned output This function test the zoned output for a basic configuration. |
| template bool | ZoneOutputTest< double > (int nzones, double zsinit) |
| template bool | ZoneOutputTest< float > (int nzones, float zsinit) |
| void | alloc_init2Darray (float ** arr, int NX, int NY) Allocates and initializes a 2D array This function allocates and fills a 2D array with zero values. |
| 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. |
| template void | copyBlockinfo2var< double > (Param XParam, BlockP< double > XBlock, int * blkinfo, double * z) |
| template void | copyBlockinfo2var< float > (Param XParam, BlockP< float > XBlock, int * blkinfo, float * z) |
| 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. |
| template void | copyID2var< double > (Param XParam, BlockP< double > XBlock, double * z) |
| template void | copyID2var< float > (Param XParam, BlockP< float > XBlock, float * z) |
| void | diffArray (Param XParam, BlockP< T > XBlock, std::string varname, bool checkhalo, T * cpu, T * gpu, T * dummy, T * out) |
| void | diffSource (Param XParam, BlockP< T > XBlock, T * Fqux, T * Su, T * output) Calculate The source term of the equation 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 the calculation. |
| void | diffdh (Param XParam, BlockP< T > XBlock, T * input, T * output, T * shuffle) Calculate The difference between adjacent cells in an array 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. |
| void | fillgauss (Param XParam, BlockP< T > XBlock, T amp, T * z) Fill an array with a gaussian bump This function fill an array with a gaussian bump. |
| template void | fillgauss< double > (Param XParam, BlockP< double > XBlock, double amp, double * z) |
| template void | fillgauss< float > (Param XParam, BlockP< float > XBlock, float amp, float * z) |
| void | fillrandom (Param XParam, BlockP< T > XBlock, T * z) Fill an array with random values This function fill an array with random values (0 - 1) |
| template void | fillrandom< double > (Param XParam, BlockP< double > XBlock, double * z) |
| template void | fillrandom< float > (Param XParam, BlockP< float > XBlock, float * z) |
| void | init3Darray (float *** arr, int rows, int cols, int depths) Initializes a 3D array This function fill a 3D array with zero values. |
| bool | reductiontest (Param XParam, Model< T > XModel, Model< T > XModel_g) Reduction test Test the algorithm for reducing the global time step on the user grid layout. |
| template bool | reductiontest< double > (Param XParam, Model< double > XModel, Model< double > XModel_g) |
| template bool | reductiontest< float > (Param XParam, Model< float > XModel, Model< float > XModel_g) |
| void | testButtingerX (Param XParam, int ib, int ix, int iy, Model< T > XModel) Test the Buttinger scheme in X direction 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. |
| bool | testboundaries (Param XParam, T maxslope) |
| void | testkurganovX (Param XParam, int ib, int ix, int iy, Model< T > XModel) Test the Kurganov scheme in X direction 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 See also: void testButtingerX(Param XParam, int ib, int ix, int iy, Model<T> XModel) |
| __global__ void | vectoroffsetGPU (int nx, T offset, T * z) A simple kernel to add an offset to a vector This is used to test the pin memory allocation and transfer between CPU and GPU. |
Public Functions Documentation
function CPUGPUtest
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:
XParamModel parametersXModelModel structure (CPU)XModel_gModel structure (GPU)varlistList of variable names to check (as in OutputVarMap)checkhalotrue if halo cells should be checked, false otherwise
function CompareCPUvsGPU< double >
template void CompareCPUvsGPU< double > (
Param XParam,
Model < double > XModel,
Model < double > XModel_g,
std::vector< std::string > varlist,
bool checkhalo
)
function CompareCPUvsGPU< float >
template void CompareCPUvsGPU< float > (
Param XParam,
Model < float > XModel,
Model < float > XModel_g,
std::vector< std::string > varlist,
bool checkhalo
)
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:
zsnitInitial water surface elevation at the centre of the domaingpuGPU device number to use (-1 for CPU only)compareIf true, compare GPU and CPU results (GPU required)
Returns:
true if the test passed (results within 1e-6 of reference values)
function GaussianHumptest< double >
function GaussianHumptest< float >
function LakeAtRest
Test the lake at rest condition 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.
!
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
Parameters:
Returns:
true if test passed
function MakValleyBathy
Creates a valley bathymetry This function creates a valley bathymetry with a given slope and center It also adds a wall around the domain to avoid boundary effects.
template<class T>
Forcing < float > MakValleyBathy (
Param XParam,
T slope,
bool bottop,
bool flip
)
Parameters:
XParamModel parameters (only used to set the mesh size)slopeSlope of the valleybottoptrue if the valley is oriented in the y direction (i.e. bottom/top boundaries), false if in the x direction (i.e. left/right boundaries)fliptrue if the valley is oriented towards top or right, false if towards bottom or left
Returns:
A Forcing structure containing the bathymetry
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:
zsnitInitial water surface elevation at the centre of the domaingpuGPU device number to use (-1 for CPU only)
Returns:
true if the test passed (mass conservation within 5%)
function MassConserveSteepSlope< double >
function MassConserveSteepSlope< float >
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:
zsinitInitial water levelgpuGPU device to use (or -1 for CPU)alphaTolerance 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:
zsnitInitial water levelgpuGPU device to use (or -1 for CPU)alphaSlope of the bathymetry in %engineEngine 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:
gpuGPU 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:
gpuGPU device to use (or -1 for CPU)dimfDimension of the rain forcing (1=uniform, 3=2zinitInitial water level
Returns:
vector of flux at the bottom of the slope
function Raintestmap< double >
function Raintestmap< float >
function RiverOnBoundary
function RiverVolumeAdapt
function RiverVolumeAdapt
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 account for the different scenarios: * uniform level * flow from coarse to fine * flow from fine to coarse This is done in the higher level wrapping function
Parameters:
XParamModel parametersslopeslope of the valley sidesbottopif true the river flows bottom to top, if false left to rightflipif true the river flows right to left or top to bottom, if false left to right or bottom to top
Returns:
true if test passed
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:
zsnitInitial water surface elevation at the centre of the domaingpuGPU 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 Rivertest< double >
function Rivertest< float >
function TestAIObnd
Test the aoibnd option of the model This function tests the aoibnd option of the model on a valley domain with a small amount of water 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 20s.
template<class T>
int TestAIObnd (
Param XParam,
Model < T > XModel,
Model < T > XModel_g,
bool bottop,
bool flip,
bool withaoi
)
Parameters:
XParamModel parametersXModelModel structure (CPU)XModel_gModel structure (GPU)bottoptrue if the boundary condition to test is bottom/top, false for left/rightfliptrue if the boundary condition to test is top or right, false for bottom or leftwithaoitrue if the AOI is to be used, false otherwise
Returns:
1 if the test passed (i.e. the model runs without crashing and gives a reasonable result), 0 otherwise
function TestFirsthalfstep
Test the first half step of the model This function tests the first half step of the model on a sloping domain with a small amount of water 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.
template<class T>
void TestFirsthalfstep (
Param XParam,
Forcing < float > XForcing,
Model < T > XModel,
Model < T > XModel_g
)
Parameters:
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:
gpuGPU to use (-1 for CPU only)refReference elevation for the bathymetry filesscenarioScenario 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 TestGradientSpeed
Test the speed of different gradient functions 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
Parameters:
Returns:
1 if test passed
function TestHaloSpeed
Test the speed of different halo filling functions This function test the speed and accuracy of a new gradient function gradient are only calculated for zb but assigned to different gradient variable for storage.
!
Parameters:
Returns:
true if test passed
function TestInstability
Test the stability of the model This function tests the stability of the model on a sloping domain with a small amount of water 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.
Parameters:
Returns:
0 if test failed (i.e. unstable), 1 if test passed
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:
gpuGPU to use (-1 for CPU only)refReference elevation for the bathymetry filesscenarioScenario 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 TestPinMem
Test the pin memory allocation and transfer between CPU and GPU This function allocates a pinned memory array on the CPU, fills it with values, transfers it to the GPU, modifies it there, and transfers it back to the CPU. It then checks that the values have been correctly modified.
Parameters:
XParamModel parameters (only GPUDEVICE is used)XModelModel structure (CPU)XModel_gModel structure (GPU)
Returns:
1 if the test passed (i.e. the values are as expected), 0 otherwise
function TestPinMem< double >
template int TestPinMem< double > (
Param XParam,
Model < double > XModel,
Model < double > XModel_g
)
function TestPinMem< float >
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:
XParamSimulation parametersXForcingForcing data structureXModelHost model data structureXModel_gDevice model data structure
Returns:
true if all the tests passed
function Testing< double >
template bool Testing< double > (
Param XParam,
Forcing < float > XForcing,
Model < double > XModel,
Model < double > XModel_g
)
function Testing< float >
template bool Testing< float > (
Param XParam,
Forcing < float > XForcing,
Model < float > XModel,
Model < float > XModel_g
)
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 TestingOutput< double >
function TestingOutput< float >
function Testzbinit
Test the zbinit option of the model This function tests the zbinit option of the model on a sloping domain with a small amount of water 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.
template<class T>
void Testzbinit (
Param XParam,
Forcing < float > XForcing,
Model < T > XModel,
Model < T > XModel_g
)
Parameters:
function ThackerBathy
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.
Parameters:
xx coordinateyy coordinateLcharacteristic length scale of the bassinDcharacteristic depth of the bassin
Returns:
the depth of the basin at point (x,y)
function ThackerLakeAtRest
Simulate the Lake-at-rest in a parabolic bassin.
This function creates a parabolic bassin filled to a given level and run the modle for a while and checks that the velocities in the lake remain very small thus verifying the well-balancedness of teh engine and the Lake-at-rest condition.
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.
Parameters:
XParamModel parameterszsinitinitial water surface elevation
Returns:
true if test passed
function ThackerLakeAtRest< double >
function ThackerLakeAtRest< float >
function ValleyBathy
create V shape Valley basin
!
This function creates a simple V shape Valley basin
Parameters:
xx coordinateyy coordinateslopeslope of the valley sidescenterx coordinate of the valley center
Returns:
the depth of the basin at point (x,y)
function ZoneOutputTest
Test the zoned output This function test the zoned output for a basic configuration.
!
Parameters:
nzonesNumber of zones to test (1 or 3)zsinitInitial water level
Returns:
true if test passed
function ZoneOutputTest< double >
function ZoneOutputTest< float >
function alloc_init2Darray
Allocates and initializes a 2D array This function allocates and fills a 2D array with zero values.
!
Parameters:
arrPointer to the 2D arrayNXNumber of rowsNYNumber of columns
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:
XParamModel parameters (only nblk, blkwidth, xo, yo, xmax, ymax and dx are used)XBlockBlock parameters (only active is used)blkinfoBlock information array (CPU)zArray to fill
function copyBlockinfo2var< double >
template void copyBlockinfo2var< double > (
Param XParam,
BlockP < double > XBlock,
int * blkinfo,
double * z
)
function copyBlockinfo2var< float >
template void copyBlockinfo2var< float > (
Param XParam,
BlockP < float > XBlock,
int * blkinfo,
float * z
)
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:
XParamModel parameters (only nblk, blkwidth, xo, yo, xmax, ymax and dx are used)XBlockBlock parameters (only active is used)zArray to fill
function copyID2var< double >
function copyID2var< float >
function diffArray
template<class T>
void diffArray (
Param XParam,
BlockP < T > XBlock,
std::string varname,
bool checkhalo,
T * cpu,
T * gpu,
T * dummy,
T * out
)
function diffSource
Calculate The source term of the equation 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 the calculation.
template<class T>
void diffSource (
Param XParam,
BlockP < T > XBlock,
T * Fqux,
T * Su,
T * output
)
!
Parameters:
XParamModel parameters (only nblk and blkwidth are used)XBlockBlock parameters (only active are used)FquxInput arraySuInput arrayoutputOutput array (source term)
function diffdh
Calculate The difference between adjacent cells in an array 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.
template<class T>
void diffdh (
Param XParam,
BlockP < T > XBlock,
T * input,
T * output,
T * shuffle
)
!
Parameters:
XParamModel parameters (only nblk and blkwidth are used)XBlockBlock parameters (only active are used)inputInput arrayoutputOutput array (difference)shuffleOutput array (right side term)
function fillgauss
Fill an array with a gaussian bump This function fill an array with a gaussian bump.
!
borrowed/adapted from Basilisk test (?)
Parameters:
XParamModel parameters (only nblk, blkwidth, xo, yo, xmax, ymax and dx are used)XBlockBlock parameters (only active, level, xo and yo are used)ampAmplitude of the gaussian bumpzArray to fill
function fillgauss< double >
template void fillgauss< double > (
Param XParam,
BlockP < double > XBlock,
double amp,
double * z
)
function fillgauss< float >
function fillrandom
Fill an array with random values This function fill an array with random values (0 - 1)
!
Parameters:
XParamModel parameters (only nblk and blkwidth are used)XBlockBlock parameters (only active are used)zArray to fill
function fillrandom< double >
function fillrandom< float >
function init3Darray
Initializes a 3D array This function fill a 3D array with zero values.
!
Parameters:
arrPointer to the 3D arrayrowsNumber of rowscolsNumber of columnsdepthsNumber of depths
function reductiontest
Reduction test Test the algorithm for reducing the global time step on the user grid layout.
!
Parameters:
XParamModel parametersXModelCPU modelXModel_gGPU model
Returns:
true if test passed
function reductiontest< double >
template bool reductiontest< double > (
Param XParam,
Model < double > XModel,
Model < double > XModel_g
)
function reductiontest< float >
template bool reductiontest< float > (
Param XParam,
Model < float > XModel,
Model < float > XModel_g
)
function testButtingerX
Test the Buttinger scheme in X direction 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)
Parameters:
XParamModel parametersibBlock indexixX index in the blockiyY index in the blockXModelModel variables
function testboundaries
function testkurganovX
Test the Kurganov scheme in X direction 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 See also: void testButtingerX(Param XParam, int ib, int ix, int iy, Model<T> XModel)
!
Parameters:
XParamModel parametersibBlock indexixX index in the blockiyY index in the blockXModelModel variables
function vectoroffsetGPU
A simple kernel to add an offset to a vector This is used to test the pin memory allocation and transfer between CPU and GPU.
Parameters:
nxNumber of elements in the vectoroffsetOffset to addzVector to modify (input and output)
Template parameters:
TData type of the vector (float or double)
The documentation for this class was generated from the following file src/Testing.cu