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)
 
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) 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::Real) 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::Real) 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::Real > m_phi
 
const amrex::Real eps =1.0e-40
 
const amrex::Real tol =1.0e-12
 

Static Private Attributes

static constexpr amrex::Real g1 =( 1.0/64.0)
 
static constexpr amrex::Real g2 =(21.0/64.0)
 
static constexpr amrex::Real g3 =(35.0/64.0)
 
static constexpr amrex::Real g4 =( 7.0/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)
inline
396  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:562

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
498  {
499  // Smoothing factors
500  amrex::Real b1 = ( sm3 * sm3 * 6649./2880.0
501  - sm3 * sm2 * 2623./160.0
502  + sm3 * sm1 * 9449./480.0
503  - sm3 * s * 11389./1440.0
504  + sm2 * sm2 * 28547./960.0
505  - sm2 * sm1 * 35047./480.0
506  + sm2 * s * 14369./480.0
507  + sm1 * sm1 * 44747./960.0
508  - sm1 * s * 6383./160.0
509  + s * s * 25729./2880.0 );
510  amrex::Real b2 = ( sm2 * sm2 * 3169/2880.0
511  - sm2 * sm1 * 3229/480.0
512  + sm2 * s * 3169/480.0
513  - sm2 * sp1 * 2989/1440.0
514  + sm1 * sm1 * 11147/960.0
515  - sm1 * s * 11767/480.0
516  + sm1 * sp1 * 1283/160.0
517  + s * s * 13667/960.0
518  - s * sp1 * 5069/480.0
519  + sp1 * sp1 * 6649/2880.0 );
520  amrex::Real b3 = ( sm1 * sm1 * 6649./2880.0
521  - sm1 * s * 5069./480.0
522  + sm1 * sp1 * 1283./160.0
523  - sm1 * sp2 * 2989./1440.0
524  + s * s * 13667./960.0
525  - s * sp1 * 11767./480.0
526  + s * sp2 * 3169./480.0
527  + sp1 * sp1 * 11147./960.0
528  - sp1 * sp2 * 3229./480.0
529  + sp2 * sp2 * 3169./2880.0 );
530  amrex::Real b4 = ( s * s * 25729./2880.
531  - s * sp1 * 6383./160.
532  + s * sp2 * 14369./480.
533  - s * sp3 * 11389./1440.
534  + sp1 * sp1 * 44747./960.
535  - sp1 * sp2 * 35047./480.
536  + sp1 * sp3 * 9449./480.
537  + sp2 * sp2 * 28547./960.
538  - sp2 * sp3 * 2623./160.
539  + sp3 * sp3 * 6649./2880. );
540 
541  // Weight factors
542  amrex::Real t5 = std::abs(b1 - b2 - b3 + b4);
543  amrex::Real w1 = g1 * ( 1.0 + (t5*t5) / ((eps + b1) * (eps + b1)) );
544  amrex::Real w2 = g2 * ( 1.0 + (t5*t5) / ((eps + b2) * (eps + b2)) );
545  amrex::Real w3 = g3 * ( 1.0 + (t5*t5) / ((eps + b3) * (eps + b3)) );
546  amrex::Real w4 = g4 * ( 1.0 + (t5*t5) / ((eps + b3) * (eps + b3)) );
547 
548  // Weight factor norm
549  amrex::Real wsum = w1 + w2 + w3 + w4;
550 
551  // Taylor expansions
552  amrex::Real v1 = (-0.3125)*sm3 + ( 1.3125)*sm2 + (-2.1875)*sm1 + ( 2.1875)*s;
553  amrex::Real v2 = ( 0.0625)*sm2 + (-0.3125)*sm1 + ( 0.9375)*s + ( 0.3125)*sp1;
554  amrex::Real v3 = (-0.0625)*sm1 + ( 0.5625)*s + ( 0.5625)*sp1 + (-0.0625)*sp2;
555  amrex::Real v4 = ( 0.3125)*s + ( 0.9375)*sp1 + (-0.3125)*sp2 + ( 0.0625)*sp3;
556 
557  // Interpolated value
558  return ( (w1 * v1 + w2 * v2 + w3 * v3 + w4 * v4) / (wsum) );
559  }
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:565
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:563
static constexpr amrex::Real g4
Definition: ERF_Interpolation_WENO_Z.H:568
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:566
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:567

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 amrex::Real   
) const
inline
408  {
409  // Data to interpolate on
410  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
411  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
412  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
413  amrex::Real s = m_phi(i , j , k , qty_index);
414  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
415  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
416  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
417  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
418 
419  if (upw_lo > tol) {
420  val_lo = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
421  } else if (upw_lo < -tol) {
422  val_lo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
423  } else {
424  val_lo = 0.5 * (s + sm1);
425  }
426  }
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:491
const amrex::Real tol
Definition: ERF_Interpolation_WENO_Z.H:564
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 amrex::Real   
) const
inline
438  {
439  // Data to interpolate on
440  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
441  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
442  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
443  amrex::Real s = m_phi(i , j , k , qty_index);
444  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
445  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
446  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
447  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
448 
449  if (upw_lo > tol) {
450  val_lo = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
451  } else if (upw_lo < -tol) {
452  val_lo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
453  } else {
454  val_lo = 0.5 * (s + sm1);
455  }
456  }
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 amrex::Real   
) const
inline
468  {
469  // Data to interpolate on
470  amrex::Real sp3 = m_phi(i , j , k+2, qty_index);
471  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
472  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
473  amrex::Real s = m_phi(i , j , k , qty_index);
474  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
475  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
476  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
477  amrex::Real sm4 = m_phi(i , j , k-3, qty_index);
478 
479  if (upw_lo > tol) {
480  val_lo = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
481  } else if (upw_lo < -tol) {
482  val_lo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
483  } else {
484  val_lo = 0.5 * (s + sm1);
485  }
486  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

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

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ g3

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

Referenced by Evaluate().

◆ g4

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

Referenced by Evaluate().

◆ m_phi

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

◆ tol

const amrex::Real WENO_Z7::tol =1.0e-12
private

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