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);
87 amrex::Array4<const amrex::Real>
m_phi;
88 static constexpr amrex::Real
g1=(0.5);
96 UPWIND3 (
const amrex::Array4<const amrex::Real>& phi)
105 const int& qty_index,
108 const amrex::Real upw_frac)
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,
135 const amrex::Real upw_frac)
const
138 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
139 amrex::Real s =
m_phi(i , j , k , qty_index);
140 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
141 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
144 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
150 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
159 const int& qty_index,
162 const amrex::Real upw_frac)
const
165 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
166 amrex::Real s =
m_phi(i , j , k , qty_index);
167 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
168 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
171 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
177 val_lo =
Evaluate(sp1,s,sm1,sm2,upw_lo);
184 const amrex::Real& s,
185 const amrex::Real& sm1,
186 const amrex::Real& sm2,
187 const amrex::Real& upw)
const
190 amrex::Real a1 = (s + sm1);
191 amrex::Real d1 = (s - sm1);
192 amrex::Real a2 = (sp1 + sm2);
193 amrex::Real d2 = (sp1 - sm2);
196 return (
g1*a1 -
g2*a2 + upw *
g2 * (d2 - 3.0*d1) );
202 amrex::Array4<const amrex::Real>
m_phi;
203 static constexpr amrex::Real
g1=(7.0/12.0);
204 static constexpr amrex::Real
g2=(1.0/12.0);
222 const int& qty_index,
225 const amrex::Real )
const
228 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
229 amrex::Real s =
m_phi(i , j , k , qty_index);
230 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
231 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
243 const int& qty_index,
246 const amrex::Real )
const
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,
267 const amrex::Real )
const
270 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
271 amrex::Real s =
m_phi(i , j , k , qty_index);
272 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
273 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
283 const amrex::Real& s,
284 const amrex::Real& sm1,
285 const amrex::Real& sm2)
const
288 amrex::Real a1 = (s + sm1);
289 amrex::Real a2 = (sp1 + sm2);
292 return (
g1*a1 -
g2*a2 );
298 amrex::Array4<const amrex::Real>
m_phi;
299 static constexpr amrex::Real
g1=(7.0/12.0);
300 static constexpr amrex::Real
g2=(1.0/12.0);
308 UPWIND5 (
const amrex::Array4<const amrex::Real>& phi)
317 const int& qty_index,
320 const amrex::Real upw_frac)
const
323 amrex::Real sp2 =
m_phi(i+2, j , k , qty_index);
324 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
325 amrex::Real s =
m_phi(i , j , k , qty_index);
326 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
327 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
328 amrex::Real sm3 =
m_phi(i-3, j , k , qty_index);
331 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
337 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
346 const int& qty_index,
349 const amrex::Real upw_frac)
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,
378 const amrex::Real upw_frac)
const
381 amrex::Real sp2 =
m_phi(i , j , k+2, qty_index);
382 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
383 amrex::Real s =
m_phi(i , j , k , qty_index);
384 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
385 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
386 amrex::Real sm3 =
m_phi(i , j , k-3, qty_index);
389 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
395 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
402 const amrex::Real& sp1,
403 const amrex::Real& s,
404 const amrex::Real& sm1,
405 const amrex::Real& sm2,
406 const amrex::Real& sm3,
407 const amrex::Real& upw)
const
410 amrex::Real a1 = (s + sm1);
411 amrex::Real a2 = (sp1 + sm2);
412 amrex::Real a3 = (sp2 + sm3);
413 amrex::Real d1 = (s - sm1);
414 amrex::Real d2 = (sp1 - sm2);
415 amrex::Real d3 = (sp2 - sm3);
418 return (
g1*a1 -
g2*a2 +
g3*a3 - upw *
g3 * (d3 - 5.0*d2 + 10.0*d1) );
424 amrex::Array4<const amrex::Real>
m_phi;
425 static constexpr amrex::Real
g1=(37.0/60.0);
426 static constexpr amrex::Real
g2=(2.0/15.0);
427 static constexpr amrex::Real
g3=(1.0/60.0);
444 const int& qty_index,
447 const amrex::Real )
const
450 amrex::Real sp2 =
m_phi(i+2, j , k , qty_index);
451 amrex::Real sp1 =
m_phi(i+1, j , k , qty_index);
452 amrex::Real s =
m_phi(i , j , k , qty_index);
453 amrex::Real sm1 =
m_phi(i-1, j , k , qty_index);
454 amrex::Real sm2 =
m_phi(i-2, j , k , qty_index);
455 amrex::Real sm3 =
m_phi(i-3, j , k , qty_index);
458 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
467 const int& qty_index,
470 const amrex::Real )
const
473 amrex::Real sp2 =
m_phi(i , j+2, k , qty_index);
474 amrex::Real sp1 =
m_phi(i , j+1, k , qty_index);
475 amrex::Real s =
m_phi(i , j , k , qty_index);
476 amrex::Real sm1 =
m_phi(i , j-1, k , qty_index);
477 amrex::Real sm2 =
m_phi(i , j-2, k , qty_index);
478 amrex::Real sm3 =
m_phi(i , j-3, k , qty_index);
481 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3);
490 const int& qty_index,
493 const amrex::Real )
const
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);
549 const int& qty_index,
552 const amrex::Real upw_frac,
556 val_lo = 0.5 * (
m_phi(i,j,k,qty_index) +
m_phi(i,j,k-1,qty_index) );
561 amrex::Real sp1 =
m_phi(i , j , k+1, qty_index);
562 amrex::Real s =
m_phi(i , j , k , qty_index);
563 amrex::Real sm1 =
m_phi(i , j , k-1, qty_index);
564 amrex::Real sm2 =
m_phi(i , j , k-2, qty_index);
568 if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
574 val_lo =
Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
582 const amrex::Real& sp1,
583 const amrex::Real& s,
584 const amrex::Real& sm1,
585 const amrex::Real& sm2,
586 const amrex::Real& sm3,
587 const amrex::Real& upw,
591 amrex::Real a1 = (s + sm1);
592 amrex::Real a2 = (sp1 + sm2);
593 amrex::Real d1 = (s - sm1);
594 amrex::Real d2 = (sp1 - sm2);
595 amrex::Real a3 = (sp2 + sm3);
596 amrex::Real d3 = (sp2 - sm3);
615 amrex::Array4<const amrex::Real>
m_phi;
616 static constexpr amrex::Real
g1_3_4=( 7.0/12.0);
617 static constexpr amrex::Real
g2_3_4=( 1.0/12.0);
618 static constexpr amrex::Real
g1_5_6=(37.0/60.0);
619 static constexpr amrex::Real
g2_5_6=( 2.0/15.0);
620 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
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:84
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:87
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:88
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:212
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: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 amrex::Real) const
Definition: ERF_Interpolation_UPW.H:240
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:298
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:299
CENTERED4(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:213
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:295
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:219
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:282
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:300
Definition: ERF_Interpolation_UPW.H:434
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:464
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:531
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 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)
Definition: ERF_Interpolation_UPW.H:435
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:487
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:532
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:441
Definition: ERF_Interpolation_UPW.H:95
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:183
static constexpr amrex::Real g2
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 amrex::Real upw_frac) const
Definition: ERF_Interpolation_UPW.H:129
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:202
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:203
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:199
UPWIND3(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:96
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:102
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:156
Definition: ERF_Interpolation_UPW.H:307
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:401
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:424
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:426
int GetUpwindCellNumber() const
Definition: ERF_Interpolation_UPW.H:421
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:425
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:372
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:314
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:427
UPWIND5(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:308
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:343
Definition: ERF_Interpolation_UPW.H:539
UPWINDALL(const amrex::Array4< const amrex::Real > &phi)
Definition: ERF_Interpolation_UPW.H:540
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:615
static constexpr amrex::Real g1_5_6
Definition: ERF_Interpolation_UPW.H:618
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:616
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:546
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:617
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:581
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:620
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:619