ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPertVels_TaylorGreenVortex.H
Go to the documentation of this file.
1 
2  // On a mesh other than ConstantDz, heights come from z_nd and the vertical levels,
3  // not from geomdata's prob_lo[2], prob_hi[2] and CellSize(2)
4  const bool use_z_phys = use_physical_z();
5 
6  ParmParse pp_for_pert_vels("prob");
7  Real V_0 = one; pp_for_pert_vels.query("V_0", V_0);
8 
9  // Set the x-velocity
10  ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
11  {
12  const Real* prob_lo = geomdata.ProbLo();
13  const Real* dx = geomdata.CellSize();
14  const Real x = prob_lo[0] + (i + zero) * dx[0];
15  const Real y = prob_lo[1] + (j + myhalf) * dx[1];
16  const Real z = use_z_phys ? erf_prob_heights::z_xface(i,j,k,z_nd) : prob_lo[2] + (k + myhalf) * dx[2];
17 
18  // Set the x-velocity
19  x_vel_pert(i, j, k) = V_0 * std::sin(x) * std::cos(y) * std::cos(z);
20  });
21 
22  // Set the y-velocity
23  ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
24  {
25  const Real* prob_lo = geomdata.ProbLo();
26  const Real* dx = geomdata.CellSize();
27  const Real x = prob_lo[0] + (i + myhalf) * dx[0];
28  const Real y = prob_lo[1] + (j + zero) * dx[1];
29  const Real z = use_z_phys ? erf_prob_heights::z_yface(i,j,k,z_nd) : prob_lo[2] + (k + myhalf) * dx[2];
30 
31  // Set the y-velocity
32  y_vel_pert(i, j, k) = - V_0 * std::cos(x) * std::sin(y) * std::cos(z);
33  });
const bool use_z_phys
Definition: ERF_InitCustomPertVels_TaylorGreenVortex.H:4
ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const Real *prob_lo=geomdata.ProbLo();const Real *dx=geomdata.CellSize();const Real x=prob_lo[0]+(i+zero) *dx[0];const Real y=prob_lo[1]+(j+myhalf) *dx[1];const Real z=use_z_phys ? erf_prob_heights::z_xface(i, j, k, z_nd) :prob_lo[2]+(k+myhalf) *dx[2];x_vel_pert(i, j, k)=V_0 *std::sin(x) *std::cos(y) *std::cos(z);})
ParmParse pp_for_pert_vels("prob")
Real V_0
Definition: ERF_InitCustomPertVels_TaylorGreenVortex.H:7
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
const GpuArray< Real, AMREX_SPACEDIM > prob_lo
Definition: ERF_InitCustomPert_CloudChamber.H:33
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_yface(int i, int j, int k, amrex::Array4< amrex::Real const > const &z_nd) noexcept
Height of the centre of y-face (i,j,k)
Definition: ERF_ProbHeights.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real z_xface(int i, int j, int k, amrex::Array4< amrex::Real const > const &z_nd) noexcept
Height of the centre of x-face (i,j,k)
Definition: ERF_ProbHeights.H:21