5 #ifndef ERF_EBSLOPES_H_
6 #define ERF_EBSLOPES_H_
8 #include <AMReX_EBCellFlag.H>
9 #include <AMReX_EB_Slopes_K.H>
27 AMREX_GPU_DEVICE AMREX_FORCE_INLINE
28 amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>
32 amrex::RealVect
const& bcent_eb,
34 amrex::Array4<amrex::Real const>
const& state,
35 amrex::Array4<amrex::Real const>
const& ccent,
36 amrex::Array4<amrex::EBCellFlag const>
const& flag)
38 amrex::EBSlopeNormalEquation normal_eq;
44 for (
int kk = -1; kk <= 1; ++kk) {
48 for (
int jj = -1; jj <= 1; ++jj) {
52 for (
int ii = -1; ii <= 1; ++ii) {
53 if (flag(i,j,k).isConnected(ii,jj,kk) && !(ii == 0 && jj == 0 && kk == 0)) {
58 normal_eq.add(offset_x, offset_y, offset_z, du);
62 return normal_eq.solve();
82 template <
int Gr
idQuery,
int Gr
idData>
83 AMREX_GPU_DEVICE AMREX_FORCE_INLINE
84 amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>
88 amrex::RealVect
const& bcent_eb,
90 amrex::Array4<amrex::Real const>
const& state,
91 amrex::Array4<amrex::Real const>
const& ccent,
92 amrex::Array4<amrex::EBCellFlag const>
const& flag)
100 constexpr
int ii_lo = (GridQuery ==
Vars::xvel) ? -2 : -1;
101 constexpr
int jj_lo = (GridQuery ==
Vars::yvel) ? -2 : -1;
102 constexpr
int kk_lo = (GridQuery ==
Vars::zvel) ? -2 : -1;
103 constexpr
int ii_hi = (GridData ==
Vars::xvel) ? 2 : 1;
104 constexpr
int jj_hi = (GridData ==
Vars::yvel) ? 2 : 1;
105 constexpr
int kk_hi = (GridData ==
Vars::zvel) ? 2 : 1;
109 bias[GridQuery-1] =
myhalf;
110 bias[GridData-1] = -
myhalf;
112 amrex::EBSlopeNormalEquation normal_eq;
118 for (
int kk = kk_lo; kk <= kk_hi; ++kk) {
122 for (
int jj = jj_lo; jj <= jj_hi; ++jj) {
126 for (
int ii = ii_lo; ii <= ii_hi; ++ii) {
127 if (!flag(i+ii,j+jj,k+kk).isCovered()) {
132 normal_eq.add(offset_x, offset_y, offset_z, du);
136 return normal_eq.solve();
154 AMREX_GPU_DEVICE AMREX_FORCE_INLINE
155 amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>
160 amrex::Array4<amrex::Real const>
const& state,
161 amrex::Array4<amrex::Real const>
const& ccent,
162 amrex::Array4<amrex::EBCellFlag const>
const& flag)
193 bias[igrid_query-1] =
myhalf;
195 amrex::EBSlopeNormalEquation normal_eq;
201 for (
int kk = kk_lo; kk <= kk_hi; ++kk) {
205 for (
int jj = jj_lo; jj <= jj_hi; ++jj) {
209 for (
int ii = ii_lo; ii <= ii_hi; ++ii) {
210 if (!flag(i+ii,j+jj,k+kk).isCovered()) {
212 + bias[0] - ccent(i,j,k,0)) *
dx;
214 + bias[1] - ccent(i,j,k,1)) *
dy;
216 + bias[2] - ccent(i,j,k,2)) *
dz;
217 amrex::Real du = state(i+ii,j+jj,k+kk) - state(i,j,k);
218 normal_eq.add(offset_x, offset_y, offset_z, du);
222 return normal_eq.solve();
241 AMREX_GPU_DEVICE AMREX_FORCE_INLINE
242 amrex::GpuArray<amrex::Real,AMREX_SPACEDIM>
244 [[maybe_unused]]
int igrid_data,
247 const amrex::Array4<const amrex::Real>& vel_arr,
248 amrex::Array4<amrex::Real const>
const& state,
249 amrex::Array4<amrex::Real const>
const& ccent,
250 amrex::Array4<amrex::EBCellFlag const>
const& flag)
278 bias[igrid_query-1] =
myhalf;
280 amrex::EBSlopeNormalEquation normal_eq;
286 for (
int kk = kk_lo; kk <= kk_hi; ++kk) {
290 for (
int jj = jj_lo; jj <= jj_hi; ++jj) {
294 for (
int ii = ii_lo; ii <= ii_hi; ++ii) {
295 if (!flag(i+ii,j+jj,k+kk).isCovered() && !(ii == 0 && jj == 0 && kk == 0)) {
297 + bias[0] - ccent(i,j,k,0)) *
dx;
299 + bias[1] - ccent(i,j,k,1)) *
dy;
301 + bias[2] - ccent(i,j,k,2)) *
dz;
302 amrex::Real du = state(i+ii,j+jj,k+kk) - state(i,j,k);
303 normal_eq.add(offset_x, offset_y, offset_z, du);
307 return normal_eq.solve();
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > erf_calc_slopes_eb_Dirichlet(amrex::Real dx, amrex::Real dy, amrex::Real dz, int i, int j, int k, amrex::RealVect const &bcent_eb, amrex::Real const state_eb, amrex::Array4< amrex::Real const > const &state, amrex::Array4< amrex::Real const > const &ccent, amrex::Array4< amrex::EBCellFlag const > const &flag)
Compute least-squares slopes using EB Dirichlet data.
Definition: ERF_EBSlopes.H:29
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > erf_calc_slopes_eb_staggered_upwind(int igrid_query, [[maybe_unused]] int igrid_data, amrex::Real dx, amrex::Real dy, amrex::Real dz, int i, int j, int k, const amrex::Array4< const amrex::Real > &vel_arr, amrex::Array4< amrex::Real const > const &state, amrex::Array4< amrex::Real const > const &ccent, amrex::Array4< amrex::EBCellFlag const > const &flag)
Compute upwind-biased least-squares slopes for staggered EB advection.
Definition: ERF_EBSlopes.H:243
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > erf_calc_slopes_eb_Dirichlet_staggered(amrex::Real dx, amrex::Real dy, amrex::Real dz, int i, int j, int k, amrex::RealVect const &bcent_eb, amrex::Real const state_eb, amrex::Array4< amrex::Real const > const &state, amrex::Array4< amrex::Real const > const &ccent, amrex::Array4< amrex::EBCellFlag const > const &flag)
Compute least-squares slopes from staggered data using EB Dirichlet data.
Definition: ERF_EBSlopes.H:85
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > erf_calc_slopes_eb_staggered(int igrid_query, int igrid_data, amrex::Real dx, amrex::Real dy, amrex::Real dz, int i, int j, int k, amrex::Array4< amrex::Real const > const &state, amrex::Array4< amrex::Real const > const &ccent, amrex::Array4< amrex::EBCellFlag const > const &flag)
Compute centered least-squares slopes from cell data to a staggered query grid.
Definition: ERF_EBSlopes.H:156
const Real dy
Definition: ERF_InitCustomPert_ABL.H:45
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ xvel
Definition: ERF_IndexDefines.H:255
@ cons
Definition: ERF_IndexDefines.H:254
@ zvel
Definition: ERF_IndexDefines.H:257
@ yvel
Definition: ERF_IndexDefines.H:256
@ dz
Definition: ERF_AdvanceWDM6.cpp:273