7#ifndef TSUNAMI_LAB_PATCHES_WAVE_PROPAGATION_1D
8#define TSUNAMI_LAB_PATCHES_WAVE_PROPAGATION_1D
15 class WavePropagation1d;
30 unsigned short m_step = 0;
36 t_real * m_h[2] = {
nullptr,
nullptr };
39 t_real * m_hu[2] = {
nullptr,
nullptr };
54 for(
unsigned short l_st = 0; l_st < 2; l_st++ ) {
55 m_h[l_st] =
new t_real[ m_nCells + 2 ];
56 m_hu[l_st] =
new t_real[ m_nCells + 2 ];
60 for(
unsigned short l_st = 0; l_st < 2; l_st++ ) {
61 for(
t_idx l_ce = 0; l_ce < m_nCells + 2; l_ce++ ) {
68 m_bm =
new t_real[m_nCells + 2]();
75 for(
unsigned short l_st = 0; l_st < 2; l_st++ ) {
89 t_real * l_hOld = m_h[m_step];
90 t_real * l_huOld = m_hu[m_step];
92 m_step = (m_step+1) % 2;
93 t_real * l_hNew = m_h[m_step];
94 t_real * l_huNew = m_hu[m_step];
97 for(
t_idx l_ce = 1; l_ce < m_nCells+1; l_ce++ ) {
98 l_hNew[l_ce] = l_hOld[l_ce];
99 l_huNew[l_ce] = l_huOld[l_ce];
103 for(
t_idx l_ed = 0; l_ed < m_nCells+1; l_ed++ ) {
106 t_idx l_ceR = l_ed+1;
108 t_real l_hL_ref = l_hOld[l_ceL];
109 t_real l_hR_ref = l_hOld[l_ceR];
110 t_real l_huL_ref = l_huOld[l_ceL];
111 t_real l_huR_ref = l_huOld[l_ceR];
112 t_real l_bmL_ref = m_bm[l_ceL];
113 t_real l_bmR_ref = m_bm[l_ceR];
116 const bool l_dryL = l_hL_ref <= 0;
117 const bool l_dryR = l_hR_ref <= 0;
120 if( l_dryL && l_dryR )
continue;
126 l_huL_ref = -l_huR_ref;
127 l_bmL_ref = l_bmR_ref;
128 }
else if( l_dryR ) {
130 l_huR_ref = -l_huL_ref;
131 l_bmR_ref = l_bmL_ref;
135 t_real l_netUpdates[2][2];
137 this->
solver.netUpdates( l_hL_ref,
148 l_hNew[l_ceL] -= i_scaling * l_netUpdates[0][0];
149 l_huNew[l_ceL] -= i_scaling * l_netUpdates[0][1];
152 l_hNew[l_ceR] -= i_scaling * l_netUpdates[1][0];
153 l_huNew[l_ceR] -= i_scaling * l_netUpdates[1][1];
167 t_real * l_h = m_h[m_step];
168 t_real * l_hu = m_hu[m_step];
176 l_h[m_nCells + 1] = l_h[m_nCells];
177 m_bm[m_nCells + 1] = m_bm[m_nCells];
214 return m_h[m_step]+1;
223 return m_hu[m_step]+1;
251 m_h[m_step][i_ix+1] = i_h;
263 m_hu[m_step][i_ix+1] = i_hu;
282 m_bm[i_ix + 1] = i_b;
Definition WavePropagation1d.h:27
t_real const * getBathymetry()
Definition WavePropagation1d.h:238
void setGhostBoundary(BoundaryCondition i_left, BoundaryCondition i_right, BoundaryCondition, BoundaryCondition)
Definition WavePropagation1d.h:163
void setHeight(t_idx i_ix, t_idx, t_real i_h)
Definition WavePropagation1d.h:248
void timeStep(t_real i_scaling)
Definition WavePropagation1d.h:87
t_real const * getMomentumX()
Definition WavePropagation1d.h:222
WavePropagation1d(t_idx i_nCells)
Definition WavePropagation1d.h:50
t_idx getStride()
Definition WavePropagation1d.h:204
t_real const * getHeight()
Definition WavePropagation1d.h:213
~WavePropagation1d()
Definition WavePropagation1d.h:74
void setGhostReflection()
Definition WavePropagation1d.h:194
void setGhostOutflow()
Definition WavePropagation1d.h:186
void setMomentumX(t_idx i_ix, t_idx, t_real i_hu)
Definition WavePropagation1d.h:260
void setMomentumY(t_idx, t_idx, t_real)
Definition WavePropagation1d.h:269
void setBathymetry(t_idx i_ix, t_idx, t_real i_b)
Definition WavePropagation1d.h:281
t_real const * getMomentumY()
Definition WavePropagation1d.h:229
Definition WavePropagation.h:31
T solver
Definition WavePropagation.h:32
BoundaryCondition
Definition WavePropagation.h:19
@ OUTFLOW
zero-gradient: copy the inner cell into the ghost cell
Definition constants.h:12
float t_real
floating point type
Definition constants.h:17
std::size_t t_idx
integral type for cell-ids, pointer arithmetic, etc.
Definition constants.h:14