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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWIND3:

Public Member Functions

 UPWIND3 (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 &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, 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 =(7.0/12.0)
 
static constexpr amrex::Real g2 =(1.0/12.0)
 

Detailed Description

Interpolation operators used for 3rd order upwind scheme

Constructor & Destructor Documentation

◆ UPWIND3()

UPWIND3::UPWIND3 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real  upw_frac 
)
inline
96  : m_phi(phi)
97  , m_upw_frac(upw_frac)
98  {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:202
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:203

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real UPWIND3::Evaluate ( const amrex::Real &  sp1,
const amrex::Real &  s,
const amrex::Real &  sm1,
const amrex::Real &  sm2,
const amrex::Real &  upw 
) const
inline
186  {
187  // Averages and diffs
188  amrex::Real a1 = (s + sm1);
189  amrex::Real d1 = (s - sm1);
190  amrex::Real a2 = (sp1 + sm2);
191  amrex::Real d2 = (sp1 - sm2);
192 
193  // Interpolated value
194  return ( g1*a1 - g2*a2 + upw * g2 * (d2 - 3.0*d1) );
195  }
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:205
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:204

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

Here is the caller graph for this function:

◆ GetUpwindCellNumber()

int UPWIND3::GetUpwindCellNumber ( ) const
inline
197 {return 2;}

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND3::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
109  {
110  // Data to interpolate on
111  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
112  amrex::Real s = m_phi(i , j , k , qty_index);
113  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
114  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
115 
116  // Upwinding flags
117  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
118 
119  // Add blending
120  upw_lo *= m_upw_frac;
121 
122  // Interpolate lo
123  val_lo = Evaluate(sp1,s,sm1,sm2,upw_lo);
124  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sp1, const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2, const amrex::Real &upw) const
Definition: ERF_Interpolation_UPW.H:181

Referenced by EBAdvectionSrcForScalarsWrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND3::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
135  {
136  // Data to interpolate on
137  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
138  amrex::Real s = m_phi(i , j , k , qty_index);
139  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
140  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
141 
142  // Upwinding flags
143  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
144 
145  // Add blending
146  upw_lo *= m_upw_frac;
147 
148  // Interpolate lo
149  val_lo = Evaluate(sp1,s,sm1,sm2,upw_lo);
150  }

Referenced by EBAdvectionSrcForScalarsWrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND3::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
161  {
162  // Data to interpolate on
163  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
164  amrex::Real s = m_phi(i , j , k , qty_index);
165  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
166  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
167 
168  // Upwinding flags
169  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
170 
171  // Add blending
172  upw_lo *= m_upw_frac;
173 
174  // Interpolate lo
175  val_lo = Evaluate(sp1,s,sm1,sm2,upw_lo);
176  }

Referenced by EBAdvectionSrcForScalarsWrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetUpwinding()

void UPWIND3::SetUpwinding ( amrex::Real  upw_frac)
inline
199 {m_upw_frac = upw_frac;}

Referenced by EBAdvectionSrcForScalarsWrapper().

Here is the caller graph for this function:

Member Data Documentation

◆ g1

constexpr amrex::Real UPWIND3::g1 =(7.0/12.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real UPWIND3::g2 =(1.0/12.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

◆ m_upw_frac

amrex::Real UPWIND3::m_upw_frac
private

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