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
656  : m_phi(phi)
657  , m_upw_frac(upw_frac)
658  {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:731
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:732

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
705  {
706  // Averages and diffs
707  amrex::Real a1 = (s + sm1);
708  amrex::Real a2 = (sp1 + sm2);
709  amrex::Real d1 = (s - sm1);
710  amrex::Real d2 = (sp1 - sm2);
711  amrex::Real a3 = (sp2 + sm3);
712  amrex::Real d3 = (sp2 - sm3);
713 
714  // Interpolated value
715  amrex::Real iv(0.0);
716  if (adv_type == AdvType::Centered_2nd) {
717  iv = 0.5 * a1;
718  } else if (adv_type == AdvType::Upwind_3rd) {
719  iv = g1_3_4*a1 - g2_3_4*a2 + upw * g2_3_4 * (d2 - 3.0*d1);
720  } else if (adv_type == AdvType::Centered_4th) {
721  iv = g1_3_4*a1 - g2_3_4*a2;
722  } else if (adv_type == AdvType::Upwind_5th) {
723  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3 - upw * g3_5_6 * (d3 - 5.0*d2 + 10.0*d1);
724  } else if (adv_type == AdvType::Centered_6th) {
725  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3;
726  }
727  return ( iv );
728  }
@ Centered_4th
@ Centered_6th
@ Centered_2nd
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 g1_5_6
Definition: ERF_Interpolation_UPW.H:735
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:733
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:734
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:737
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:736

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
670  {
671  if (adv_type == AdvType::Centered_2nd) {
672  val_lo = 0.5 * ( m_phi(i,j,k,qty_index) + m_phi(i,j,k-1,qty_index) );
673  return;
674  } else {
675  // Data to interpolate on
676  amrex::Real sp2 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k+2, qty_index): 0.;
677  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
678  amrex::Real s = m_phi(i , j , k , qty_index);
679  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
680  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
681  amrex::Real sm3 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k-3, qty_index) : 0.;
682 
683  // Upwinding flags
684  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
685 
686  // Add blending
687  upw_lo *= m_upw_frac;
688 
689  // Interpolate lo
690  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
691  }
692  }
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:697
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: