ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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::Real > m_phi
 
const amrex::Real eps =1.0e-40
 

Static Private Attributes

static constexpr amrex::Real g1 =(1.0/3.0)
 
static constexpr amrex::Real g2 =(1.0/3.0)
 
static constexpr amrex::Real g3 =(1.0/3.0)
 

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
137  : m_phi(phi) {}
amrex::Array4< const amrex::Real > m_phi
Definition: ERF_Interpolation_WENO_Z.H:252

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
226  {
227  // Smoothing factors
228  amrex::Real b1 = (s - sm1) * (s - sm1);
229  amrex::Real b2 = (sp1 - s) * (sp1 - s);
230  amrex::Real b3 = ( (13.0 / 12.0) * ((sm1 - 2.0*s + sp1)*(sm1 - 2.0*s + sp1)) ) + ( ((sp1 - sm1)*(sp1 - sm1)) / 4.0 );
231 
232  // Weight factors
233  amrex::Real t5 = ( std::abs(b3 - b1) + std::abs(b3 - b2) ) / 32.0;
234  amrex::Real a1 = g1 * ( 1.0 + (t5*t5) / ((eps + b1) * (eps + b1)) );
235  amrex::Real a2 = g2 * ( 1.0 + (t5*t5) / ((eps + b2) * (eps + b2)) );
236  amrex::Real a3 = g3 * ( 1.0 + (t5*t5) / ((eps + b3) * (eps + b3)) );
237  amrex::Real asum = a1 + a2 + a3;
238  amrex::Real w1 = a1 / asum;
239  amrex::Real w2 = a2 / asum;
240  amrex::Real w3 = a3 / asum;
241 
242  // Taylor expansions
243  amrex::Real v1 = (-sm1 + 3.0 * s) / 2.0;
244  amrex::Real v2 = ( s + sp1) / 2.0;
245  amrex::Real v3 = (-sm1 + 5.0 * s + 2.0 * sp1) / 6.0;
246 
247  // Interpolated value
248  return ( (w3 / g3) * (v3 - g1 * v1 - g2 * v2) + w1 * v1 + w2 * v2 );
249  }
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:255
static constexpr amrex::Real g3
Definition: ERF_Interpolation_WENO_Z.H:256
const amrex::Real eps
Definition: ERF_Interpolation_WENO_Z.H:253
static constexpr amrex::Real g1
Definition: ERF_Interpolation_WENO_Z.H:254

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
148  {
149  // Upwinding flags
150  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
151 
152  // Data to interpolate on
153  amrex::Real sp1 = m_phi(i+1, j , k , qty_index);
154  amrex::Real s = m_phi(i , j , k , qty_index);
155  amrex::Real sm1 = m_phi(i-1, j , k , qty_index);
156  amrex::Real sm2 = m_phi(i-2, j , k , qty_index);
157 
158  // Left and right fluxes
159  amrex::Real Fhi = Evaluate(sm2,sm1,s );
160  amrex::Real Flo = Evaluate(sp1,s ,sm1);
161 
162  // Numerical flux
163  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
164  }
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:223
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
175  {
176  // Upwinding flags
177  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
178 
179  // Data to interpolate on
180  amrex::Real sp1 = m_phi(i , j+1, k , qty_index);
181  amrex::Real s = m_phi(i , j , k , qty_index);
182  amrex::Real sm1 = m_phi(i , j-1, k , qty_index);
183  amrex::Real sm2 = m_phi(i , j-2, k , qty_index);
184 
185  // Left and right fluxes
186  amrex::Real Fhi = Evaluate(sm2,sm1,s );
187  amrex::Real Flo = Evaluate(sp1,s ,sm1);
188 
189  // Numerical flux
190  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
191  }
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
202  {
203  // Upwinding flags
204  if (upw_lo != 0.) upw_lo = (upw_lo > 0) ? 1. : -1.;
205 
206  // Data to interpolate on
207  amrex::Real sp1 = m_phi(i , j , k+1, qty_index);
208  amrex::Real s = m_phi(i , j , k , qty_index);
209  amrex::Real sm1 = m_phi(i , j , k-1, qty_index);
210  amrex::Real sm2 = m_phi(i , j , k-2, qty_index);
211 
212  // Left and right fluxes
213  amrex::Real Fhi = Evaluate(sm2,sm1,s );
214  amrex::Real Flo = Evaluate(sp1,s ,sm1);
215 
216  // Numerical flux
217  val_lo = (1.0 + upw_lo)/2.0 * Fhi + (1.0 - upw_lo)/2.0 * Flo;
218  }
Here is the call graph for this function:

Member Data Documentation

◆ eps

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

Referenced by Evaluate().

◆ g1

constexpr amrex::Real WENO_MZQ3::g1 =(1.0/3.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g2

constexpr amrex::Real WENO_MZQ3::g2 =(1.0/3.0)
staticconstexprprivate

Referenced by Evaluate().

◆ g3

constexpr amrex::Real WENO_MZQ3::g3 =(1.0/3.0)
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: