Tsunami Project Lab
Loading...
Searching...
No Matches
tsunami_lab::patches::WavePropagation2d< T > Class Template Reference

#include <WavePropagation2d.h>

Inheritance diagram for tsunami_lab::patches::WavePropagation2d< T >:
Collaboration diagram for tsunami_lab::patches::WavePropagation2d< T >:

Public Member Functions

 WavePropagation2d (t_idx i_nx, t_idx i_ny)
 
 ~WavePropagation2d ()
 
void timeStep (t_real i_scaling)
 
void setGhostBoundary (BoundaryCondition i_left, BoundaryCondition i_right, BoundaryCondition i_bottom, BoundaryCondition i_top)
 
void setGhostOutflow ()
 
void setGhostReflection ()
 
t_idx getStride ()
 
t_real const * getHeight ()
 
t_real const * getMomentumX ()
 
t_real const * getMomentumY ()
 
t_real const * getBathymetry ()
 
void setHeight (t_idx i_ix, t_idx i_iy, t_real i_h)
 
void setMomentumX (t_idx i_ix, t_idx i_iy, t_real i_hu)
 
void setMomentumY (t_idx i_ix, t_idx i_iy, t_real i_hv)
 
void setBathymetry (t_idx i_ix, t_idx i_iy, t_real i_b)
 
- Public Member Functions inherited from tsunami_lab::patches::WavePropagation< T >
 WavePropagation ()
 
virtual ~WavePropagation ()
 

Additional Inherited Members

- Protected Attributes inherited from tsunami_lab::patches::WavePropagation< T >
solver
 

Constructor & Destructor Documentation

◆ WavePropagation2d()

template<class T >
tsunami_lab::patches::WavePropagation2d< T >::WavePropagation2d ( t_idx i_nx,
t_idx i_ny )
inline

Constructs the 2d wave propagation solver.

Parameters
i_nxnumber of cells in x-direction (interior, no ghosts).
i_nynumber of cells in y-direction (interior, no ghosts).

◆ ~WavePropagation2d()

template<class T >
tsunami_lab::patches::WavePropagation2d< T >::~WavePropagation2d ( )
inline

Destructor which frees all allocated memory.

Member Function Documentation

◆ getBathymetry()

template<class T >
t_real const * tsunami_lab::patches::WavePropagation2d< T >::getBathymetry ( )
inlinevirtual

Gets the cells' bathymetry.

Returns
bathymetry.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ getHeight()

template<class T >
t_real const * tsunami_lab::patches::WavePropagation2d< T >::getHeight ( )
inlinevirtual

Gets cells' water heights. The pointer addresses interior cell (0, 0); access cell (ix, iy) via ptr[ix + iy * getStride()].

Returns
water heights.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ getMomentumX()

template<class T >
t_real const * tsunami_lab::patches::WavePropagation2d< T >::getMomentumX ( )
inlinevirtual

Gets the cells' momenta in x-direction.

Returns
momenta in x-direction.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ getMomentumY()

template<class T >
t_real const * tsunami_lab::patches::WavePropagation2d< T >::getMomentumY ( )
inlinevirtual

Gets the cells' momenta in y-direction.

Returns
momenta in y-direction.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ getStride()

template<class T >
t_idx tsunami_lab::patches::WavePropagation2d< T >::getStride ( )
inlinevirtual

Gets the stride in y-direction. x-direction is stride-1.

Returns
stride in y-direction (= m_nx + 2).

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setBathymetry()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setBathymetry ( t_idx i_ix,
t_idx i_iy,
t_real i_b )
inlinevirtual

Sets the bathymetry of the interior cell.

Parameters
i_ixid of the cell in x-direction.
i_iyid of the cell in y-direction.
i_bbathymetry value.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setGhostBoundary()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setGhostBoundary ( BoundaryCondition i_left,
BoundaryCondition i_right,
BoundaryCondition i_bottom,
BoundaryCondition i_top )
inlinevirtual

Sets the ghost cells per side. Bathymetry and water height are always copied from the inner cell. At reflecting walls only the normal momentum component is negated (Spec 3.2.1):

  • left/right walls: negate hu, copy hv
  • bottom/top walls: negate hv, copy hu

Corner ghost cells (i ∈ {0, m_nx+1} ∧ j ∈ {0, m_ny+1}) are irrelevant for the unsplit method (no Riemann problem references them) and are left untouched here.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setGhostOutflow()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setGhostOutflow ( )
inlinevirtual

Convenience: outflow on all four sides.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setGhostReflection()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setGhostReflection ( )
inlinevirtual

Convenience: reflecting on all four sides (Spec 3.2.1).

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setHeight()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setHeight ( t_idx i_ix,
t_idx i_iy,
t_real i_h )
inlinevirtual

Sets the height of the interior cell to the given value.

Parameters
i_ixid of the cell in x-direction (0-based, interior).
i_iyid of the cell in y-direction (0-based, interior).
i_hwater height.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setMomentumX()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setMomentumX ( t_idx i_ix,
t_idx i_iy,
t_real i_hu )
inlinevirtual

Sets the momentum in x-direction to the given value.

Parameters
i_ixid of the cell in x-direction.
i_iyid of the cell in y-direction.
i_humomentum in x-direction.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ setMomentumY()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::setMomentumY ( t_idx i_ix,
t_idx i_iy,
t_real i_hv )
inlinevirtual

Sets the momentum in y-direction to the given value.

Parameters
i_ixid of the cell in x-direction.
i_iyid of the cell in y-direction.
i_hvmomentum in y-direction.

Implements tsunami_lab::patches::WavePropagation< T >.

◆ timeStep()

template<class T >
void tsunami_lab::patches::WavePropagation2d< T >::timeStep ( t_real i_scaling)
inlinevirtual

Performs a time step using the unsplit donor-cell method.

Q^{n+1}_{i,j} = Q^n_{i,j}

  • (Δt/Δx)(A^+ ΔQ_{i-1/2,j} + A^- ΔQ_{i+1/2,j})
  • (Δt/Δy)(B^+ ΔQ_{i,j-1/2} + B^- ΔQ_{i,j+1/2})

Both sweeps read from Q^n exclusively and accumulate their contributions into Q^{n+1} (which starts as a copy of Q^n). x-edges feed (h, hu, b) to the 1d Riemann solver and update h,hu on each side; y-edges feed (h, hv, b) and update h,hv. The tangential momentum is left untouched by each 1d solve.

Wet/dry edges follow the same convention as the 1d patch (Spec 3.2): a dry side is mirrored from its wet partner with the normal momentum negated, and updates are only applied to wet cells so dry cells stay dry.

Assumes a uniform grid (Δx = Δy) so a single scaling factor suffices; assignment 4 scenarios are all on square domains.

Parameters
i_scalingscaling Δt/Δxy of the time step.

Implements tsunami_lab::patches::WavePropagation< T >.


The documentation for this class was generated from the following file: