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

#include <ERF_Interpolation_WENO.H>

Collaboration diagram for WENO3:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WENO3 (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::Realm_phi
 
const amrex::Real eps =amrex::Real(1.0e-40)
 

Static Private Attributes

static constexpr amrex::Real g1 =(amrex::Real(1)/amrex::Real(3))
 
static constexpr amrex::Real g2 =(amrex::Real(2)/amrex::Real(3))
 

Detailed Description

Interpolation operators used for WENO-5 scheme

Constructor & Destructor Documentation

◆ WENO3()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WENO3::WENO3 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
15  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO.H:125

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
104  {
105  // Smoothing factors
106  amrex::Real b1 = (s - sm1) * (s - sm1);
107  amrex::Real b2 = (sp1 - s) * (sp1 - s);
108 
109  // Weight factors
110  amrex::Real w1 = g1 / ( (eps + b1) * (eps + b1) );
111  amrex::Real w2 = g2 / ( (eps + b2) * (eps + b2) );
112 
113  // Weight factor norm
114  amrex::Real wsum = w1 + w2;
115 
116  // Taylor expansions
117  amrex::Real v1 = -sm1 + amrex::Real(3) * s;
118  amrex::Real v2 = s + sp1;
119 
120  // Interpolated value
121  return ( (w1 * v1 + w2 * v2) / (amrex::Real(2) * wsum) );
122  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO.H:131
const amrex::Real eps
Definition: ERF_Interpolation_WENO.H:129
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO.H:132

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
inline
26  {
27  // Upwinding flags
28  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
29 
30  // Data to interpolate on
31  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
32  amrex::Real s = m_phi(i , j , k , qty_index);
33  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
34  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
35 
36  // Left and right fluxes
37  amrex::Real Fhi = Evaluate(sm2,sm1,s );
38  amrex::Real Flo = Evaluate(sp1,s ,sm1);
39 
40  // Numerical flux
41  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
42  }
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:101
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
inline
53  {
54  // Upwinding flags
55  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
56 
57  // Data to interpolate on
58  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
59  amrex::Real s = m_phi(i , j , k , qty_index);
60  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
61  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
62 
63  // Left and right fluxes
64  amrex::Real Fhi = Evaluate(sm2,sm1,s );
65  amrex::Real Flo = Evaluate(sp1,s ,sm1);
66 
67  // Numerical flux
68  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
69  }
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
inline
80  {
81  // Upwinding flags
82  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
83 
84  // Data to interpolate on
85  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
86  amrex::Real s = m_phi(i , j , k , qty_index);
87  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
88  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
89 
90  // Left and right fluxes
91  amrex::Real Fhi = Evaluate(sm2,sm1,s );
92  amrex::Real Flo = Evaluate(sp1,s ,sm1);
93 
94  // Numerical flux
95  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
96  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO3::g1 =(amrex::Real(1)/amrex::Real(3))
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO3::g2 =(amrex::Real(2)/amrex::Real(3))
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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