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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWINDALL:

Public Member Functions

 UPWINDALL (const amrex::Array4< const amrex::Real > &phi, const amrex::Real upw_frac)
 
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 AdvType adv_type) 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 AdvType adv_type) const
 

Private Attributes

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

Static Private Attributes

static constexpr amrex::Real g1_3_4 =( 7.0/12.0)
 
static constexpr amrex::Real g2_3_4 =( 1.0/12.0)
 
static constexpr amrex::Real g1_5_6 =(37.0/60.0)
 
static constexpr amrex::Real g2_5_6 =( 2.0/15.0)
 
static constexpr amrex::Real g3_5_6 =( 1.0/60.0)
 

Detailed Description

Interpolation operators used for all central/upwind schemes

Constructor & Destructor Documentation

◆ UPWINDALL()

UPWINDALL::UPWINDALL ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real  upw_frac 
)
inline
542  : m_phi(phi)
543  , m_upw_frac(upw_frac)
544  {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:617
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:618

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real UPWINDALL::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 AdvType  adv_type 
) const
inline
591  {
592  // Averages and diffs
593  amrex::Real a1 = (s + sm1);
594  amrex::Real a2 = (sp1 + sm2);
595  amrex::Real d1 = (s - sm1);
596  amrex::Real d2 = (sp1 - sm2);
597  amrex::Real a3 = (sp2 + sm3);
598  amrex::Real d3 = (sp2 - sm3);
599 
600  // Interpolated value
601  amrex::Real iv(0.0);
602  if (adv_type == AdvType::Centered_2nd) {
603  iv = 0.5 * a1;
604  } else if (adv_type == AdvType::Upwind_3rd) {
605  iv = g1_3_4*a1 - g2_3_4*a2 + upw * g2_3_4 * (d2 - 3.0*d1);
606  } else if (adv_type == AdvType::Centered_4th) {
607  iv = g1_3_4*a1 - g2_3_4*a2;
608  } else if (adv_type == AdvType::Upwind_5th) {
609  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3 - upw * g3_5_6 * (d3 - 5.0*d2 + 10.0*d1);
610  } else if (adv_type == AdvType::Centered_6th) {
611  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3;
612  }
613  return ( iv );
614  }
@ Centered_4th
@ Centered_6th
@ Centered_2nd
static constexpr amrex::Real g1_5_6
Definition: ERF_Interpolation_UPW.H:621
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:619
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:620
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:623
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:622

Referenced by InterpolateInZ().

Here is the caller graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWINDALL::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo,
const AdvType  adv_type 
) const
inline
556  {
557  if (adv_type == AdvType::Centered_2nd) {
558  val_lo = 0.5 * ( m_phi(i,j,k,qty_index) + m_phi(i,j,k-1,qty_index) );
559  return;
560  } else {
561  // Data to interpolate on
562  amrex::Real sp2 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k+2, qty_index): 0.;
563  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
564  amrex::Real s = m_phi(i , j , k , qty_index);
565  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
566  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
567  amrex::Real sm3 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k-3, qty_index) : 0.;
568 
569  // Upwinding flags
570  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
571 
572  // Add blending
573  upw_lo *= m_upw_frac;
574 
575  // Interpolate lo
576  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
577  }
578  }
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 AdvType adv_type) const
Definition: ERF_Interpolation_UPW.H:583
Here is the call graph for this function:

Member Data Documentation

◆ g1_3_4

constexpr amrex::Real UPWINDALL::g1_3_4 =( 7.0/12.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g1_5_6

constexpr amrex::Real UPWINDALL::g1_5_6 =(37.0/60.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2_3_4

constexpr amrex::Real UPWINDALL::g2_3_4 =( 1.0/12.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2_5_6

constexpr amrex::Real UPWINDALL::g2_5_6 =( 2.0/15.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g3_5_6

constexpr amrex::Real UPWINDALL::g3_5_6 =( 1.0/60.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

Referenced by InterpolateInZ().

◆ m_upw_frac

amrex::Real UPWINDALL::m_upw_frac
private

Referenced by InterpolateInZ().


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