ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WENO_Z3 Struct Reference

#include <ERF_Interpolation_WENO_Z.H>

Collaboration diagram for WENO_Z3:

Public Member Functions

 WENO_Z3 (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 &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-40
 

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_Z-3 scheme

Constructor & Destructor Documentation

◆ WENO_Z3()

WENO_Z3::WENO_Z3 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
13  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:124

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO_Z3::Evaluate ( const amrex::Real &  sm1,
const amrex::Real &  s,
const amrex::Real &  sp1 
) const
inline
102  {
103  // Smoothing factors
104  amrex::Real b1 = (s - sm1) * (s - sm1);
105  amrex::Real b2 = (sp1 - s) * (sp1 - s);
106 
107  // Weight factors
108  amrex::Real t5 = std::abs(b2 - b1);
109  amrex::Real w1 = g1 * ( 1.0 + (t5*t5) / ((eps + b1) * (eps + b1)) );
110  amrex::Real w2 = g2 * ( 1.0 + (t5*t5) / ((eps + b2) * (eps + b2)) );
111 
112  // Weight factor norm
113  amrex::Real wsum = w1 + w2;
114 
115  // Taylor expansions
116  amrex::Real v1 = -sm1 + 3.0 * s;
117  amrex::Real v2 = s + sp1;
118 
119  // Interpolated value
120  return ( (w1 * v1 + w2 * v2) / (2.0 * wsum) );
121  }
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:125
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:127
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:126

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z3::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
24  {
25  // Upwinding flags
26  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
27 
28  // Data to interpolate on
29  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
30  amrex::Real s = m_phi(i , j , k , qty_index);
31  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
32  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
33 
34  // Left and right fluxes
35  amrex::Real Fhi = Evaluate(sm2,sm1,s );
36  amrex::Real Flo = Evaluate(sp1,s ,sm1);
37 
38  // Numerical flux
39  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
40  }
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_Z.H:99
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z3::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
51  {
52  // Upwinding flags
53  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
54 
55  // Data to interpolate on
56  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
57  amrex::Real s = m_phi(i , j , k , qty_index);
58  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
59  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
60 
61  // Left and right fluxes
62  amrex::Real Fhi = Evaluate(sm2,sm1,s );
63  amrex::Real Flo = Evaluate(sp1,s ,sm1);
64 
65  // Numerical flux
66  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
67  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z3::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
78  {
79  // Upwinding flags
80  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
81 
82  // Data to interpolate on
83  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
84  amrex::Real s = m_phi(i , j , k , qty_index);
85  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
86  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
87 
88  // Left and right fluxes
89  amrex::Real Fhi = Evaluate(sm2,sm1,s );
90  amrex::Real Flo = Evaluate(sp1,s ,sm1);
91 
92  // Numerical flux
93  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
94  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

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

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ m_phi

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

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