SWE
Public Member Functions | Friends
SWE_RusanovBlockCUDA Class Reference

#include <SWE_RusanovBlockCUDA.hh>

Inheritance diagram for SWE_RusanovBlockCUDA:
SWE_BlockCUDA SWE_Block

List of all members.

Public Member Functions

 SWE_RusanovBlockCUDA (float _offsetX=0, float _offsetY=0, const int i_cudaDevice=0)
virtual ~SWE_RusanovBlockCUDA ()
virtual void computeNumericalFluxes ()
virtual void updateUnknowns (float dt)
virtual void simulateTimestep (float dt)
 execute a single time step of the simulation
virtual float simulate (float tStart, float tEnd)

Friends

ostream & operator<< (ostream &os, const SWE_RusanovBlockCUDA &swe)

Detailed Description

SWE_RusanovBlockCUDA extends the base class SWE_BlockCUDA, and provides a concrete CUDA implementation of a simple shallow water model based on Rusanov Flux computation on the edges and explicit time stepping.


Constructor & Destructor Documentation

SWE_RusanovBlockCUDA::SWE_RusanovBlockCUDA ( float  _offsetX = 0,
float  _offsetY = 0,
const int  i_cudaDevice = 0 
)

Constructor: allocate variables for simulation

unknowns h,hu,hv,b are defined on grid indices [0,..,nx+1]*[0,..,ny+1] -> computational domain is [1,..,nx]*[1,..,ny] -> plus ghost cell layer

flux terms are defined for edges with indices [0,..,nx]*[1,..,ny] or [1,..,nx]*[0,..,ny] (for horizontal/vertical edges) Flux term with index (i,j) is located on the edge between cells with index (i,j) and (i+1,j) or (i,j+1)

bathymetry source terms are defined for cells with indices [1,..,nx]*[1,..,ny]

Destructor: de-allocate all variables


Member Function Documentation

compute the flux terms on all edges

Implements SWE_Block.

__host__ float SWE_RusanovBlockCUDA::simulate ( float  tStart,
float  tEnd 
) [virtual]

perform forward-Euler time steps, starting with simulation time tStart,: until simulation time tEnd is reached; device-global variables hd, hud, hvd are updated; unknowns h, hu, hv in main memory are not updated. Ghost layers and bathymetry sources are updated between timesteps. intended as main simulation loop between two checkpoints

Implements SWE_Block.

void SWE_RusanovBlockCUDA::simulateTimestep ( float  dt) [virtual]

execute a single time step of the simulation

Depending on the current values of h, hu, hv (incl. ghost layers) update these unknowns in each grid cell (ghost layers and bathymetry are not updated). The Rusanov CUDA-implementation of simulateTimestep subsequently calls the functions computeNumericalFluxes (to compute all fluxes on grid edges), and updateUnknowns (to update the variables according to flux values, typically according to an Euler time step).

Parameters:
dtsize of the time step

Implements SWE_Block.

__host__ void SWE_RusanovBlockCUDA::updateUnknowns ( float  dt) [virtual]

implements interface function updateUnknowns: based on the (Rusanov) fluxes computed on each edge (and stored in the variables Fh, Gh, etc.); compute the balance terms for each cell, and update the unknowns according to an Euler time step. It will force an update of the copy layer in the main memory by calling synchCopyLayerBeforeRead(), and provide an compute the maximum allowed time step size by calling computeMaxTimestepCUDA().

Parameters:
dtsize of the time step.

Implements SWE_Block.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
const SWE_RusanovBlockCUDA swe 
) [friend]

overload operator<< such that data can be written via cout << -> needs to be declared as friend to be allowed to access private data


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends