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

#include <ERF_Interpolation_WENO.H>

Collaboration diagram for WENO3:

Public Member Functions

 WENO3 (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 &sm1, const amrex::Real &s, const amrex::Real &sp1) const
 

Private Attributes

amrex::Array4< const amrex::Real > m_phi
 
const amrex::Real eps =1.0e-6
 
const amrex::Real tol =1.0e-12
 

Static Private Attributes

static constexpr amrex::Real g1 =(1.0/3.0)
 
static constexpr amrex::Real g2 =(2.0/3.0)
 

Detailed Description

Interpolation operators used for WENO-5 scheme

Constructor & Destructor Documentation

◆ WENO3()

WENO3::WENO3 ( const amrex::Array4< const amrex::Real > &  phi)
inline
12  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO.H:119

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO3::Evaluate ( const amrex::Real &  sm1,
const amrex::Real &  s,
const amrex::Real &  sp1 
) const
inline
98  {
99  // Smoothing factors
100  amrex::Real b1 = (s - sm1) * (s - sm1);
101  amrex::Real b2 = (sp1 - s) * (sp1 - s);
102 
103  // Weight factors
104  amrex::Real w1 = g1 / ( (eps + b1) * (eps + b1) );
105  amrex::Real w2 = g2 / ( (eps + b2) * (eps + b2) );
106 
107  // Weight factor norm
108  amrex::Real wsum = w1 + w2;
109 
110  // Taylor expansions
111  amrex::Real v1 = -sm1 + 3.0 * s;
112  amrex::Real v2 = s + sp1;
113 
114  // Interpolated value
115  return ( (w1 * v1 + w2 * v2) / (2.0 * wsum) );
116  }
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO.H:122
const amrex::Real eps
Definition: ERF_Interpolation_WENO.H:120
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO.H:123

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO3::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
24  {
25  // Data to interpolate on
26  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
27  amrex::Real s = m_phi(i , j , k , qty_index);
28  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
29  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
30 
31  if (upw_lo > tol) {
32  val_lo = Evaluate(sm2,sm1,s );
33  } else if (upw_lo < -tol) {
34  val_lo = Evaluate(sp1,s ,sm1);
35  } else {
36  val_lo = 0.5 * (s + sm1);
37  }
38  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sm1, const amrex::Real &s, const amrex::Real &sp1) const
Definition: ERF_Interpolation_WENO.H:95
const amrex::Real tol
Definition: ERF_Interpolation_WENO.H:121
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO3::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
50  {
51  // Data to interpolate on
52  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
53  amrex::Real s = m_phi(i , j , k , qty_index);
54  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
55  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
56 
57  if (upw_lo > tol) {
58  val_lo = Evaluate(sm2,sm1,s );
59  } else if (upw_lo < -tol) {
60  val_lo = Evaluate(sp1,s ,sm1);
61  } else {
62  val_lo = 0.5 * (s + sm1);
63  }
64  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO3::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
76  {
77  // Data to interpolate on
78  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
79  amrex::Real s = m_phi(i , j , k , qty_index);
80  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
81  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
82 
83  if (upw_lo > tol) {
84  val_lo = Evaluate(sm2,sm1,s );
85  } else if (upw_lo < -tol) {
86  val_lo = Evaluate(sp1,s ,sm1);
87  } else {
88  val_lo = 0.5 * (s + sm1);
89  }
90  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

const amrex::Real WENO3::eps =1.0e-6
private

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO3::g1 =(1.0/3.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO3::g2 =(2.0/3.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

◆ tol

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

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