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

#include <ERF_Interpolation_WENO.H>

Collaboration diagram for WENO7:

Public Member Functions

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

Private Attributes

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

Static Private Attributes

static constexpr amrex::Real g1 =( 1.0/64.0)
 
static constexpr amrex::Real g2 =(21.0/64.0)
 
static constexpr amrex::Real g3 =(35.0/64.0)
 
static constexpr amrex::Real g4 =( 7.0/64.0)
 

Detailed Description

Interpolation operators used for WENO-7 scheme

Constructor & Destructor Documentation

◆ WENO7()

WENO7::WENO7 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
275  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO.H:443

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO7::Evaluate ( const amrex::Real &  sm3,
const amrex::Real &  sm2,
const amrex::Real &  sm1,
const amrex::Real &  s,
const amrex::Real &  sp1,
const amrex::Real &  sp2,
const amrex::Real &  sp3 
) const
inline
380  {
381  // Smoothing factors
382  amrex::Real b1 = ( sm3 * sm3 * 6649./2880.0
383  - sm3 * sm2 * 2623./160.0
384  + sm3 * sm1 * 9449./480.0
385  - sm3 * s * 11389./1440.0
386  + sm2 * sm2 * 28547./960.0
387  - sm2 * sm1 * 35047./480.0
388  + sm2 * s * 14369./480.0
389  + sm1 * sm1 * 44747./960.0
390  - sm1 * s * 6383./160.0
391  + s * s * 25729./2880.0 );
392  amrex::Real b2 = ( sm2 * sm2 * 3169/2880.0
393  - sm2 * sm1 * 3229/480.0
394  + sm2 * s * 3169/480.0
395  - sm2 * sp1 * 2989/1440.0
396  + sm1 * sm1 * 11147/960.0
397  - sm1 * s * 11767/480.0
398  + sm1 * sp1 * 1283/160.0
399  + s * s * 13667/960.0
400  - s * sp1 * 5069/480.0
401  + sp1 * sp1 * 6649/2880.0 );
402  amrex::Real b3 = ( sm1 * sm1 * 6649./2880.0
403  - sm1 * s * 5069./480.0
404  + sm1 * sp1 * 1283./160.0
405  - sm1 * sp2 * 2989./1440.0
406  + s * s * 13667./960.0
407  - s * sp1 * 11767./480.0
408  + s * sp2 * 3169./480.0
409  + sp1 * sp1 * 11147./960.0
410  - sp1 * sp2 * 3229./480.0
411  + sp2 * sp2 * 3169./2880.0 );
412  amrex::Real b4 = ( s * s * 25729./2880.
413  - s * sp1 * 6383./160.
414  + s * sp2 * 14369./480.
415  - s * sp3 * 11389./1440.
416  + sp1 * sp1 * 44747./960.
417  - sp1 * sp2 * 35047./480.
418  + sp1 * sp3 * 9449./480.
419  + sp2 * sp2 * 28547./960.
420  - sp2 * sp3 * 2623./160.
421  + sp3 * sp3 * 6649./2880. );
422 
423  // Weight factors
424  amrex::Real w1 = g1 / ( (eps + b1) * (eps + b1) );
425  amrex::Real w2 = g2 / ( (eps + b2) * (eps + b2) );
426  amrex::Real w3 = g3 / ( (eps + b3) * (eps + b3) );
427  amrex::Real w4 = g4 / ( (eps + b4) * (eps + b4) );
428 
429  // Weight factor norm
430  amrex::Real wsum = w1 + w2 + w3 + w4;
431 
432  // Taylor expansions
433  amrex::Real v1 = (-0.3125)*sm3 + ( 1.3125)*sm2 + (-2.1875)*sm1 + ( 2.1875)*s;
434  amrex::Real v2 = ( 0.0625)*sm2 + (-0.3125)*sm1 + ( 0.9375)*s + ( 0.3125)*sp1;
435  amrex::Real v3 = (-0.0625)*sm1 + ( 0.5625)*s + ( 0.5625)*sp1 + (-0.0625)*sp2;
436  amrex::Real v4 = ( 0.3125)*s + ( 0.9375)*sp1 + (-0.3125)*sp2 + ( 0.0625)*sp3;
437 
438  // Interpolated value
439  return ( (w1 * v1 + w2 * v2 + w3 * v3 + w4 * v4) / (wsum) );
440  }
const amrex::Real eps
Definition: ERF_Interpolation_WENO.H:444
static constexpr amrex::Real g4
Definition: ERF_Interpolation_WENO.H:448
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO.H:447
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO.H:446
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO.H:445

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO7::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
286  {
287  // Upwinding flags
288  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
289 
290  // Data to interpolate on
291  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
292  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
293  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
294  amrex::Real s = m_phi(i , j , k , qty_index);
295  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
296  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
297  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
298  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
299 
300  // Left and right fluxes
301  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
302  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
303 
304  // Numerical flux
305  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
306  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sm3, const amrex::Real &sm2, const amrex::Real &sm1, const amrex::Real &s, const amrex::Real &sp1, const amrex::Real &sp2, const amrex::Real &sp3) const
Definition: ERF_Interpolation_WENO.H:373
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO7::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
317  {
318  // Upwinding flags
319  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
320 
321  // Data to interpolate on
322  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
323  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
324  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
325  amrex::Real s = m_phi(i , j , k , qty_index);
326  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
327  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
328  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
329  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
330 
331  // Left and right fluxes
332  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
333  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
334 
335  // Numerical flux
336  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
337  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO7::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
348  {
349  // Upwinding flags
350  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
351 
352  // Data to interpolate on
353  amrex::Real sp3 = m_phi(i , j , k+2, qty_index);
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  amrex::Real sm4 = m_phi(i , j , k-3, qty_index);
361 
362  // Left and right fluxes
363  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
364  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
365 
366  // Numerical flux
367  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
368  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO7::g1 =( 1.0/64.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO7::g2 =(21.0/64.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real WENO7::g3 =(35.0/64.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g4

constexpr amrex::Real WENO7::g4 =( 7.0/64.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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