ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
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::Realm_phi
 
const amrex::Real eps =amrex::Real(1.0e-40)
 

Static Private Attributes

static constexpr amrex::Real g1 =( amrex::Real(1)/amrex::Real(64.0))
 
static constexpr amrex::Real g2 =(amrex::Real(21.0)/amrex::Real(64.0))
 
static constexpr amrex::Real g3 =(amrex::Real(35.0)/amrex::Real(64.0))
 
static constexpr amrex::Real g4 =( amrex::Real(7.0)/amrex::Real(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
283  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO.H:451

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

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
294  {
295  // Upwinding flags
296  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
297 
298  // Data to interpolate on
299  amrex::Real sp3 = m_phi(i+3, j , k , qty_index);
300  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
301  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
302  amrex::Real s = m_phi(i , j , k , qty_index);
303  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
304  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
305  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
306  amrex::Real sm4 = m_phi(i-4, j , k , qty_index);
307 
308  // Left and right fluxes
309  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
310  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
311 
312  // Numerical flux
313  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
314  }
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:381
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
325  {
326  // Upwinding flags
327  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
328 
329  // Data to interpolate on
330  amrex::Real sp3 = m_phi(i , j+3, k , qty_index);
331  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
332  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
333  amrex::Real s = m_phi(i , j , k , qty_index);
334  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
335  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
336  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
337  amrex::Real sm4 = m_phi(i , j-4, k , qty_index);
338 
339  // Left and right fluxes
340  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
341  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
342 
343  // Numerical flux
344  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
345  }
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
356  {
357  // Upwinding flags
358  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
359 
360  // Data to interpolate on
361  amrex::Real sp3 = m_phi(i , j , k+2, qty_index);
362  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
363  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
364  amrex::Real s = m_phi(i , j , k , qty_index);
365  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
366  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
367  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
368  amrex::Real sm4 = m_phi(i , j , k-3, qty_index);
369 
370  // Left and right fluxes
371  amrex::Real Fhi = Evaluate(sm4,sm3,sm2,sm1,s ,sp1,sp2);
372  amrex::Real Flo = Evaluate(sp3,sp2,sp1,s ,sm1,sm2,sm3);
373 
374  // Numerical flux
375  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
376  }
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)/amrex::Real(64.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ g3

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

Referenced by Evaluate().

◆ g4

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