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::SetEdgeBCsLo(0,i,j,k,n,q,qmns,qpls,umac(i,j,k),d_bcrec[n].lo(0),domlo,is_velocity);
49 HydroBC::SetEdgeBCsHi(0,i,j,k,n,q,qmns,qpls,umac(i,j,k),d_bcrec[n].hi(0),domhi,is_velocity);
51 if ( (i==domlo) && (d_bcrec[n].lo(0) == amrex::BCType::foextrap || d_bcrec[n].lo(0) == amrex::BCType::hoextrap) )
53 if ( umac(i,j,k) >= 0. && n==
XVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
56 if ( (i==domhi+1) && (d_bcrec[n].hi(0) == amrex::BCType::foextrap || d_bcrec[n].hi(0) == amrex::BCType::hoextrap) )
58 if ( umac(i,j,k) <= 0. && n==
XVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
84 int domlo,
int domhi,
bool is_velocity) noexcept
90 amrex::Real qpls = q(i ,j,k,n) - 0.5 *
amrex_calc_xslope( i , j, k, n, order, q );
91 amrex::Real qmns = q(i-1,j,k,n) + 0.5 *
amrex_calc_xslope( i-1, j, k, n, order, q );
93 HydroBC::SetEdgeBCsLo(0,i,j,k,n,q,qmns,qpls,umac(i,j,k),d_bcrec[n].lo(0),domlo,is_velocity);
94 HydroBC::SetEdgeBCsHi(0,i,j,k,n,q,qmns,qpls,umac(i,j,k),d_bcrec[n].hi(0),domhi,is_velocity);
96 if ( (i==domlo) && (d_bcrec[n].lo(0) == amrex::BCType::foextrap || d_bcrec[n].lo(0) == amrex::BCType::hoextrap) )
98 if ( umac(i,j,k) >= 0. && n==
XVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
101 if ( (i==domhi+1) && (d_bcrec[n].hi(0) == amrex::BCType::foextrap || d_bcrec[n].hi(0) == amrex::BCType::hoextrap) )
103 if ( umac(i,j,k) <= 0. && n==
XVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
117 qs = 0.5*(qmns+qpls);
129 int domlo,
int domhi,
bool is_velocity) noexcept
134 bool edlo = (d_bcrec[n].lo(1) == amrex::BCType::ext_dir);
135 bool edhi = (d_bcrec[n].hi(1) == amrex::BCType::ext_dir);
137 bool extdir_or_ho_lo = (d_bcrec[n].lo(1) == amrex::BCType::ext_dir) || d_bcrec[n].lo(1) == amrex::BCType::hoextrap;
138 bool extdir_or_ho_hi = (d_bcrec[n].hi(1) == amrex::BCType::ext_dir) || d_bcrec[n].lo(1) == amrex::BCType::hoextrap;
142 if (edlo && j <= domlo)
144 qs = q(i,domlo-1,k,n);
146 else if ( edhi && j >= domhi+1)
148 qs = q(i,domhi+1,k,n);
152 amrex::Real qpls = q(i,j ,k,n) - 0.5 *
154 amrex::Real qmns = q(i,j-1,k,n) + 0.5 *
157 HydroBC::SetEdgeBCsLo(1,i,j,k,n,q,qmns,qpls,vmac(i,j,k),d_bcrec[n].lo(1),domlo,is_velocity);
158 HydroBC::SetEdgeBCsHi(1,i,j,k,n,q,qmns,qpls,vmac(i,j,k),d_bcrec[n].hi(1),domhi,is_velocity);
160 if ( (j==domlo) && (d_bcrec[n].lo(1) == amrex::BCType::foextrap || d_bcrec[n].lo(1) == amrex::BCType::hoextrap) )
162 if ( vmac(i,j,k) >= 0. && n==
YVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
165 if ( (j==domhi+1) && (d_bcrec[n].hi(1) == amrex::BCType::foextrap || d_bcrec[n].hi(1) == amrex::BCType::hoextrap) )
167 if ( vmac(i,j,k) <= 0. && n==
YVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
181 qs = 0.5*(qmns+qpls);
195 int domlo,
int domhi,
bool is_velocity) noexcept
201 amrex::Real qpls = q(i,j ,k,n) - 0.5 *
amrex_calc_yslope( i, j , k, n, order, q );
202 amrex::Real qmns = q(i,j-1,k,n) + 0.5 *
amrex_calc_yslope( i, j-1, k, n, order, q );
204 HydroBC::SetEdgeBCsLo(1,i,j,k,n,q,qmns,qpls,vmac(i,j,k), d_bcrec[n].lo(1),domlo,is_velocity);
205 HydroBC::SetEdgeBCsHi(1,i,j,k,n,q,qmns,qpls,vmac(i,j,k), d_bcrec[n].hi(1),domhi,is_velocity);
207 if ( (j==domlo) && (d_bcrec[n].lo(1) == amrex::BCType::foextrap || d_bcrec[n].lo(1) == amrex::BCType::hoextrap) )
209 if ( vmac(i,j,k) >= 0. && n==
YVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
212 if ( (j==domhi+1) && (d_bcrec[n].hi(1) == amrex::BCType::foextrap || d_bcrec[n].hi(1) == amrex::BCType::hoextrap) )
214 if ( vmac(i,j,k) <= 0. && n==
YVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
228 qs = 0.5*(qmns+qpls);
235 #if (AMREX_SPACEDIM==3)
238 amrex::Real hydro_mol_zedge_state_extdir (
int i,
int j,
int k,
int n,
242 int domlo,
int domhi,
bool is_velocity) noexcept
249 bool edlo = (d_bcrec[n].lo(2) == amrex::BCType::ext_dir);
250 bool edhi = (d_bcrec[n].hi(2) == amrex::BCType::ext_dir);
252 bool extdir_or_ho_lo = (d_bcrec[n].lo(2) == amrex::BCType::ext_dir) || d_bcrec[n].lo(2) == amrex::BCType::hoextrap;
253 bool extdir_or_ho_hi = (d_bcrec[n].hi(2) == amrex::BCType::ext_dir) || d_bcrec[n].lo(2) == amrex::BCType::hoextrap;
255 if (edlo && k <= domlo)
257 qs = q(i,j,domlo-1,n);
259 else if ( edhi && k >= domhi+1)
261 qs = q(i,j,domhi+1,n);
265 amrex::Real qpls = q(i,j,k ,n) - 0.5 *
266 amrex_calc_zslope_extdir( i, j, k , n, order, q, extdir_or_ho_lo, extdir_or_ho_hi, domlo, domhi );
267 amrex::Real qmns = q(i,j,k-1,n) + 0.5 *
268 amrex_calc_zslope_extdir( i, j, k-1, n, order, q, extdir_or_ho_lo, extdir_or_ho_hi, domlo, domhi );
270 HydroBC::SetEdgeBCsLo(2,i,j,k,n,q,qmns,qpls,wmac(i,j,k),d_bcrec[n].lo(2),domlo,is_velocity);
271 HydroBC::SetEdgeBCsHi(2,i,j,k,n,q,qmns,qpls,wmac(i,j,k),d_bcrec[n].hi(2),domhi,is_velocity);
273 if ( (k==domlo) && (d_bcrec[n].lo(2) == amrex::BCType::foextrap || d_bcrec[n].lo(2) == amrex::BCType::hoextrap) )
275 if ( wmac(i,j,k) >= 0. && n==
ZVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
278 if ( (k==domhi+1) && (d_bcrec[n].hi(2) == amrex::BCType::foextrap || d_bcrec[n].hi(2) == amrex::BCType::hoextrap) )
280 if ( wmac(i,j,k) <= 0. && n==
ZVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
294 qs = 0.5*(qmns+qpls);
304 amrex::Real hydro_mol_zedge_state (
int i,
int j,
int k,
int n,
308 int domlo,
int domhi,
bool is_velocity) noexcept
314 amrex::Real qpls = q(i,j,k ,n) - 0.5 * amrex_calc_zslope( i, j, k , n, order, q );
315 amrex::Real qmns = q(i,j,k-1,n) + 0.5 * amrex_calc_zslope( i, j, k-1, n, order, q );
317 HydroBC::SetEdgeBCsLo(2,i,j,k,n,q,qmns,qpls,wmac(i,j,k),d_bcrec[n].lo(2),domlo,is_velocity);
318 HydroBC::SetEdgeBCsHi(2,i,j,k,n,q,qmns,qpls,wmac(i,j,k),d_bcrec[n].hi(2),domhi,is_velocity);
320 if ( (k==domlo) && (d_bcrec[n].lo(2) == amrex::BCType::foextrap || d_bcrec[n].lo(2) == amrex::BCType::hoextrap) )
322 if ( wmac(i,j,k) >= 0. && n==
ZVEL && is_velocity ) qpls =
amrex::min(qpls,0.0_rt);
325 if ( (k==domhi+1) && (d_bcrec[n].hi(2) == amrex::BCType::foextrap || d_bcrec[n].hi(2) == amrex::BCType::hoextrap) )
327 if ( wmac(i,j,k) <= 0. && n==
ZVEL && is_velocity ) qmns =
amrex::max(qmns,0.0_rt);
341 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 SetEdgeBCsHi(int edge_dir, int i, int j, int k, int n, const amrex::Array4< const amrex::Real > &s, amrex::Real &lo, amrex::Real &hi, amrex::Real macvel, int bchi, int domhi, bool is_velocity)
Boundary condition effects.
Definition: hydro_bcs_K.H:256
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetEdgeBCsLo(int edge_dir, int i, int j, int k, int n, const amrex::Array4< const amrex::Real > &s, amrex::Real &lo, amrex::Real &hi, amrex::Real macvel, int bclo, int domlo, bool is_velocity)
Boundary condition effects.
Definition: hydro_bcs_K.H:190
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:80
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:125
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:191
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