ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPertVels_IsentropicVortex.H
Go to the documentation of this file.
1 
2  // Parse params
3  ParmParse pp_for_pert_vels("prob");
4 
5  amrex::Real M_inf = 0.2; pp_for_pert_vels.query("M_inf", M_inf);//freestream Mach number [-]
6  amrex::Real T_inf = 300.0; pp_for_pert_vels.query("T_inf", T_inf);//freestream temperature [K]
7  amrex::Real alpha = 0.0; pp_for_pert_vels.query("alpha", alpha);//inflow angle, 0 --> x-aligned [rad]
8  amrex::Real gamma = Gamma; pp_for_pert_vels.query("gamma", gamma);//specific heat ratio [-]
9  amrex::Real beta = 0.01; pp_for_pert_vels.query("beta", beta);//non-dimensional max perturbation strength [-]
10  amrex::Real sigma = 1.0; pp_for_pert_vels.query("sigma", sigma);//Gaussian standard deviation, i.e., spreading parameter [-]
11  amrex::Real R = 2.0; pp_for_pert_vels.query("R", R);//characteristic length scale for grid [m]
12  amrex::Real xc_frac = 0.5; pp_for_pert_vels.query("xc", xc_frac);//normalized x-location of vortex center [-]
13  amrex::Real yc_frac = 0.5; pp_for_pert_vels.query("yc", yc_frac);//normalized y-location of vortex center [-]
14 
15  const amrex::Real* prob_lo = geomdata.ProbLo();
16  const amrex::Real* prob_hi = geomdata.ProbHi();
17 
20 
21  amrex::Real a_inf = std::sqrt(gamma * R_d * T_inf);
22 
23  // Set the x-velocity
24  ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
25  {
26  const Real* dx = geomdata.CellSize();
27 
28  // Note that since we only use (x-xc) and (y-yc), we neglect the prob_lo offset in these
29  const Real x = i * dx[0]; // face center
30  const Real y = (j + 0.5) * dx[1]; // cell center
31  const Real Omg = erf_vortex_Gaussian(x,y,xc,yc,R,beta,sigma);
32 
33  x_vel_pert(i, j, k) = (M_inf * std::cos(alpha)
34  - (y - yc)/R * Omg) * a_inf;
35  });
36 
37  // Set the y-velocity
38  ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
39  {
40  const Real* dx = geomdata.CellSize();
41 
42  // Note that since we only use (x-xc) and (y-yc), we neglect the prob_lo offset in these
43  const Real x = (i + 0.5) * dx[0]; // cell center
44  const Real y = j * dx[1]; // face center
45  const Real Omg = erf_vortex_Gaussian(x,y,xc,yc,R,beta,sigma);
46 
47  y_vel_pert(i, j, k) = (M_inf * std::sin(alpha)
48  + (x - xc)/R * Omg) * a_inf;
49  });
constexpr amrex::Real R_d
Definition: ERF_Constants.H:10
constexpr amrex::Real Gamma
Definition: ERF_Constants.H:19
ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const Real *dx=geomdata.CellSize();const Real x=i *dx[0];const Real y=(j+0.5) *dx[1];const Real Omg=erf_vortex_Gaussian(x, y, xc, yc, R, beta, sigma);x_vel_pert(i, j, k)=(M_inf *std::cos(alpha) -(y - yc)/R *Omg) *a_inf;})
amrex::Real gamma
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:8
const amrex::Real * prob_lo
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:15
amrex::Real R
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:11
amrex::Real yc
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:19
ParmParse pp_for_pert_vels("prob")
amrex::Real a_inf
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:21
amrex::Real sigma
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:10
amrex::Real alpha
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:7
amrex::Real xc_frac
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:12
const amrex::Real * prob_hi
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:16
amrex::Real beta
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:9
amrex::Real M_inf
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:5
amrex::Real yc_frac
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:13
amrex::Real T_inf
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:6
amrex::Real xc
Definition: ERF_InitCustomPertVels_IsentropicVortex.H:18
const auto dx
Definition: ERF_InitCustomPertVels_ParticleTests.H:15
static AMREX_GPU_DEVICE amrex::Real erf_vortex_Gaussian(amrex::Real x, amrex::Real y, amrex::Real xc, amrex::Real yc, amrex::Real R, amrex::Real beta, amrex::Real sigma)
Definition: ERF_InitCustomPert.H:31
const Box xbx
Definition: ERF_SetupDiff.H:7
const Box ybx
Definition: ERF_SetupDiff.H:8
amrex::Real Real
Definition: ERF_ShocInterface.H:19