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

 WENO_Z5 (const amrex::Array4< const amrex::Real > &phi)
 
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::Real) 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::Real) 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::Real) 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-6
 
const amrex::Real tol =1.0e-12
 

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)
inline
259  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:381

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
353  {
354  // Smoothing factors
355  amrex::Real b1 = c1 * (sm2 - 2.0 * sm1 + s) * (sm2 - 2.0 * sm1 + s) +
356  0.25 * (sm2 - 4.0 * sm1 + 3.0 * s) * (sm2 - 4.0 * sm1 + 3.0 * s);
357  amrex::Real b2 = c1 * (sm1 - 2.0 * s + sp1) * (sm1 - 2.0 * s + sp1) +
358  0.25 * (sm1 - sp1) * (sm1 - sp1);
359  amrex::Real b3 = c1 * (s - 2.0 * sp1 + sp2) * (s - 2.0 * sp1 + sp2) +
360  0.25 * (3.0 * s - 4.0 * sp1 + sp2) * (3.0 * s - 4.0 * sp1 + sp2);
361 
362  // Weight factors
363  amrex::Real t5 = std::abs(b3 - b1);
364  amrex::Real w1 = g1 * ( 1.0 + (t5*t5) / ((eps + b1) * (eps + b1)) );
365  amrex::Real w2 = g2 * ( 1.0 + (t5*t5) / ((eps + b2) * (eps + b2)) );
366  amrex::Real w3 = g3 * ( 1.0 + (t5*t5) / ((eps + b3) * (eps + b3)) );
367 
368  // Weight factor norm
369  amrex::Real wsum = w1 + w2 + w3;
370 
371  // Taylor expansions
372  amrex::Real v1 = 2.0 * sm2 - 7.0 * sm1 + 11.0 * s;
373  amrex::Real v2 = -sm1 + 5.0 * s + 2.0 * sp1;
374  amrex::Real v3 = 2.0 * s + 5.0 * sp1 - sp2;
375 
376  // Interpolated value
377  return ( (w1 * v1 + w2 * v2 + w3 * v3) / (6.0 * wsum) );
378  }
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:387
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:385
static constexpr amrex::Real c1
Definition: ERF_Interpolation_WENO_Z.H:384
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:382
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:386

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 amrex::Real   
) const
inline
271  {
272  // Data to interpolate on
273  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
274  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
275  amrex::Real s = m_phi(i , j , k , qty_index);
276  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
277  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
278  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
279 
280  if (upw_lo > tol) {
281  val_lo = Evaluate(sm3,sm2,sm1,s ,sp1);
282  } else if (upw_lo < -tol) {
283  val_lo = Evaluate(sp2,sp1,s,sm1,sm2);
284  } else {
285  val_lo = 0.5 * (s + sm1);
286  }
287  }
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:348
const amrex::Real tol
Definition: ERF_Interpolation_WENO_Z.H:383
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 amrex::Real   
) const
inline
299  {
300  // Data to interpolate on
301  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
302  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
303  amrex::Real s = m_phi(i , j , k , qty_index);
304  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
305  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
306  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
307 
308  if (upw_lo > tol) {
309  val_lo = Evaluate(sm3,sm2,sm1,s ,sp1);
310  } else if (upw_lo < -tol) {
311  val_lo = Evaluate(sp2,sp1,s,sm1,sm2);
312  } else {
313  val_lo = 0.5 * (s + sm1);
314  }
315  }
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 amrex::Real   
) const
inline
327  {
328  // Data to interpolate on
329  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
330  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
331  amrex::Real s = m_phi(i , j , k , qty_index);
332  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
333  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
334  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
335 
336  if (upw_lo > tol) {
337  val_lo = Evaluate(sm3,sm2,sm1,s ,sp1);
338  } else if (upw_lo < -tol) {
339  val_lo = Evaluate(sp2,sp1,s,sm1,sm2);
340  } else {
341  val_lo = 0.5 * (s + sm1);
342  }
343  }
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-6
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

◆ tol

const amrex::Real WENO_Z5::tol =1.0e-12
private

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