ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPert_TaylorGreenVortex.H
Go to the documentation of this file.
1 
2  ParmParse pp("prob");
3  Real rho_0 = 1.0; pp.query("rho_0", rho_0);
4  Real T_0 = 300.0; pp.query("T_0", T_0);
5  Real M_0 = 1.0; pp.query("M_0", M_0);
6  Real V_0 = 1.0; pp.query("V_0", V_0);
7 
8  ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
9  {
10  // Geometry
11  const Real* prob_lo = geomdata.ProbLo();
12  const Real* dx = geomdata.CellSize();
13  const Real x = prob_lo[0] + (i + 0.5) * dx[0];
14  const Real y = prob_lo[1] + (j + 0.5) * dx[1];
15  const Real z = prob_lo[2] + (k + 0.5) * dx[2];
16 
17  // Initial potential temperature (actually rho*theta) perturbation
18  const Real p = rho_0 * V_0*V_0*
19  ( 1.0 / (Gamma * M_0 * M_0)
20  + (1.0 / 16.0) * (cos(2 * x) + cos(2 * y)) * (cos(2 * z) + 2));
21  state_pert(i, j, k, RhoTheta_comp) = getRhoThetagivenP(p) - getRhoThetagivenP(p_hse(i,j,k));
22 
23  // Set scalar = 0 everywhere
24  state_pert(i, j, k, RhoScalar_comp) = 1.0 * rho_0;
25  });
constexpr amrex::Real Gamma
Definition: ERF_Constants.H:19
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 RhoTheta_comp
Definition: ERF_IndexDefines.H:37
const auto dx
Definition: ERF_InitCustomPertVels_ParticleTests.H:15
const amrex::Real * prob_lo
Definition: ERF_InitCustomPert_IsentropicVortex.H:16
Real M_0
Definition: ERF_InitCustomPert_TaylorGreenVortex.H:5
Real rho_0
Definition: ERF_InitCustomPert_TaylorGreenVortex.H:3
ParmParse pp("prob")
Real T_0
Definition: ERF_InitCustomPert_TaylorGreenVortex.H:4
ParallelFor(bx, [=] 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+0.5) *dx[0];const Real y=prob_lo[1]+(j+0.5) *dx[1];const Real z=prob_lo[2]+(k+0.5) *dx[2];const Real p=rho_0 *V_0 *V_0 *(1.0/(Gamma *M_0 *M_0)+(1.0/16.0) *(cos(2 *x)+cos(2 *y)) *(cos(2 *z)+2));state_pert(i, j, k, RhoTheta_comp)=getRhoThetagivenP(p) - getRhoThetagivenP(p_hse(i, j, k));state_pert(i, j, k, RhoScalar_comp)=1.0 *rho_0;})
Real V_0
Definition: ERF_InitCustomPert_TaylorGreenVortex.H:6
amrex::Real Real
Definition: ERF_ShocInterface.H:19