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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWINDALL:

Public Member Functions

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

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)
inline
531  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:605

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
579  {
580  // Averages and diffs
581  amrex::Real a1 = (s + sm1);
582  amrex::Real a2 = (sp1 + sm2);
583  amrex::Real d1 = (s - sm1);
584  amrex::Real d2 = (sp1 - sm2);
585  amrex::Real a3 = (sp2 + sm3);
586  amrex::Real d3 = (sp2 - sm3);
587 
588  // Interpolated value
589  amrex::Real iv(0.0);
590  if (adv_type == AdvType::Centered_2nd) {
591  iv = 0.5 * a1;
592  } else if (adv_type == AdvType::Upwind_3rd) {
593  iv = g1_3_4*a1 - g2_3_4*a2 + upw * g2_3_4 * (d2 - 3.0*d1);
594  } else if (adv_type == AdvType::Centered_4th) {
595  iv = g1_3_4*a1 - g2_3_4*a2;
596  } else if (adv_type == AdvType::Upwind_5th) {
597  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3 - upw * g3_5_6 * (d3 - 5.0*d2 + 10.0*d1);
598  } else if (adv_type == AdvType::Centered_6th) {
599  iv = g1_5_6*a1 - g2_5_6*a2 + g3_5_6*a3;
600  }
601  return ( iv );
602  }
@ Centered_4th
@ Centered_6th
@ Centered_2nd
static constexpr amrex::Real g1_5_6
Definition: ERF_Interpolation_UPW.H:608
static constexpr amrex::Real g1_3_4
Definition: ERF_Interpolation_UPW.H:606
static constexpr amrex::Real g2_3_4
Definition: ERF_Interpolation_UPW.H:607
static constexpr amrex::Real g3_5_6
Definition: ERF_Interpolation_UPW.H:610
static constexpr amrex::Real g2_5_6
Definition: ERF_Interpolation_UPW.H:609

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 amrex::Real  upw_frac,
const AdvType  adv_type 
) const
inline
544  {
545  if (adv_type == AdvType::Centered_2nd) {
546  val_lo = 0.5 * ( m_phi(i,j,k,qty_index) + m_phi(i,j,k-1,qty_index) );
547  return;
548  } else {
549  // Data to interpolate on
550  amrex::Real sp2 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k+2, qty_index): 0.;
551  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
552  amrex::Real s = m_phi(i , j , k , qty_index);
553  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
554  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
555  amrex::Real sm3 = (adv_type == AdvType::Upwind_5th || adv_type == AdvType::Centered_6th ) ? m_phi(i , j , k-3, qty_index) : 0.;
556 
557  // Upwinding flags
558  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
559 
560  // Add blending
561  upw_lo *= upw_frac;
562 
563  // Interpolate lo
564  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo,adv_type);
565  }
566  }
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:571
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().


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