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

#include <ERF_Interpolation_WENO_Z.H>

Collaboration diagram for WENO_Z7:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WENO_Z7 (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_Z-7 scheme

Constructor & Destructor Documentation

◆ WENO_Z7()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WENO_Z7::WENO_Z7 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
426  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:599

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO_Z7::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
531  {
532  // Finite-volume Jiang-Shu smoothness indicators for cell-average data.
533  amrex::Real b1 = ( amrex::Real(547.0) * sm3 * sm3
534  - amrex::Real(3882.0) * sm3 * sm2
535  + amrex::Real(4642.0) * sm3 * sm1
536  - amrex::Real(1854.0) * sm3 * s
537  + amrex::Real(7043.0) * sm2 * sm2
538  - amrex::Real(17246.0) * sm2 * sm1
539  + amrex::Real(7042.0) * sm2 * s
540  + amrex::Real(11003.0) * sm1 * sm1
541  - amrex::Real(9402.0) * sm1 * s
542  + amrex::Real(2107.0) * s * s ) / amrex::Real(240.0);
543  amrex::Real b2 = ( amrex::Real(267.0) * sm2 * sm2
544  - amrex::Real(1642.0) * sm2 * sm1
545  + amrex::Real(1602.0) * sm2 * s
546  - amrex::Real(494.0) * sm2 * sp1
547  + amrex::Real(2843.0) * sm1 * sm1
548  - amrex::Real(5966.0) * sm1 * s
549  + amrex::Real(1922.0) * sm1 * sp1
550  + amrex::Real(3443.0) * s * s
551  - amrex::Real(2522.0) * s * sp1
552  + amrex::Real(547.0) * sp1 * sp1 ) / amrex::Real(240.0);
553  amrex::Real b3 = ( amrex::Real(547.0) * sm1 * sm1
554  - amrex::Real(2522.0) * sm1 * s
555  + amrex::Real(1922.0) * sm1 * sp1
556  - amrex::Real(494.0) * sm1 * sp2
557  + amrex::Real(3443.0) * s * s
558  - amrex::Real(5966.0) * s * sp1
559  + amrex::Real(1602.0) * s * sp2
560  + amrex::Real(2843.0) * sp1 * sp1
561  - amrex::Real(1642.0) * sp1 * sp2
562  + amrex::Real(267.0) * sp2 * sp2 ) / amrex::Real(240.0);
563  amrex::Real b4 = ( amrex::Real(2107.0) * s * s
564  - amrex::Real(9402.0) * s * sp1
565  + amrex::Real(7042.0) * s * sp2
566  - amrex::Real(1854.0) * s * sp3
567  + amrex::Real(11003.0) * sp1 * sp1
568  - amrex::Real(17246.0) * sp1 * sp2
569  + amrex::Real(4642.0) * sp1 * sp3
570  + amrex::Real(7043.0) * sp2 * sp2
571  - amrex::Real(3882.0) * sp2 * sp3
572  + amrex::Real(547.0) * sp3 * sp3 ) / amrex::Real(240.0);
573 
574  // Weight factors
575  amrex::Real t5 = std::abs(b1 - b2 - b3 + b4);
576  amrex::Real w1 = g1 * ( amrex::Real(1) + (t5*t5) / ((eps + b1) * (eps + b1)) );
577  amrex::Real w2 = g2 * ( amrex::Real(1) + (t5*t5) / ((eps + b2) * (eps + b2)) );
578  amrex::Real w3 = g3 * ( amrex::Real(1) + (t5*t5) / ((eps + b3) * (eps + b3)) );
579  amrex::Real w4 = g4 * ( amrex::Real(1) + (t5*t5) / ((eps + b4) * (eps + b4)) );
580 
581  // Weight factor norm
582  amrex::Real wsum = w1 + w2 + w3 + w4;
583 
584  // Finite-volume face-reconstruction coefficients for the left state at i-1/2.
585  amrex::Real v1 = (-amrex::Real(1.0)/amrex::Real(4.0))*sm3 + ( amrex::Real(13.0)/amrex::Real(12.0))*sm2 -
586  ( amrex::Real(23.0)/amrex::Real(12.0))*sm1 + ( amrex::Real(25.0)/amrex::Real(12.0))*s;
587  amrex::Real v2 = ( amrex::Real(1.0)/amrex::Real(12.0))*sm2 - ( amrex::Real(5.0)/amrex::Real(12.0))*sm1 +
588  ( amrex::Real(13.0)/amrex::Real(12.0))*s + ( amrex::Real(1.0)/amrex::Real(4.0))*sp1;
589  amrex::Real v3 = (-amrex::Real(1.0)/amrex::Real(12.0))*sm1 + ( amrex::Real(7.0)/amrex::Real(12.0))*s +
590  ( amrex::Real(7.0)/amrex::Real(12.0))*sp1 - ( amrex::Real(1.0)/amrex::Real(12.0))*sp2;
591  amrex::Real v4 = ( amrex::Real(1.0)/amrex::Real(4.0))*s + ( amrex::Real(13.0)/amrex::Real(12.0))*sp1 -
592  ( amrex::Real(5.0)/amrex::Real(12.0))*sp2 + ( amrex::Real(1.0)/amrex::Real(12.0))*sp3;
593 
594  // Interpolated value
595  return ( (w1 * v1 + w2 * v2 + w3 * v3 + w4 * v4) / (wsum) );
596  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:605
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:603
static constexpr amrex::Real g4
Definition: ERF_Interpolation_WENO_Z.H:608
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:606
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:607

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z7::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
437  {
438  // Upwinding flags
439  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
440 
441  // Data to interpolate on
442  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
443  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
444  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
445  amrex::Real s = m_phi(i , j , k , qty_index);
446  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
447  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
448  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
449  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
450 
451  // Left and right fluxes
452  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
453  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
454 
455  // Numerical flux
456  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
457  }
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_Z.H:524
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z7::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
468  {
469  // Upwinding flags
470  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
471 
472  // Data to interpolate on
473  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
474  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
475  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
476  amrex::Real s = m_phi(i , j , k , qty_index);
477  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
478  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
479  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
480  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
481 
482  // Left and right fluxes
483  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
484  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
485 
486  // Numerical flux
487  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
488  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_Z7::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
499  {
500  // Upwinding flags
501  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
502 
503  // Data to interpolate on
504  amrex::Real sp3 = m_phi(i , j , k+3, qty_index);
505  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
506  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
507  amrex::Real s = m_phi(i , j , k , qty_index);
508  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
509  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
510  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
511  amrex::Real sm4 = m_phi(i , j , k-4, qty_index);
512 
513  // Left and right fluxes
514  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
515  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
516 
517  // Numerical flux
518  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
519  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

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

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ g3

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

Referenced by Evaluate().

◆ g4

constexpr amrex::Real WENO_Z7::g4 =( amrex::Real(4.0)/amrex::Real(35.0))
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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