ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPertVels_MovingTerrain.H
Go to the documentation of this file.
1  ParmParse pp_prob("prob");
2  Real Ampl = zero; pp_prob.query("Ampl", Ampl);
3  Real wavelength = Real(100.); pp_prob.queryAdd("wavelength", wavelength); // as the custom terrain
4  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(wavelength > zero, "prob.wavelength must be > 0");
5 
6  Real H = phys_zhi(geomdata, lev); // physical top of the domain
9  Real omega = std::sqrt(g * kp);
10 
11  // Set the x-velocity
12  ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
13  {
14  const auto prob_lo = geomdata.ProbLo();
15  const auto dx = geomdata.CellSize();
16 
17  const Real x = prob_lo[0] + i * dx[0];
18  Real z = fourth * (z_nd(i,j,k) + z_nd(i,j+1,k) + z_nd(i,j,k+1) + z_nd(i,j+1,k+1));
19 
20  Real z_base = Ampl * std::sin(kp * x);
21  z -= z_base;
22 
23  Real fac = std::cosh( kp * (z - H) ) / std::sinh(kp * H);
24 
25  x_vel_pert(i, j, k) = -Ampl * omega * fac * std::sin(kp * x);
26  });
27 
28  // Set the z-velocity from impenetrable condition
29  ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
30  {
31  const auto prob_lo = geomdata.ProbLo();
32  const auto dx = geomdata.CellSize();
33 
34  Real x = prob_lo[0] + (i + myhalf) * dx[0];
35  Real z = fourth * ( z_nd(i,j,k) + z_nd(i+1,j,k) + z_nd(i,j+1,k) + z_nd(i+1,j+1,k) );
36  Real z_base = Ampl * std::sin(kp * x);
37 
38  z -= z_base;
39  Real fac = std::sinh( kp * (z - H) ) / std::sinh(kp * H);
40 
41  z_vel_pert(i, j, k) = Ampl * omega * fac * std::cos(kp * x);
42  });
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:72
Real Ampl
Definition: ERF_InitCustomPertVels_MovingTerrain.H:2
Real g
Definition: ERF_InitCustomPertVels_MovingTerrain.H:8
ParmParse pp_prob("prob")
ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const auto prob_lo=geomdata.ProbLo();const auto dx=geomdata.CellSize();const Real x=prob_lo[0]+i *dx[0];Real z=fourth *(z_nd(i, j, k)+z_nd(i, j+1, k)+z_nd(i, j, k+1)+z_nd(i, j+1, k+1));Real z_base=Ampl *std::sin(kp *x);z -=z_base;Real fac=std::cosh(kp *(z - H))/std::sinh(kp *H);x_vel_pert(i, j, k)=-Ampl *omega *fac *std::sin(kp *x);})
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(wavelength > zero, "prob.wavelength must be > 0")
Real H
Definition: ERF_InitCustomPertVels_MovingTerrain.H:6
Real wavelength
Definition: ERF_InitCustomPertVels_MovingTerrain.H:3
Real omega
Definition: ERF_InitCustomPertVels_MovingTerrain.H:9
Real kp
Definition: ERF_InitCustomPertVels_MovingTerrain.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 two
Definition: ERF_NumericalConstants.H:38
constexpr amrex::Real fourth
Definition: ERF_NumericalConstants.H:42
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:46
amrex::Real Real
Definition: ERF_ShocInterface.H:19