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

#include <ERF_Interpolation_WENO.H>

Collaboration diagram for WENO5:

Public Member Functions

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

Private Attributes

amrex::Array4< const amrex::Real > m_phi
 
const amrex::Real eps =1.0e-40
 

Static Private Attributes

static constexpr amrex::Real c1 =(13.0/12.0)
 
static constexpr amrex::Real g1 =(1.0/10.0)
 
static constexpr amrex::Real g2 =(3.0/5.0)
 
static constexpr amrex::Real g3 =(3.0/10.0)
 

Detailed Description

Interpolation operators used for WENO-5 scheme

Constructor & Destructor Documentation

◆ WENO5()

WENO5::WENO5 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
136  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO.H:260

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO5::Evaluate ( const amrex::Real &  sm2,
const amrex::Real &  sm1,
const amrex::Real &  s,
const amrex::Real &  sp1,
const amrex::Real &  sp2 
) const
inline
233  {
234  // Smoothing factors
235  amrex::Real b1 = c1 * (sm2 - 2.0 * sm1 + s) * (sm2 - 2.0 * sm1 + s) +
236  0.25 * (sm2 - 4.0 * sm1 + 3.0 * s) * (sm2 - 4.0 * sm1 + 3.0 * s);
237  amrex::Real b2 = c1 * (sm1 - 2.0 * s + sp1) * (sm1 - 2.0 * s + sp1) +
238  0.25 * (sm1 - sp1) * (sm1 - sp1);
239  amrex::Real b3 = c1 * (s - 2.0 * sp1 + sp2) * (s - 2.0 * sp1 + sp2) +
240  0.25 * (3.0 * s - 4.0 * sp1 + sp2) * (3.0 * s - 4.0 * sp1 + sp2);
241 
242  // Weight factors
243  amrex::Real w1 = g1 / ( (eps + b1) * (eps + b1) );
244  amrex::Real w2 = g2 / ( (eps + b2) * (eps + b2) );
245  amrex::Real w3 = g3 / ( (eps + b3) * (eps + b3) );
246 
247  // Weight factor norm
248  amrex::Real wsum = w1 + w2 + w3;
249 
250  // Taylor expansions
251  amrex::Real v1 = 2.0 * sm2 - 7.0 * sm1 + 11.0 * s;
252  amrex::Real v2 = -sm1 + 5.0 * s + 2.0 * sp1;
253  amrex::Real v3 = 2.0 * s + 5.0 * sp1 - sp2;
254 
255  // Interpolated value
256  return ( (w1 * v1 + w2 * v2 + w3 * v3) / (6.0 * wsum) );
257  }
const amrex::Real eps
Definition: ERF_Interpolation_WENO.H:261
static constexpr amrex::Real c1
Definition: ERF_Interpolation_WENO.H:262
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO.H:264
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO.H:265
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO.H:263

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO5::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
147  {
148  // Upwinding flags
149  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
150 
151  // Data to interpolate on
152  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
153  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
154  amrex::Real s = m_phi(i , j , k , qty_index);
155  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
156  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
157  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
158 
159  // Left and right fluxes
160  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
161  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
162 
163  // Numerical flux
164  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
165  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sm2, const amrex::Real &sm1, const amrex::Real &s, const amrex::Real &sp1, const amrex::Real &sp2) const
Definition: ERF_Interpolation_WENO.H:228
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO5::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
176  {
177  // Upwinding flags
178  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
179 
180  // Data to interpolate on
181  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
182  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
183  amrex::Real s = m_phi(i , j , k , qty_index);
184  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
185  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
186  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
187 
188  // Left and right fluxes
189  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
190  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
191 
192  // Numerical flux
193  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
194  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO5::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
205  {
206  // Upwinding flags
207  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
208 
209  // Data to interpolate on
210  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
211  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
212  amrex::Real s = m_phi(i , j , k , qty_index);
213  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
214  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
215  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
216 
217  // Left and right fluxes
218  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
219  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
220 
221  // Numerical flux
222  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
223  }
Here is the call graph for this function:

Member Data Documentation

◆ c1

constexpr amrex::Real WENO5::c1 =(13.0/12.0)
staticconstexprprivate

Referenced by Evaluate().

◆ eps

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

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO5::g1 =(1.0/10.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO5::g2 =(3.0/5.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real WENO5::g3 =(3.0/10.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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