ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPertVels_EkmanSpiral.H File Reference

Go to the source code of this file.

Functions

ParmParse pp_for_pert_vels ("erf")
 
pp_for_pert_vels query_enum_case_insensitive ("init_type", init_type)
 
ParmParse pp_for_pert_vels_prob ("prob")
 
pp_for_pert_vels_prob query ("rho_0", rho_0)
 
 if (init_type==InitType::Uniform)
 

Variables

InitType init_type
 
Real rho_0 = 1.0
 

Function Documentation

◆ if()

if ( init_type  = = InitType::Uniform)
10  {
11  Real rot_time_period;
12  pp_for_pert_vels.get("rotational_time_period", rot_time_period);
13  Real coriolis_factor = 4.0 * PI / rot_time_period;
14 
15  Real Az;
16  pp_for_pert_vels.get("dynamic_viscosity", Az); // dynamic viscosity [kg-m/s]
17  Az = Az / rho_0; // kinematic viscosity [m^2/s]
18 
19  Vector<Real> abl_geo_wind(3);
20  pp_for_pert_vels.queryarr("abl_geo_wind",abl_geo_wind);
21  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
22  (amrex::Math::abs(abl_geo_wind[1]) < 1.0e-15) &&
23  (amrex::Math::abs(abl_geo_wind[2]) < 1.0e-15),
24  "Ekman Spiral uses geostrophic forcing of the form (V_0, 0, 0)");
25  const Real u_0 = abl_geo_wind[0];
26 
27  const Real DE = std::sqrt(2.0 * Az / coriolis_factor);
28  const Real a = 1.0 / DE;
29 
30  // Set the x-velocity
31  ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
32  const auto dx = geomdata.CellSize();
33  const Real z = (k + 0.5) * dx[2];
34 
35  // Set the x-velocity
36  x_vel_pert(i, j, k) = u_0 * (1.0 - std::exp(-a * z) * std::cos(-a * z));
37  });
38 
39  // Set the y-velocity
40  ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
41  const auto dx = geomdata.CellSize();
42  const Real z = (k + 0.5) * dx[2];
43 
44  // Set the y-velocity
45  y_vel_pert(i, j, k) = -u_0 * std::exp(-a * z) * std::sin(-a * z);
46  });
47 
48  // Set the z-velocity
49  ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept {
50  z_vel_pert(i, j, k) = 0.0;
51  });
52  } // end if uniform
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
Real rho_0
Definition: ERF_InitCustomPertVels_EkmanSpiral.H:7
ParmParse pp_for_pert_vels("erf")
const auto dx
Definition: ERF_InitCustomPertVels_ParticleTests.H:15
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])/mf_m(i, j, 0);const Real z=z_cc(i, j, k);Real L=std::sqrt(std::pow((x - x_c)/x_r, 2)+std::pow((z - z_c)/z_r, 2));if(L<=1.0) { Real dT=T_pert *(std::cos(PI *L)+1.0)/2.0;Real Tbar_hse=p_hse(i, j, k)/(R_d *r_hse(i, j, k));Real theta_perturbed=(Tbar_hse+dT) *std::pow(p_0/p_hse(i, j, k), rdOcp);Real theta_0=(Tbar_hse) *std::pow(p_0/p_hse(i, j, k), rdOcp);if(const_rho) { state_pert(i, j, k, RhoTheta_comp)=r_hse(i, j, k) *(theta_perturbed - theta_0);} else { state_pert(i, j, k, Rho_comp)=getRhoThetagivenP(p_hse(i, j, k))/theta_perturbed - r_hse(i, j, k);} } })
const Box zbx
Definition: ERF_SetupDiff.H:9
const Box xbx
Definition: ERF_SetupDiff.H:7
const Box ybx
Definition: ERF_SetupDiff.H:8
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Here is the call graph for this function:

◆ pp_for_pert_vels()

ParmParse pp_for_pert_vels ( "erf"  )

Referenced by if().

Here is the caller graph for this function:

◆ pp_for_pert_vels_prob()

ParmParse pp_for_pert_vels_prob ( "prob"  )

◆ query()

pp_for_pert_vels_prob query ( "rho_0"  ,
rho_0   
)

◆ query_enum_case_insensitive()

pp_for_pert_vels query_enum_case_insensitive ( "init_type"  ,
init_type   
)

Variable Documentation

◆ init_type

InitType init_type

◆ rho_0

Real rho_0 = 1.0

Referenced by if().