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

#include <ERF_Interpolation_WENO_Z.H>

Collaboration diagram for WENO_Z5:

Public Member Functions

 WENO_Z5 (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_Z-5 scheme

Constructor & Destructor Documentation

◆ WENO_Z5()

WENO_Z5::WENO_Z5 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
266  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:391

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO_Z5::Evaluate ( const amrex::Real &  sm2,
const amrex::Real &  sm1,
const amrex::Real &  s,
const amrex::Real &  sp1,
const amrex::Real &  sp2 
) const
inline
363  {
364  // Smoothing factors
365  amrex::Real b1 = c1 * (sm2 - 2.0 * sm1 + s) * (sm2 - 2.0 * sm1 + s) +
366  0.25 * (sm2 - 4.0 * sm1 + 3.0 * s) * (sm2 - 4.0 * sm1 + 3.0 * s);
367  amrex::Real b2 = c1 * (sm1 - 2.0 * s + sp1) * (sm1 - 2.0 * s + sp1) +
368  0.25 * (sm1 - sp1) * (sm1 - sp1);
369  amrex::Real b3 = c1 * (s - 2.0 * sp1 + sp2) * (s - 2.0 * sp1 + sp2) +
370  0.25 * (3.0 * s - 4.0 * sp1 + sp2) * (3.0 * s - 4.0 * sp1 + sp2);
371 
372  // Weight factors
373  amrex::Real t5 = std::abs(b3 - b1);
374  amrex::Real w1 = g1 * ( 1.0 + (t5*t5) / ((eps + b1) * (eps + b1)) );
375  amrex::Real w2 = g2 * ( 1.0 + (t5*t5) / ((eps + b2) * (eps + b2)) );
376  amrex::Real w3 = g3 * ( 1.0 + (t5*t5) / ((eps + b3) * (eps + b3)) );
377 
378  // Weight factor norm
379  amrex::Real wsum = w1 + w2 + w3;
380 
381  // Taylor expansions
382  amrex::Real v1 = 2.0 * sm2 - 7.0 * sm1 + 11.0 * s;
383  amrex::Real v2 = -sm1 + 5.0 * s + 2.0 * sp1;
384  amrex::Real v3 = 2.0 * s + 5.0 * sp1 - sp2;
385 
386  // Interpolated value
387  return ( (w1 * v1 + w2 * v2 + w3 * v3) / (6.0 * wsum) );
388  }
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:396
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:394
static constexpr amrex::Real c1
Definition: ERF_Interpolation_WENO_Z.H:393
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:392
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:395

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z5::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
277  {
278  // Upwinding flags
279  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
280 
281  // Data to interpolate on
282  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
283  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
284  amrex::Real s = m_phi(i , j , k , qty_index);
285  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
286  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
287  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
288 
289  // Left and right fluxes
290  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
291  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
292 
293  // Numerical flux
294  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
295  }
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_Z.H:358
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z5::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
306  {
307  // Upwinding flags
308  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
309 
310  // Data to interpolate on
311  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
312  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
313  amrex::Real s = m_phi(i , j , k , qty_index);
314  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
315  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
316  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
317 
318  // Left and right fluxes
319  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
320  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
321 
322  // Numerical flux
323  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
324  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z5::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
335  {
336  // Upwinding flags
337  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
338 
339  // Data to interpolate on
340  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
341  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
342  amrex::Real s = m_phi(i , j , k , qty_index);
343  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
344  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
345  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
346 
347  // Left and right fluxes
348  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
349  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
350 
351  // Numerical flux
352  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
353  }
Here is the call graph for this function:

Member Data Documentation

◆ c1

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

Referenced by Evaluate().

◆ eps

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

Referenced by Evaluate().

◆ g1

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

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ g3

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

Referenced by Evaluate().

◆ m_phi

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

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