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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWIND5:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE UPWIND5 (const amrex::Array4< const amrex::Real > &phi, const amrex::Real upw_frac)
 
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 &sp2, const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &sm3, const amrex::Real &upw) const
 
int GetUpwindCellNumber () const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetUpwinding (amrex::Real upw_frac)
 

Private Attributes

amrex::Array4< const amrex::Realm_phi
 
amrex::Real m_upw_frac
 

Static Private Attributes

static constexpr amrex::Real g1 =(amrex::Real(37.0)/amrex::Real(60.0))
 
static constexpr amrex::Real g2 =(amrex::Real(2)/amrex::Real(15.0))
 
static constexpr amrex::Real g3 =(amrex::Real(1)/amrex::Real(60.0))
 

Detailed Description

Interpolation operators used for 5th order upwind scheme

Constructor & Destructor Documentation

◆ UPWIND5()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE UPWIND5::UPWIND5 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real  upw_frac 
)
inline
435  : m_phi(phi)
436  , m_upw_frac(upw_frac)
437  {}
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:554
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:553

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real UPWIND5::Evaluate ( const amrex::Real sp2,
const amrex::Real sp1,
const amrex::Real s,
const amrex::Real sm1,
const amrex::Real sm2,
const amrex::Real sm3,
const amrex::Real upw 
) const
inline
533  {
534  // Averages and diffs
535  amrex::Real a1 = (s + sm1);
536  amrex::Real a2 = (sp1 + sm2);
537  amrex::Real a3 = (sp2 + sm3);
538  amrex::Real d1 = (s - sm1);
539  amrex::Real d2 = (sp1 - sm2);
540  amrex::Real d3 = (sp2 - sm3);
541 
542  // Interpolated value
543  return ( g1*a1 - g2*a2 + g3*a3 - upw * g3 * (d3 - amrex::Real(5.0)*d2 + amrex::Real(10.0)*d1) );
544  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter a2
Definition: ERF_module_model_constants.F90:95
real(c_double), parameter a3
Definition: ERF_module_model_constants.F90:96
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:556
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:555
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:557

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

Here is the caller graph for this function:

◆ GetUpwindCellNumber()

int UPWIND5::GetUpwindCellNumber ( ) const
inline
546 {return 3;}

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND5::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
448  {
449  // Data to interpolate on
450  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
451  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
452  amrex::Real s = m_phi(i , j , k , qty_index);
453  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
454  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
455  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
456 
457  // Upwinding flags
458  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
459 
460  // Add blending
461  upw_lo *= m_upw_frac;
462 
463  // Interpolate lo
464  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
465  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp2, const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &sm3, const amrex::Real &upw) const
Definition: ERF_Interpolation_UPW.H:526
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND5::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
476  {
477  // Data to interpolate on
478  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
479  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
480  amrex::Real s = m_phi(i , j , k , qty_index);
481  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
482  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
483  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
484 
485  // Upwinding flags
486  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
487 
488  // Add blending
489  upw_lo *= m_upw_frac;
490 
491  // Interpolate lo
492  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
493  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND5::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
504  {
505  // Data to interpolate on
506  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
507  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
508  amrex::Real s = m_phi(i , j , k , qty_index);
509  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
510  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
511  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
512 
513  // Upwinding flags
514  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
515 
516  // Add blending
517  upw_lo *= m_upw_frac;
518 
519  // Interpolate lo
520  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
521  }
Here is the call graph for this function:

◆ SetUpwinding()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void UPWIND5::SetUpwinding ( amrex::Real  upw_frac)
inline
550 {m_upw_frac = upw_frac;}

Member Data Documentation

◆ g1

constexpr amrex::Real UPWIND5::g1 =(amrex::Real(37.0)/amrex::Real(60.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real UPWIND5::g2 =(amrex::Real(2)/amrex::Real(15.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real UPWIND5::g3 =(amrex::Real(1)/amrex::Real(60.0))
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

◆ m_upw_frac

amrex::Real UPWIND5::m_upw_frac
private

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