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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWIND3SL:

Public Member Functions

 UPWIND3SL (const amrex::Array4< const amrex::Real > &phi, const amrex::Real)
 
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 &s, const amrex::Real &sm1, const amrex::Real &sm2) const
 
int GetUpwindCellNumber () const
 

Private Attributes

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

Static Private Attributes

static constexpr amrex::Real eps =(1.0e-16)
 
static constexpr amrex::Real l1 =(1.0/6.0)
 
static constexpr amrex::Real l2 =(1.0/3.0)
 

Detailed Description

Interpolation operators used for 3rd order upwind scheme

Constructor & Destructor Documentation

◆ UPWIND3SL()

UPWIND3SL::UPWIND3SL ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
216  : m_phi(phi)
217  {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:316

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real UPWIND3SL::Evaluate ( const amrex::Real &  s,
const amrex::Real &  sm1,
const amrex::Real &  sm2 
) const
inline
306  {
307  amrex::Real rmh = (s - sm1) / ((sm1 - sm2) + eps);
308  amrex::Real K = l2 + 2.0*l2*rmh;
309  amrex::Real phi = std::max(0.0,std::min(2.0*rmh,std::min(2.0,K)));
310  return (sm1 + 0.5 * phi * (sm1 - sm2));
311  }
static constexpr amrex::Real eps
Definition: ERF_Interpolation_UPW.H:317
static constexpr amrex::Real l2
Definition: ERF_Interpolation_UPW.H:319

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

Here is the caller graph for this function:

◆ GetUpwindCellNumber()

int UPWIND3SL::GetUpwindCellNumber ( ) const
inline
313 {return 2;}

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND3SL::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
228  {
229  // Upwinding flags
230  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
231 
232  // Data to interpolate on
233  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
234  amrex::Real s = m_phi(i , j , k , qty_index);
235  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
236  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
237 
238  // Left and right fluxes
239  amrex::Real Fhi = Evaluate(s ,sm1,sm2);
240  amrex::Real Flo = Evaluate(sm1,s ,sp1);
241 
242  // Numerical flux
243  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
244  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &s, const amrex::Real &sm1, const amrex::Real &sm2) const
Definition: ERF_Interpolation_UPW.H:303
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND3SL::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
255  {
256  // Upwinding flags
257  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
258 
259  // Data to interpolate on
260  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
261  amrex::Real s = m_phi(i , j , k , qty_index);
262  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
263  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
264 
265  // Left and right fluxes
266  amrex::Real Fhi = Evaluate(s ,sm1,sm2);
267  amrex::Real Flo = Evaluate(sm1,s ,sp1);
268 
269  // Numerical flux
270  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
271  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND3SL::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real &  val_lo,
amrex::Real  upw_lo 
) const
inline
282  {
283  // Upwinding flags
284  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
285 
286  // Data to interpolate on
287  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
288  amrex::Real s = m_phi(i , j , k , qty_index);
289  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
290  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
291 
292  // Left and right fluxes
293  amrex::Real Fhi = Evaluate(s ,sm1,sm2);
294  amrex::Real Flo = Evaluate(sm1,s ,sp1);
295 
296  // Numerical flux
297  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
298  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

constexpr amrex::Real UPWIND3SL::eps =(1.0e-16)
staticconstexprprivate

Referenced by Evaluate().

◆ l1

constexpr amrex::Real UPWIND3SL::l1 =(1.0/6.0)
staticconstexprprivate

◆ l2

constexpr amrex::Real UPWIND3SL::l2 =(1.0/3.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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