1 #ifndef ERF_INTERPOLATE_H_
2 #define ERF_INTERPOLATE_H_
48 "interpolatedVal only supports Centered_2nd, Upwind_3rd, Centered_4th, Upwind_5th, and Centered_6th");
52 myInterpolatedVal =
myhalf * avg1;
65 "interpolatedVal only supports Centered_2nd, Upwind_3rd, Centered_4th, Upwind_5th, and Centered_6th");
67 return myInterpolatedVal;
85 InterpolateInX (
int i,
int j,
int k,
const amrex::Array4<const amrex::Real>& qty,
90 return myhalf * (qty(i,j,k,qty_index) + qty(i-1,j,k,qty_index));
100 avg1 = (qty(i, j, k, qty_index) + qty(i-1, j, k, qty_index));
101 diff1 = (qty(i, j, k, qty_index) - qty(i-1, j, k, qty_index));
102 avg2 = (qty(i+1, j, k, qty_index) + qty(i-2, j, k, qty_index));
103 diff2 = (qty(i+1, j, k, qty_index) - qty(i-2, j, k, qty_index));
106 avg3 = (qty(i+2, j, k, qty_index) + qty(i-3, j, k, qty_index));
107 diff3 = (qty(i+2, j, k, qty_index) - qty(i-3, j, k, qty_index));
109 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
128 InterpolateInY (
int i,
int j,
int k,
const amrex::Array4<const amrex::Real>& qty,
132 return myhalf * (qty(i,j,k,qty_index) + qty(i,j-1,k,qty_index));
142 avg1 = (qty(i, j , k, qty_index) + qty(i, j-1, k, qty_index));
143 diff1 = (qty(i, j , k, qty_index) - qty(i, j-1, k, qty_index));
144 avg2 = (qty(i, j+1, k, qty_index) + qty(i, j-2, k, qty_index));
145 diff2 = (qty(i, j+1, k, qty_index) - qty(i, j-2, k, qty_index));
148 avg3 = (qty(i, j+2, k, qty_index) + qty(i, j-3, k, qty_index));
149 diff3 = (qty(i, j+2, k, qty_index) - qty(i, j-3, k, qty_index));
151 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
170 InterpolateInZ (
int i,
int j,
int k,
const amrex::Array4<const amrex::Real>& qty,
174 return myhalf * (qty(i,j,k,qty_index) + qty(i,j,k-1,qty_index));
183 avg1 = (qty(i, j, k , qty_index) + qty(i, j, k-1, qty_index));
184 diff1 = (qty(i, j, k , qty_index) - qty(i, j, k-1, qty_index));
185 avg2 = (qty(i, j, k+1, qty_index) + qty(i, j, k-2, qty_index));
186 diff2 = (qty(i, j, k+1, qty_index) - qty(i, j, k-2, qty_index));
189 avg3 = (qty(i, j, k+2, qty_index) + qty(i, j, k-3, qty_index));
190 diff3 = (qty(i, j, k+2, qty_index) - qty(i, j, k-3, qty_index));
192 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
214 const amrex::Array4<const amrex::Real>& qty,
216 const AdvType adv_type,
const amrex::Array4<const amrex::Real>& r0_arr)
228 avg1 = (qty(i , j, k, qty_index) + qty(i-1, j, k, qty_index));
229 avg1 -= (r0_arr(i,j,k) + r0_arr(i-1,j,k));
230 diff1 = (qty(i , j, k, qty_index) - qty(i-1, j, k, qty_index));
231 diff1 -= (r0_arr(i,j,k) - r0_arr(i-1,j,k));
234 avg2 = (qty(i+1, j, k, qty_index) + qty(i-2, j, k, qty_index));
235 avg2 -= (r0_arr(i+1,j,k) + r0_arr(i-2,j,k));
236 diff2 = (qty(i+1, j, k, qty_index) - qty(i-2, j, k, qty_index));
237 diff2 -= (r0_arr(i+1,j,k) - r0_arr(i-2,j,k));
241 avg3 = (qty(i+2, j, k, qty_index) + qty(i-3, j, k, qty_index));
242 avg3 -= (r0_arr(i+2,j,k) + r0_arr(i-3,j,k));
243 diff3 = (qty(i+2, j, k, qty_index) - qty(i-3, j, k, qty_index));
244 diff3 -= (r0_arr(i+2,j,k) - r0_arr(i-3,j,k));
247 avg1 = (qty(i, j , k, qty_index) + qty(i, j-1, k, qty_index));
248 avg1 -= (r0_arr(i,j,k) + r0_arr(i,j-1,k));
249 diff1 = (qty(i, j , k, qty_index) - qty(i, j-1, k, qty_index));
250 diff1 -= (r0_arr(i,j,k) - r0_arr(i,j-1,k));
253 avg2 = (qty(i, j+1, k, qty_index) + qty(i, j-2, k, qty_index));
254 avg2 -= (r0_arr(i,j+1,k) + r0_arr(i,j-2,k));
255 diff2 = (qty(i, j+1, k, qty_index) - qty(i, j-2, k, qty_index));
256 diff2 -= (r0_arr(i,j+1,k) - r0_arr(i,j-2,k));
260 avg3 = (qty(i, j+2, k, qty_index) + qty(i, j-3, k, qty_index));
261 avg3 -= (r0_arr(i,j+2,k) + r0_arr(i,j-3,k));
262 diff3 = (qty(i, j+2, k, qty_index) - qty(i, j-3, k, qty_index));
263 diff3 -= (r0_arr(i,j+2,k) - r0_arr(i,j-3,k));
266 avg1 = (qty(i, j, k , qty_index) + qty(i, j, k-1, qty_index));
267 diff1 = (qty(i, j, k , qty_index) - qty(i, j, k-1, qty_index));
268 avg1 -= (r0_arr(i,j,k) + r0_arr(i,j,k-1));
269 diff1 -= (r0_arr(i,j,k) - r0_arr(i,j,k-1));
273 avg2 = (qty(i, j, k+1, qty_index) + qty(i, j, k-2, qty_index));
274 diff2 = (qty(i, j, k+1, qty_index) - qty(i, j, k-2, qty_index));
275 avg2 -= (r0_arr(i,j,k+1) + r0_arr(i,j,k-2));
276 diff2 -= (r0_arr(i,j,k+1) - r0_arr(i,j,k-2));
280 avg3 = (qty(i, j, k+2, qty_index) + qty(i, j, k-3, qty_index));
281 diff3 = (qty(i, j, k+2, qty_index) - qty(i, j, k-3, qty_index));
282 avg3 -= (r0_arr(i,j,k+2) + r0_arr(i,j,k-3));
283 diff3 -= (r0_arr(i,j,k+2) - r0_arr(i,j,k-3));
287 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
308 const amrex::Array4<const amrex::Real>& r0_arr)
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
Coord
Coordinate-axis selector.
Definition: ERF_DataStruct.H:144
#define Rho_comp
Definition: ERF_IndexDefines.H:39
AdvType
Definition: ERF_IndexDefines.H:304
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real InterpolateInZ(int i, int j, int k, const amrex::Array4< const amrex::Real > &qty, int qty_index, amrex::Real upw, const AdvType adv_type)
Definition: ERF_Interpolation.H:170
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool isSupportedInterpolationAdvType(const AdvType adv_type) noexcept
Definition: ERF_Interpolation.H:17
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real InterpolatePertFromCell(int i, int j, int k, const amrex::Array4< const amrex::Real > &qty, int qty_index, amrex::Real upw, Coord coordDir, const AdvType adv_type, const amrex::Array4< const amrex::Real > &r0_arr)
Definition: ERF_Interpolation.H:213
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real InterpolateDensityPertFromCellToFace(int i, int j, int k, const amrex::Array4< const amrex::Real > &cons_in, amrex::Real upw, Coord coordDir, const AdvType adv_type, const amrex::Array4< const amrex::Real > &r0_arr)
Definition: ERF_Interpolation.H:306
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real interpolatedVal(amrex::Real avg1, amrex::Real avg2, amrex::Real avg3, amrex::Real diff1, amrex::Real diff2, amrex::Real diff3, amrex::Real scaled_upw, const AdvType adv_type)
Definition: ERF_Interpolation.H:42
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real InterpolateInY(int i, int j, int k, const amrex::Array4< const amrex::Real > &qty, int qty_index, amrex::Real upw, const AdvType adv_type)
Definition: ERF_Interpolation.H:128
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real InterpolateInX(int i, int j, int k, const amrex::Array4< const amrex::Real > &qty, int qty_index, amrex::Real upw, const AdvType adv_type)
Definition: ERF_Interpolation.H:85
amrex::Real Real
Definition: ERF_ShocInterface.H:19