1 #ifndef ERF_INTERPOLATE_UPW_H_
2 #define ERF_INTERPOLATE_UPW_H_
11 CENTERED2 (
const amrex::Array4<const amrex::Real>& phi)
23 const amrex::Real )
const
26 amrex::Real s =
m_phi(i , j , k , qty_index);
27 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
42 const amrex::Real )
const
45 amrex::Real s =
m_phi(i , j , k , qty_index);
46 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
61 const amrex::Real )
const
64 amrex::Real s =
m_phi(i , j , k , qty_index);
65 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
75 const amrex::Real& sm1)
const
78 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)
103 const int& qty_index,
106 const amrex::Real upw_frac)
const
109 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
110 amrex::Real s =
m_phi(i , j , k , qty_index);
111 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
112 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
115 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
121 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
130 const int& qty_index,
133 const amrex::Real upw_frac)
const
136 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
137 amrex::Real s =
m_phi(i , j , k , qty_index);
138 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
139 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
142 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
148 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
157 const int& qty_index,
160 const amrex::Real upw_frac)
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) );
198 amrex::Array4<const amrex::Real>
m_phi;
199 static constexpr amrex::Real
g1=(7.0/12.0);
200 static constexpr amrex::Real
g2=(1.0/12.0);
218 const int& qty_index,
221 const amrex::Real )
const
224 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
225 amrex::Real s =
m_phi(i , j , k , qty_index);
226 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
227 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
239 const int& qty_index,
242 const amrex::Real )
const
245 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
246 amrex::Real s =
m_phi(i , j , k , qty_index);
247 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
248 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
260 const int& qty_index,
263 const amrex::Real )
const
266 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
267 amrex::Real s =
m_phi(i , j , k , qty_index);
268 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
269 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
279 const amrex::Real& s,
280 const amrex::Real& sm1,
281 const amrex::Real& sm2)
const
284 amrex::Real a1 = (s + sm1);
285 amrex::Real a2 = (sp1 + sm2);
288 return (
g1*a1 -
g2*a2 );
292 amrex::Array4<const amrex::Real>
m_phi;
293 static constexpr amrex::Real
g1=(7.0/12.0);
294 static constexpr amrex::Real
g2=(1.0/12.0);
302 UPWIND5 (
const amrex::Array4<const amrex::Real>& phi)
311 const int& qty_index,
314 const amrex::Real upw_frac)
const
317 amrex::Real sp2 =
m_phi(i+2, j , k , qty_index);
318 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
319 amrex::Real s =
m_phi(i , j , k , qty_index);
320 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
321 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
322 amrex::Real sm3 =
m_phi(i-3, j , k , qty_index);
325 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
331 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
340 const int& qty_index,
343 const amrex::Real upw_frac)
const
346 amrex::Real sp2 =
m_phi(i , j+2, k , qty_index);
347 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
348 amrex::Real s =
m_phi(i , j , k , qty_index);
349 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
350 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
351 amrex::Real sm3 =
m_phi(i , j-3, k , qty_index);
354 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
360 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
369 const int& qty_index,
372 const amrex::Real upw_frac)
const
375 amrex::Real sp2 =
m_phi(i , j , k+2, qty_index);
376 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
377 amrex::Real s =
m_phi(i , j , k , qty_index);
378 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
379 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
380 amrex::Real sm3 =
m_phi(i , j , k-3, qty_index);
383 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
389 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
396 const amrex::Real& sp1,
397 const amrex::Real& s,
398 const amrex::Real& sm1,
399 const amrex::Real& sm2,
400 const amrex::Real& sm3,
401 const amrex::Real& upw)
const
404 amrex::Real a1 = (s + sm1);
405 amrex::Real a2 = (sp1 + sm2);
406 amrex::Real a3 = (sp2 + sm3);
407 amrex::Real d1 = (s - sm1);
408 amrex::Real d2 = (sp1 - sm2);
409 amrex::Real d3 = (sp2 - sm3);
412 return (
g1*a1 -
g2*a2 +
g3*a3 - upw *
g3 * (d3 - 5.0*d2 + 10.0*d1) );
416 amrex::Array4<const amrex::Real>
m_phi;
417 static constexpr amrex::Real
g1=(37.0/60.0);
418 static constexpr amrex::Real
g2=(2.0/15.0);
419 static constexpr amrex::Real
g3=(1.0/60.0);
436 const int& qty_index,
439 const amrex::Real )
const
442 amrex::Real sp2 =
m_phi(i+2, j , k , qty_index);
443 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
444 amrex::Real s =
m_phi(i , j , k , qty_index);
445 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
446 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
447 amrex::Real sm3 =
m_phi(i-3, j , k , qty_index);
450 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
459 const int& qty_index,
462 const amrex::Real )
const
465 amrex::Real sp2 =
m_phi(i , j+2, k , qty_index);
466 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
467 amrex::Real s =
m_phi(i , j , k , qty_index);
468 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
469 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
470 amrex::Real sm3 =
m_phi(i , j-3, k , qty_index);
473 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
482 const int& qty_index,
485 const amrex::Real )
const
488 amrex::Real sp2 =
m_phi(i , j , k+2, qty_index);
489 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
490 amrex::Real s =
m_phi(i , j , k , qty_index);
491 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
492 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
493 amrex::Real sm3 =
m_phi(i , j , k-3, qty_index);
496 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
503 const amrex::Real& sp1,
504 const amrex::Real& s,
505 const amrex::Real& sm1,
506 const amrex::Real& sm2,
507 const amrex::Real& sm3)
const
510 amrex::Real a1 = (s + sm1);
511 amrex::Real a2 = (sp1 + sm2);
512 amrex::Real a3 = (sp2 + sm3);
515 return (
g1*a1 -
g2*a2 +
g3*a3 );
519 amrex::Array4<const amrex::Real>
m_phi;
520 static constexpr amrex::Real
g1=(37.0/60.0);
521 static constexpr amrex::Real
g2=(2.0/15.0);
522 static constexpr amrex::Real
g3=(1.0/60.0);
539 const int& qty_index,
542 const amrex::Real upw_frac,
546 val_lo = 0.5 * (
m_phi(i,j,k,qty_index) +
m_phi(i,j,k-1,qty_index) );
551 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
552 amrex::Real s =
m_phi(i , j , k , qty_index);
553 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
554 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
558 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
564 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
572 const amrex::Real& sp1,
573 const amrex::Real& s,
574 const amrex::Real& sm1,
575 const amrex::Real& sm2,
576 const amrex::Real& sm3,
577 const amrex::Real& upw,
581 amrex::Real a1 = (s + sm1);
582 amrex::Real a2 = (sp1 + sm2);
583 amrex::Real d1 = (s - sm1);
584 amrex::Real d2 = (sp1 - sm2);
585 amrex::Real a3 = (sp2 + sm3);
586 amrex::Real d3 = (sp2 - sm3);
605 amrex::Array4<const amrex::Real>
m_phi;
606 static constexpr amrex::Real
g1_3_4=( 7.0/12.0);
607 static constexpr amrex::Real
g2_3_4=( 1.0/12.0);
608 static constexpr amrex::Real
g1_5_6=(37.0/60.0);
609 static constexpr amrex::Real
g2_5_6=( 2.0/15.0);
610 static constexpr amrex::Real
g3_5_6=( 1.0/60.0);
AdvType
Definition: ERF_IndexDefines.H:191
Definition: ERF_Interpolation_UPW.H:10
CENTERED2(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:11
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &s, const amrex::Real &sm1) const
Definition: ERF_Interpolation_UPW.H:74
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:55
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:36
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:17
Definition: ERF_Interpolation_UPW.H:208
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:257
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:236
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:292
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:293
CENTERED4(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:209
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:215
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:278
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:294
Definition: ERF_Interpolation_UPW.H:426
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:456
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:521
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:520
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:519
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:502
CENTERED6(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:427
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:479
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:522
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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:433
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:200
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:127
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:198
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:199
UPWIND3(const amrex::Array4< const amrex::Real > &phi)
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:100
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:154
Definition: ERF_Interpolation_UPW.H:301
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:395
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:416
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:418
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:417
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:366
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:308
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:419
UPWIND5(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:302
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:337
Definition: ERF_Interpolation_UPW.H:529
UPWINDALL(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:530
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:605
static constexpr amrex::Real g1_5_6
Definition: ERF_Interpolation_UPW.H:608
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:606
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 amrex::Real upw_frac, const AdvType adv_type) const
Definition: ERF_Interpolation_UPW.H:536
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:607
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:571
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:610
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:609