SWE
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
SWE_RusanovBlock Class Reference

#include <SWE_RusanovBlock.hh>

Inheritance diagram for SWE_RusanovBlock:
SWE_Block

List of all members.

Public Member Functions

 SWE_RusanovBlock (float _offsetX=0, float _offsetY=0)
virtual ~SWE_RusanovBlock ()
virtual void simulateTimestep (float dt)
 execute a single time step of the simulation
virtual float simulate (float tStart, float tEnd)
 compute simulate from specified start to end time
virtual void computeNumericalFluxes ()
 compute flux terms on edges
virtual void updateUnknowns (float dt)
 update unknowns according to fluxes (Euler time step)

Protected Member Functions

virtual void computeBathymetrySources ()
 compute source terms
float computeLocalSV (int i, int j, char dir)
virtual void computeMaxTimestep ()

Static Protected Member Functions

static float computeFlux (float fLoc, float fNeigh, float xiLoc, float xiNeigh, float llf)

Protected Attributes

Float2D Fh
Float2D Fhu
Float2D Fhv
Float2D Gh
Float2D Ghu
Float2D Ghv
Float2D Bx
Float2D By

Friends

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

Detailed Description

SWE_RusanovBlock is an implementation of the SWE_Block abstract class. It uses a simple Rusanov flux (aka local Lax-Friedrich) in the model, with some simple modifications to obtain a well-balanced scheme.


Constructor & Destructor Documentation

SWE_RusanovBlock::SWE_RusanovBlock ( float  _offsetX = 0,
float  _offsetY = 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]

@ param _offsetX x coordinate of block origin @ param _offsetY y coordinate of block origin

Destructor: de-allocate all variables


Member Function Documentation

void SWE_RusanovBlock::computeBathymetrySources ( ) [protected, virtual]

compute source terms

compute the bathymetry source terms in all cells

float SWE_RusanovBlock::computeFlux ( float  fLow,
float  fHigh,
float  xiLow,
float  xiHigh,
float  llf 
) [static, protected]

compute the flux term on a given edge (acc. to local Lax-Friedrich method aka Rusanov flux): fLow and fHigh contain the values of the flux function in the two adjacent grid cells xiLow and xiHigh are the values of the unknowns in the two adjacent grid cells "Low" represents the cell with lower i/j index ("High" for larger index). llf should contain the local signal velocity (as compute by computeLocalSV) for llf=dx/dt (or dy/dt), we obtain the standard Lax Friedrich method

float SWE_RusanovBlock::computeLocalSV ( int  i,
int  j,
char  dir 
) [protected]

computes the local signal velocity in x- or y-direction for two adjacent cells with indices (i,j) and (i+1,j) (if dir='x') or (i,j+1) (if dir='y'

compute flux terms on edges

compute the flux terms on all edges; before the computation, computeBathymetrySources is called

Implements SWE_Block.

float SWE_RusanovBlock::simulate ( float  tStart,
float  tEnd 
) [virtual]

compute simulate from specified start to end time

implements interface function simulate: perform forward-Euler time steps, starting with simulation time tStart,: until simulation time tEnd is reached; boundary conditions and bathymetry source terms are computed for each timestep as required - intended as main simulation loop between two checkpoints

Implements SWE_Block.

void SWE_RusanovBlock::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 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.

void SWE_RusanovBlock::updateUnknowns ( float  dt) [virtual]

update unknowns according to fluxes (Euler time step)

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.

Parameters:
dtsize of the time step.

Implements SWE_Block.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
const SWE_RusanovBlock 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