ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Advection.H File Reference
#include "AMReX.H"
#include "AMReX_MultiFab.H"
#include "AMReX_iMultiFab.H"
#include "AMReX_BCRec.H"
#include "AMReX_YAFluxRegister.H"
#include "ERF_DataStruct.H"
#include "ERF_IndexDefines.H"
#include "ERF_SurfaceLayer.H"
#include "ERF_EB.H"
Include dependency graph for ERF_Advection.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  OpenBCPatch
 

Enumerations

enum class  OpenSide : int { lo = -1 , none = 0 , hi = 1 }
 

Functions

void AdvectionSrcForRho (const amrex::Box &bx, const amrex::Array4< amrex::Real > &src, 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< amrex::Real > &avg_xmom, const amrex::Array4< amrex::Real > &avg_ymom, const amrex::Array4< amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &ax_arr, const amrex::Array4< const amrex::Real > &ay_arr, const amrex::Array4< const amrex::Real > &az_arr, 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_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const bool fixed_rho)
 
void AdvectionSrcForScalars (const amrex::Box &bx, const int icomp, const int ncomp, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< amrex::Real > &src, const amrex::Array4< const amrex::Real > &vf_arr, 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 AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_arr, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h)
 
void AdvectionSrcForMom (const amrex::MFIter &mfi, const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Vector< amrex::Box > &bxx_grown, const amrex::Vector< amrex::Box > &bxy_grown, const amrex::Vector< amrex::Box > &bxz_grown, 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, 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 > &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 > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, amrex::Gpu::DeviceVector< amrex::Real > &stretched_dz_d, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, MeshType &mesh_type, TerrainType &terrain_type, const eb_ &ebfact, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_u_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_v_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_w_arr, const amrex::Vector< amrex::iMultiFab > &physbnd_mask, const bool already_on_centroids, const int lo_z_face, const int hi_z_face, const amrex::Box &domain, const amrex::BCRec *bc_ptr_h)
 
void AdvectionSrcForMom_ConstantDz (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 > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, 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::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, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, TerrainType &terrain_type, const int lo_z_face, const int hi_z_face)
 
void AdvectionSrcForMom_StretchedDz (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 > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, 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::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, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const int lo_z_face, const int hi_z_face)
 
void AdvectionSrcForMom_TF (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 > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, 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 > &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, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const int lo_z_face, const int hi_z_face)
 
void AdvectionSrcForMom_EB (const amrex::MFIter &mfi, const amrex::Box &bxx, const amrex::Box &bxy, const amrex::Box &bxz, const amrex::Vector< amrex::Box > &bxx_grown, const amrex::Vector< amrex::Box > &bxy_grown, const amrex::Vector< amrex::Box > &bxz_grown, 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 > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, 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::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const amrex::Array4< const amrex::Real > &mf_mx, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vx, const amrex::Array4< const amrex::Real > &mf_my, const amrex::Array4< const amrex::Real > &mf_uy, const amrex::Array4< const amrex::Real > &mf_vy, const AdvType horiz_adv_type, const AdvType vert_adv_type, const amrex::Real horiz_upw_frac, const amrex::Real vert_upw_frac, const eb_ &ebfact, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_u_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_v_arr, amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &flx_w_arr, const amrex::Vector< amrex::iMultiFab > &physbnd_mask, const bool already_on_centroids, const int lo_z_face, const int hi_z_face, const amrex::Box &domain)
 
amrex::Box ShrinkZmomBoxAtDomainEnds (amrex::Box b, const amrex::Box &domain)
 
amrex::Box TrimOpenBCCorner (amrex::Box b, const int dim, const amrex::Box &domain, const bool lo_open, const bool hi_open)
 
amrex::Box OpenBCCornerBox (amrex::Box b, const amrex::Box &domain, const OpenSide x_side, const OpenSide y_side)
 
amrex::Vector< OpenBCPatchOpenBCTangentPatches (const amrex::Box &b, const amrex::Box &domain, const bool xlo_open, const bool xhi_open, const bool ylo_open, const bool yhi_open)
 
void AdvectionSrcForOpenBC_Normal (const amrex::Box &bx, const int &dir, const amrex::Array4< amrex::Real > &rhs_arr, const amrex::Array4< const amrex::Real > &vel_norm_arr, const amrex::Array4< const amrex::Real > &cell_data_arr, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv, const bool do_lo=false)
 
void AdvectionSrcForOpenBC_Tangent_Xmom (const amrex::Box &bxx, const int &dir, const amrex::Array4< amrex::Real > &rho_u_rhs, const amrex::Array4< const amrex::Real > &u, 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 > &ax, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const bool do_lo=false)
 
void AdvectionSrcForOpenBC_Tangent_Ymom (const amrex::Box &bxy, const int &dir, const amrex::Array4< amrex::Real > &rho_v_rhs, const amrex::Array4< const amrex::Real > &v, 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 > &ay, const amrex::Array4< const amrex::Real > &az, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv, const bool do_lo=false)
 
void AdvectionSrcForOpenBC_Tangent_Zmom (const amrex::Box &bxz, const OpenSide x_side, const OpenSide y_side, const amrex::Array4< amrex::Real > &rho_w_rhs, const amrex::Array4< const amrex::Real > &w, 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 > &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 int domhi_z)
 
void AdvectionSrcForOpenBC_Tangent_Scalars (const amrex::Box &bx, const OpenSide x_side, const OpenSide y_side, const int scalar_icomp, const int rhs_icomp, const int ncomp, const amrex::Array4< amrex::Real > &rhs, const amrex::Array4< const amrex::Real > &scalar, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv)
 
void AdvectionSrcForOpenBC_Tangent_Cons (const amrex::Box &bx, const OpenSide x_side, const OpenSide y_side, const int &icomp, const int &ncomp, const amrex::Array4< amrex::Real > &cell_rhs, const amrex::Array4< const amrex::Real > &cell_prim, const amrex::Array4< const amrex::Real > &avg_xmom, const amrex::Array4< const amrex::Real > &avg_ymom, const amrex::Array4< const amrex::Real > &avg_zmom, const amrex::Array4< const amrex::Real > &detJ, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &cellSizeInv)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForOpenBC_Tangent (const int &i, const int &j, const int &k, const int &nprim, const int &dir, const amrex::Array4< const amrex::Real > &prim_tang_arr, const amrex::Array4< const amrex::Real > &mom_norm_arr, const amrex::Real &dxInv, const bool do_lo=false)
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE AdvType EfficientAdvType (int nrk, AdvType adv_type)
 

Enumeration Type Documentation

◆ OpenSide

enum OpenSide : int
strong

Which side of the domain is open in one coordinate direction, as seen by the cells an open-boundary kernel is about to update.

Enumerator
lo 
none 
hi 
214 : int { lo = -1, none = 0, hi = 1 };

Function Documentation

◆ AdvectionSrcForMom()

void AdvectionSrcForMom ( const amrex::MFIter &  mfi,
const amrex::Box &  bxx,
const amrex::Box &  bxy,
const amrex::Box &  bxz,
const amrex::Vector< amrex::Box > &  bxx_grown,
const amrex::Vector< amrex::Box > &  bxy_grown,
const amrex::Vector< amrex::Box > &  bxz_grown,
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,
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 > &  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 > &  ay,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
amrex::Gpu::DeviceVector< amrex::Real > &  stretched_dz_d,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
const amrex::Array4< const amrex::Real > &  mf_mx,
const amrex::Array4< const amrex::Real > &  mf_ux,
const amrex::Array4< const amrex::Real > &  mf_vx,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy,
const amrex::Array4< const amrex::Real > &  mf_vy,
const AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
MeshType &  mesh_type,
TerrainType &  terrain_type,
const eb_ ebfact,
amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_u_arr,
amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_v_arr,
amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_w_arr,
const amrex::Vector< amrex::iMultiFab > &  physbnd_mask,
const bool  already_on_centroids,
const int  lo_z_face,
const int  hi_z_face,
const amrex::Box &  domain,
const amrex::BCRec *  bc_ptr_h 
)

Compute advection tendencies for all components of momentum

Referenced by erf_slow_rhs_pre().

Here is the caller graph for this function:

◆ AdvectionSrcForMom_ConstantDz()

void AdvectionSrcForMom_ConstantDz ( 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 > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
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::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,
const amrex::Array4< const amrex::Real > &  mf_vx,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy,
const amrex::Array4< const amrex::Real > &  mf_vy,
const AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
TerrainType &  terrain_type,
const int  lo_z_face,
const int  hi_z_face 
)

Compute advection tendencies for all components of momentum when dz is constant

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForMom_EB()

void AdvectionSrcForMom_EB ( const amrex::MFIter &  mfi,
const amrex::Box &  bxx,
const amrex::Box &  bxy,
const amrex::Box &  bxz,
const amrex::Vector< amrex::Box > &  bxx_grown,
const amrex::Vector< amrex::Box > &  bxy_grown,
const amrex::Vector< amrex::Box > &  bxz_grown,
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 > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
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::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
const amrex::Array4< const amrex::Real > &  mf_mx,
const amrex::Array4< const amrex::Real > &  mf_ux,
const amrex::Array4< const amrex::Real > &  mf_vx,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy,
const amrex::Array4< const amrex::Real > &  mf_vy,
const AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
const eb_ ebfact,
amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_u_arr,
amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_v_arr,
amrex::GpuArray< amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_w_arr,
const amrex::Vector< amrex::iMultiFab > &  physbnd_mask,
const bool  already_on_centroids,
const int  lo_z_face,
const int  hi_z_face,
const amrex::Box &  domain 
)

Compute advection tendencies for all components of momentum when using EB for terrain

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForMom_StretchedDz()

void AdvectionSrcForMom_StretchedDz ( 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 > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
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::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,
const amrex::Array4< const amrex::Real > &  mf_vx,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy,
const amrex::Array4< const amrex::Real > &  mf_vy,
const AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
const int  lo_z_face,
const int  hi_z_face 
)

Compute advection tendencies for all components of momentum when dz is stretched

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForMom_TF()

void AdvectionSrcForMom_TF ( 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 > &  u,
const amrex::Array4< const amrex::Real > &  v,
const amrex::Array4< const amrex::Real > &  w,
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 > &  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,
const amrex::Array4< const amrex::Real > &  mf_vx,
const amrex::Array4< const amrex::Real > &  mf_my,
const amrex::Array4< const amrex::Real > &  mf_uy,
const amrex::Array4< const amrex::Real > &  mf_vy,
const AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
const int  lo_z_face,
const int  hi_z_face 
)

Compute advection tendencies for all components of momentum for TERRAIN-FITTED COORDS only

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Normal()

void AdvectionSrcForOpenBC_Normal ( const amrex::Box &  bx,
const int &  dir,
const amrex::Array4< amrex::Real > &  rhs_arr,
const amrex::Array4< const amrex::Real > &  vel_norm_arr,
const amrex::Array4< const amrex::Real > &  cell_data_arr,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  dxInv,
const bool  do_lo = false 
)

Compute advection tendencies for all normal components of momentum

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Tangent()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real AdvectionSrcForOpenBC_Tangent ( const int &  i,
const int &  j,
const int &  k,
const int &  nprim,
const int &  dir,
const amrex::Array4< const amrex::Real > &  prim_tang_arr,
const amrex::Array4< const amrex::Real > &  mom_norm_arr,
const amrex::Real dxInv,
const bool  do_lo = false 
)

Compute advection tendencies in the normal direction for variables tangent to open BC

◆ AdvectionSrcForOpenBC_Tangent_Cons()

void AdvectionSrcForOpenBC_Tangent_Cons ( const amrex::Box &  bx,
const OpenSide  x_side,
const OpenSide  y_side,
const int &  icomp,
const int &  ncomp,
const amrex::Array4< amrex::Real > &  cell_rhs,
const amrex::Array4< const amrex::Real > &  cell_prim,
const amrex::Array4< const amrex::Real > &  avg_xmom,
const amrex::Array4< const amrex::Real > &  avg_ymom,
const amrex::Array4< const amrex::Real > &  avg_zmom,
const amrex::Array4< const amrex::Real > &  detJ,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv 
)

Compute advection tendencies for conserved variables tangential to open BC x_side and y_side say which lateral boundaries the cells being updated lie on; both are set at a corner, where neither direction may be differenced across. This native adapter maps conserved component icomp + n to primitive component icomp + n - 1 before calling the component-explicit scalar operation.

Referenced by AdvectionSrcForScalars(), and EBAdvectionSrcForScalars().

Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Scalars()

void AdvectionSrcForOpenBC_Tangent_Scalars ( const amrex::Box &  bx,
const OpenSide  x_side,
const OpenSide  y_side,
const int  scalar_icomp,
const int  rhs_icomp,
const int  ncomp,
const amrex::Array4< amrex::Real > &  rhs,
const amrex::Array4< const amrex::Real > &  scalar,
const amrex::Array4< const amrex::Real > &  avg_xmom,
const amrex::Array4< const amrex::Real > &  avg_ymom,
const amrex::Array4< const amrex::Real > &  avg_zmom,
const amrex::Array4< const amrex::Real > &  detJ,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv 
)

Compute advection tendencies for scalar fields tangential to open BC.

Parameters
[in]bxbox over which scalar tendencies are updated
[in]x_sidelateral x boundary, if any
[in]y_sidelateral y boundary, if any
[in]scalar_icompfirst component of the supplied scalar view to read
[in]rhs_icompfirst component of the supplied tendency view to write
[in]ncompnumber of components to update
[out]rhstendency view
[in]scalarsupplied scalar view
[in]avg_xmomx-component of time-averaged mass flux
[in]avg_ymomy-component of time-averaged mass flux
[in]avg_zmomz-component of time-averaged mass flux
[in]detJmetric Jacobian
[in]cellSizeInvinverse grid spacing

At a corner both sides are set, so neither direction is differenced across its open boundary.

◆ AdvectionSrcForOpenBC_Tangent_Xmom()

void AdvectionSrcForOpenBC_Tangent_Xmom ( const amrex::Box &  bxx,
const int &  dir,
const amrex::Array4< amrex::Real > &  rho_u_rhs,
const amrex::Array4< const amrex::Real > &  u,
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 > &  ax,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
const bool  do_lo = false 
)

Compute advection tendencies for u momentum tangent to open BC

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Ymom()

void AdvectionSrcForOpenBC_Tangent_Ymom ( const amrex::Box &  bxy,
const int &  dir,
const amrex::Array4< amrex::Real > &  rho_v_rhs,
const amrex::Array4< const amrex::Real > &  v,
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 > &  ay,
const amrex::Array4< const amrex::Real > &  az,
const amrex::Array4< const amrex::Real > &  detJ,
const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &  cellSizeInv,
const bool  do_lo = false 
)

Compute advection tendencies for v momentum tangent to open BC

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForOpenBC_Tangent_Zmom()

void AdvectionSrcForOpenBC_Tangent_Zmom ( const amrex::Box &  bxz,
const OpenSide  x_side,
const OpenSide  y_side,
const amrex::Array4< amrex::Real > &  rho_w_rhs,
const amrex::Array4< const amrex::Real > &  w,
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 > &  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 int  domhi_z 
)

Compute advection tendencies for w momentum tangent to open BC x_side and y_side say which lateral boundaries the cells being updated lie on; both are set at a corner, where neither direction may be differenced across.

Referenced by AdvectionSrcForMom().

Here is the caller graph for this function:

◆ AdvectionSrcForRho()

void AdvectionSrcForRho ( const amrex::Box &  bx,
const amrex::Array4< amrex::Real > &  src,
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< amrex::Real > &  avg_xmom,
const amrex::Array4< amrex::Real > &  avg_ymom,
const amrex::Array4< amrex::Real > &  avg_zmom,
const amrex::Array4< const amrex::Real > &  ax_arr,
const amrex::Array4< const amrex::Real > &  ay_arr,
const amrex::Array4< const amrex::Real > &  az_arr,
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_my,
const amrex::Array4< const amrex::Real > &  mf_uy,
const amrex::Array4< const amrex::Real > &  mf_vx,
const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_arr,
const bool  fixed_rho 
)

Compute advection tendency for density and averaged momentum fluxes

Referenced by erf_slow_rhs_pre().

Here is the caller graph for this function:

◆ AdvectionSrcForScalars()

void AdvectionSrcForScalars ( const amrex::Box &  bx,
const int  icomp,
const int  ncomp,
const amrex::Array4< const amrex::Real > &  avg_xmom,
const amrex::Array4< const amrex::Real > &  avg_ymom,
const amrex::Array4< const amrex::Real > &  avg_zmom,
const amrex::Array4< const amrex::Real > &  cell_prim,
const amrex::Array4< amrex::Real > &  src,
const amrex::Array4< const amrex::Real > &  vf_arr,
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 AdvType  horiz_adv_type,
const AdvType  vert_adv_type,
const amrex::Real  horiz_upw_frac,
const amrex::Real  vert_upw_frac,
const amrex::GpuArray< const amrex::Array4< amrex::Real >, AMREX_SPACEDIM > &  flx_arr,
const amrex::Box &  domain,
const amrex::BCRec *  bc_ptr_h 
)

Compute advection tendencies for cell-centered scalar components

Referenced by erf_slow_rhs_post(), and erf_slow_rhs_pre().

Here is the caller graph for this function:

◆ EfficientAdvType()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE AdvType EfficientAdvType ( int  nrk,
AdvType  adv_type 
)

Return the effective advection type used for the requested Runge-Kutta stage.

468 {
469  AdvType eff_adv_type;
470 
471  if (nrk == 0) {
472 
473  eff_adv_type = AdvType::Centered_2nd;
474 
475  } else if (nrk == 1) {
476 
477  if ( (adv_type == AdvType::Centered_2nd) ||
478  (adv_type == AdvType::Upwind_3rd) ||
479  (adv_type == AdvType::Centered_4th) ||
480  (adv_type == AdvType::Weno_3) ||
481  (adv_type == AdvType::Weno_3Z) ||
482  (adv_type == AdvType::Weno_3MZQ) )
483  {
484  eff_adv_type = AdvType::Centered_2nd;
485 
486  } else if ( (adv_type == AdvType::Upwind_5th) ||
487  (adv_type == AdvType::Weno_5) ||
488  (adv_type == AdvType::Weno_5Z) )
489  {
490  eff_adv_type = AdvType::Upwind_3rd;
491 
492  } else { // (adv_type == AdvType::Centered_6th)
493 
494  eff_adv_type = AdvType::Centered_4th;
495  }
496 
497  } else {
498 
499  eff_adv_type = adv_type;
500  }
501 
502  return(eff_adv_type);
503 }
AdvType
Definition: ERF_IndexDefines.H:309
@ Centered_4th
@ Centered_2nd

Referenced by erf_slow_rhs_post().

Here is the caller graph for this function:

◆ OpenBCCornerBox()

amrex::Box OpenBCCornerBox ( amrex::Box  b,
const amrex::Box &  domain,
const OpenSide  x_side,
const OpenSide  y_side 
)
inline

Build the one-cell-wide box where the x_side and y_side open boundaries meet, or an empty box if b does not reach both of them.

263 {
264  AMREX_ALWAYS_ASSERT(x_side != OpenSide::none && y_side != OpenSide::none);
265 
266  if (!b.ok()) { return amrex::Box(); }
267 
268  const OpenSide side[2] = {x_side, y_side};
269  for (int dim(0); dim < 2; ++dim) {
270  const int idx = (side[dim] == OpenSide::lo) ?
271  domain.smallEnd(dim) :
272  domain.bigEnd(dim) + (b.ixType().nodeCentered(dim) ? 1 : 0);
273  if (idx < b.smallEnd(dim) || idx > b.bigEnd(dim)) { return amrex::Box(); }
274  b = amrex::makeSlab(b, dim, idx);
275  }
276 
277  return b;
278 }
OpenSide
Definition: ERF_Advection.H:214
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int idx(int i, int j, int k, int nx, int ny)
Definition: ERF_InitForEnsemble.cpp:396

Referenced by OpenBCTangentPatches().

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

◆ OpenBCTangentPatches()

amrex::Vector<OpenBCPatch> OpenBCTangentPatches ( const amrex::Box &  b,
const amrex::Box &  domain,
const bool  xlo_open,
const bool  xhi_open,
const bool  ylo_open,
const bool  yhi_open 
)
inline

Enumerate the boxes on which the open-boundary tangential operator must be applied for a quantity that has no boundary-normal owner at a lateral corner – that is, w and the cell-centered state, both of which are tangent to every lateral boundary.

The returned boxes are disjoint and together cover every cell of b that lies on an open lateral boundary: the four edges, trimmed so they do not reach into a corner, plus the corners themselves, which carry both sides so the kernel differences across neither open boundary there.

297 {
298  amrex::Vector<OpenBCPatch> patches;
299  if (!b.ok()) { return patches; }
300  patches.reserve(8);
301 
302  const int dom_xhi = domain.bigEnd(0) + (b.ixType().nodeCentered(0) ? 1 : 0);
303  const int dom_yhi = domain.bigEnd(1) + (b.ixType().nodeCentered(1) ? 1 : 0);
304 
305  // Edges: each is trimmed by the open boundaries perpendicular to it, which own
306  // the corner cells by way of the corner patches added below.
307  if (xlo_open && b.smallEnd(0) == domain.smallEnd(0)) {
308  amrex::Box e = TrimOpenBCCorner(amrex::makeSlab(b,0,domain.smallEnd(0)), 1, domain, ylo_open, yhi_open);
309  if (e.ok()) { patches.push_back({e, OpenSide::lo, OpenSide::none}); }
310  }
311  if (xhi_open && b.bigEnd(0) == dom_xhi) {
312  amrex::Box e = TrimOpenBCCorner(amrex::makeSlab(b,0,dom_xhi), 1, domain, ylo_open, yhi_open);
313  if (e.ok()) { patches.push_back({e, OpenSide::hi, OpenSide::none}); }
314  }
315  if (ylo_open && b.smallEnd(1) == domain.smallEnd(1)) {
316  amrex::Box e = TrimOpenBCCorner(amrex::makeSlab(b,1,domain.smallEnd(1)), 0, domain, xlo_open, xhi_open);
317  if (e.ok()) { patches.push_back({e, OpenSide::none, OpenSide::lo}); }
318  }
319  if (yhi_open && b.bigEnd(1) == dom_yhi) {
320  amrex::Box e = TrimOpenBCCorner(amrex::makeSlab(b,1,dom_yhi), 0, domain, xlo_open, xhi_open);
321  if (e.ok()) { patches.push_back({e, OpenSide::none, OpenSide::hi}); }
322  }
323 
324  // Corners
325  for (OpenSide x_side : {OpenSide::lo, OpenSide::hi}) {
326  if (!((x_side == OpenSide::lo) ? xlo_open : xhi_open)) { continue; }
327  for (OpenSide y_side : {OpenSide::lo, OpenSide::hi}) {
328  if (!((y_side == OpenSide::lo) ? ylo_open : yhi_open)) { continue; }
329  amrex::Box c = OpenBCCornerBox(b, domain, x_side, y_side);
330  if (c.ok()) { patches.push_back({c, x_side, y_side}); }
331  }
332  }
333 
334  return patches;
335 }
amrex::Box TrimOpenBCCorner(amrex::Box b, const int dim, const amrex::Box &domain, const bool lo_open, const bool hi_open)
Definition: ERF_Advection.H:237
amrex::Box OpenBCCornerBox(amrex::Box b, const amrex::Box &domain, const OpenSide x_side, const OpenSide y_side)
Definition: ERF_Advection.H:259

Referenced by AdvectionSrcForMom(), AdvectionSrcForScalars(), and EBAdvectionSrcForScalars().

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

◆ ShrinkZmomBoxAtDomainEnds()

amrex::Box ShrinkZmomBoxAtDomainEnds ( amrex::Box  b,
const amrex::Box &  domain 
)
inline

Shrink a z-momentum box away from the bottom and top of the domain, where no z-momentum source term is computed.

The shrink must be applied only at an end that actually coincides with the domain, which is why this takes domain rather than shrinking unconditionally: on a grid decomposed in z, an unconditional shrink also removes the w-face at every internal split, and any operator run on the result silently skips those faces.

b is z-nodal; domain is cell-centered.

204 {
205  if (b.smallEnd(2) == domain.smallEnd(2)) { b.growLo(2,-1); }
206  if (b.bigEnd(2) == domain.bigEnd(2) + 1) { b.growHi(2,-1); }
207  return b;
208 }

Referenced by erf_slow_rhs_pre().

Here is the caller graph for this function:

◆ TrimOpenBCCorner()

amrex::Box TrimOpenBCCorner ( amrex::Box  b,
const int  dim,
const amrex::Box &  domain,
const bool  lo_open,
const bool  hi_open 
)
inline

Remove from an open-boundary box the cells that also sit on a perpendicular open boundary, so that no cell is updated by two different open-boundary kernels.

b is trimmed in dimension dim only at an end that actually coincides with the corresponding end of domain. The domain-level open flags by themselves are not a sufficient test: b is a per-box (or per-tile) slab whose ends generally lie in the interior, and trimming those would silently drop interior cells from the open-boundary treatment and make the answer depend on the grid decomposition.

domain is cell-centered; the index of the boundary is taken in the index space of b, which may be node-centered in dim.

242 {
243  if (!b.ok()) { return b; }
244 
245  const int dom_lo = domain.smallEnd(dim);
246  const int dom_hi = domain.bigEnd(dim) + (b.ixType().nodeCentered(dim) ? 1 : 0);
247 
248  if (lo_open && b.smallEnd(dim) == dom_lo) { b.growLo(dim,-1); }
249  if (hi_open && b.bigEnd(dim) == dom_hi) { b.growHi(dim,-1); }
250 
251  return b;
252 }

Referenced by AdvectionSrcForMom(), and OpenBCTangentPatches().

Here is the caller graph for this function: