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

#include <ERF_Interpolation_UPW.H>

Collaboration diagram for UPWIND5:

Public Member Functions

 UPWIND5 (const amrex::Array4< const amrex::Real > &phi)
 
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::Real upw_frac) 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::Real upw_frac) 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::Real upw_frac) 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
 
int GetUpwindCellNumber () const
 

Private Attributes

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

Static Private Attributes

static constexpr amrex::Real g1 =(37.0/60.0)
 
static constexpr amrex::Real g2 =(2.0/15.0)
 
static constexpr amrex::Real g3 =(1.0/60.0)
 

Detailed Description

Interpolation operators used for 5th order upwind scheme

Constructor & Destructor Documentation

◆ UPWIND5()

UPWIND5::UPWIND5 ( const amrex::Array4< const amrex::Real > &  phi)
inline
309  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_UPW.H:424

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real UPWIND5::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
inline
408  {
409  // Averages and diffs
410  amrex::Real a1 = (s + sm1);
411  amrex::Real a2 = (sp1 + sm2);
412  amrex::Real a3 = (sp2 + sm3);
413  amrex::Real d1 = (s - sm1);
414  amrex::Real d2 = (sp1 - sm2);
415  amrex::Real d3 = (sp2 - sm3);
416 
417  // Interpolated value
418  return ( g1*a1 - g2*a2 + g3*a3 - upw * g3 * (d3 - 5.0*d2 + 10.0*d1) );
419  }
static constexpr amrex::Real g2
Definition: ERF_Interpolation_UPW.H:426
static constexpr amrex::Real g1
Definition: ERF_Interpolation_UPW.H:425
static constexpr amrex::Real g3
Definition: ERF_Interpolation_UPW.H:427

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

Here is the caller graph for this function:

◆ GetUpwindCellNumber()

int UPWIND5::GetUpwindCellNumber ( ) const
inline
421 {return 3;}

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND5::InterpolateInX ( 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
inline
321  {
322  // Data to interpolate on
323  amrex::Real sp2 = m_phi(i+2, j , k , qty_index);
324  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
325  amrex::Real s = m_phi(i , j , k , qty_index);
326  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
327  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
328  amrex::Real sm3 = m_phi(i-3, j , k , qty_index);
329 
330  // Upwinding flags
331  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
332 
333  // Add blending
334  upw_lo *= upw_frac;
335 
336  // Interpolate lo
337  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
338  }
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
Definition: ERF_Interpolation_UPW.H:401
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND5::InterpolateInY ( 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
inline
350  {
351  // Data to interpolate on
352  amrex::Real sp2 = m_phi(i , j+2, k , qty_index);
353  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
354  amrex::Real s = m_phi(i , j , k , qty_index);
355  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
356  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
357  amrex::Real sm3 = m_phi(i , j-3, k , qty_index);
358 
359  // Upwinding flags
360  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
361 
362  // Add blending
363  upw_lo *= upw_frac;
364 
365  // Interpolate lo
366  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
367  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void UPWIND5::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
inline
379  {
380  // Data to interpolate on
381  amrex::Real sp2 = m_phi(i , j , k+2, qty_index);
382  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
383  amrex::Real s = m_phi(i , j , k , qty_index);
384  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
385  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
386  amrex::Real sm3 = m_phi(i , j , k-3, qty_index);
387 
388  // Upwinding flags
389  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
390 
391  // Add blending
392  upw_lo *= upw_frac;
393 
394  // Interpolate lo
395  val_lo = Evaluate(sp2,sp1,s,sm1,sm2,sm3,upw_lo);
396  }
Here is the call graph for this function:

Member Data Documentation

◆ g1

constexpr amrex::Real UPWIND5::g1 =(37.0/60.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real UPWIND5::g2 =(2.0/15.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real UPWIND5::g3 =(1.0/60.0)
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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