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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWINDALL:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE 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::Realm_phi
 
amrex::Real m_upw_frac
 

Static Private Attributes

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

Detailed Description

Interpolation operators used for all central/upwind schemes

Constructor & Destructor Documentation

◆ UPWINDALL()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE UPWINDALL::UPWINDALL ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real  upw_frac 
)
inline
674  : m_phi(phi)
675  , m_upw_frac(upw_frac)
676  {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:749
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:750

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
723  {
724  // Averages and diffs
725  amrex::Real a1 = (s + sm1);
726  amrex::Real a2 = (sp1 + sm2);
727  amrex::Real d1 = (s - sm1);
728  amrex::Real d2 = (sp1 - sm2);
729  amrex::Real a3 = (sp2 + sm3);
730  amrex::Real d3 = (sp2 - sm3);
731 
732  // Interpolated value
733  amrex::Real iv(amrex::Real(0));
734  if (adv_type == AdvType::Centered_2nd) {
735  iv = myhalf * a1;
736  } else if (adv_type == AdvType::Upwind_3rd) {
737  iv = g1_3_4*a1 - g2_3_4*a2 + upw * g2_3_4 * (d2 - three*d1);
738  } else if (adv_type == AdvType::Centered_4th) {
739  iv = g1_3_4*a1 - g2_3_4*a2;
740  } else if (adv_type == AdvType::Upwind_5th) {
741  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3 - upw * g3_5_6 * (d3 - amrex::Real(5.0)*d2 + amrex::Real(10.0)*d1);
742  } else if (adv_type == AdvType::Centered_6th) {
743  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3;
744  }
745  return ( iv );
746  }
constexpr amrex::Real three
Definition: ERF_Constants.H:9
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
@ Centered_4th
@ Centered_6th
@ Centered_2nd
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 g1_5_6
Definition: ERF_Interpolation_UPW.H:753
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:751
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:752
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:755
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:754

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
688  {
689  if (adv_type == AdvType::Centered_2nd) {
690  val_lo = myhalf * ( m_phi(i,j,k,qty_index) + m_phi(i,j,k-1,qty_index) );
691  return;
692  } else {
693  // Data to interpolate on
694  amrex::Real sp2 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k+2, qty_index): amrex::Real(0);
695  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
696  amrex::Real s = m_phi(i , j , k , qty_index);
697  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
698  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
699  amrex::Real sm3 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k-3, qty_index) : amrex::Real(0);
700 
701  // Upwinding flags
702  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
703 
704  // Add blending
705  upw_lo *= m_upw_frac;
706 
707  // Interpolate lo
708  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
709  }
710  }
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:715
Here is the call graph for this function:

Member Data Documentation

◆ g1_3_4

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

Referenced by Evaluate().

◆ g1_5_6

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

Referenced by Evaluate().

◆ g2_3_4

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

Referenced by Evaluate().

◆ g2_5_6

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

Referenced by Evaluate().

◆ g3_5_6

constexpr amrex::Real UPWINDALL::g3_5_6 =( amrex::Real(1)/amrex::Real(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: