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 = 0. ; pp.query("Ampl", Ampl);
5  Real wavelength = 1.0; pp.get("wavelength", wavelength);
6 
7  Real H = geomdata.ProbHi()[2];
8  Real kp = 2.0 * PI / wavelength;
10  Real omega = std::sqrt(g * kp);
11 
12  ParallelFor(bx, [=] 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  const Real x = prob_lo[0] + (i + 0.5) * dx[0];
17 
18  Real z = z_cc(i,j,k);
19  Real z_base = Ampl * std::sin(kp * x);
20  z -= z_base;
21 
22  Real fac = std::cosh( kp * (z - H) ) / std::sinh(kp * H);
23  Real p_prime = -(Ampl * omega * omega / kp) * fac * std::sin(kp * x) * r_hse(i,j,k);
24  Real p_total = p_hse(i,j,k) + p_prime;
25 
26  // Define (rho theta) given pprime
27  state_pert(i, j, k, RhoTheta_comp) = getRhoThetagivenP(p_total) - getRhoThetagivenP(p_hse(i,j,k));
28 
29  // Set scalar = 0 everywhere
30  state_pert(i, j, k, RhoScalar_comp) = state_pert(i,j,k,Rho_comp);
31  });
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhoThetagivenP(const amrex::Real p, const amrex::Real qv=0.0)
Definition: ERF_EOS.H:172
#define RhoScalar_comp
Definition: ERF_IndexDefines.H:40
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
state_pert(i, j, k, RhoTheta_comp)
const amrex::Real * prob_lo
Definition: ERF_InitCustomPert_IsentropicVortex.H:16
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+0.5) *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)=state_pert(i, j, k, Rho_comp);})
Real Ampl
Definition: ERF_InitCustomPert_MovingTerrain.H:4
Real g
Definition: ERF_InitCustomPert_MovingTerrain.H:9
ParmParse pp("prob")
Real H
Definition: ERF_InitCustomPert_MovingTerrain.H:7
Real wavelength
Definition: ERF_InitCustomPert_MovingTerrain.H:5
Real omega
Definition: ERF_InitCustomPert_MovingTerrain.H:10
Real kp
Definition: ERF_InitCustomPert_MovingTerrain.H:8
amrex::Real Real
Definition: ERF_ShocInterface.H:19