ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPertVels_ParticleTests.H
Go to the documentation of this file.
1  ParmParse pp_for_pert_vels("prob");
2  Real U_0 = zero; pp_for_pert_vels.query("U_0",U_0);
3 
4  const Real ztop = phys_zhi(geomdata, lev); // physical top of the domain
5 
6  // Set the x-velocity
7  // NOTE: z_sfc_nd(i,j,0) is the terrain surface height, which every box has,
8  // including one that starts above the surface
9  ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
10  {
11  Real zbot = z_sfc_nd(i,j,0);
12  x_vel_pert(i, j, k) = U_0 * ztop / (ztop - zbot);
13  });
14 
15  const auto dx = geomdata.CellSize();
16  amrex::GpuArray<Real, AMREX_SPACEDIM> dxInv;
17  dxInv[0] = one / dx[0];
18  dxInv[1] = one / dx[1];
19  dxInv[2] = one / dx[2];
20 
21  // Set the z-velocity from impenetrable condition
22  ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
23  {
24  z_vel_pert(i, j, k) = WFromOmega(i, j, k, zero,
25  x_vel_pert, y_vel_pert,
26  mf_u, mf_v, z_nd, dxInv);
27  });
const Real ztop
Definition: ERF_InitCustomPertVels_ParticleTests.H:4
ParmParse pp_for_pert_vels("prob")
Real U_0
Definition: ERF_InitCustomPertVels_ParticleTests.H:2
const auto dx
Definition: ERF_InitCustomPertVels_ParticleTests.H:15
ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Real zbot=z_sfc_nd(i, j, 0);x_vel_pert(i, j, k)=U_0 *ztop/(ztop - zbot);})
amrex::GpuArray< Real, AMREX_SPACEDIM > dxInv
Definition: ERF_InitCustomPertVels_ParticleTests.H:16
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
AMREX_GPU_DEVICE AMREX_FORCE_INLINE amrex::Real WFromOmega(int &i, int &j, int &k, amrex::Real omega, const amrex::Array4< const amrex::Real > &u_arr, const amrex::Array4< const amrex::Real > &v_arr, const amrex::Array4< const amrex::Real > &mf_ux, const amrex::Array4< const amrex::Real > &mf_vy, const amrex::Array4< const amrex::Real > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:867