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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWIND3:

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE 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
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetUpwinding (amrex::Real upw_frac)
 

Private Attributes

amrex::Array4< const amrex::Realm_phi
 
amrex::Real m_upw_frac
 

Static Private Attributes

static constexpr amrex::Real g1 =(amrex::Real(7.0)/amrex::Real(12.0))
 
static constexpr amrex::Real g2 =(amrex::Real(1)/amrex::Real(12.0))
 

Detailed Description

Interpolation operators used for 3rd order upwind scheme

Constructor & Destructor Documentation

◆ UPWIND3()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE UPWIND3::UPWIND3 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real  upw_frac 
)
inline
100  : m_phi(phi)
101  , m_upw_frac(upw_frac)
102  {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:208
amrex::Real m_upw_frac
Definition: ERF_Interpolation_UPW.H:209

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
190  {
191  // Averages and diffs
192  amrex::Real a1 = (s + sm1);
193  amrex::Real d1 = (s - sm1);
194  amrex::Real a2 = (sp1 + sm2);
195  amrex::Real d2 = (sp1 - sm2);
196 
197  // Interpolated value
198  return ( g1*a1 - g2*a2 + upw * g2 * (d2 - three*d1) );
199  }
constexpr amrex::Real three
Definition: ERF_Constants.H:9
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter a2
Definition: ERF_module_model_constants.F90:95
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:211
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:210

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

Here is the caller graph for this function:

◆ GetUpwindCellNumber()

int UPWIND3::GetUpwindCellNumber ( ) const
inline
201 {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
113  {
114  // Data to interpolate on
115  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
116  amrex::Real s = m_phi(i , j , k , qty_index);
117  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
118  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
119 
120  // Upwinding flags
121  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
122 
123  // Add blending
124  upw_lo *= m_upw_frac;
125 
126  // Interpolate lo
127  val_lo = Evaluate(sp1,s,sm1,sm2,upw_lo);
128  }
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:185

Referenced by EBAdvectionSrcForMomWrapper(), and 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
139  {
140  // Data to interpolate on
141  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
142  amrex::Real s = m_phi(i , j , k , qty_index);
143  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
144  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
145 
146  // Upwinding flags
147  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
148 
149  // Add blending
150  upw_lo *= m_upw_frac;
151 
152  // Interpolate lo
153  val_lo = Evaluate(sp1,s,sm1,sm2,upw_lo);
154  }

Referenced by EBAdvectionSrcForMomWrapper(), and 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
165  {
166  // Data to interpolate on
167  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
168  amrex::Real s = m_phi(i , j , k , qty_index);
169  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
170  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
171 
172  // Upwinding flags
173  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
174 
175  // Add blending
176  upw_lo *= m_upw_frac;
177 
178  // Interpolate lo
179  val_lo = Evaluate(sp1,s,sm1,sm2,upw_lo);
180  }

Referenced by EBAdvectionSrcForMomWrapper(), and EBAdvectionSrcForScalarsWrapper().

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

◆ SetUpwinding()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void UPWIND3::SetUpwinding ( amrex::Real  upw_frac)
inline
205 {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 =(amrex::Real(7.0)/amrex::Real(12.0))
staticconstexprprivate

Referenced by Evaluate().

◆ g2

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