ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
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_ux_inv, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vx_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_uy_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Array4< const amrex::Real > &mf_vy_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_mx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vx_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_mx, const amrex::Array4< const amrex::Real > &mf_ux_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vy_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_mx, const amrex::Array4< const amrex::Real > &mf_ux_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vy_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_mx,
const amrex::Array4< const amrex::Real > &  mf_ux_inv,
const amrex::Array4< const amrex::Real > &  mf_vx_inv,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy_inv,
const amrex::Array4< const amrex::Real > &  mf_vy_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 > two

Template Parameters
InterpType_Hhorizontal interpolation type
Parameters
[in]bxxbox over which x-momentum is updated
[in]bxybox over which y-momentum is updated
[in]bxzbox over which z-momentum is updated
[out]rho_u_rhstendency for the x-momentum equation
[out]rho_v_rhstendency for the y-momentum equation
[out]rho_w_rhstendency for the z-momentum equation
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]rho_wz-component of momentum
[in]ux-component of velocity
[in]vy-component of velocity
[in]wz-component of velocity
[in]cellSizeInvinverse grid spacing
[in]stretched_dz_ddevice vector of vertical cell spacing
[in]mf_mxx map factor on cell centers
[in]mf_ux_invinverse x map factor on x-faces
[in]mf_vx_invinverse x map factor on y-faces
[in]mf_myy map factor on cell centers
[in]mf_uy_invinverse y map factor on x-faces
[in]mf_vy_invinverse y map factor on y-faces
[in]upw_frac_hhorizontal upwind blending fraction
[in]upw_frac_vvertical upwind blending fraction
[in]vert_adv_typevertical advection stencil
[in]lo_z_faceminimum z-face k-index at this level
[in]hi_z_facemaximum z-face k-index at this level
455 {
456  if (vert_adv_type == AdvType::Centered_2nd) {
457  AdvectionSrcForMomWrapper_N<InterpType_H,CENTERED2,UPWINDALL>(bxx, bxy, bxz,
458  rho_u_rhs, rho_v_rhs, rho_w_rhs,
459  rho_u, rho_v, rho_w, u, v, w,
460  cellSizeInv, stretched_dz_d,
461  mf_mx, mf_ux_inv, mf_vx_inv,
462  mf_my, mf_uy_inv, mf_vy_inv,
463  upw_frac_h, upw_frac_v,
464  vert_adv_type,
465  lo_z_face, hi_z_face);
466  } else if (vert_adv_type == AdvType::Upwind_3rd) {
467  AdvectionSrcForMomWrapper_N<InterpType_H,UPWIND3,UPWINDALL>(bxx, bxy, bxz,
468  rho_u_rhs, rho_v_rhs, rho_w_rhs,
469  rho_u, rho_v, rho_w, u, v, w,
470  cellSizeInv, stretched_dz_d,
471  mf_mx, mf_ux_inv, mf_vx_inv,
472  mf_my, mf_uy_inv, mf_vy_inv,
473  upw_frac_h, upw_frac_v,
474  vert_adv_type,
475  lo_z_face, hi_z_face);
476  } else if (vert_adv_type == AdvType::Centered_4th) {
477  AdvectionSrcForMomWrapper_N<InterpType_H,CENTERED4,UPWINDALL>(bxx, bxy, bxz,
478  rho_u_rhs, rho_v_rhs, rho_w_rhs,
479  rho_u, rho_v, rho_w, u, v, w,
480  cellSizeInv, stretched_dz_d,
481  mf_mx, mf_ux_inv, mf_vx_inv,
482  mf_my, mf_uy_inv, mf_vy_inv,
483  upw_frac_h, upw_frac_v,
484  vert_adv_type,
485  lo_z_face, hi_z_face);
486  } else if (vert_adv_type == AdvType::Upwind_5th) {
487  AdvectionSrcForMomWrapper_N<InterpType_H,UPWIND5,UPWINDALL>(bxx, bxy, bxz,
488  rho_u_rhs, rho_v_rhs, rho_w_rhs,
489  rho_u, rho_v, rho_w, u, v, w,
490  cellSizeInv, stretched_dz_d,
491  mf_mx, mf_ux_inv, mf_vx_inv,
492  mf_my, mf_uy_inv, mf_vy_inv,
493  upw_frac_h, upw_frac_v,
494  vert_adv_type,
495  lo_z_face, hi_z_face);
496  } else if (vert_adv_type == AdvType::Centered_6th) {
497  AdvectionSrcForMomWrapper_N<InterpType_H,CENTERED6,UPWINDALL>(bxx, bxy, bxz,
498  rho_u_rhs, rho_v_rhs, rho_w_rhs,
499  rho_u, rho_v, rho_w, u, v, w,
500  cellSizeInv, stretched_dz_d,
501  mf_mx, mf_ux_inv, mf_vx_inv,
502  mf_my, mf_uy_inv, mf_vy_inv,
503  upw_frac_h, upw_frac_v,
504  vert_adv_type,
505  lo_z_face, hi_z_face);
506  } else if (vert_adv_type == AdvType::Weno_3) {
507  AdvectionSrcForMomWrapper_N<InterpType_H,WENO3,UPWINDALL>(bxx, bxy, bxz,
508  rho_u_rhs, rho_v_rhs, rho_w_rhs,
509  rho_u, rho_v, rho_w, u, v, w,
510  cellSizeInv, stretched_dz_d,
511  mf_mx, mf_ux_inv, mf_vx_inv,
512  mf_my, mf_uy_inv, mf_vy_inv,
513  upw_frac_h, upw_frac_v,
514  vert_adv_type,
515  lo_z_face, hi_z_face);
516  } else if (vert_adv_type == AdvType::Weno_3Z) {
517  AdvectionSrcForMomWrapper_N<InterpType_H,WENO_Z3,UPWINDALL>(bxx, bxy, bxz,
518  rho_u_rhs, rho_v_rhs, rho_w_rhs,
519  rho_u, rho_v, rho_w, u, v, w,
520  cellSizeInv, stretched_dz_d,
521  mf_mx, mf_ux_inv, mf_vx_inv,
522  mf_my, mf_uy_inv, mf_vy_inv,
523  upw_frac_h, upw_frac_v,
524  vert_adv_type,
525  lo_z_face, hi_z_face);
526  } else if (vert_adv_type == AdvType::Weno_3MZQ) {
527  AdvectionSrcForMomWrapper_N<InterpType_H,WENO_MZQ3,UPWINDALL>(bxx, bxy, bxz,
528  rho_u_rhs, rho_v_rhs, rho_w_rhs,
529  rho_u, rho_v, rho_w, u, v, w,
530  cellSizeInv, stretched_dz_d,
531  mf_mx, mf_ux_inv, mf_vx_inv,
532  mf_my, mf_uy_inv, mf_vy_inv,
533  upw_frac_h, upw_frac_v,
534  vert_adv_type,
535  lo_z_face, hi_z_face);
536  } else if (vert_adv_type == AdvType::Weno_5) {
537  AdvectionSrcForMomWrapper_N<InterpType_H,WENO5,UPWINDALL>(bxx, bxy, bxz,
538  rho_u_rhs, rho_v_rhs, rho_w_rhs,
539  rho_u, rho_v, rho_w, u, v, w,
540  cellSizeInv, stretched_dz_d,
541  mf_mx, mf_ux_inv, mf_vx_inv,
542  mf_my, mf_uy_inv, mf_vy_inv,
543  upw_frac_h, upw_frac_v,
544  vert_adv_type,
545  lo_z_face, hi_z_face);
546  } else if (vert_adv_type == AdvType::Weno_5Z) {
547  AdvectionSrcForMomWrapper_N<InterpType_H,WENO_Z5,UPWINDALL>(bxx, bxy, bxz,
548  rho_u_rhs, rho_v_rhs, rho_w_rhs,
549  rho_u, rho_v, rho_w, u, v, w,
550  cellSizeInv, stretched_dz_d,
551  mf_mx, mf_ux_inv, mf_vx_inv,
552  mf_my, mf_uy_inv, mf_vy_inv,
553  upw_frac_h, upw_frac_v,
554  vert_adv_type,
555  lo_z_face, hi_z_face);
556  } else if (vert_adv_type == AdvType::Weno_7) {
557  AdvectionSrcForMomWrapper_N<InterpType_H,WENO7,UPWINDALL>(bxx, bxy, bxz,
558  rho_u_rhs, rho_v_rhs, rho_w_rhs,
559  rho_u, rho_v, rho_w, u, v, w,
560  cellSizeInv, stretched_dz_d,
561  mf_mx, mf_ux_inv, mf_vx_inv,
562  mf_my, mf_uy_inv, mf_vy_inv,
563  upw_frac_h, upw_frac_v,
564  vert_adv_type,
565  lo_z_face, hi_z_face);
566  } else if (vert_adv_type == AdvType::Weno_7Z) {
567  AdvectionSrcForMomWrapper_N<InterpType_H,WENO_Z7,UPWINDALL>(bxx, bxy, bxz,
568  rho_u_rhs, rho_v_rhs, rho_w_rhs,
569  rho_u, rho_v, rho_w, u, v, w,
570  cellSizeInv, stretched_dz_d,
571  mf_mx, mf_ux_inv, mf_vx_inv,
572  mf_my, mf_uy_inv, mf_vy_inv,
573  upw_frac_h, upw_frac_v,
574  vert_adv_type,
575  lo_z_face, hi_z_face);
576  } else {
577  AMREX_ASSERT_WITH_MESSAGE(false, "Unknown advection scheme!");
578  }
579 }
@ Centered_4th
@ Centered_6th
@ Centered_2nd
Real w
Definition: ERF_Plotfile2DInterpolator.cpp:22
AMREX_ASSERT_WITH_MESSAGE(wbar_cutoff_min > wbar_cutoff_max, "ERROR: wbar_cutoff_min < wbar_cutoff_max")
Here is the call graph for this function:

◆ 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_mx,
const amrex::Array4< const amrex::Real > &  mf_ux_inv,
const amrex::Array4< const amrex::Real > &  mf_vx_inv,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy_inv,
const amrex::Array4< const amrex::Real > &  mf_vy_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 > two

Template Parameters
InterpType_Hhorizontal interpolation type
InterpType_Vvertical interpolation type
WallInterpTypewall-aware vertical interpolation type
Parameters
[in]bxxbox over which x-momentum is updated
[in]bxybox over which y-momentum is updated
[in]bxzbox over which z-momentum is updated
[out]rho_u_rhstendency for the x-momentum equation
[out]rho_v_rhstendency for the y-momentum equation
[out]rho_w_rhstendency for the z-momentum equation
[in]rho_ux-component of momentum
[in]rho_vy-component of momentum
[in]rho_wz-component of momentum
[in]ux-component of velocity
[in]vy-component of velocity
[in]wz-component of velocity
[in]cellSizeInvinverse grid spacing
[in]stretched_dz_ddevice vector of vertical cell spacing
[in]mf_mxx map factor on cell centers
[in]mf_ux_invinverse x map factor on x-faces
[in]mf_vx_invinverse x map factor on y-faces
[in]mf_myy map factor on cell centers
[in]mf_uy_invinverse y map factor on x-faces
[in]mf_vy_invinverse y map factor on y-faces
[in]upw_frac_hhorizontal upwind blending fraction
[in]upw_frac_vvertical upwind blending fraction
[in]vert_adv_typevertical advection stencil
[in]lo_z_faceminimum z-face k-index at this level
[in]hi_z_facemaximum z-face k-index at this level
357 {
358  // Instantiate the appropriate structs
359  InterpType_H interp_u_h(u, upw_frac_h); InterpType_V interp_u_v(u, upw_frac_v); // X-MOM
360  InterpType_H interp_v_h(v, upw_frac_h); InterpType_V interp_v_v(v, upw_frac_v); // Y-MOM
361  InterpType_H interp_w_h(w, upw_frac_h); InterpType_V interp_w_v(w, upw_frac_v); // Z-MOM
362  WallInterpType interp_w_wall(w, upw_frac_v); // Z-MOM @ wall
363 
364  auto dxInv = cellSizeInv[0];
365  auto dyInv = cellSizeInv[1];
366 
367  auto dz_ptr = stretched_dz_d.data();
368 
369  amrex::ParallelFor(bxx,
370  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
371  {
372  auto dzInv = one/dz_ptr[k];
373  rho_u_rhs(i, j, k) = -AdvectionSrcForXMom_N(i, j, k, rho_u, rho_v, rho_w,
374  interp_u_h, interp_u_v,
375  mf_ux_inv, mf_uy_inv, mf_vx_inv,
376  dxInv, dyInv, dzInv);
377  });
378 
379  amrex::ParallelFor(bxy,
380  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
381  {
382  auto dzInv = one/dz_ptr[k];
383  rho_v_rhs(i, j, k) = -AdvectionSrcForYMom_N(i, j, k, rho_u, rho_v, rho_w,
384  interp_v_h, interp_v_v,
385  mf_uy_inv, mf_vx_inv, mf_vy_inv,
386  dxInv, dyInv, dzInv);
387  });
388 
389  amrex::ParallelFor(bxz,
390  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
391  {
392  auto dzInv = (k == 0) ? one / dz_ptr[k] : two/(dz_ptr[k] + dz_ptr[k-1]);
393  rho_w_rhs(i, j, k) = -AdvectionSrcForZMom_N(i, j, k, rho_u, rho_v, rho_w, w,
394  interp_w_h, interp_w_v, interp_w_wall,
395  mf_mx, mf_my, mf_uy_inv, mf_vx_inv,
396  vert_adv_type, lo_z_face, hi_z_face,
397  dxInv, dyInv, dzInv);
398  });
399 }
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_uy_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Array4< const amrex::Real > &mf_vy_inv, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
Definition: ERF_AdvectionSrcForMom_N.H:112
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_mx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vx_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:201
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_ux_inv, const amrex::Array4< const amrex::Real > &mf_uy_inv, const amrex::Array4< const amrex::Real > &mf_vx_inv, const amrex::Real dxInv, const amrex::Real dyInv, const amrex::Real dzInv)
Definition: ERF_AdvectionSrcForMom_N.H:30
constexpr amrex::Real two
Definition: ERF_Constants.H:10
constexpr amrex::Real one
Definition: ERF_Constants.H:9
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:17
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
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_ux_inv,
const amrex::Array4< const amrex::Real > &  mf_uy_inv,
const amrex::Array4< const amrex::Real > &  mf_vx_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 (constant OR stretched dz) and for higher-order stencils

Template Parameters
InterpType_Hhorizontal interpolation type
InterpType_Vvertical interpolation type
Parameters
[in]ii-index of x-face at which to create tendency
[in]jj-index of x-face at which to create tendency
[in]kk-index 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]interp_u_hhorizontal interpolator for x-component velocity
[in]interp_u_vvertical interpolator for x-component velocity
[in]mf_ux_invinverse x map factor on x-faces
[in]mf_uy_invinverse y map factor on x-faces
[in]mf_vx_invinverse x map factor on y-faces
[in]dxInvinverse grid spacing in x
[in]dyInvinverse grid spacing in y
[in]dzInvinverse grid spacing in z
Returns
advective tendency for x-momentum
40 {
41  amrex::Real advectionSrc;
42 
43  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
44  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
45  amrex::Real rho_w_avg_lo, rho_w_avg_hi;
46 
47  amrex::Real xflux_hi; amrex::Real xflux_lo;
48  amrex::Real yflux_hi; amrex::Real yflux_lo;
49  amrex::Real zflux_hi; amrex::Real zflux_lo;
50 
51  amrex::Real interp_hi(zero), interp_lo(zero);
52 
53  rho_u_avg_hi = myhalf * (rho_u(i+1, j, k) * mf_uy_inv(i+1,j,0) + rho_u(i, j, k) * mf_uy_inv(i,j,0));
54  interp_u_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
55  xflux_hi = rho_u_avg_hi * interp_hi;
56 
57  rho_u_avg_lo = myhalf * (rho_u(i-1, j, k) * mf_uy_inv(i-1,j,0) + rho_u(i, j, k) * mf_uy_inv(i,j,0));
58  interp_u_h.InterpolateInX(i,j,k,0,interp_lo,rho_u_avg_lo);
59  xflux_lo = rho_u_avg_lo * interp_lo;
60 
61  rho_v_avg_hi = myhalf * (rho_v(i, j+1, k) * mf_vx_inv(i,j+1,0) + rho_v(i-1, j+1, k) * mf_vx_inv(i-1,j+1,0));
62  interp_u_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
63  yflux_hi = rho_v_avg_hi * interp_hi;
64 
65  rho_v_avg_lo = myhalf * (rho_v(i, j , k) * mf_vx_inv(i,j ,0) + rho_v(i-1, j , k) * mf_vx_inv(i-1,j ,0));
66  interp_u_h.InterpolateInY(i,j,k,0,interp_lo,rho_v_avg_lo);
67  yflux_lo = rho_v_avg_lo * interp_lo;
68 
69  rho_w_avg_hi = myhalf * (rho_w(i, j, k+1) + rho_w(i-1, j, k+1));
70  interp_u_v.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi);
71  zflux_hi = rho_w_avg_hi * interp_hi;
72 
73  rho_w_avg_lo = myhalf * (rho_w(i, j, k ) + rho_w(i-1, j, k ));
74  interp_u_v.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo);
75  zflux_lo = rho_w_avg_lo * interp_lo;
76 
77  amrex::Real mfsq = 1 / (mf_ux_inv(i,j,0) * mf_uy_inv(i,j,0));
78 
79  advectionSrc = (xflux_hi - xflux_lo) * dxInv * mfsq
80  + (yflux_hi - yflux_lo) * dyInv * mfsq
81  + (zflux_hi - zflux_lo) * dzInv;
82 
83  return advectionSrc;
84 }
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
amrex::Real Real
Definition: ERF_ShocInterface.H:19

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_uy_inv,
const amrex::Array4< const amrex::Real > &  mf_vx_inv,
const amrex::Array4< const amrex::Real > &  mf_vy_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

Template Parameters
InterpType_Hhorizontal interpolation type
InterpType_Vvertical interpolation type
Parameters
[in]ii-index of y-face at which to create tendency
[in]jj-index of y-face at which to create tendency
[in]kk-index 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]interp_v_hhorizontal interpolator for y-component velocity
[in]interp_v_vvertical interpolator for y-component velocity
[in]mf_uy_invinverse y map factor on x-faces
[in]mf_vx_invinverse x map factor on y-faces
[in]mf_vy_invinverse y map factor on y-faces
[in]dxInvinverse grid spacing in x
[in]dyInvinverse grid spacing in y
[in]dzInvinverse grid spacing in z
Returns
advective tendency for y-momentum
122 {
123  amrex::Real advectionSrc;
124 
125  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
126  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
127  amrex::Real rho_w_avg_lo, rho_w_avg_hi;
128 
129  amrex::Real xflux_hi; amrex::Real xflux_lo;
130  amrex::Real yflux_hi; amrex::Real yflux_lo;
131  amrex::Real zflux_hi; amrex::Real zflux_lo;
132 
133  amrex::Real interp_hi(zero), interp_lo(zero);
134 
135  rho_u_avg_hi = myhalf * (rho_u(i+1, j, k) * mf_uy_inv(i+1,j ,0) + rho_u(i+1, j-1, k) * mf_uy_inv(i+1,j-1,0));
136  interp_v_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
137  xflux_hi = rho_u_avg_hi * interp_hi;
138 
139  rho_u_avg_lo = myhalf * (rho_u(i , j, k) * mf_uy_inv(i ,j ,0) + rho_u(i , j-1, k) * mf_uy_inv(i ,j-1,0));
140  interp_v_h.InterpolateInX(i,j,k,0,interp_lo,rho_u_avg_lo);
141  xflux_lo = rho_u_avg_lo * interp_lo;
142 
143  rho_v_avg_hi = myhalf * (rho_v(i, j, k) * mf_vx_inv(i ,j ,0) + rho_v(i, j+1, k) * mf_vx_inv(i ,j+1,0));
144  interp_v_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
145  yflux_hi = rho_v_avg_hi * interp_hi;
146 
147  rho_v_avg_lo = myhalf * (rho_v(i, j, k) * mf_vx_inv(i ,j ,0) + rho_v(i, j-1, k) * mf_vx_inv(i ,j-1,0));
148  interp_v_h.InterpolateInY(i,j,k,0,interp_lo,rho_v_avg_lo);
149  yflux_lo = rho_v_avg_lo * interp_lo;
150 
151  rho_w_avg_hi = myhalf * (rho_w(i, j, k+1) + rho_w(i, j-1, k+1));
152  interp_v_v.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi);
153  zflux_hi = rho_w_avg_hi * interp_hi;
154 
155  rho_w_avg_lo = myhalf * (rho_w(i, j, k ) + rho_w(i, j-1, k ));
156  interp_v_v.InterpolateInZ(i,j,k ,0,interp_lo,rho_w_avg_lo);
157  zflux_lo = rho_w_avg_lo * interp_lo;
158 
159  amrex::Real mfsq = 1 / (mf_vx_inv(i,j,0) * mf_vy_inv(i,j,0));
160 
161  advectionSrc = (xflux_hi - xflux_lo) * dxInv * mfsq
162  + (yflux_hi - yflux_lo) * dyInv * mfsq
163  + (zflux_hi - zflux_lo) * dzInv;
164 
165  return advectionSrc;
166 }

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_mx,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy_inv,
const amrex::Array4< const amrex::Real > &  mf_vx_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

Template Parameters
InterpType_Hhorizontal interpolation type
InterpType_Vvertical interpolation type
WallInterpTypewall-aware vertical interpolation type
Parameters
[in]ii-index of z-face at which to create tendency
[in]jj-index of z-face at which to create tendency
[in]kk-index 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]interp_w_hhorizontal interpolator for z-component velocity
[in]interp_w_vvertical interpolator for z-component velocity
[in]interp_w_wallwall-aware vertical interpolator for z-component velocity
[in]mf_mxx map factor on cell centers
[in]mf_myy map factor on cell centers
[in]mf_uy_invinverse y map factor on x-faces
[in]mf_vx_invinverse x map factor on y-faces
[in]vert_adv_typevertical advection stencil
[in]lo_z_faceminimum z-face k-index at this level
[in]hi_z_facemaximum z-face k-index at this level
[in]dxInvinverse grid spacing in x
[in]dyInvinverse grid spacing in y
[in]dzInvinverse grid spacing in z
Returns
advective tendency for z-momentum
216 {
217 
218  amrex::Real advectionSrc;
219 
220  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
221  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
222  amrex::Real rho_w_avg_lo, rho_w_avg_hi;
223 
224  amrex::Real xflux_hi; amrex::Real xflux_lo;
225  amrex::Real yflux_hi; amrex::Real yflux_lo;
226  amrex::Real zflux_hi; amrex::Real zflux_lo;
227 
228  amrex::Real interp_hi(zero), interp_lo(zero);
229 
230  rho_u_avg_hi = myhalf * (rho_u(i+1, j, k) + rho_u(i+1, j, k-1)) * mf_uy_inv(i+1,j ,0);
231  interp_w_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
232  xflux_hi = rho_u_avg_hi * interp_hi;
233 
234  rho_u_avg_lo = myhalf * (rho_u(i , j, k) + rho_u(i , j, k-1)) * mf_uy_inv(i ,j ,0);
235  interp_w_h.InterpolateInX(i,j,k,0,interp_lo,rho_u_avg_lo);
236  xflux_lo = rho_u_avg_lo * interp_lo;
237 
238  rho_v_avg_hi = myhalf * (rho_v(i, j+1, k) + rho_v(i, j+1, k-1)) * mf_vx_inv(i ,j+1,0);
239  interp_w_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
240  yflux_hi = rho_v_avg_hi * interp_hi;
241 
242  rho_v_avg_lo = myhalf * (rho_v(i, j , k) + rho_v(i, j , k-1)) * mf_vx_inv(i ,j ,0);
243  interp_w_h.InterpolateInY(i,j,k,0,interp_lo,rho_v_avg_lo);
244  yflux_lo = rho_v_avg_lo * interp_lo;
245 
246  // int l_spatial_order_hi = std::min(std::min(vert_spatial_order, 2*(hi_z_face-k)), 2*(k+1));
247  // If k == hi_z_face-1, l_spatial_order_hi = 2
248  // If k == hi_z_face-2, l_spatial_order_hi = std::min(vert_spatial_order, 4);
249  // If k == lo_z+face+1, l_spatial_order_hi = std::min(vert_spatial_order, 4);
250 
251  if (k == hi_z_face) {
252  zflux_hi = rho_w(i,j,k) * w(i,j,k);
253  } else {
254  rho_w_avg_hi = myhalf * (rho_w(i,j,k) + rho_w(i,j,k+1));
255  if (k == hi_z_face-1) {
256  interp_w_wall.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi,AdvType::Centered_2nd);
257  } else if (k == hi_z_face-2 || k == lo_z_face+1) {
258  if (vert_adv_type != AdvType::Centered_2nd && vert_adv_type != AdvType::Upwind_3rd) {
259  interp_w_wall.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi,AdvType::Centered_4th);
260  } else {
261  interp_w_wall.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi,vert_adv_type);
262  }
263  } else {
264  interp_w_v.InterpolateInZ(i,j,k+1,0,interp_hi,rho_w_avg_hi);
265  }
266  zflux_hi = rho_w_avg_hi * interp_hi;
267  }
268 
269  // int l_spatial_order_lo = std::min(std::min(vert_spatial_order, 2*(hi_z_face+1-k)), 2*k);
270  // If k == lo_z_face+1, l_spatial_order_hi = 2
271  // If k == lo_z_face+2, l_spatial_order_hi = std::min(vert_spatial_order, 4);
272  // If k == hi_z_face-1, l_spatial_order_hi = std::min(vert_spatial_order, 4);
273 
274  if (k == lo_z_face) {
275  zflux_lo = rho_w(i,j,k) * w(i,j,k);
276  } else {
277  rho_w_avg_lo = myhalf * (rho_w(i,j,k) + rho_w(i,j,k-1));
278  if (k == lo_z_face+1) {
279  interp_w_wall.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo,AdvType::Centered_2nd);
280  } else if (k == lo_z_face+2 || k == hi_z_face-1) {
281  if (vert_adv_type != AdvType::Centered_2nd && vert_adv_type != AdvType::Upwind_3rd) {
282  interp_w_wall.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo,AdvType::Centered_4th);
283  } else {
284  interp_w_wall.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo,vert_adv_type);
285  }
286  } else {
287  interp_w_v.InterpolateInZ(i,j,k,0,interp_lo,rho_w_avg_lo);
288  }
289  zflux_lo = rho_w_avg_lo * interp_lo;
290  }
291 
292  amrex::Real mfsq = mf_mx(i,j,0) * mf_my(i,j,0);
293 
294  advectionSrc = (xflux_hi - xflux_lo) * dxInv * mfsq
295  + (yflux_hi - yflux_lo) * dyInv * mfsq
296  + (zflux_hi - zflux_lo) * dzInv;
297 
298  return advectionSrc;
299 }

Referenced by AdvectionSrcForMomWrapper_N().

Here is the caller graph for this function: