Patches
-
namespace patches
-
class WavePropagation
- #include <WavePropagation.h>
Subclassed by tsunami_lab::patches::WavePropagation1d, tsunami_lab::patches::WavePropagation2d
Public Functions
-
inline virtual ~WavePropagation()
Virtual destructor for base class.
-
virtual void timeStep(t_real i_scalingX, t_real i_scalingY) = 0
Performs a time step.
- Parameters:
i_scalingX – scaling of the time step.
i_scalingY – scaling of the time step.
-
virtual void setGhostOutflow() = 0
Sets the values of the ghost cells according to outflow boundary conditions.
-
virtual t_idx getStride() = 0
Gets the stride in y-direction. x-direction is stride-1.
- Returns:
stride in y-direction.
-
virtual t_real const *getHeight() = 0
Gets cells’ water heights.
- Returns:
water heights.
-
virtual t_real const *getMomentumX() = 0
Gets the cells’ momensta in x-direction.
- Returns:
momenta in x-direction.
-
virtual t_real const *getMomentumY() = 0
Gets the cells’ momenta in y-direction.
- Returns:
momenta in y-direction.
-
virtual t_real const *getBathymetry() = 0
Gets cells bathymetry
- Returns:
bathymetry.
-
virtual void setHeight(t_idx i_ix, t_idx i_iy, t_real i_h) = 0
Sets the height of the cell to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_h – water height.
-
virtual void setMomentumX(t_idx i_ix, t_idx i_iy, t_real i_hu) = 0
Sets the momentum in x-direction to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_hu – momentum in x-direction.
-
virtual void setMomentumY(t_idx i_ix, t_idx i_iy, t_real i_hv) = 0
Sets the momentum in y-direction to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_hv – momentum in y-direction.
-
virtual void setBathymetry(t_idx i_ix, t_idx i_iy, t_real i_b) = 0
Sets the bathymetry of the cell to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_b – bathymetry.
-
virtual void adjustWaterHeight() = 0
Corrects the water height based on the bathymetry
-
inline virtual ~WavePropagation()
-
class WavePropagation1d : public tsunami_lab::patches::WavePropagation
- #include <WavePropagation1d.h>
Public Functions
-
WavePropagation1d(t_idx i_nCells, const std::string &i_solver, Boundary i_boundaryL, Boundary i_boundaryR)
Constructs the 1d wave propagation solver.
- Author
Luca-Philipp Grumbach
- Author
Richard Hofmann
Description
One-dimensional wave propagation patch.
- Parameters:
i_nCells – number of cells.
i_solver – selected solver.
i_boundaryL – boundary condition on the left side
i_boundaryR – boundary condition on the right side
-
~WavePropagation1d()
Destructor which frees all allocated memory.
-
virtual void timeStep(t_real i_scaling, t_real)
Performs a time step.
- Parameters:
i_scaling – scaling of the time step (dt / dx).
-
virtual void setGhostOutflow()
Sets the values of the ghost cells according to outflow boundary conditions.
-
inline virtual t_idx getStride()
Gets the stride in y-direction. x-direction is stride-1.
- Returns:
stride in y-direction.
-
inline virtual t_real const *getHeight()
Gets cells’ water heights.
- Returns:
water heights.
-
inline virtual t_real const *getMomentumX()
Gets the cells’ momenta in x-direction.
- Returns:
momenta in x-direction.
-
inline virtual t_real const *getMomentumY()
Dummy function which returns a nullptr.
-
inline virtual t_real const *getBathymetry()
Gets cells bathymetry
- Returns:
bathymetry.
-
inline virtual void setHeight(t_idx i_ix, t_idx, t_real i_h)
Sets the height of the cell to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_h – water height.
-
inline virtual void setMomentumX(t_idx i_ix, t_idx, t_real i_hu)
Sets the momentum in x-direction to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_hu – momentum in x-direction.
-
inline virtual void setMomentumY(t_idx, t_idx, t_real)
Dummy function since there is no y-momentum in the 1d solver.
-
inline virtual void setBathymetry(t_idx i_ix, t_idx, t_real i_b)
Sets the bathymetry of the cell to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_b – bathymetry.
-
inline virtual void adjustWaterHeight()
Corrects the water height based on the bathymetry
Private Functions
-
void handleReflections(t_real *i_h, t_real *i_hu, t_idx i_ceL, t_idx i_ceR, t_real &o_hL, t_real &o_hR, t_real &o_huL, t_real &o_huR, t_real &o_bL, t_real &o_bR)
Compute the reflection effect
- Parameters:
i_h – water height
i_hu – water momentum
i_ceL – left cell
i_ceR – right cell
o_hL – water height on the left side
o_hR – water height on the right side
o_huL – water momentum on the left side
o_huR – water momentum on the right side
o_bL – bathymetry on the left side
o_bR – bathymetry on the right side
Private Members
-
unsigned short m_step = 0
current step which indicates the active values in the arrays below
-
t_idx m_nCells = 0
number of cells discretizing the computational domain
-
t_real *m_h[2] = {nullptr, nullptr}
water heights for the current and next time step for all cells
-
t_real *m_hu[2] = {nullptr, nullptr}
momenta for the current and next time step for all cells
-
t_real *m_b = nullptr
bathymetry
-
std::string m_solver = ""
selected solver (roe or fwave)
-
Boundary m_boundaryL = OUTFLOW
boundary condition on the left side
-
Boundary m_boundaryR = OUTFLOW
boundary condition on the right side
-
WavePropagation1d(t_idx i_nCells, const std::string &i_solver, Boundary i_boundaryL, Boundary i_boundaryR)
-
class WavePropagation2d : public tsunami_lab::patches::WavePropagation
- #include <WavePropagation2d.h>
Public Functions
-
WavePropagation2d(t_idx i_nCellsX, t_idx i_nCellsY, Boundary i_boundaryL, Boundary i_boundaryR, Boundary i_boundaryT, Boundary i_boundaryB)
Constructs the 2d wave propagation solver.
- Author
Luca-Philipp Grumbach
- Author
Richard Hofmann
Description
Two-dimensional wave propagation patch.
- Parameters:
i_nCellsX – number of cells in x direction.
i_nCellsY – number of cells in y direction.
i_boundaryL – boundary condition on the left side
i_boundaryR – boundary condition on the left side
i_boundaryT – boundary condition on the top side
i_boundaryB – boundary condition on the bottom side
-
~WavePropagation2d()
Destructor which frees all allocated memory.
-
virtual void timeStep(t_real i_scalingX, t_real i_scalingY)
Performs a time step.
- Parameters:
i_scalingX – scaling of the time step (dt / dx).
i_scalingY – scaling of the time step (dt / dy).
-
virtual void setGhostOutflow()
Sets the values of the ghost cells according to outflow boundary conditions.
-
inline virtual t_idx getStride()
Gets the stride in y-direction. x-direction is stride-1.
- Returns:
stride in y-direction.
-
inline virtual t_real const *getHeight()
Gets cells’ water heights.
- Returns:
water heights.
-
inline virtual t_real const *getMomentumX()
Gets the cells’ momenta in x-direction.
- Returns:
momenta in x-direction.
-
inline virtual t_real const *getMomentumY()
- Returns:
momenta in y-direction.
-
inline virtual t_real const *getBathymetry()
Gets cells bathymetry
- Returns:
bathymetry.
-
inline virtual void setHeight(t_idx i_ix, t_idx i_iy, t_real i_h)
Sets the height of the cell to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_h – water height.
-
inline virtual void setMomentumX(t_idx i_ix, t_idx i_iy, t_real i_huX)
Sets the momentum in x-direction to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_huX – momentum in x-direction.
-
inline virtual void setMomentumY(t_idx i_ix, t_idx i_iy, t_real i_huY)
Sets the momentum in y-direction to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_huY – momentum in y-direction.
-
inline virtual void setBathymetry(t_idx i_ix, t_idx i_iy, t_real i_b)
Sets the bathymetry of the cell to the given value.
- Parameters:
i_ix – id of the cell in x-direction.
i_iy – id of the cell in y-direction.
i_b – bathymetry.
-
virtual void adjustWaterHeight()
Corrects the water height based on the bathymetry
Private Functions
-
void handleReflections(t_real *i_h, t_real *i_hu, t_idx i_ceL, t_idx i_ceR, t_real &o_hL, t_real &o_hR, t_real &o_huL, t_real &o_huR, t_real &o_bL, t_real &o_bR)
Compute the reflection effect
- Parameters:
i_h – water height
i_hu – water momentum
i_ceL – left cell
i_ceR – right cell
o_hL – water height on the left side
o_hR – water height on the right side
o_huL – water momentum on the left side
o_huR – water momentum on the right side
o_bL – bathymetry on the left side
o_bR – bathymetry on the right side
Private Members
-
unsigned short m_step = 0
current step which indicates the active values in the arrays below
-
t_idx m_nCellsX = 0
number of cells discretizing the computational domain
-
t_idx m_nCellsY = 0
-
t_real *m_h[2] = {nullptr, nullptr}
water heights for the current and next time step for all cells
-
t_real *m_huX[2] = {nullptr, nullptr}
x momenta for the current and next time step for all cells
-
t_real *m_huY[2] = {nullptr, nullptr}
y momenta for the current and next time step for all cells
-
t_real *m_b = nullptr
bathymetry
-
Boundary m_boundaryL = OUTFLOW
boundary condition on the left side
-
Boundary m_boundaryR = OUTFLOW
boundary condition on the right side
-
Boundary m_boundaryT = OUTFLOW
boundary condition on the top side
-
Boundary m_boundaryB = OUTFLOW
boundary condition on the bottom side
-
WavePropagation2d(t_idx i_nCellsX, t_idx i_nCellsY, Boundary i_boundaryL, Boundary i_boundaryR, Boundary i_boundaryT, Boundary i_boundaryB)
-
class WavePropagation