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 = geomdata.ProbHi()[2];
5 
6  // Set the x-velocity
7  // NOTE: z_nd(i,j,0) is the terrain surface height. This works when the
8  // refined patch abuts the terrain (klo=0) but will fail if L1 is elevated
9  // above the surface (k=0 would be out of bounds for the local z_nd data).
10  ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
11  {
12  Real zbot = z_nd(i,j,0);
13  x_vel_pert(i, j, k) = U_0 * ztop / (ztop - zbot);
14  });
15 
16  const auto dx = geomdata.CellSize();
17  amrex::GpuArray<Real, AMREX_SPACEDIM> dxInv;
18  dxInv[0] = one / dx[0];
19  dxInv[1] = one / dx[1];
20  dxInv[2] = one / dx[2];
21 
22  // Set the z-velocity from impenetrable condition
23  ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
24  {
25  z_vel_pert(i, j, k) = WFromOmega(i, j, k, zero,
26  x_vel_pert, y_vel_pert,
27  mf_u, mf_v, z_nd, dxInv);
28  });
constexpr amrex::Real one
Definition: ERF_Constants.H:7
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
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:16
ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Real zbot=z_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:17
const Box zbx
Definition: ERF_SetupDiff.H:9
const Box xbx
Definition: ERF_SetupDiff.H:7
amrex::Real Real
Definition: ERF_ShocInterface.H:19
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_u, const amrex::Array4< const amrex::Real > &mf_v, const amrex::Array4< const amrex::Real > &z_nd, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dxInv)
Definition: ERF_TerrainMetrics.H:464