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

#include <ERF_Interpolation_WENO.H>

Collaboration diagram for WENO7:

Public Member Functions

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

Static Private Attributes

static constexpr amrex::Real g1 =( amrex::Real(1.0)/amrex::Real(35.0))
 
static constexpr amrex::Real g2 =(amrex::Real(12.0)/amrex::Real(35.0))
 
static constexpr amrex::Real g3 =(amrex::Real(18.0)/amrex::Real(35.0))
 
static constexpr amrex::Real g4 =( amrex::Real(4.0)/amrex::Real(35.0))
 

Detailed Description

Interpolation operators used for WENO-7 scheme

Constructor & Destructor Documentation

◆ WENO7()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WENO7::WENO7 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
289  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO.H:461

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
394  {
395  // Finite-volume Jiang-Shu smoothness indicators for cell-average data.
396  amrex::Real b1 = ( amrex::Real(547.0) * sm3 * sm3
397  - amrex::Real(3882.0) * sm3 * sm2
398  + amrex::Real(4642.0) * sm3 * sm1
399  - amrex::Real(1854.0) * sm3 * s
400  + amrex::Real(7043.0) * sm2 * sm2
401  - amrex::Real(17246.0) * sm2 * sm1
402  + amrex::Real(7042.0) * sm2 * s
403  + amrex::Real(11003.0) * sm1 * sm1
404  - amrex::Real(9402.0) * sm1 * s
405  + amrex::Real(2107.0) * s * s ) / amrex::Real(240.0);
406  amrex::Real b2 = ( amrex::Real(267.0) * sm2 * sm2
407  - amrex::Real(1642.0) * sm2 * sm1
408  + amrex::Real(1602.0) * sm2 * s
409  - amrex::Real(494.0) * sm2 * sp1
410  + amrex::Real(2843.0) * sm1 * sm1
411  - amrex::Real(5966.0) * sm1 * s
412  + amrex::Real(1922.0) * sm1 * sp1
413  + amrex::Real(3443.0) * s * s
414  - amrex::Real(2522.0) * s * sp1
415  + amrex::Real(547.0) * sp1 * sp1 ) / amrex::Real(240.0);
416  amrex::Real b3 = ( amrex::Real(547.0) * sm1 * sm1
417  - amrex::Real(2522.0) * sm1 * s
418  + amrex::Real(1922.0) * sm1 * sp1
419  - amrex::Real(494.0) * sm1 * sp2
420  + amrex::Real(3443.0) * s * s
421  - amrex::Real(5966.0) * s * sp1
422  + amrex::Real(1602.0) * s * sp2
423  + amrex::Real(2843.0) * sp1 * sp1
424  - amrex::Real(1642.0) * sp1 * sp2
425  + amrex::Real(267.0) * sp2 * sp2 ) / amrex::Real(240.0);
426  amrex::Real b4 = ( amrex::Real(2107.0) * s * s
427  - amrex::Real(9402.0) * s * sp1
428  + amrex::Real(7042.0) * s * sp2
429  - amrex::Real(1854.0) * s * sp3
430  + amrex::Real(11003.0) * sp1 * sp1
431  - amrex::Real(17246.0) * sp1 * sp2
432  + amrex::Real(4642.0) * sp1 * sp3
433  + amrex::Real(7043.0) * sp2 * sp2
434  - amrex::Real(3882.0) * sp2 * sp3
435  + amrex::Real(547.0) * sp3 * sp3 ) / amrex::Real(240.0);
436 
437  // Weight factors
438  amrex::Real w1 = g1 / ( (eps + b1) * (eps + b1) );
439  amrex::Real w2 = g2 / ( (eps + b2) * (eps + b2) );
440  amrex::Real w3 = g3 / ( (eps + b3) * (eps + b3) );
441  amrex::Real w4 = g4 / ( (eps + b4) * (eps + b4) );
442 
443  // Weight factor norm
444  amrex::Real wsum = w1 + w2 + w3 + w4;
445 
446  // Finite-volume face-reconstruction coefficients for the left state at i-1/2.
447  amrex::Real v1 = (-amrex::Real(1.0)/amrex::Real(4.0))*sm3 + ( amrex::Real(13.0)/amrex::Real(12.0))*sm2 -
448  ( amrex::Real(23.0)/amrex::Real(12.0))*sm1 + ( amrex::Real(25.0)/amrex::Real(12.0))*s;
449  amrex::Real v2 = ( amrex::Real(1.0)/amrex::Real(12.0))*sm2 - ( amrex::Real(5.0)/amrex::Real(12.0))*sm1 +
450  ( amrex::Real(13.0)/amrex::Real(12.0))*s + ( amrex::Real(1.0)/amrex::Real(4.0))*sp1;
451  amrex::Real v3 = (-amrex::Real(1.0)/amrex::Real(12.0))*sm1 + ( amrex::Real(7.0)/amrex::Real(12.0))*s +
452  ( amrex::Real(7.0)/amrex::Real(12.0))*sp1 - ( amrex::Real(1.0)/amrex::Real(12.0))*sp2;
453  amrex::Real v4 = ( amrex::Real(1.0)/amrex::Real(4.0))*s + ( amrex::Real(13.0)/amrex::Real(12.0))*sp1 -
454  ( amrex::Real(5.0)/amrex::Real(12.0))*sp2 + ( amrex::Real(1.0)/amrex::Real(12.0))*sp3;
455 
456  // Interpolated value
457  return ( (w1 * v1 + w2 * v2 + w3 * v3 + w4 * v4) / (wsum) );
458  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
const amrex::Real eps
Definition: ERF_Interpolation_WENO.H:465
static constexpr amrex::Real g4
Definition: ERF_Interpolation_WENO.H:470
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO.H:469
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO.H:468
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO.H:467

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
300  {
301  // Upwinding flags
302  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
303 
304  // Data to interpolate on
305  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
306  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
307  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
308  amrex::Real s = m_phi(i , j , k , qty_index);
309  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
310  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
311  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
312  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
313 
314  // Left and right fluxes
315  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
316  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
317 
318  // Numerical flux
319  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
320  }
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:387
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
331  {
332  // Upwinding flags
333  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
334 
335  // Data to interpolate on
336  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
337  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
338  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
339  amrex::Real s = m_phi(i , j , k , qty_index);
340  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
341  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
342  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
343  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
344 
345  // Left and right fluxes
346  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
347  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
348 
349  // Numerical flux
350  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
351  }
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
362  {
363  // Upwinding flags
364  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
365 
366  // Data to interpolate on
367  amrex::Real sp3 = m_phi(i , j , k+3, qty_index);
368  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
369  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
370  amrex::Real s = m_phi(i , j , k , qty_index);
371  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
372  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
373  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
374  amrex::Real sm4 = m_phi(i , j , k-4, qty_index);
375 
376  // Left and right fluxes
377  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
378  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
379 
380  // Numerical flux
381  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
382  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

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

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO7::g2 =(amrex::Real(12.0)/amrex::Real(35.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g3

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

Referenced by Evaluate().

◆ g4

constexpr amrex::Real WENO7::g4 =( amrex::Real(4.0)/amrex::Real(35.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: