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

#include <ERF_Interpolation_WENO_Z.H>

Collaboration diagram for WENO_MZQ3:

Public Member Functions

 WENO_MZQ3 (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 &sm1, const amrex::Real &s, const amrex::Real &sp1) const
 

Private Attributes

amrex::Array4< const amrex::Realm_phi
 
const amrex::Real eps =amrex::Real(1.0e-40)
 

Static Private Attributes

static constexpr amrex::Real g1 =(amrex::Real(1)/amrex::Real(3))
 
static constexpr amrex::Real g2 =(amrex::Real(1)/amrex::Real(3))
 
static constexpr amrex::Real g3 =(amrex::Real(1)/amrex::Real(3))
 

Detailed Description

Interpolation operators used for WENO_MZQ3 scheme

Constructor & Destructor Documentation

◆ WENO_MZQ3()

WENO_MZQ3::WENO_MZQ3 ( const amrex::Array4< const amrex::Real > &  phi,
const amrex::Real   
)
inline
141  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:256

Member Function Documentation

◆ Evaluate()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WENO_MZQ3::Evaluate ( const amrex::Real sm1,
const amrex::Real s,
const amrex::Real sp1 
) const
inline
230  {
231  // Smoothing factors
232  amrex::Real b1 = (s - sm1) * (s - sm1);
233  amrex::Real b2 = (sp1 - s) * (sp1 - s);
234  amrex::Real b3 = ( (amrex::Real(13.0) / amrex::Real(12.0)) * ((sm1 - amrex::Real(2)*s + sp1)*(sm1 - amrex::Real(2)*s + sp1)) ) + ( ((sp1 - sm1)*(sp1 - sm1)) / amrex::Real(4.0) );
235 
236  // Weight factors
237  amrex::Real t5 = ( std::abs(b3 - b1) + std::abs(b3 - b2) ) / amrex::Real(32.0);
238  amrex::Real a1 = g1 * ( amrex::Real(1) + (t5*t5) / ((eps + b1) * (eps + b1)) );
239  amrex::Real a2 = g2 * ( amrex::Real(1) + (t5*t5) / ((eps + b2) * (eps + b2)) );
240  amrex::Real a3 = g3 * ( amrex::Real(1) + (t5*t5) / ((eps + b3) * (eps + b3)) );
241  amrex::Real asum = a1 + a2 + a3;
242  amrex::Real w1 = a1 / asum;
243  amrex::Real w2 = a2 / asum;
244  amrex::Real w3 = a3 / asum;
245 
246  // Taylor expansions
247  amrex::Real v1 = (-sm1 + amrex::Real(3) * s) / amrex::Real(2);
248  amrex::Real v2 = ( s + sp1) / amrex::Real(2);
249  amrex::Real v3 = (-sm1 + amrex::Real(5.0) * s + amrex::Real(2) * sp1) / amrex::Real(6.0);
250 
251  // Interpolated value
252  return ( (w3 / g3) * (v3 - g1 * v1 - g2 * v2) + w1 * v1 + w2 * v2 );
253  }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
real(c_double), parameter a2
Definition: ERF_module_model_constants.F90:95
real(c_double), parameter a3
Definition: ERF_module_model_constants.F90:96
static constexpr amrex::Real g2
Definition: ERF_Interpolation_WENO_Z.H:263
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:264
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:260
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:262

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

Here is the caller graph for this function:

◆ InterpolateInX()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_MZQ3::InterpolateInX ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
152  {
153  // Upwinding flags
154  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
155 
156  // Data to interpolate on
157  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
158  amrex::Real s = m_phi(i , j , k , qty_index);
159  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
160  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
161 
162  // Left and right fluxes
163  amrex::Real Fhi = Evaluate(sm2,sm1,s );
164  amrex::Real Flo = Evaluate(sp1,s ,sm1);
165 
166  // Numerical flux
167  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
168  }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Evaluate(const amrex::Real &sm1, const amrex::Real &s, const amrex::Real &sp1) const
Definition: ERF_Interpolation_WENO_Z.H:227
Here is the call graph for this function:

◆ InterpolateInY()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_MZQ3::InterpolateInY ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
179  {
180  // Upwinding flags
181  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
182 
183  // Data to interpolate on
184  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
185  amrex::Real s = m_phi(i , j , k , qty_index);
186  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
187  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
188 
189  // Left and right fluxes
190  amrex::Real Fhi = Evaluate(sm2,sm1,s );
191  amrex::Real Flo = Evaluate(sp1,s ,sm1);
192 
193  // Numerical flux
194  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
195  }
Here is the call graph for this function:

◆ InterpolateInZ()

AMREX_GPU_DEVICE AMREX_FORCE_INLINE void WENO_MZQ3::InterpolateInZ ( const int &  i,
const int &  j,
const int &  k,
const int &  qty_index,
amrex::Real val_lo,
amrex::Real  upw_lo 
) const
inline
206  {
207  // Upwinding flags
208  if (upw_lo != amrex::Real(0)) upw_lo = (upw_lo > 0) ? amrex::Real(1) : -amrex::Real(1);
209 
210  // Data to interpolate on
211  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
212  amrex::Real s = m_phi(i , j , k , qty_index);
213  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
214  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
215 
216  // Left and right fluxes
217  amrex::Real Fhi = Evaluate(sm2,sm1,s );
218  amrex::Real Flo = Evaluate(sp1,s ,sm1);
219 
220  // Numerical flux
221  val_lo = (amrex::Real(1) + upw_lo)/amrex::Real(2) * Fhi + (amrex::Real(1) - upw_lo)/amrex::Real(2) * Flo;
222  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

const amrex::Real WENO_MZQ3::eps =amrex::Real(1.0e-40)
private

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO_MZQ3::g1 =(amrex::Real(1)/amrex::Real(3))
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO_MZQ3::g2 =(amrex::Real(1)/amrex::Real(3))
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real WENO_MZQ3::g3 =(amrex::Real(1)/amrex::Real(3))
staticconstexprprivate

Referenced by Evaluate().

◆ m_phi

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

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