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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWIND5:

Public Member Functions

 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
 
void SetUpwinding (amrex::Real upw_frac)
 

Private Attributes

amrex::Array4< const amrex::Real > m_phi
 
amrex::Real m_upw_frac
 

Static Private Attributes

static constexpr amrex::Real g1 =(37.0/60.0)
 
static constexpr amrex::Real g2 =(2.0/15.0)
 
static constexpr amrex::Real g3 =(1.0/60.0)
 

Detailed Description

Interpolation operators used for 5th order upwind scheme

Constructor & Destructor Documentation

◆ UPWIND5()

UPWIND5::UPWIND5 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real  upw_frac 
)
inline
423  : m_phi(phi)
424  , m_upw_frac(upw_frac)
425  {}
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:540
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:539

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
521  {
522  // Averages and diffs
523  amrex::Real a1 = (s + sm1);
524  amrex::Real a2 = (sp1 + sm2);
525  amrex::Real a3 = (sp2 + sm3);
526  amrex::Real d1 = (s - sm1);
527  amrex::Real d2 = (sp1 - sm2);
528  amrex::Real d3 = (sp2 - sm3);
529 
530  // Interpolated value
531  return ( g1*a1 - g2*a2 + g3*a3 - upw * g3 * (d3 - 5.0*d2 + 10.0*d1) );
532  }
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:542
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:541
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:543

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

Here is the caller graph for this function:

◆ GetUpwindCellNumber()

int UPWIND5::GetUpwindCellNumber ( ) const
inline
534 {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
436  {
437  // Data to interpolate on
438  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
439  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
440  amrex::Real s = m_phi(i , j , k , qty_index);
441  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
442  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
443  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
444 
445  // Upwinding flags
446  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
447 
448  // Add blending
449  upw_lo *= m_upw_frac;
450 
451  // Interpolate lo
452  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
453  }
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:514
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
464  {
465  // Data to interpolate on
466  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
467  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
468  amrex::Real s = m_phi(i , j , k , qty_index);
469  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
470  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
471  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
472 
473  // Upwinding flags
474  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
475 
476  // Add blending
477  upw_lo *= m_upw_frac;
478 
479  // Interpolate lo
480  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
481  }
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
492  {
493  // Data to interpolate on
494  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
495  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
496  amrex::Real s = m_phi(i , j , k , qty_index);
497  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
498  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
499  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
500 
501  // Upwinding flags
502  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
503 
504  // Add blending
505  upw_lo *= m_upw_frac;
506 
507  // Interpolate lo
508  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
509  }
Here is the call graph for this function:

◆ SetUpwinding()

void UPWIND5::SetUpwinding ( amrex::Real  upw_frac)
inline
536 {m_upw_frac = upw_frac;}

Member Data Documentation

◆ g1

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

Referenced by Evaluate().

◆ g2

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

Referenced by Evaluate().

◆ g3

constexpr amrex::Real UPWIND5::g3 =(1.0/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: