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
418  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:587

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

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
429  {
430  // Upwinding flags
431  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
432 
433  // Data to interpolate on
434  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
435  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
436  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
437  amrex::Real s = m_phi(i , j , k , qty_index);
438  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
439  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
440  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
441  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
442 
443  // Left and right fluxes
444  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
445  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
446 
447  // Numerical flux
448  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
449  }
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:516
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
460  {
461  // Upwinding flags
462  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
463 
464  // Data to interpolate on
465  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
466  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
467  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
468  amrex::Real s = m_phi(i , j , k , qty_index);
469  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
470  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
471  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
472  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
473 
474  // Left and right fluxes
475  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
476  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
477 
478  // Numerical flux
479  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
480  }
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
491  {
492  // Upwinding flags
493  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
494 
495  // Data to interpolate on
496  amrex::Real sp3 = m_phi(i , j , k+3, qty_index);
497  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
498  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
499  amrex::Real s = m_phi(i , j , k , qty_index);
500  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
501  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
502  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
503  amrex::Real sm4 = m_phi(i , j , k-4, qty_index);
504 
505  // Left and right fluxes
506  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
507  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
508 
509  // Numerical flux
510  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
511  }
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: