ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPert_MovingTerrain.H
Go to the documentation of this file.
1 
2  // Parse params
3  ParmParse pp("prob");
4  Real Ampl = zero ; pp.query("Ampl", Ampl);
5  Real wavelength = Real(100.); pp.queryAdd("wavelength", wavelength); // as the custom terrain
6  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(wavelength > zero, "prob.wavelength must be > 0");
7 
8  Real H = phys_zhi(geomdata, lev); // physical top of the domain
11  Real omega = std::sqrt(g * kp);
12 
13  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
14  {
15  const auto prob_lo = geomdata.ProbLo();
16  const auto dx = geomdata.CellSize();
17  const Real x = prob_lo[0] + (i + myhalf) * dx[0];
18 
19  Real z = z_cc(i,j,k);
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  Real p_prime = -(Ampl * omega * omega / kp) * fac * std::sin(kp * x) * r_hse(i,j,k);
25  Real p_total = p_hse(i,j,k) + p_prime;
26 
27  // Define (rho theta) given pprime
28  state_pert(i, j, k, RhoTheta_comp) = getRhoThetagivenP(p_total) - getRhoThetagivenP(p_hse(i,j,k));
29 
30  // Set scalar = 0 everywhere
31  state_pert(i, j, k, RhoScalar_comp) = zero;
32  });
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:72
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhoThetagivenP(const amrex::Real p, const amrex::Real qv=amrex::Real(0))
Definition: ERF_EOS.H:172
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:57
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:54
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
const GpuArray< Real, AMREX_SPACEDIM > prob_lo
Definition: ERF_InitCustomPert_CloudChamber.H:33
ParallelFor(bx, [=] 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+myhalf) *dx[0];Real z=z_cc(i, j, k);Real z_base=Ampl *std::sin(kp *x);z -=z_base;Real fac=std::cosh(kp *(z - H))/std::sinh(kp *H);Real p_prime=-(Ampl *omega *omega/kp) *fac *std::sin(kp *x) *r_hse(i, j, k);Real p_total=p_hse(i, j, k)+p_prime;state_pert(i, j, k, RhoTheta_comp)=getRhoThetagivenP(p_total) - getRhoThetagivenP(p_hse(i, j, k));state_pert(i, j, k, RhoScalar_comp)=zero;})
Real Ampl
Definition: ERF_InitCustomPert_MovingTerrain.H:4
Real g
Definition: ERF_InitCustomPert_MovingTerrain.H:10
ParmParse pp("prob")
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(wavelength > zero, "prob.wavelength must be > 0")
Real H
Definition: ERF_InitCustomPert_MovingTerrain.H:8
Real wavelength
Definition: ERF_InitCustomPert_MovingTerrain.H:5
Real omega
Definition: ERF_InitCustomPert_MovingTerrain.H:11
Real kp
Definition: ERF_InitCustomPert_MovingTerrain.H:9
constexpr amrex::Real two
Definition: ERF_NumericalConstants.H:38
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