ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ERF_AdvectionSrcForMom_N.H File Reference
Include dependency graph for ERF_AdvectionSrcForMom_N.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForXMom_N (int i, int j, int k, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, InterpType_H interp_u_h, InterpType_V interp_u_v, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
 
template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForYMom_N (int i, int j, int k, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, InterpType_H interp_v_h, InterpType_V interp_v_v, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
 
template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForZMom_N (int i, int j, int k, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, const amrex::Array4< const amrex::Real > &w, InterpType_H interp_w_h, InterpType_V interp_w_v, WallInterpType interp_w_wall, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const AdvType vert_adv_type, const int lo_z_face, const int hi_z_face, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
 
template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
void AdvectionSrcForMomWrapper_N (const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Array4< amrex::Real > &rho_u_rhs, const amrex::Array4< amrex::Real > &rho_v_rhs, const amrex::Array4< amrex::Real > &rho_w_rhs, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const amrex::Real upw_frac_h, const amrex::Real upw_frac_v, const AdvType vert_adv_type, const int lo_z_face, const int hi_z_face)
 
template<typename InterpType_H >
void AdvectionSrcForMomVert_N (const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Array4< amrex::Real > &rho_u_rhs, const amrex::Array4< amrex::Real > &rho_v_rhs, const amrex::Array4< amrex::Real > &rho_w_rhs, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const amrex::Real upw_frac_h, const amrex::Real upw_frac_v, const AdvType vert_adv_type, const int lo_z_face, const int hi_z_face)
 

Function Documentation

◆ AdvectionSrcForMomVert_N()

template<typename InterpType_H >
void AdvectionSrcForMomVert_N ( const amrex::Box &  bxx,
const amrex::Box &  bxy,
const amrex::Box &  bxz,
const amrex::Array4< amrex::Real > &  rho_u_rhs,
const amrex::Array4< amrex::Real > &  rho_v_rhs,
const amrex::Array4< amrex::Real > &  rho_w_rhs,
const amrex::Array4< const amrex::Real > &  rho_u,
const amrex::Array4< const amrex::Real > &  rho_v,
const amrex::Array4< const amrex::Real > &  rho_w,
const amrex::Array4< const amrex::Real > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
const amrex::Gpu::DeviceVector< amrex::Real > &  stretched_dz_d,
const amrex::Array4< const amrex::Real > &  mf_m,
const amrex::Array4< const amrex::Real > &  mf_u_inv,
const amrex::Array4< const amrex::Real > &  mf_v_inv,
const amrex::Real  upw_frac_h,
const amrex::Real  upw_frac_v,
const AdvType  vert_adv_type,
const int  lo_z_face,
const int  hi_z_face 
)

Wrapper function for computing the advective tendency w/ spatial order > 2.

359 {
360  if (vert_adv_type == AdvType::Centered_2nd) {
361  AdvectionSrcForMomWrapper_N<InterpType_H,CENTERED2,UPWINDALL>(bxx, bxy, bxz,
362  rho_u_rhs, rho_v_rhs, rho_w_rhs,
363  rho_u, rho_v, rho_w, u, v, w,
364  cellSizeInv, stretched_dz_d, mf_m,
365  mf_u_inv, mf_v_inv,
366  upw_frac_h, upw_frac_v,
367  vert_adv_type,
368  lo_z_face, hi_z_face);
369  } else if (vert_adv_type == AdvType::Upwind_3rd) {
370  AdvectionSrcForMomWrapper_N<InterpType_H,UPWIND3,UPWINDALL>(bxx, bxy, bxz,
371  rho_u_rhs, rho_v_rhs, rho_w_rhs,
372  rho_u, rho_v, rho_w, u, v, w,
373  cellSizeInv, stretched_dz_d, mf_m,
374  mf_u_inv, mf_v_inv,
375  upw_frac_h, upw_frac_v,
376  vert_adv_type,
377  lo_z_face, hi_z_face);
378  } else if (vert_adv_type == AdvType::Centered_4th) {
379  AdvectionSrcForMomWrapper_N<InterpType_H,CENTERED4,UPWINDALL>(bxx, bxy, bxz,
380  rho_u_rhs, rho_v_rhs, rho_w_rhs,
381  rho_u, rho_v, rho_w, u, v, w,
382  cellSizeInv, stretched_dz_d, mf_m,
383  mf_u_inv, mf_v_inv,
384  upw_frac_h, upw_frac_v,
385  vert_adv_type,
386  lo_z_face, hi_z_face);
387  } else if (vert_adv_type == AdvType::Upwind_5th) {
388  AdvectionSrcForMomWrapper_N<InterpType_H,UPWIND5,UPWINDALL>(bxx, bxy, bxz,
389  rho_u_rhs, rho_v_rhs, rho_w_rhs,
390  rho_u, rho_v, rho_w, u, v, w,
391  cellSizeInv, stretched_dz_d, mf_m,
392  mf_u_inv, mf_v_inv,
393  upw_frac_h, upw_frac_v,
394  vert_adv_type,
395  lo_z_face, hi_z_face);
396  } else if (vert_adv_type == AdvType::Centered_6th) {
397  AdvectionSrcForMomWrapper_N<InterpType_H,CENTERED6,UPWINDALL>(bxx, bxy, bxz,
398  rho_u_rhs, rho_v_rhs, rho_w_rhs,
399  rho_u, rho_v, rho_w, u, v, w,
400  cellSizeInv, stretched_dz_d, mf_m,
401  mf_u_inv, mf_v_inv,
402  upw_frac_h, upw_frac_v,
403  vert_adv_type,
404  lo_z_face, hi_z_face);
405  } else {
406  AMREX_ASSERT_WITH_MESSAGE(false, "Unknown advection scheme!");
407  }
408 }
@ Centered_4th
@ Centered_6th
@ Centered_2nd

◆ AdvectionSrcForMomWrapper_N()

template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
void AdvectionSrcForMomWrapper_N ( const amrex::Box &  bxx,
const amrex::Box &  bxy,
const amrex::Box &  bxz,
const amrex::Array4< amrex::Real > &  rho_u_rhs,
const amrex::Array4< amrex::Real > &  rho_v_rhs,
const amrex::Array4< amrex::Real > &  rho_w_rhs,
const amrex::Array4< const amrex::Real > &  rho_u,
const amrex::Array4< const amrex::Real > &  rho_v,
const amrex::Array4< const amrex::Real > &  rho_w,
const amrex::Array4< const amrex::Real > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
const amrex::Gpu::DeviceVector< amrex::Real > &  stretched_dz_d,
const amrex::Array4< const amrex::Real > &  mf_m,
const amrex::Array4< const amrex::Real > &  mf_u_inv,
const amrex::Array4< const amrex::Real > &  mf_v_inv,
const amrex::Real  upw_frac_h,
const amrex::Real  upw_frac_v,
const AdvType  vert_adv_type,
const int  lo_z_face,
const int  hi_z_face 
)

Wrapper function for computing the advective tendency w/ spatial order > 2.

291 {
292  // Instantiate the appropriate structs
293  InterpType_H interp_u_h(u, upw_frac_h); InterpType_V interp_u_v(u, upw_frac_v); // X-MOM
294  InterpType_H interp_v_h(v, upw_frac_h); InterpType_V interp_v_v(v, upw_frac_v); // Y-MOM
295  InterpType_H interp_w_h(w, upw_frac_h); InterpType_V interp_w_v(w, upw_frac_v); // Z-MOM
296  WallInterpType interp_w_wall(w, upw_frac_v); // Z-MOM @ wall
297 
298  auto dxInv = cellSizeInv[0];
299  auto dyInv = cellSizeInv[1];
300 
301  auto dz_ptr = stretched_dz_d.data();
302 
303  amrex::ParallelFor(bxx,
304  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
305  {
306  auto dzInv = 1.0/dz_ptr[k];
307  rho_u_rhs(i, j, k) = -AdvectionSrcForXMom_N(i, j, k, rho_u, rho_v, rho_w,
308  interp_u_h, interp_u_v,
309  mf_u_inv, mf_v_inv,
310  dxInv, dyInv, dzInv);
311  });
312 
313  amrex::ParallelFor(bxy,
314  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
315  {
316  auto dzInv = 1.0/dz_ptr[k];
317  rho_v_rhs(i, j, k) = -AdvectionSrcForYMom_N(i, j, k, rho_u, rho_v, rho_w,
318  interp_v_h, interp_v_v,
319  mf_u_inv, mf_v_inv,
320  dxInv, dyInv, dzInv);
321  });
322 
323  amrex::ParallelFor(bxz,
324  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
325  {
326  auto dzInv = 2.0/(dz_ptr[k] + dz_ptr[k-1]);
327  rho_w_rhs(i, j, k) = -AdvectionSrcForZMom_N(i, j, k, rho_u, rho_v, rho_w, w,
328  interp_w_h, interp_w_v, interp_w_wall,
329  mf_m, mf_u_inv, mf_v_inv,
330  vert_adv_type, lo_z_face, hi_z_face,
331  dxInv, dyInv, dzInv);
332  });
333 }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForZMom_N(int i, int j, int k, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, const amrex::Array4< const amrex::Real > &w, InterpType_H interp_w_h, InterpType_V interp_w_v, WallInterpType interp_w_wall, const amrex::Array4< const amrex::Real > &mf_m, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const AdvType vert_adv_type, const int lo_z_face, const int hi_z_face, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
Definition: ERF_AdvectionSrcForMom_N.H:167
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForXMom_N(int i, int j, int k, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, InterpType_H interp_u_h, InterpType_V interp_u_v, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
Definition: ERF_AdvectionSrcForMom_N.H:21
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForYMom_N(int i, int j, int k, const amrex::Array4< const amrex::Real > &rho_u, const amrex::Array4< const amrex::Real > &rho_v, const amrex::Array4< const amrex::Real > &rho_w, InterpType_H interp_v_h, InterpType_V interp_v_v, const amrex::Array4< const amrex::Real > &mf_u_inv, const amrex::Array4< const amrex::Real > &mf_v_inv, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
Definition: ERF_AdvectionSrcForMom_N.H:93
Here is the call graph for this function:

◆ AdvectionSrcForXMom_N()

template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForXMom_N ( int  i,
int  j,
int  k,
const amrex::Array4< const amrex::Real > &  rho_u,
const amrex::Array4< const amrex::Real > &  rho_v,
const amrex::Array4< const amrex::Real > &  rho_w,
InterpType_H  interp_u_h,
InterpType_V  interp_u_v,
const amrex::Array4< const amrex::Real > &  mf_u_inv,
const amrex::Array4< const amrex::Real > &  mf_v_inv,
const amrex::Real  dxInv,
const amrex::Real  dyInv,
const amrex::Real  dzInv 
)

Function for computing the advective tendency for the x-component of momentum without metric terms and for higher-order stencils

Parameters
[in]i,j,kindices of x-face at which to create tendency
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]rho_wz-component of momentum
[in]ux-component of velocity
[in]cellSizeInvinverse of the mesh spacing
[in]mf_umap factor on x-faces
[in]mf_vmap factor on y-faces
30 {
31  amrex::Real advectionSrc;
32 
33  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
34  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
35  amrex::Real rho_w_avg_lo, rho_w_avg_hi;
36 
37  amrex::Real xflux_hi; amrex::Real xflux_lo;
38  amrex::Real yflux_hi; amrex::Real yflux_lo;
39  amrex::Real zflux_hi; amrex::Real zflux_lo;
40 
41  amrex::Real interp_hi(0.), interp_lo(0.);
42 
43  rho_u_avg_hi = 0.5 * (rho_u(i+1, j, k) * mf_u_inv(i+1,j,0) + rho_u(i, j, k) * mf_u_inv(i,j,0));
44  interp_u_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
45  xflux_hi = rho_u_avg_hi * interp_hi;
46 
47  rho_u_avg_lo = 0.5 * (rho_u(i-1, j, k) * mf_u_inv(i-1,j,0) + rho_u(i, j, k) * mf_u_inv(i,j,0));
48  interp_u_h.InterpolateInX(i,j,k,0,interp_lo,rho_u_avg_lo);
49  xflux_lo = rho_u_avg_lo * interp_lo;
50 
51  rho_v_avg_hi = 0.5 * (rho_v(i, j+1, k) * mf_v_inv(i,j+1,0) + rho_v(i-1, j+1, k) * mf_v_inv(i-1,j+1,0));
52  interp_u_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
53  yflux_hi = rho_v_avg_hi * interp_hi;
54 
55  rho_v_avg_lo = 0.5 * (rho_v(i, j , k) * mf_v_inv(i,j ,0) + rho_v(i-1, j , k) * mf_v_inv(i-1,j ,0));
56  interp_u_h.InterpolateInY(i,j,k,0,interp_lo,rho_v_avg_lo);
57  yflux_lo = rho_v_avg_lo * interp_lo;
58 
59  rho_w_avg_hi = 0.5 * (rho_w(i, j, k+1) + rho_w(i-1, j, k+1));
60  interp_u_v.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi);
61  zflux_hi = rho_w_avg_hi * interp_hi;
62 
63  rho_w_avg_lo = 0.5 * (rho_w(i, j, k ) + rho_w(i-1, j, k ));
64  interp_u_v.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo);
65  zflux_lo = rho_w_avg_lo * interp_lo;
66 
67  amrex::Real mfsq = 1 / (mf_u_inv(i,j,0) * mf_u_inv(i,j,0));
68 
69  advectionSrc = (xflux_hi - xflux_lo) * dxInv * mfsq
70  + (yflux_hi - yflux_lo) * dyInv * mfsq
71  + (zflux_hi - zflux_lo) * dzInv;
72 
73  return advectionSrc;
74 }

Referenced by AdvectionSrcForMomWrapper_N().

Here is the caller graph for this function:

◆ AdvectionSrcForYMom_N()

template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForYMom_N ( int  i,
int  j,
int  k,
const amrex::Array4< const amrex::Real > &  rho_u,
const amrex::Array4< const amrex::Real > &  rho_v,
const amrex::Array4< const amrex::Real > &  rho_w,
InterpType_H  interp_v_h,
InterpType_V  interp_v_v,
const amrex::Array4< const amrex::Real > &  mf_u_inv,
const amrex::Array4< const amrex::Real > &  mf_v_inv,
const amrex::Real  dxInv,
const amrex::Real  dyInv,
const amrex::Real  dzInv 
)

Function for computing the advective tendency for the y-component of momentum without metric terms and for higher-order stencils

Parameters
[in]i,j,kindices of y-face at which to create tendency
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]rho_wz-component of momentum
[in]vy-component of velocity
[in]cellSizeInvinverse of the mesh spacing
[in]mf_umap factor on x-faces
[in]mf_vmap factor on y-faces
102 {
103  amrex::Real advectionSrc;
104 
105  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
106  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
107  amrex::Real rho_w_avg_lo, rho_w_avg_hi;
108 
109  amrex::Real xflux_hi; amrex::Real xflux_lo;
110  amrex::Real yflux_hi; amrex::Real yflux_lo;
111  amrex::Real zflux_hi; amrex::Real zflux_lo;
112 
113  amrex::Real interp_hi(0.), interp_lo(0.);
114 
115  rho_u_avg_hi = 0.5 * (rho_u(i+1, j, k) * mf_u_inv(i+1,j ,0) + rho_u(i+1, j-1, k) * mf_u_inv(i+1,j-1,0));
116  interp_v_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
117  xflux_hi = rho_u_avg_hi * interp_hi;
118 
119  rho_u_avg_lo = 0.5 * (rho_u(i , j, k) * mf_u_inv(i ,j ,0) + rho_u(i , j-1, k) * mf_u_inv(i ,j-1,0));
120  interp_v_h.InterpolateInX(i,j,k,0,interp_lo,rho_u_avg_lo);
121  xflux_lo = rho_u_avg_lo * interp_lo;
122 
123  rho_v_avg_hi = 0.5 * (rho_v(i, j, k) * mf_v_inv(i ,j ,0) + rho_v(i, j+1, k) * mf_v_inv(i ,j+1,0));
124  interp_v_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
125  yflux_hi = rho_v_avg_hi * interp_hi;
126 
127  rho_v_avg_lo = 0.5 * (rho_v(i, j, k) * mf_v_inv(i ,j ,0) + rho_v(i, j-1, k) * mf_v_inv(i ,j-1,0));
128  interp_v_h.InterpolateInY(i,j,k,0,interp_lo,rho_v_avg_lo);
129  yflux_lo = rho_v_avg_lo * interp_lo;
130 
131  rho_w_avg_hi = 0.5 * (rho_w(i, j, k+1) + rho_w(i, j-1, k+1));
132  interp_v_v.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi);
133  zflux_hi = rho_w_avg_hi * interp_hi;
134 
135  rho_w_avg_lo = 0.5 * (rho_w(i, j, k ) + rho_w(i, j-1, k ));
136  interp_v_v.InterpolateInZ(i,j,k ,0,interp_lo,rho_w_avg_lo);
137  zflux_lo = rho_w_avg_lo * interp_lo;
138 
139  amrex::Real mfsq = 1 / (mf_v_inv(i,j,0) * mf_v_inv(i,j,0));
140 
141  advectionSrc = (xflux_hi - xflux_lo) * dxInv * mfsq
142  + (yflux_hi - yflux_lo) * dyInv * mfsq
143  + (zflux_hi - zflux_lo) * dzInv;
144 
145  return advectionSrc;
146 }

Referenced by AdvectionSrcForMomWrapper_N().

Here is the caller graph for this function:

◆ AdvectionSrcForZMom_N()

template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForZMom_N ( int  i,
int  j,
int  k,
const amrex::Array4< const amrex::Real > &  rho_u,
const amrex::Array4< const amrex::Real > &  rho_v,
const amrex::Array4< const amrex::Real > &  rho_w,
const amrex::Array4< const amrex::Real > &  w,
InterpType_H  interp_w_h,
InterpType_V  interp_w_v,
WallInterpType  interp_w_wall,
const amrex::Array4< const amrex::Real > &  mf_m,
const amrex::Array4< const amrex::Real > &  mf_u_inv,
const amrex::Array4< const amrex::Real > &  mf_v_inv,
const AdvType  vert_adv_type,
const int  lo_z_face,
const int  hi_z_face,
const amrex::Real  dxInv,
const amrex::Real  dyInv,
const amrex::Real  dzInv 
)

Function for computing the advective tendency for the z-component of momentum without metric terms and for higher-order stencils

Parameters
[in]i,j,kindices of z-face at which to create tendency
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]rho_wz-component of momentum
[in]wz-component of velocity
[in]cellSizeInvinverse of the mesh spacing
[in]mf_mmap factor on cell centers
[in]mf_umap factor on x-faces
[in]mf_vmap factor on y-faces
[in]domhi_zmaximum k value in the domain
181 {
182 
183  amrex::Real advectionSrc;
184 
185  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
186  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
187  amrex::Real rho_w_avg_lo, rho_w_avg_hi;
188 
189  amrex::Real xflux_hi; amrex::Real xflux_lo;
190  amrex::Real yflux_hi; amrex::Real yflux_lo;
191  amrex::Real zflux_hi; amrex::Real zflux_lo;
192 
193  amrex::Real interp_hi(0.), interp_lo(0.);
194 
195  rho_u_avg_hi = 0.5 * (rho_u(i+1, j, k) + rho_u(i+1, j, k-1)) * mf_u_inv(i+1,j ,0);
196  interp_w_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
197  xflux_hi = rho_u_avg_hi * interp_hi;
198 
199  rho_u_avg_lo = 0.5 * (rho_u(i , j, k) + rho_u(i , j, k-1)) * mf_u_inv(i ,j ,0);
200  interp_w_h.InterpolateInX(i,j,k,0,interp_lo,rho_u_avg_lo);
201  xflux_lo = rho_u_avg_lo * interp_lo;
202 
203  rho_v_avg_hi = 0.5 * (rho_v(i, j+1, k) + rho_v(i, j+1, k-1)) * mf_v_inv(i ,j+1,0);
204  interp_w_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
205  yflux_hi = rho_v_avg_hi * interp_hi;
206 
207  rho_v_avg_lo = 0.5 * (rho_v(i, j , k) + rho_v(i, j , k-1)) * mf_v_inv(i ,j ,0);
208  interp_w_h.InterpolateInY(i,j,k,0,interp_lo,rho_v_avg_lo);
209  yflux_lo = rho_v_avg_lo * interp_lo;
210 
211  // int l_spatial_order_hi = std::min(std::min(vert_spatial_order, 2*(hi_z_face-k)), 2*(k+1));
212  // If k == hi_z_face-1, l_spatial_order_hi = 2
213  // If k == hi_z_face-2, l_spatial_order_hi = std::min(vert_spatial_order, 4);
214  // If k == lo_z+face+1, l_spatial_order_hi = std::min(vert_spatial_order, 4);
215 
216  if (k == hi_z_face) {
217  zflux_hi = rho_w(i,j,k) * w(i,j,k);
218  } else {
219  rho_w_avg_hi = 0.5 * (rho_w(i,j,k) + rho_w(i,j,k+1));
220  if (k == hi_z_face-1)
221  {
222  interp_w_wall.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi,AdvType::Centered_2nd);
223  } else if (k == hi_z_face-2 || k == lo_z_face+1) {
224  if (vert_adv_type != AdvType::Centered_2nd && vert_adv_type != AdvType::Upwind_3rd) {
225  interp_w_wall.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi,AdvType::Centered_4th);
226  } else {
227  interp_w_wall.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi,vert_adv_type);
228  }
229  } else {
230  interp_w_v.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi);
231  }
232  zflux_hi = rho_w_avg_hi * interp_hi;
233  }
234 
235  // int l_spatial_order_lo = std::min(std::min(vert_spatial_order, 2*(hi_z_face+1-k)), 2*k);
236  // If k == lo_z_face+1, l_spatial_order_hi = 2
237  // If k == lo_z_face+2, l_spatial_order_hi = std::min(vert_spatial_order, 4);
238  // If k == hi_z_face-1, l_spatial_order_hi = std::min(vert_spatial_order, 4);
239 
240  if (k == lo_z_face) {
241  zflux_lo = rho_w(i,j,k) * w(i,j,k);
242  } else {
243  rho_w_avg_lo = 0.5 * (rho_w(i,j,k) + rho_w(i,j,k-1));
244  if (k == lo_z_face+1) {
245  interp_w_wall.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo,AdvType::Centered_2nd);
246  } else if (k == lo_z_face+2 || k == hi_z_face-1) {
247  if (vert_adv_type != AdvType::Centered_2nd && vert_adv_type != AdvType::Upwind_3rd) {
248  interp_w_wall.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo,AdvType::Centered_4th);
249  } else {
250  interp_w_wall.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo,vert_adv_type);
251  }
252  } else {
253  interp_w_v.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo);
254  }
255  zflux_lo = rho_w_avg_lo * interp_lo;
256  }
257 
258  amrex::Real mfsq = mf_m(i,j,0) * mf_m(i,j,0);
259 
260  advectionSrc = (xflux_hi - xflux_lo) * dxInv * mfsq
261  + (yflux_hi - yflux_lo) * dyInv * mfsq
262  + (zflux_hi - zflux_lo) * dzInv;
263 
264  return advectionSrc;
265 }

Referenced by AdvectionSrcForMomWrapper_N().

Here is the caller graph for this function: