1 #ifndef ERF_INTERPOLATE_H_
2 #define ERF_INTERPOLATE_H_
17 amrex::Real diff1, amrex::Real diff2, amrex::Real diff3,
18 amrex::Real scaled_upw,
const AdvType adv_type)
20 amrex::Real myInterpolatedVal(0.);
22 myInterpolatedVal = 0.5 * avg1;
24 myInterpolatedVal = (7.0/12.0)*avg1 -(1.0/12.0)*avg2 + (scaled_upw/12.0)*(diff2 - 3.0*diff1);
26 myInterpolatedVal = (7.0/12.0)*avg1 -(1.0/12.0)*avg2;
28 myInterpolatedVal = (37.0/60.0)*avg1 -(2.0/15.0)*avg2 +(1.0/60.0)*avg3
29 -(scaled_upw/60.0)*(diff3 - 5.0*diff2 + 10.0*diff1);
31 myInterpolatedVal = (37.0/60.0)*avg1 -(2.0/15.0)*avg2 +(1.0/60.0)*avg3;
33 return myInterpolatedVal;
39 InterpolateInX (
int i,
int j,
int k,
const amrex::Array4<const amrex::Real>& qty,
40 int qty_index, amrex::Real upw,
const AdvType adv_type)
44 return 0.5 * (qty(i,j,k,qty_index) + qty(i-1,j,k,qty_index));
47 amrex::Real avg1 = 0.; amrex::Real avg2 = 0.; amrex::Real avg3 = 0.;
48 amrex::Real diff1 = 0.; amrex::Real diff2 = 0.; amrex::Real diff3 = 0.;
49 amrex::Real scaled_upw = 0.;
52 if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; }
54 avg1 = (qty(i, j, k, qty_index) + qty(i-1, j, k, qty_index));
55 diff1 = (qty(i, j, k, qty_index) - qty(i-1, j, k, qty_index));
56 avg2 = (qty(i+1, j, k, qty_index) + qty(i-2, j, k, qty_index));
57 diff2 = (qty(i+1, j, k, qty_index) - qty(i-2, j, k, qty_index));
60 avg3 = (qty(i+2, j, k, qty_index) + qty(i-3, j, k, qty_index));
61 diff3 = (qty(i+2, j, k, qty_index) - qty(i-3, j, k, qty_index));
63 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
70 InterpolateInY (
int i,
int j,
int k,
const amrex::Array4<const amrex::Real>& qty,
71 int qty_index, amrex::Real upw,
const AdvType adv_type)
74 return 0.5 * (qty(i,j,k,qty_index) + qty(i,j-1,k,qty_index));
77 amrex::Real avg1; amrex::Real avg2; amrex::Real avg3 = 0.;
78 amrex::Real diff1; amrex::Real diff2; amrex::Real diff3 = 0.;
79 amrex::Real scaled_upw = 0.;
82 if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; }
84 avg1 = (qty(i, j , k, qty_index) + qty(i, j-1, k, qty_index));
85 diff1 = (qty(i, j , k, qty_index) - qty(i, j-1, k, qty_index));
86 avg2 = (qty(i, j+1, k, qty_index) + qty(i, j-2, k, qty_index));
87 diff2 = (qty(i, j+1, k, qty_index) - qty(i, j-2, k, qty_index));
90 avg3 = (qty(i, j+2, k, qty_index) + qty(i, j-3, k, qty_index));
91 diff3 = (qty(i, j+2, k, qty_index) - qty(i, j-3, k, qty_index));
93 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
100 InterpolateInZ (
int i,
int j,
int k,
const amrex::Array4<const amrex::Real>& qty,
101 int qty_index, amrex::Real upw,
const AdvType adv_type)
104 return 0.5 * (qty(i,j,k,qty_index) + qty(i,j,k-1,qty_index));
107 amrex::Real avg1 = 0.; amrex::Real avg2 = 0.; amrex::Real avg3 = 0.;
108 amrex::Real diff1 = 0.; amrex::Real diff2 = 0.; amrex::Real diff3 = 0.;
109 amrex::Real scaled_upw = 0.;
111 if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; }
113 avg1 = (qty(i, j, k , qty_index) + qty(i, j, k-1, qty_index));
114 diff1 = (qty(i, j, k , qty_index) - qty(i, j, k-1, qty_index));
115 avg2 = (qty(i, j, k+1, qty_index) + qty(i, j, k-2, qty_index));
116 diff2 = (qty(i, j, k+1, qty_index) - qty(i, j, k-2, qty_index));
119 avg3 = (qty(i, j, k+2, qty_index) + qty(i, j, k-3, qty_index));
120 diff3 = (qty(i, j, k+2, qty_index) - qty(i, j, k-3, qty_index));
122 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
130 const amrex::Array4<const amrex::Real>& qty,
131 int qty_index, amrex::Real upw,
Coord coordDir,
132 const AdvType adv_type,
const amrex::Array4<const amrex::Real>& r0_arr)
134 amrex::Real avg1 = 0.; amrex::Real avg2 = 0.; amrex::Real avg3 = 0.;
135 amrex::Real diff1 = 0.; amrex::Real diff2 = 0.; amrex::Real diff3 = 0.;
136 amrex::Real scaled_upw = 0.;
139 if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; }
142 avg1 = (qty(i , j, k, qty_index) + qty(i-1, j, k, qty_index));
143 avg1 -= (r0_arr(i,j,k) + r0_arr(i-1,j,k));
144 diff1 = (qty(i , j, k, qty_index) - qty(i-1, j, k, qty_index));
147 avg2 = (qty(i+1, j, k, qty_index) + qty(i-2, j, k, qty_index));
148 avg2 -= (r0_arr(i+1,j,k) + r0_arr(i-2,j,k));
149 diff2 = (qty(i+1, j, k, qty_index) - qty(i-2, j, k, qty_index));
153 avg3 = (qty(i+2, j, k, qty_index) + qty(i-3, j, k, qty_index));
154 avg3 -= (r0_arr(i+2,j,k) + r0_arr(i-3,j,k));
155 diff3 = (qty(i+2, j, k, qty_index) - qty(i-3, j, k, qty_index));
158 avg1 = (qty(i, j , k, qty_index) + qty(i, j-1, k, qty_index));
159 avg1 -= (r0_arr(i,j,k) + r0_arr(i,j-1,k));
160 diff1 = (qty(i, j , k, qty_index) - qty(i, j-1, k, qty_index));
163 avg2 = (qty(i, j+1, k, qty_index) + qty(i, j-2, k, qty_index));
164 avg2 -= (r0_arr(i,j+1,k) + r0_arr(i,j-2,k));
165 diff2 = (qty(i, j+1, k, qty_index) - qty(i, j-2, k, qty_index));
169 avg3 = (qty(i, j+2, k, qty_index) + qty(i, j-3, k, qty_index));
170 avg3 -= (r0_arr(i,j+2,k) + r0_arr(i,j-3,k));
171 diff3 = (qty(i, j+2, k, qty_index) - qty(i, j-3, k, qty_index));
174 avg1 = (qty(i, j, k , qty_index) + qty(i, j, k-1, qty_index));
175 diff1 = (qty(i, j, k , qty_index) - qty(i, j, k-1, qty_index));
176 avg1 -= (r0_arr(i,j,k) + r0_arr(i,j,k-1));
177 diff1 -= (r0_arr(i,j,k) - r0_arr(i,j,k-1));
181 avg2 = (qty(i, j, k+1, qty_index) + qty(i, j, k-2, qty_index));
182 diff2 = (qty(i, j, k+1, qty_index) - qty(i, j, k-2, qty_index));
183 avg2 -= (r0_arr(i,j,k+1) + r0_arr(i,j,k-2));
184 diff2 -= (r0_arr(i,j,k+1) - r0_arr(i,j,k-2));
188 avg3 = (qty(i, j, k+2, qty_index) + qty(i, j, k-3, qty_index));
189 diff3 = (qty(i, j, k+2, qty_index) - qty(i, j, k-3, qty_index));
190 avg3 -= (r0_arr(i,j,k+2) + r0_arr(i,j,k-3));
191 diff3 -= (r0_arr(i,j,k+2) - r0_arr(i,j,k-3));
195 return interpolatedVal(avg1,avg2,avg3,diff1,diff2,diff3,scaled_upw,adv_type);
202 amrex::Real upw,
Coord coordDir,
const AdvType adv_type,
203 const amrex::Array4<const amrex::Real>& r0_arr)
Coord
Definition: ERF_DataStruct.H:64
#define Rho_comp
Definition: ERF_IndexDefines.H:36
AdvType
Definition: ERF_IndexDefines.H:191
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:100
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:129
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:201
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:16
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:70
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:39