1 #ifndef ERF_INTERPOLATE_UPW_H_
2 #define ERF_INTERPOLATE_UPW_H_
11 CENTERED2 (
const amrex::Array4<const amrex::Real>& phi,
26 amrex::Real s =
m_phi(i , j , k , qty_index);
27 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
44 amrex::Real s =
m_phi(i , j , k , qty_index);
45 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
62 amrex::Real s =
m_phi(i , j , k , qty_index);
63 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
73 const amrex::Real& sm1)
const
76 amrex::Real a1 = (s + sm1);
85 amrex::Array4<const amrex::Real>
m_phi;
86 static constexpr amrex::Real
g1=(0.5);
94 UPWIND3 (
const amrex::Array4<const amrex::Real>& phi,
95 const amrex::Real upw_frac)
106 const int& qty_index,
108 amrex::Real upw_lo)
const
111 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
112 amrex::Real s =
m_phi(i , j , k , qty_index);
113 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
114 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
117 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
123 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
132 const int& qty_index,
134 amrex::Real upw_lo)
const
137 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
138 amrex::Real s =
m_phi(i , j , k , qty_index);
139 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
140 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
143 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
149 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
158 const int& qty_index,
160 amrex::Real upw_lo)
const
163 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
164 amrex::Real s =
m_phi(i , j , k , qty_index);
165 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
166 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
169 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
175 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
182 const amrex::Real& s,
183 const amrex::Real& sm1,
184 const amrex::Real& sm2,
185 const amrex::Real& upw)
const
188 amrex::Real a1 = (s + sm1);
189 amrex::Real d1 = (s - sm1);
190 amrex::Real a2 = (sp1 + sm2);
191 amrex::Real d2 = (sp1 - sm2);
194 return (
g1*a1 -
g2*a2 + upw *
g2 * (d2 - 3.0*d1) );
202 amrex::Array4<const amrex::Real>
m_phi;
204 static constexpr amrex::Real
g1=(7.0/12.0);
205 static constexpr amrex::Real
g2=(1.0/12.0);
224 const int& qty_index,
229 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
230 amrex::Real s =
m_phi(i , j , k , qty_index);
231 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
232 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
244 const int& qty_index,
249 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
250 amrex::Real s =
m_phi(i , j , k , qty_index);
251 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
252 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
264 const int& qty_index,
269 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
270 amrex::Real s =
m_phi(i , j , k , qty_index);
271 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
272 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
282 const amrex::Real& s,
283 const amrex::Real& sm1,
284 const amrex::Real& sm2)
const
287 amrex::Real a1 = (s + sm1);
288 amrex::Real a2 = (sp1 + sm2);
291 return (
g1*a1 -
g2*a2 );
297 amrex::Array4<const amrex::Real>
m_phi;
298 static constexpr amrex::Real
g1=(7.0/12.0);
299 static constexpr amrex::Real
g2=(1.0/12.0);
307 UPWIND5 (
const amrex::Array4<const amrex::Real>& phi,
308 const amrex::Real upw_frac)
319 const int& qty_index,
321 amrex::Real upw_lo)
const
324 amrex::Real sp2 =
m_phi(i+2, j , k , qty_index);
325 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
326 amrex::Real s =
m_phi(i , j , k , qty_index);
327 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
328 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
329 amrex::Real sm3 =
m_phi(i-3, j , k , qty_index);
332 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
338 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
347 const int& qty_index,
349 amrex::Real upw_lo)
const
352 amrex::Real sp2 =
m_phi(i , j+2, k , qty_index);
353 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
354 amrex::Real s =
m_phi(i , j , k , qty_index);
355 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
356 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
357 amrex::Real sm3 =
m_phi(i , j-3, k , qty_index);
360 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
366 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
375 const int& qty_index,
377 amrex::Real upw_lo)
const
380 amrex::Real sp2 =
m_phi(i , j , k+2, qty_index);
381 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
382 amrex::Real s =
m_phi(i , j , k , qty_index);
383 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
384 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
385 amrex::Real sm3 =
m_phi(i , j , k-3, qty_index);
388 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
394 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
401 const amrex::Real& sp1,
402 const amrex::Real& s,
403 const amrex::Real& sm1,
404 const amrex::Real& sm2,
405 const amrex::Real& sm3,
406 const amrex::Real& upw)
const
409 amrex::Real a1 = (s + sm1);
410 amrex::Real a2 = (sp1 + sm2);
411 amrex::Real a3 = (sp2 + sm3);
412 amrex::Real d1 = (s - sm1);
413 amrex::Real d2 = (sp1 - sm2);
414 amrex::Real d3 = (sp2 - sm3);
417 return (
g1*a1 -
g2*a2 +
g3*a3 - upw *
g3 * (d3 - 5.0*d2 + 10.0*d1) );
425 amrex::Array4<const amrex::Real>
m_phi;
427 static constexpr amrex::Real
g1=(37.0/60.0);
428 static constexpr amrex::Real
g2=(2.0/15.0);
429 static constexpr amrex::Real
g3=(1.0/60.0);
447 const int& qty_index,
452 amrex::Real sp2 =
m_phi(i+2, j , k , qty_index);
453 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
454 amrex::Real s =
m_phi(i , j , k , qty_index);
455 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
456 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
457 amrex::Real sm3 =
m_phi(i-3, j , k , qty_index);
460 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
469 const int& qty_index,
474 amrex::Real sp2 =
m_phi(i , j+2, k , qty_index);
475 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
476 amrex::Real s =
m_phi(i , j , k , qty_index);
477 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
478 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
479 amrex::Real sm3 =
m_phi(i , j-3, k , qty_index);
482 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
491 const int& qty_index,
496 amrex::Real sp2 =
m_phi(i , j , k+2, qty_index);
497 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
498 amrex::Real s =
m_phi(i , j , k , qty_index);
499 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
500 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
501 amrex::Real sm3 =
m_phi(i , j , k-3, qty_index);
504 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
511 const amrex::Real& sp1,
512 const amrex::Real& s,
513 const amrex::Real& sm1,
514 const amrex::Real& sm2,
515 const amrex::Real& sm3)
const
518 amrex::Real a1 = (s + sm1);
519 amrex::Real a2 = (sp1 + sm2);
520 amrex::Real a3 = (sp2 + sm3);
523 return (
g1*a1 -
g2*a2 +
g3*a3 );
529 amrex::Array4<const amrex::Real>
m_phi;
530 static constexpr amrex::Real
g1=(37.0/60.0);
531 static constexpr amrex::Real
g2=(2.0/15.0);
532 static constexpr amrex::Real
g3=(1.0/60.0);
541 const amrex::Real upw_frac)
552 const int& qty_index,
558 val_lo = 0.5 * (
m_phi(i,j,k,qty_index) +
m_phi(i,j,k-1,qty_index) );
563 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
564 amrex::Real s =
m_phi(i , j , k , qty_index);
565 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
566 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
570 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
576 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
584 const amrex::Real& sp1,
585 const amrex::Real& s,
586 const amrex::Real& sm1,
587 const amrex::Real& sm2,
588 const amrex::Real& sm3,
589 const amrex::Real& upw,
593 amrex::Real a1 = (s + sm1);
594 amrex::Real a2 = (sp1 + sm2);
595 amrex::Real d1 = (s - sm1);
596 amrex::Real d2 = (sp1 - sm2);
597 amrex::Real a3 = (sp2 + sm3);
598 amrex::Real d3 = (sp2 - sm3);
617 amrex::Array4<const amrex::Real>
m_phi;
619 static constexpr amrex::Real
g1_3_4=( 7.0/12.0);
620 static constexpr amrex::Real
g2_3_4=( 1.0/12.0);
621 static constexpr amrex::Real
g1_5_6=(37.0/60.0);
622 static constexpr amrex::Real
g2_5_6=( 2.0/15.0);
623 static constexpr amrex::Real
g3_5_6=( 1.0/60.0);
AdvType
Definition: ERF_IndexDefines.H:203
Definition: ERF_Interpolation_UPW.H:10
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &s, const amrex::Real &sm1) const
Definition: ERF_Interpolation_UPW.H:72
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:36
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:82
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:54
CENTERED2(const amrex::Array4< const amrex::Real > &phi, const amrex::Real)
Definition: ERF_Interpolation_UPW.H:11
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:85
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:86
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:18
Definition: ERF_Interpolation_UPW.H:213
CENTERED4(const amrex::Array4< const amrex::Real > &phi, const amrex::Real)
Definition: ERF_Interpolation_UPW.H:214
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:261
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:241
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:297
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:298
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:294
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:221
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2) const
Definition: ERF_Interpolation_UPW.H:281
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:299
Definition: ERF_Interpolation_UPW.H:436
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:444
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:531
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:466
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:526
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:530
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:529
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real) const
Definition: ERF_Interpolation_UPW.H:488
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp2, const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &sm3) const
Definition: ERF_Interpolation_UPW.H:510
CENTERED6(const amrex::Array4< const amrex::Real > &phi, const amrex::Real)
Definition: ERF_Interpolation_UPW.H:437
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:532
Definition: ERF_Interpolation_UPW.H:93
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &upw) const
Definition: ERF_Interpolation_UPW.H:181
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:205
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:155
void SetUpwinding(amrex::Real upw_frac)
Definition: ERF_Interpolation_UPW.H:199
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:202
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:204
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:129
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:197
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:203
UPWIND3(const amrex::Array4< const amrex::Real > &phi, const amrex::Real upw_frac)
Definition: ERF_Interpolation_UPW.H:94
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:103
Definition: ERF_Interpolation_UPW.H:306
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:426
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp2, const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &sm3, const amrex::Real &upw) const
Definition: ERF_Interpolation_UPW.H:400
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:425
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:428
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:372
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInY(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:344
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInX(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo) const
Definition: ERF_Interpolation_UPW.H:316
UPWIND5(const amrex::Array4< const amrex::Real > &phi, const amrex::Real upw_frac)
Definition: ERF_Interpolation_UPW.H:307
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:420
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:427
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:429
void SetUpwinding(amrex::Real upw_frac)
Definition: ERF_Interpolation_UPW.H:422
Definition: ERF_Interpolation_UPW.H:539
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:617
static constexpr amrex::Real g1_5_6
Definition: ERF_Interpolation_UPW.H:621
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:619
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:618
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:620
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp2, const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &sm3, const amrex::Real &upw, const AdvType adv_type) const
Definition: ERF_Interpolation_UPW.H:583
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:623
UPWINDALL(const amrex::Array4< const amrex::Real > &phi, const amrex::Real upw_frac)
Definition: ERF_Interpolation_UPW.H:540
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void InterpolateInZ(const int &i, const int &j, const int &k, const int &qty_index, amrex::Real &val_lo, amrex::Real upw_lo, const AdvType adv_type) const
Definition: ERF_Interpolation_UPW.H:549
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:622