ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_AdvectionSrcForMom_T.H File Reference
Include dependency graph for ERF_AdvectionSrcForMom_T.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 (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 > &Omega, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &ax, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, InterpType_H interp_u_h, InterpType_V interp_u_v, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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)
 
template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForYMom (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 > &Omega, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, InterpType_H interp_v_h, InterpType_V interp_v_v, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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)
 
template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForZMom (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 > &Omega, const amrex::Array4< const amrex::Real > &w, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, InterpType_H interp_omega_h, InterpType_V interp_omega_v, WallInterpType interp_omega_wall, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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)
 
template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
void AdvectionSrcForMomWrapper (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 > &Omega, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &ax, const amrex::Array4< const amrex::Real > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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 (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 > &Omega, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &ax, const amrex::Array4< const amrex::Real > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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()

template<typename InterpType_H >
void AdvectionSrcForMomVert ( 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 > &  Omega,
const amrex::Array4< const amrex::Real > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
const amrex::Array4< const amrex::Real > &  z_nd,
const amrex::Array4< const amrex::Real > &  ax,
const amrex::Array4< const amrex::Real > &  ay,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
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]Omegacomponent of the momentum normal to the z-coordinate surface
[in]ux-component of velocity
[in]vy-component of velocity
[in]wz-component of velocity
[in]z_ndheight coordinate at nodes
[in]axarea fractions on x-faces
[in]ayarea fractions on y-faces
[in]azarea fractions on z-faces
[in]detJJacobian of the metric transformation
[in]cellSizeInvinverse grid 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
535 {
536  if (vert_adv_type == AdvType::Centered_2nd) {
537  AdvectionSrcForMomWrapper<InterpType_H,CENTERED2,UPWINDALL>(bxx, bxy, bxz,
538  rho_u_rhs, rho_v_rhs, rho_w_rhs,
539  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
540  cellSizeInv,
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, lo_z_face, hi_z_face);
545  } else if (vert_adv_type == AdvType::Upwind_3rd) {
546  AdvectionSrcForMomWrapper<InterpType_H,UPWIND3,UPWINDALL>(bxx, bxy, bxz,
547  rho_u_rhs, rho_v_rhs, rho_w_rhs,
548  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
549  cellSizeInv,
550  mf_mx, mf_ux_inv, mf_vx_inv,
551  mf_my, mf_uy_inv, mf_vy_inv,
552  upw_frac_h, upw_frac_v,
553  vert_adv_type, lo_z_face, hi_z_face);
554  } else if (vert_adv_type == AdvType::Centered_4th) {
555  AdvectionSrcForMomWrapper<InterpType_H,CENTERED4,UPWINDALL>(bxx, bxy, bxz,
556  rho_u_rhs, rho_v_rhs, rho_w_rhs,
557  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
558  cellSizeInv,
559  mf_mx, mf_ux_inv, mf_vx_inv,
560  mf_my, mf_uy_inv, mf_vy_inv,
561  upw_frac_h, upw_frac_v,
562  vert_adv_type, lo_z_face, hi_z_face);
563  } else if (vert_adv_type == AdvType::Upwind_5th) {
564  AdvectionSrcForMomWrapper<InterpType_H,UPWIND5,UPWINDALL>(bxx, bxy, bxz,
565  rho_u_rhs, rho_v_rhs, rho_w_rhs,
566  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
567  cellSizeInv,
568  mf_mx, mf_ux_inv, mf_vx_inv,
569  mf_my, mf_uy_inv, mf_vy_inv,
570  upw_frac_h, upw_frac_v,
571  vert_adv_type, lo_z_face, hi_z_face);
572  } else if (vert_adv_type == AdvType::Centered_6th) {
573  AdvectionSrcForMomWrapper<InterpType_H,CENTERED6,UPWINDALL>(bxx, bxy, bxz,
574  rho_u_rhs, rho_v_rhs, rho_w_rhs,
575  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
576  cellSizeInv,
577  mf_mx, mf_ux_inv, mf_vx_inv,
578  mf_my, mf_uy_inv, mf_vy_inv,
579  upw_frac_h, upw_frac_v,
580  vert_adv_type, lo_z_face, hi_z_face);
581 
582  } else if (vert_adv_type == AdvType::Weno_3) {
583  AdvectionSrcForMomWrapper<InterpType_H,WENO3,UPWINDALL>(bxx, bxy, bxz,
584  rho_u_rhs, rho_v_rhs, rho_w_rhs,
585  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
586  cellSizeInv,
587  mf_mx, mf_ux_inv, mf_vx_inv,
588  mf_my, mf_uy_inv, mf_vy_inv,
589  upw_frac_h, upw_frac_v,
590  vert_adv_type, lo_z_face, hi_z_face);
591  } else if (vert_adv_type == AdvType::Weno_3Z) {
592  AdvectionSrcForMomWrapper<InterpType_H,WENO_Z3,UPWINDALL>(bxx, bxy, bxz,
593  rho_u_rhs, rho_v_rhs, rho_w_rhs,
594  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
595  cellSizeInv,
596  mf_mx, mf_ux_inv, mf_vx_inv,
597  mf_my, mf_uy_inv, mf_vy_inv,
598  upw_frac_h, upw_frac_v,
599  vert_adv_type, lo_z_face, hi_z_face);
600  } else if (vert_adv_type == AdvType::Weno_3MZQ) {
601  AdvectionSrcForMomWrapper<InterpType_H,WENO_MZQ3,UPWINDALL>(bxx, bxy, bxz,
602  rho_u_rhs, rho_v_rhs, rho_w_rhs,
603  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
604  cellSizeInv,
605  mf_mx, mf_ux_inv, mf_vx_inv,
606  mf_my, mf_uy_inv, mf_vy_inv,
607  upw_frac_h, upw_frac_v,
608  vert_adv_type, lo_z_face, hi_z_face);
609  } else if (vert_adv_type == AdvType::Weno_5) {
610  AdvectionSrcForMomWrapper<InterpType_H,WENO5,UPWINDALL>(bxx, bxy, bxz,
611  rho_u_rhs, rho_v_rhs, rho_w_rhs,
612  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
613  cellSizeInv,
614  mf_mx, mf_ux_inv, mf_vx_inv,
615  mf_my, mf_uy_inv, mf_vy_inv,
616  upw_frac_h, upw_frac_v,
617  vert_adv_type, lo_z_face, hi_z_face);
618  } else if (vert_adv_type == AdvType::Weno_5Z) {
619  AdvectionSrcForMomWrapper<InterpType_H,WENO_Z5,UPWINDALL>(bxx, bxy, bxz,
620  rho_u_rhs, rho_v_rhs, rho_w_rhs,
621  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
622  cellSizeInv,
623  mf_mx, mf_ux_inv, mf_vx_inv,
624  mf_my, mf_uy_inv, mf_vy_inv,
625  upw_frac_h, upw_frac_v,
626  vert_adv_type, lo_z_face, hi_z_face);
627  } else if (vert_adv_type == AdvType::Weno_7) {
628  AdvectionSrcForMomWrapper<InterpType_H,WENO7,UPWINDALL>(bxx, bxy, bxz,
629  rho_u_rhs, rho_v_rhs, rho_w_rhs,
630  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
631  cellSizeInv,
632  mf_mx, mf_ux_inv, mf_vx_inv,
633  mf_my, mf_uy_inv, mf_vy_inv,
634  upw_frac_h, upw_frac_v,
635  vert_adv_type, lo_z_face, hi_z_face);
636  } else if (vert_adv_type == AdvType::Weno_7Z) {
637  AdvectionSrcForMomWrapper<InterpType_H,WENO_Z7,UPWINDALL>(bxx, bxy, bxz,
638  rho_u_rhs, rho_v_rhs, rho_w_rhs,
639  rho_u, rho_v, Omega, u, v, w, z_nd, ax, ay, az, detJ,
640  cellSizeInv,
641  mf_mx, mf_ux_inv, mf_vx_inv,
642  mf_my, mf_uy_inv, mf_vy_inv,
643  upw_frac_h, upw_frac_v,
644  vert_adv_type, lo_z_face, hi_z_face);
645  } else {
646  AMREX_ASSERT_WITH_MESSAGE(false, "Unknown advection scheme!");
647  }
648 }
@ 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()

template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
void AdvectionSrcForMomWrapper ( 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 > &  Omega,
const amrex::Array4< const amrex::Real > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
const amrex::Array4< const amrex::Real > &  z_nd,
const amrex::Array4< const amrex::Real > &  ax,
const amrex::Array4< const amrex::Real > &  ay,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
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]Omegacomponent of the momentum normal to the z-coordinate surface
[in]ux-component of velocity
[in]vy-component of velocity
[in]wz-component of velocity
[in]z_ndheight coordinate at nodes
[in]axarea fractions on x-faces
[in]ayarea fractions on y-faces
[in]azarea fractions on z-faces
[in]detJJacobian of the metric transformation
[in]cellSizeInvinverse grid 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
440 {
441  // Instantiate the appropriate structs
442  InterpType_H interp_u_h(u, upw_frac_h); InterpType_V interp_u_v(u, upw_frac_v); // X-MOM
443  InterpType_H interp_v_h(v, upw_frac_h); InterpType_V interp_v_v(v, upw_frac_v); // Y-MOM
444  InterpType_H interp_w_h(w, upw_frac_h); InterpType_V interp_w_v(w, upw_frac_v); // Z-MOM
445  WallInterpType interp_w_wall(w, upw_frac_v); // Z-MOM @ wall
446 
447  amrex::ParallelFor(bxx,
448  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
449  {
450  rho_u_rhs(i, j, k) = -AdvectionSrcForXMom(i, j, k, rho_u, rho_v, Omega, z_nd, ax, ay, az, detJ,
451  interp_u_h, interp_u_v,
452  cellSizeInv, mf_ux_inv, mf_uy_inv, mf_vx_inv);
453  });
454 
455  amrex::ParallelFor(bxy,
456  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
457  {
458  rho_v_rhs(i, j, k) = -AdvectionSrcForYMom(i, j, k, rho_u, rho_v, Omega, z_nd, ax, ay, az, detJ,
459  interp_v_h, interp_v_v,
460  cellSizeInv, mf_uy_inv, mf_vx_inv, mf_vy_inv);
461  });
462 
463  amrex::ParallelFor(bxz,
464  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
465  {
466  rho_w_rhs(i, j, k) = -AdvectionSrcForZMom(i, j, k, rho_u, rho_v, Omega, w, z_nd, ax, ay, az, detJ,
467  interp_w_h, interp_w_v, interp_w_wall,
468  cellSizeInv, mf_mx, mf_my, mf_uy_inv, mf_vx_inv,
469  vert_adv_type, lo_z_face, hi_z_face);
470  });
471 }
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForZMom(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 > &Omega, const amrex::Array4< const amrex::Real > &w, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, InterpType_H interp_omega_h, InterpType_V interp_omega_v, WallInterpType interp_omega_wall, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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)
Definition: ERF_AdvectionSrcForMom_T.H:249
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForYMom(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 > &Omega, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, InterpType_H interp_v_h, InterpType_V interp_v_v, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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)
Definition: ERF_AdvectionSrcForMom_T.H:138
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForXMom(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 > &Omega, const amrex::Array4< const amrex::Real > &z_nd, const amrex::Array4< const amrex::Real > &ax, const amrex::Array4< const amrex::Real > &, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, InterpType_H interp_u_h, InterpType_V interp_u_v, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, 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)
Definition: ERF_AdvectionSrcForMom_T.H:33
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()

template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForXMom ( 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 > &  Omega,
const amrex::Array4< const amrex::Real > &  z_nd,
const amrex::Array4< const amrex::Real > &  ax,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
InterpType_H  interp_u_h,
InterpType_V  interp_u_v,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
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 
)

Function for computing the advective tendency for the x-component of momentum with metric terms and for spatial order > 2

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]Omegacomponent of the momentum normal to the z-coordinate surface
[in]z_ndheight coordinate at nodes
[in]axArea fractions on x-faces
[in]azArea fractions on z-faces
[in]detJJacobian of the metric transformation (= 1 if use_terrain is false)
[in]interp_u_hhorizontal interpolator for x-component velocity
[in]interp_u_vvertical interpolator for x-component velocity
[in]cellSizeInvinverse of the grid spacing
[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
Returns
advective tendency for x-momentum
48 {
49  amrex::Real advectionSrc;
50  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
51 
52  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
53  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
54  amrex::Real Omega_avg_lo, Omega_avg_hi;
55 
56  amrex::Real interp_hi(zero), interp_lo(zero);
57 
58  // ****************************************************************************************
59  // X-fluxes (at cell centers)
60  // ****************************************************************************************
61  // average in the i direction, inverse mapfac 1/m_y = Δy/Δη
62  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));
63  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));
64 
65  interp_u_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
66  interp_u_h.InterpolateInX(i ,j,k,0,interp_lo,rho_u_avg_lo);
67 
68  // note: ax = (face height averaged over y) * dzInv = Δz/Δζ
69  amrex::Real centFluxXXNext = rho_u_avg_hi * interp_hi * myhalf * (ax(i,j,k) + ax(i+1,j,k));
70  amrex::Real centFluxXXPrev = rho_u_avg_lo * interp_lo * myhalf * (ax(i,j,k) + ax(i-1,j,k));
71 
72  // ****************************************************************************************
73  // Y-fluxes (at edges in k-direction)
74  // ****************************************************************************************
75  // average in the i direction, inverse mapfac 1/m_x = Δx/Δξ
76  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));
77  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));
78 
79  interp_u_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
80  interp_u_h.InterpolateInY(i,j ,k,0,interp_lo,rho_v_avg_lo);
81 
82  amrex::Real edgeFluxXYNext = rho_v_avg_hi * interp_hi * Compute_h_zeta_AtEdgeCenterK(i,j+1,k,cellSizeInv,z_nd);
83  amrex::Real edgeFluxXYPrev = rho_v_avg_lo * interp_lo * Compute_h_zeta_AtEdgeCenterK(i,j ,k,cellSizeInv,z_nd);
84 
85  // ****************************************************************************************
86  // Z-fluxes (at edges in j-direction)
87  // ****************************************************************************************
88  // average in the i direction
89  Omega_avg_hi = myhalf * (Omega(i, j, k+1) + Omega(i-1, j, k+1));
90  Omega_avg_lo = myhalf * (Omega(i, j, k ) + Omega(i-1, j, k ));
91 
92  interp_u_v.InterpolateInZ(i,j,k+1,0,interp_hi,Omega_avg_hi);
93  interp_u_v.InterpolateInZ(i,j,k ,0,interp_lo,Omega_avg_lo);
94 
95  amrex::Real edgeFluxXZNext = Omega_avg_hi * interp_hi * myhalf * (az(i, j, k+1) + az(i-1, j, k+1));
96  amrex::Real edgeFluxXZPrev = Omega_avg_lo * interp_lo * myhalf * (az(i, j, k ) + az(i-1, j, k ));
97 
98  // ****************************************************************************************
99 
100  amrex::Real mfsq = one / (mf_ux_inv(i,j,0) * mf_uy_inv(i,j,0)); // == m_x * m_y = (Δξ/Δx) * (Δη/Δy)
101 
102  advectionSrc = (centFluxXXNext - centFluxXXPrev) * dxInv * mfsq // ~ ρuu(Δy/Δη)(Δz/Δζ) * (1/Δξ) * (Δξ/Δx)*(Δη/Δy) = ρuu(Δz/Δζ) * (1/Δx)
103  + (edgeFluxXYNext - edgeFluxXYPrev) * dyInv * mfsq // ~ ρvu(Δx/Δξ)(Δz/Δζ) * (1/Δη) * (Δξ/Δx)*(Δη/Δy) = ρvu(Δz/Δζ) * (1/Δy)
104  + (edgeFluxXZNext - edgeFluxXZPrev) * dzInv; // ~ Ωu * (1/Δζ)
105  advectionSrc /= myhalf*(detJ(i,j,k) + detJ(i-1,j,k)); // ... then divide by (Δz/Δζ) to get back 1/Δx, 1/Δy, and 1/Δz for differencing
106 
107  return advectionSrc;
108 }
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:17
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtEdgeCenterK(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:230

Referenced by AdvectionSrcForMomWrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AdvectionSrcForYMom()

template<typename InterpType_H , typename InterpType_V >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForYMom ( 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 > &  Omega,
const amrex::Array4< const amrex::Real > &  z_nd,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ay,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
InterpType_H  interp_v_h,
InterpType_V  interp_v_v,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
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 
)

Function for computing the advective tendency for the y-component of momentum with metric terms and for spatial order > 2

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]Omegacomponent of the momentum normal to the z-coordinate surface
[in]z_ndheight coordinate at nodes
[in]ayArea fractions on y-faces
[in]azArea fractions on z-faces
[in]detJJacobian of the metric transformation (= 1 if use_terrain is false)
[in]interp_v_hhorizontal interpolator for y-component velocity
[in]interp_v_vvertical interpolator for y-component velocity
[in]cellSizeInvinverse of the grid spacing
[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
Returns
advective tendency for y-momentum
153 {
154  amrex::Real advectionSrc;
155  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
156 
157  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
158  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
159  amrex::Real Omega_avg_lo, Omega_avg_hi;
160 
161  amrex::Real interp_hi(zero), interp_lo(zero);
162 
163  // ****************************************************************************************
164  // X-fluxes (at edges in k-direction)
165  // ****************************************************************************************
166  // average in the j direction, inverse mapfac 1/m_y = Δy/Δη
167  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));
168  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));
169 
170  interp_v_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
171  interp_v_h.InterpolateInX(i ,j,k,0,interp_lo,rho_u_avg_lo);
172 
173  amrex::Real edgeFluxYXNext = rho_u_avg_hi * interp_hi * Compute_h_zeta_AtEdgeCenterK(i+1,j,k,cellSizeInv,z_nd);
174  amrex::Real edgeFluxYXPrev = rho_u_avg_lo * interp_lo * Compute_h_zeta_AtEdgeCenterK(i ,j,k,cellSizeInv,z_nd);
175 
176  // ****************************************************************************************
177  // Y-fluxes (at cell centers)
178  // ****************************************************************************************
179  // average in the j direction, inverse mapfac 1/m_x = Δx/Δξ
180  rho_v_avg_hi = myhalf * (rho_v(i, j+1, k) * mf_vx_inv(i, j+1, 0) + rho_v(i, j, k) * mf_vx_inv(i, j, 0));
181  rho_v_avg_lo = myhalf * (rho_v(i, j-1, k) * mf_vx_inv(i, j-1, 0) + rho_v(i, j, k) * mf_vx_inv(i, j, 0));
182 
183  interp_v_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
184  interp_v_h.InterpolateInY(i,j ,k,0,interp_lo,rho_v_avg_lo);
185 
186  // note: ay = (face height averaged over x) * dzInv = Δz/Δζ
187  amrex::Real centFluxYYNext = rho_v_avg_hi * interp_hi * myhalf * (ay(i,j,k) + ay(i,j+1,k));
188  amrex::Real centFluxYYPrev = rho_v_avg_lo * interp_lo * myhalf * (ay(i,j,k) + ay(i,j-1,k));
189 
190  // ****************************************************************************************
191  // Z-fluxes (at edges in i-direction)
192  // ****************************************************************************************
193  // average in the j direction
194  Omega_avg_hi = myhalf * (Omega(i, j, k+1) + Omega(i, j-1, k+1));
195  Omega_avg_lo = myhalf * (Omega(i, j, k ) + Omega(i, j-1, k ));
196 
197  interp_v_v.InterpolateInZ(i,j,k+1,0,interp_hi,Omega_avg_hi);
198  interp_v_v.InterpolateInZ(i,j,k ,0,interp_lo,Omega_avg_lo);
199 
200  amrex::Real edgeFluxYZNext = Omega_avg_hi * interp_hi * myhalf * (az(i, j, k+1) + az(i, j-1, k+1));
201  amrex::Real edgeFluxYZPrev = Omega_avg_lo * interp_lo * myhalf * (az(i, j, k ) + az(i, j-1, k ));
202 
203  // ****************************************************************************************
204 
205  amrex::Real mfsq = one / (mf_vx_inv(i,j,0) * mf_vy_inv(i,j,0)); // == m_x * m_y = (Δξ/Δx) * (Δη/Δy)
206 
207  advectionSrc = (edgeFluxYXNext - edgeFluxYXPrev) * dxInv * mfsq // ~ ρuv(Δy/Δη)(Δz/Δζ) * (1/Δξ) * (Δξ/Δx)*(Δη/Δy) = ρuu(Δz/Δζ) * (1/Δx)
208  + (centFluxYYNext - centFluxYYPrev) * dyInv * mfsq // ~ ρvv(Δx/Δξ)(Δz/Δζ) * (1/Δη) * (Δξ/Δx)*(Δη/Δy) = ρvu(Δz/Δζ) * (1/Δy)
209  + (edgeFluxYZNext - edgeFluxYZPrev) * dzInv; // ~ Ωv * (1/Δζ)
210  advectionSrc /= myhalf*(detJ(i,j,k) + detJ(i,j-1,k)); // ... then divide by (Δz/Δζ) to get back 1/Δx, 1/Δy, and 1/Δz for differencing
211 
212  return advectionSrc;
213 }

Referenced by AdvectionSrcForMomWrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AdvectionSrcForZMom()

template<typename InterpType_H , typename InterpType_V , typename WallInterpType >
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForZMom ( 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 > &  Omega,
const amrex::Array4< const amrex::Real > &  w,
const amrex::Array4< const amrex::Real > &  z_nd,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  ,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
InterpType_H  interp_omega_h,
InterpType_V  interp_omega_v,
WallInterpType  interp_omega_wall,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
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 
)

Function for computing the advective tendency for the z-component of momentum with metric terms and for spatial order > 2

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]Omegacomponent of the momentum normal to the z-coordinate surface
[in]wz-component of velocity
[in]z_ndheight coordinate at nodes
[in]azArea fractions on z-faces
[in]detJJacobian of the metric transformation (= 1 if use_terrain is false)
[in]interp_omega_hhorizontal interpolator for z-coordinate-normal momentum
[in]interp_omega_vvertical interpolator for z-coordinate-normal momentum
[in]interp_omega_wallwall-aware vertical interpolator for z-coordinate-normal momentum
[in]cellSizeInvinverse of the grid spacing
[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
Returns
advective tendency for z-momentum
269 {
270  amrex::Real advectionSrc;
271  auto dxInv = cellSizeInv[0], dyInv = cellSizeInv[1], dzInv = cellSizeInv[2];
272 
273  amrex::Real rho_u_avg_lo, rho_u_avg_hi;
274  amrex::Real rho_v_avg_lo, rho_v_avg_hi;
275  amrex::Real Omega_avg_lo, Omega_avg_hi;
276 
277  amrex::Real interp_hi(zero), interp_lo(zero);
278 
279  // ****************************************************************************************
280  // x-fluxes (at edges in j-direction)
281  // ****************************************************************************************
282  // average in the k direction, inverse mapfac 1/m_y = Δy/Δη
283  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);
284  rho_u_avg_lo = myhalf * (rho_u(i , j, k) + rho_u(i , j, k-1)) * mf_uy_inv(i ,j ,0);
285 
286  interp_omega_h.InterpolateInX(i+1,j,k,0,interp_hi,rho_u_avg_hi);
287  interp_omega_h.InterpolateInX(i ,j,k,0,interp_lo,rho_u_avg_lo);
288 
289  amrex::Real edgeFluxZXNext = rho_u_avg_hi * interp_hi * Compute_h_zeta_AtEdgeCenterJ(i+1,j,k,cellSizeInv,z_nd);
290  amrex::Real edgeFluxZXPrev = rho_u_avg_lo * interp_lo * Compute_h_zeta_AtEdgeCenterJ(i ,j,k,cellSizeInv,z_nd);
291 
292  // ****************************************************************************************
293  // y-fluxes (at edges in i-direction)
294  // ****************************************************************************************
295  // average in the k direction, inverse mapfac 1/m_x = Δx/Δξ
296  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);
297  rho_v_avg_lo = myhalf * (rho_v(i, j , k) + rho_v(i, j , k-1)) * mf_vx_inv(i ,j ,0);
298 
299  interp_omega_h.InterpolateInY(i,j+1,k,0,interp_hi,rho_v_avg_hi);
300  interp_omega_h.InterpolateInY(i,j ,k,0,interp_lo,rho_v_avg_lo);
301 
302  amrex::Real edgeFluxZYNext = rho_v_avg_hi * interp_hi * Compute_h_zeta_AtEdgeCenterI(i,j+1,k,cellSizeInv,z_nd);
303  amrex::Real edgeFluxZYPrev = rho_v_avg_lo * interp_lo * Compute_h_zeta_AtEdgeCenterI(i,j ,k,cellSizeInv,z_nd);
304 
305  // ****************************************************************************************
306  // z-fluxes (at cell centers)
307  // ****************************************************************************************
308 
309  Omega_avg_hi = (k == hi_z_face) ? Omega(i,j,k) * az(i,j,k) :
310  fourth * (Omega(i,j,k) + Omega(i,j,k+1)) * (az(i,j,k) + az(i,j,k+1));
311  amrex::Real centFluxZZNext = Omega_avg_hi;
312 
313  // int l_spatial_order_hi = std::min(std::min(vert_spatial_order, 2*(hi_z_face-k)), 2*(k+1));
314  // If k == hi_z_face-1, l_spatial_order_hi = 2
315  // If k == hi_z_face-2, l_spatial_order_hi = std::min(vert_spatial_order, 4);
316  // If k == lo_z_face+11 , l_spatial_order_hi = std::min(vert_spatial_order, 4);
317  if (k == hi_z_face) {
318  centFluxZZNext *= w(i,j,k);
319  } else {
320  if (k == hi_z_face-1)
321  {
322  interp_omega_wall.InterpolateInZ(i,j,k+1,0,interp_hi,Omega_avg_hi,AdvType::Centered_2nd);
323  } else if (k == hi_z_face-2 || k == lo_z_face+1) {
324  if (vert_adv_type != AdvType::Centered_2nd && vert_adv_type != AdvType::Upwind_3rd) {
325  interp_omega_wall.InterpolateInZ(i,j,k+1,0,interp_hi,Omega_avg_hi,AdvType::Centered_4th);
326  } else {
327  interp_omega_wall.InterpolateInZ(i,j,k+1,0,interp_hi,Omega_avg_hi,vert_adv_type);
328  }
329  } else {
330  interp_omega_v.InterpolateInZ(i,j,k+1,0,interp_hi,Omega_avg_hi);
331  }
332  centFluxZZNext *= interp_hi;
333  }
334 
335  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
336 
337  Omega_avg_lo = (k == 0) ? Omega(i,j,k) * az(i,j,k) :
338  fourth * (Omega(i,j,k) + Omega(i,j,k-1)) * (az(i,j,k) + az(i,j,k-1));
339  amrex::Real centFluxZZPrev = Omega_avg_lo;
340 
341  // int l_spatial_order_lo = std::min(std::min(vert_spatial_order, 2*(hi_z_face+1-k)), 2*k);
342  // If k == hi_z_face-1, l_spatial_order_hi = 2
343  // If k == hi_z_face-2, l_spatial_order_hi = std::min(vert_spatial_order, 4);
344  // If k == lo_z_face+1, l_spatial_order_hi = std::min(vert_spatial_order, 4);
345  if (k == 0) {
346  centFluxZZPrev *= w(i,j,k);
347  } else {
348  if (k == lo_z_face+1) {
349  interp_omega_wall.InterpolateInZ(i,j,k,0,interp_lo,Omega_avg_lo,AdvType::Centered_2nd);
350  } else if (k == lo_z_face+2 || k == hi_z_face-1) {
351  if (vert_adv_type != AdvType::Centered_2nd && vert_adv_type != AdvType::Upwind_3rd) {
352  interp_omega_wall.InterpolateInZ(i,j,k,0,interp_lo,Omega_avg_lo,AdvType::Centered_4th);
353  } else {
354  interp_omega_wall.InterpolateInZ(i,j,k,0,interp_lo,Omega_avg_lo,vert_adv_type);
355  }
356  } else {
357  interp_omega_v.InterpolateInZ(i,j,k,0,interp_lo,Omega_avg_lo);
358  }
359  centFluxZZPrev *= interp_lo;
360  }
361 
362  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
363 
364  amrex::Real mfsq = mf_mx(i,j,0) * mf_my(i,j,0);
365 
366  advectionSrc = (edgeFluxZXNext - edgeFluxZXPrev) * dxInv * mfsq
367  + (edgeFluxZYNext - edgeFluxZYPrev) * dyInv * mfsq
368  + (centFluxZZNext - centFluxZZPrev) * dzInv;
369 
370  amrex::Real denom = myhalf*(detJ(i,j,k) + detJ(i,j,k-1));
371  advectionSrc /= denom;
372 
373  return advectionSrc;
374 }
constexpr amrex::Real fourth
Definition: ERF_Constants.H:14
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtEdgeCenterJ(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:275
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real Compute_h_zeta_AtEdgeCenterI(const int &i, const int &j, const int &k, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &z_nd)
Definition: ERF_TerrainMetrics.H:319

Referenced by AdvectionSrcForMomWrapper().

Here is the call graph for this function:
Here is the caller graph for this function: