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

#include <ERF_Interpolation_WENO_Z.H>

Collaboration diagram for WENO_Z5:

Public Member Functions

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

Static Private Attributes

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

Detailed Description

Interpolation operators used for WENO_Z-5 scheme

Constructor & Destructor Documentation

◆ WENO_Z5()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WENO_Z5::WENO_Z5 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
280  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:405

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
377  {
378  // Smoothing factors
379  amrex::Real b1 = c1 * (sm2 - amrex::Real(2) * sm1 + s) * (sm2 - amrex::Real(2) * sm1 + s) +
380  amrex::Real(0.25) * (sm2 - amrex::Real(4.0) * sm1 + amrex::Real(3) * s) * (sm2 - amrex::Real(4.0) * sm1 + amrex::Real(3) * s);
381  amrex::Real b2 = c1 * (sm1 - amrex::Real(2) * s + sp1) * (sm1 - amrex::Real(2) * s + sp1) +
382  amrex::Real(0.25) * (sm1 - sp1) * (sm1 - sp1);
383  amrex::Real b3 = c1 * (s - amrex::Real(2) * sp1 + sp2) * (s - amrex::Real(2) * sp1 + sp2) +
384  amrex::Real(0.25) * (amrex::Real(3) * s - amrex::Real(4.0) * sp1 + sp2) * (amrex::Real(3) * s - amrex::Real(4.0) * sp1 + sp2);
385 
386  // Weight factors
387  amrex::Real t5 = std::abs(b3 - b1);
388  amrex::Real w1 = g1 * ( amrex::Real(1) + (t5*t5) / ((eps + b1) * (eps + b1)) );
389  amrex::Real w2 = g2 * ( amrex::Real(1) + (t5*t5) / ((eps + b2) * (eps + b2)) );
390  amrex::Real w3 = g3 * ( amrex::Real(1) + (t5*t5) / ((eps + b3) * (eps + b3)) );
391 
392  // Weight factor norm
393  amrex::Real wsum = w1 + w2 + w3;
394 
395  // Taylor expansions
396  amrex::Real v1 = amrex::Real(2) * sm2 - amrex::Real(7.0) * sm1 + amrex::Real(11.0) * s;
397  amrex::Real v2 = -sm1 + amrex::Real(5.0) * s + amrex::Real(2) * sp1;
398  amrex::Real v3 = amrex::Real(2) * s + amrex::Real(5.0) * sp1 - sp2;
399 
400  // Interpolated value
401  return ( (w1 * v1 + w2 * v2 + w3 * v3) / (amrex::Real(6.0) * wsum) );
402  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:414
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:412
static constexpr amrex::Real c1
Definition: ERF_Interpolation_WENO_Z.H:411
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:409
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:413

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
291  {
292  // Upwinding flags
293  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
294 
295  // Data to interpolate on
296  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
297  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
298  amrex::Real s = m_phi(i , j , k , qty_index);
299  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
300  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
301  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
302 
303  // Left and right fluxes
304  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
305  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
306 
307  // Numerical flux
308  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
309  }
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:372
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
320  {
321  // Upwinding flags
322  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
323 
324  // Data to interpolate on
325  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
326  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
327  amrex::Real s = m_phi(i , j , k , qty_index);
328  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
329  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
330  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
331 
332  // Left and right fluxes
333  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
334  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
335 
336  // Numerical flux
337  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
338  }
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
349  {
350  // Upwinding flags
351  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
352 
353  // Data to interpolate on
354  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
355  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
356  amrex::Real s = m_phi(i , j , k , qty_index);
357  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
358  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
359  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
360 
361  // Left and right fluxes
362  amrex::Real Fhi = Evaluate(sm3,sm2,sm1,s ,sp1);
363  amrex::Real Flo = Evaluate(sp2,sp1,s ,sm1,sm2);
364 
365  // Numerical flux
366  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
367  }
Here is the call graph for this function:

Member Data Documentation

◆ c1

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

Referenced by Evaluate().

◆ eps

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

Referenced by Evaluate().

◆ g1

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

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ g3

constexpr amrex::Real WENO_Z5::g3 =(amrex::Real(3)/amrex::Real(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: