5 #ifndef HYDRO_MOL_EDGE_STATE_K_H_
6 #define HYDRO_MOL_EDGE_STATE_K_H_
11 using namespace amrex::literals;
20 int domlo,
int domhi,
bool is_velocity) noexcept
27 bool edlo = (d_bcrec[n].lo(0) == amrex::BCType::ext_dir);
28 bool edhi = (d_bcrec[n].hi(0) == amrex::BCType::ext_dir);
30 bool extdir_or_ho_lo = (d_bcrec[n].lo(0) == amrex::BCType::ext_dir) || d_bcrec[n].lo(0) == amrex::BCType::hoextrap;
31 bool extdir_or_ho_hi = (d_bcrec[n].hi(0) == amrex::BCType::ext_dir) || d_bcrec[n].lo(0) == amrex::BCType::hoextrap;
33 if (edlo && i <= domlo)
35 qs = q(domlo-1,j,k,n);
37 else if ( edhi && i >= domhi+1)
39 qs = q(domhi+1,j,k,n);
43 amrex::Real qpls = q(i ,j,k,n) - 0.5 *
45 amrex::Real qmns = q(i-1,j,k,n) + 0.5 *
48 HydroBC::SetXEdgeBCs(i,j,k,n,q,qmns,qpls,d_bcrec[n].lo(0),domlo,d_bcrec[n].hi(0),domhi,is_velocity);
50 if ( (i==domlo) && (d_bcrec[n].lo(0) == amrex::BCType::foextrap || d_bcrec[n].lo(0) == amrex::BCType::hoextrap) )
52 if ( umac(i,j,k) >= 0. && n==
XVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
55 if ( (i==domhi+1) && (d_bcrec[n].hi(0) == amrex::BCType::foextrap || d_bcrec[n].hi(0) == amrex::BCType::hoextrap) )
57 if ( umac(i,j,k) <= 0. && n==
XVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
83 int domlo,
int domhi,
bool is_velocity) noexcept
89 amrex::Real qpls = q(i ,j,k,n) - 0.5 *
amrex_calc_xslope( i , j, k, n, order, q );
90 amrex::Real qmns = q(i-1,j,k,n) + 0.5 *
amrex_calc_xslope( i-1, j, k, n, order, q );
92 HydroBC::SetXEdgeBCs(i,j,k,n,q,qmns,qpls,d_bcrec[n].lo(0),domlo,d_bcrec[n].hi(0),domhi,is_velocity);
94 if ( (i==domlo) && (d_bcrec[n].lo(0) == amrex::BCType::foextrap || d_bcrec[n].lo(0) == amrex::BCType::hoextrap) )
96 if ( umac(i,j,k) >= 0. && n==
XVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
99 if ( (i==domhi+1) && (d_bcrec[n].hi(0) == amrex::BCType::foextrap || d_bcrec[n].hi(0) == amrex::BCType::hoextrap) )
101 if ( umac(i,j,k) <= 0. && n==
XVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
115 qs = 0.5*(qmns+qpls);
127 int domlo,
int domhi,
bool is_velocity) noexcept
132 bool edlo = (d_bcrec[n].lo(1) == amrex::BCType::ext_dir);
133 bool edhi = (d_bcrec[n].hi(1) == amrex::BCType::ext_dir);
135 bool extdir_or_ho_lo = (d_bcrec[n].lo(1) == amrex::BCType::ext_dir) || d_bcrec[n].lo(1) == amrex::BCType::hoextrap;
136 bool extdir_or_ho_hi = (d_bcrec[n].hi(1) == amrex::BCType::ext_dir) || d_bcrec[n].lo(1) == amrex::BCType::hoextrap;
140 if (edlo && j <= domlo)
142 qs = q(i,domlo-1,k,n);
144 else if ( edhi && j >= domhi+1)
146 qs = q(i,domhi+1,k,n);
150 amrex::Real qpls = q(i,j ,k,n) - 0.5 *
152 amrex::Real qmns = q(i,j-1,k,n) + 0.5 *
155 HydroBC::SetYEdgeBCs(i,j,k,n,q,qmns,qpls,d_bcrec[n].lo(1),domlo,d_bcrec[n].hi(1),domhi,is_velocity);
157 if ( (j==domlo) && (d_bcrec[n].lo(1) == amrex::BCType::foextrap || d_bcrec[n].lo(1) == amrex::BCType::hoextrap) )
159 if ( vmac(i,j,k) >= 0. && n==
YVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
162 if ( (j==domhi+1) && (d_bcrec[n].hi(1) == amrex::BCType::foextrap || d_bcrec[n].hi(1) == amrex::BCType::hoextrap) )
164 if ( vmac(i,j,k) <= 0. && n==
YVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
178 qs = 0.5*(qmns+qpls);
192 int domlo,
int domhi,
bool is_velocity) noexcept
198 amrex::Real qpls = q(i,j ,k,n) - 0.5 *
amrex_calc_yslope( i, j , k, n, order, q );
199 amrex::Real qmns = q(i,j-1,k,n) + 0.5 *
amrex_calc_yslope( i, j-1, k, n, order, q );
201 HydroBC::SetYEdgeBCs(i,j,k,n,q,qmns,qpls,d_bcrec[n].lo(1),domlo,d_bcrec[n].hi(1),domhi,is_velocity);
203 if ( (j==domlo) && (d_bcrec[n].lo(1) == amrex::BCType::foextrap || d_bcrec[n].lo(1) == amrex::BCType::hoextrap) )
205 if ( vmac(i,j,k) >= 0. && n==
YVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
208 if ( (j==domhi+1) && (d_bcrec[n].hi(1) == amrex::BCType::foextrap || d_bcrec[n].hi(1) == amrex::BCType::hoextrap) )
210 if ( vmac(i,j,k) <= 0. && n==
YVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
224 qs = 0.5*(qmns+qpls);
231 #if (AMREX_SPACEDIM==3)
234 amrex::Real hydro_mol_zedge_state_extdir (
int i,
int j,
int k,
int n,
238 int domlo,
int domhi,
bool is_velocity) noexcept
245 bool edlo = (d_bcrec[n].lo(2) == amrex::BCType::ext_dir);
246 bool edhi = (d_bcrec[n].hi(2) == amrex::BCType::ext_dir);
248 bool extdir_or_ho_lo = (d_bcrec[n].lo(2) == amrex::BCType::ext_dir) || d_bcrec[n].lo(2) == amrex::BCType::hoextrap;
249 bool extdir_or_ho_hi = (d_bcrec[n].hi(2) == amrex::BCType::ext_dir) || d_bcrec[n].lo(2) == amrex::BCType::hoextrap;
251 if (edlo && k <= domlo)
253 qs = q(i,j,domlo-1,n);
255 else if ( edhi && k >= domhi+1)
257 qs = q(i,j,domhi+1,n);
261 amrex::Real qpls = q(i,j,k ,n) - 0.5 *
262 amrex_calc_zslope_extdir( i, j, k , n, order, q, extdir_or_ho_lo, extdir_or_ho_hi, domlo, domhi );
263 amrex::Real qmns = q(i,j,k-1,n) + 0.5 *
264 amrex_calc_zslope_extdir( i, j, k-1, n, order, q, extdir_or_ho_lo, extdir_or_ho_hi, domlo, domhi );
266 HydroBC::SetZEdgeBCs(i,j,k,n,q,qmns,qpls,d_bcrec[n].lo(2),domlo,d_bcrec[n].hi(2),domhi,is_velocity);
268 if ( (k==domlo) && (d_bcrec[n].lo(2) == amrex::BCType::foextrap || d_bcrec[n].lo(2) == amrex::BCType::hoextrap) )
270 if ( wmac(i,j,k) >= 0. && n==
ZVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
273 if ( (k==domhi+1) && (d_bcrec[n].hi(2) == amrex::BCType::foextrap || d_bcrec[n].hi(2) == amrex::BCType::hoextrap) )
275 if ( wmac(i,j,k) <= 0. && n==
ZVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
289 qs = 0.5*(qmns+qpls);
299 amrex::Real hydro_mol_zedge_state (
int i,
int j,
int k,
int n,
303 int domlo,
int domhi,
bool is_velocity) noexcept
309 amrex::Real qpls = q(i,j,k ,n) - 0.5 * amrex_calc_zslope( i, j, k , n, order, q );
310 amrex::Real qmns = q(i,j,k-1,n) + 0.5 * amrex_calc_zslope( i, j, k-1, n, order, q );
312 HydroBC::SetZEdgeBCs(i,j,k,n,q,qmns,qpls,d_bcrec[n].lo(2),domlo,d_bcrec[n].hi(2),domhi,is_velocity);
314 if ( (k==domlo) && (d_bcrec[n].lo(2) == amrex::BCType::foextrap || d_bcrec[n].lo(2) == amrex::BCType::hoextrap) )
316 if ( wmac(i,j,k) >= 0. && n==
ZVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
319 if ( (k==domhi+1) && (d_bcrec[n].hi(2) == amrex::BCType::foextrap || d_bcrec[n].hi(2) == amrex::BCType::hoextrap) )
321 if ( wmac(i,j,k) <= 0. && n==
ZVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
335 qs = 0.5*(qmns+qpls);
#define AMREX_FORCE_INLINE
#define YVEL
Definition: hydro_constants.H:29
static constexpr amrex::Real small_vel
Definition: hydro_constants.H:37
#define XVEL
Definition: hydro_constants.H:28
#define ZVEL
Definition: hydro_constants.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetXEdgeBCs(int i, int j, int k, int n, const amrex::Array4< const amrex::Real > &s, amrex::Real &lo, amrex::Real &hi, int bclo, int domlo, int bchi, int domhi, bool is_velocity)
Boundary condition effects.
Definition: hydro_bcs_K.H:45
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetYEdgeBCs(int i, int j, int k, int n, const amrex::Array4< const amrex::Real > &s, amrex::Real &lo, amrex::Real &hi, int bclo, int domlo, int bchi, int domhi, bool is_velocity)
Boundary condition effects.
Definition: hydro_bcs_K.H:112
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real hydro_mol_xedge_state(int i, int j, int k, int n, amrex::Array4< amrex::Real const > const &q, amrex::Array4< amrex::Real const > const &umac, amrex::BCRec const *const d_bcrec, int domlo, int domhi, bool is_velocity) noexcept
Definition: hydro_mol_edge_state_K.H:79
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real hydro_mol_yedge_state_extdir(int i, int j, int k, int n, amrex::Array4< amrex::Real const > const &q, amrex::Array4< amrex::Real const > const &vmac, amrex::BCRec const *const d_bcrec, int domlo, int domhi, bool is_velocity) noexcept
Definition: hydro_mol_edge_state_K.H:123
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real hydro_mol_yedge_state(int i, int j, int k, int n, amrex::Array4< amrex::Real const > const &q, amrex::Array4< amrex::Real const > const &vmac, amrex::BCRec const *const d_bcrec, int domlo, int domhi, bool is_velocity) noexcept
Definition: hydro_mol_edge_state_K.H:188
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real hydro_mol_xedge_state_extdir(int i, int j, int k, int n, amrex::Array4< amrex::Real const > const &q, amrex::Array4< amrex::Real const > const &umac, amrex::BCRec const *const d_bcrec, int domlo, int domhi, bool is_velocity) noexcept
Definition: hydro_mol_edge_state_K.H:16
AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real amrex_calc_yslope_extdir(int i, int j, int k, int n, int order, amrex::Array4< Real const > const &q, bool edlo, bool edhi, int domlo, int domhi) noexcept
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & max(const T &a, const T &b) noexcept
AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real amrex_calc_yslope(int i, int j, int k, int n, int order, amrex::Array4< Real const > const &q) noexcept
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real amrex_calc_xslope_extdir(int i, int j, int k, int n, int order, amrex::Array4< Real const > const &q, bool edlo, bool edhi, int domlo, int domhi) noexcept
AMREX_GPU_DEVICE AMREX_FORCE_INLINE Real amrex_calc_xslope(int i, int j, int k, int n, int order, amrex::Array4< Real const > const &q) noexcept