ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
WENO_Z7 Struct Reference

#include <ERF_Interpolation_WENO_Z.H>

Collaboration diagram for WENO_Z7:

Public Member Functions

 WENO_Z7 (const amrex::Array4< const amrex::Real > &phi, const amrex::Real)
 
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_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_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_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate (const amrex::Real &sm3, const amrex::Real &sm2, const amrex::Real &sm1, const amrex::Real &s, const amrex::Real &sp1, const amrex::Real &sp2, const amrex::Real &sp3) const
 

Private Attributes

amrex::Array4< const amrex::Realm_phi
 
const amrex::Real eps =amrex::Real(1.0e-40)
 

Static Private Attributes

static constexpr amrex::Real g1 =( amrex::Real(1)/amrex::Real(64.0))
 
static constexpr amrex::Real g2 =(amrex::Real(21.0)/amrex::Real(64.0))
 
static constexpr amrex::Real g3 =(amrex::Real(35.0)/amrex::Real(64.0))
 
static constexpr amrex::Real g4 =( amrex::Real(7.0)/amrex::Real(64.0))
 

Detailed Description

Interpolation operators used for WENO_Z-7 scheme

Constructor & Destructor Documentation

◆ WENO_Z7()

WENO_Z7::WENO_Z7 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
406  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:575

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO_Z7::Evaluate ( const amrex::Real sm3,
const amrex::Real sm2,
const amrex::Real sm1,
const amrex::Real s,
const amrex::Real sp1,
const amrex::Real sp2,
const amrex::Real sp3 
) const
inline
511  {
512  // Smoothing factors
513  amrex::Real b1 = ( sm3 * sm3 * amrex::Real(6649.)/amrex::Real(2880.0)
514  - sm3 * sm2 * amrex::Real(2623.)/amrex::Real(160.0)
515  + sm3 * sm1 * amrex::Real(9449.)/amrex::Real(480.0)
516  - sm3 * s * amrex::Real(11389.)/amrex::Real(1440.0)
517  + sm2 * sm2 * amrex::Real(28547.)/amrex::Real(960.0)
518  - sm2 * sm1 * amrex::Real(35047.)/amrex::Real(480.0)
519  + sm2 * s * amrex::Real(14369.)/amrex::Real(480.0)
520  + sm1 * sm1 * amrex::Real(44747.)/amrex::Real(960.0)
521  - sm1 * s * amrex::Real(6383.)/amrex::Real(160.0)
522  + s * s * amrex::Real(25729.)/amrex::Real(2880.0) );
523  amrex::Real b2 = ( sm2 * sm2 * 3169/amrex::Real(2880.0)
524  - sm2 * sm1 * 3229/amrex::Real(480.0)
525  + sm2 * s * 3169/amrex::Real(480.0)
526  - sm2 * sp1 * 2989/amrex::Real(1440.0)
527  + sm1 * sm1 * 11147/amrex::Real(960.0)
528  - sm1 * s * 11767/amrex::Real(480.0)
529  + sm1 * sp1 * 1283/amrex::Real(160.0)
530  + s * s * 13667/amrex::Real(960.0)
531  - s * sp1 * 5069/amrex::Real(480.0)
532  + sp1 * sp1 * 6649/amrex::Real(2880.0) );
533  amrex::Real b3 = ( sm1 * sm1 * amrex::Real(6649.)/amrex::Real(2880.0)
534  - sm1 * s * amrex::Real(5069.)/amrex::Real(480.0)
535  + sm1 * sp1 * amrex::Real(1283.)/amrex::Real(160.0)
536  - sm1 * sp2 * amrex::Real(2989.)/amrex::Real(1440.0)
537  + s * s * amrex::Real(13667.)/amrex::Real(960.0)
538  - s * sp1 * amrex::Real(11767.)/amrex::Real(480.0)
539  + s * sp2 * amrex::Real(3169.)/amrex::Real(480.0)
540  + sp1 * sp1 * amrex::Real(11147.)/amrex::Real(960.0)
541  - sp1 * sp2 * amrex::Real(3229.)/amrex::Real(480.0)
542  + sp2 * sp2 * amrex::Real(3169.)/amrex::Real(2880.0) );
543  amrex::Real b4 = ( s * s * amrex::Real(25729.)/amrex::Real(2880.)
544  - s * sp1 * amrex::Real(6383.)/amrex::Real(160.)
545  + s * sp2 * amrex::Real(14369.)/amrex::Real(480.)
546  - s * sp3 * amrex::Real(11389.)/amrex::Real(1440.)
547  + sp1 * sp1 * amrex::Real(44747.)/amrex::Real(960.)
548  - sp1 * sp2 * amrex::Real(35047.)/amrex::Real(480.)
549  + sp1 * sp3 * amrex::Real(9449.)/amrex::Real(480.)
550  + sp2 * sp2 * amrex::Real(28547.)/amrex::Real(960.)
551  - sp2 * sp3 * amrex::Real(2623.)/amrex::Real(160.)
552  + sp3 * sp3 * amrex::Real(6649.)/amrex::Real(2880.) );
553 
554  // Weight factors
555  amrex::Real t5 = std::abs(b1 - b2 - b3 + b4);
556  amrex::Real w1 = g1 * ( amrex::Real(1) + (t5*t5) / ((eps + b1) * (eps + b1)) );
557  amrex::Real w2 = g2 * ( amrex::Real(1) + (t5*t5) / ((eps + b2) * (eps + b2)) );
558  amrex::Real w3 = g3 * ( amrex::Real(1) + (t5*t5) / ((eps + b3) * (eps + b3)) );
559  amrex::Real w4 = g4 * ( amrex::Real(1) + (t5*t5) / ((eps + b4) * (eps + b4)) );
560 
561  // Weight factor norm
562  amrex::Real wsum = w1 + w2 + w3 + w4;
563 
564  // Taylor expansions
565  amrex::Real v1 = (-amrex::Real(0.3125))*sm3 + ( amrex::Real(1.3125))*sm2 + (-amrex::Real(2.1875))*sm1 + ( amrex::Real(2.1875))*s;
566  amrex::Real v2 = ( amrex::Real(0.0625))*sm2 + (-amrex::Real(0.3125))*sm1 + ( amrex::Real(0.9375))*s + ( amrex::Real(0.3125))*sp1;
567  amrex::Real v3 = (-amrex::Real(0.0625))*sm1 + ( amrex::Real(0.5625))*s + ( amrex::Real(0.5625))*sp1 + (-amrex::Real(0.0625))*sp2;
568  amrex::Real v4 = ( amrex::Real(0.3125))*s + ( amrex::Real(0.9375))*sp1 + (-amrex::Real(0.3125))*sp2 + ( amrex::Real(0.0625))*sp3;
569 
570  // Interpolated value
571  return ( (w1 * v1 + w2 * v2 + w3 * v3 + w4 * v4) / (wsum) );
572  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:577
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:576
static constexpr amrex::Real g4
Definition: ERF_Interpolation_WENO_Z.H:580
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:578
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:579

Referenced by InterpolateInX(), InterpolateInY(), and InterpolateInZ().

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z7::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
417  {
418  // Upwinding flags
419  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
420 
421  // Data to interpolate on
422  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
423  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
424  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
425  amrex::Real s = m_phi(i , j , k , qty_index);
426  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
427  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
428  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
429  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
430 
431  // Left and right fluxes
432  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
433  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
434 
435  // Numerical flux
436  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
437  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sm3, const amrex::Real &sm2, const amrex::Real &sm1, const amrex::Real &s, const amrex::Real &sp1, const amrex::Real &sp2, const amrex::Real &sp3) const
Definition: ERF_Interpolation_WENO_Z.H:504
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z7::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
448  {
449  // Upwinding flags
450  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
451 
452  // Data to interpolate on
453  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
454  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
455  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
456  amrex::Real s = m_phi(i , j , k , qty_index);
457  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
458  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
459  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
460  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
461 
462  // Left and right fluxes
463  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
464  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
465 
466  // Numerical flux
467  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
468  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z7::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
479  {
480  // Upwinding flags
481  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
482 
483  // Data to interpolate on
484  amrex::Real sp3 = m_phi(i , j , k+3, qty_index);
485  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
486  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
487  amrex::Real s = m_phi(i , j , k , qty_index);
488  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
489  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
490  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
491  amrex::Real sm4 = m_phi(i , j , k-4, qty_index);
492 
493  // Left and right fluxes
494  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
495  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
496 
497  // Numerical flux
498  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
499  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

const amrex::Real WENO_Z7::eps =amrex::Real(1.0e-40)
private

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO_Z7::g1 =( amrex::Real(1)/amrex::Real(64.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO_Z7::g2 =(amrex::Real(21.0)/amrex::Real(64.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real WENO_Z7::g3 =(amrex::Real(35.0)/amrex::Real(64.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g4

constexpr amrex::Real WENO_Z7::g4 =( amrex::Real(7.0)/amrex::Real(64.0))
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

amrex::Array4<const amrex::Real> WENO_Z7::m_phi
private

The documentation for this struct was generated from the following file: