21 bool test_mapfactor =
false;
22 pp.query(
"test_mapfactor",test_mapfactor);
32 auto dx = geom.CellSizeArray();
33 auto ProbLoArr = geom.ProbLoArray();
34 auto ProbHiArr = geom.ProbHiArray();
36 const amrex::Box& domain = geom.Domain();
37 int domlo_x = domain.smallEnd(0);
int domhi_x = domain.bigEnd(0) + 1;
38 int domlo_y = domain.smallEnd(1);
int domhi_y = domain.bigEnd(1) + 1;
39 int domlo_z = domain.smallEnd(2);
44 Real xcen = 0.5 * (ProbLoArr[0] + ProbHiArr[0]) / mf_m;
45 Real ycen = 0.5 * (ProbLoArr[1] + ProbHiArr[1]) / mf_m;
50 std::string custom_terrain_type =
"None";
51 ParmParse pp_prob(
"prob"); pp_prob.query(
"custom_terrain_type", custom_terrain_type);
53 amrex::Box
zbx = terrain_fab.box();
54 if (
zbx.smallEnd(2) <= k0)
56 amrex::Array4<Real>
const& z_arr = terrain_fab.array();
58 if (custom_terrain_type ==
"WoA") {
61 int dir = 0; pp_prob.query(
"dir", dir);
63 Real L = 100.0; pp_prob.query(
"L" , L);
64 Real z_offset = 0.0; pp_prob.query(
"z_offset" , z_offset);
67 Real hm = 0.0; pp_prob.query(
"hmax" , hm);
74 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
77 Real x = (ProbLoArr[0] + ii *
dx[0] - xcen) * mf_m;
81 z_arr(i,j,k0) =
num / (
x*
x + 4 * a * a);
84 z_arr(i,j,k0) = hm / (1 + x_L*x_L) + z_offset;
87 }
else if (dir == 1) {
91 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
94 Real y = (ProbLoArr[1] + jj *
dx[1] - ycen) * mf_m;
98 z_arr(i,j,k0) =
num / (
y*
y + 4.0 * a * a);
101 z_arr(i,j,k0) = hm / (1.0 + y_L*y_L) + z_offset;
104 }
else if (dir == 2) {
108 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
109 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
112 Real x = (ProbLoArr[0] + ii *
dx[0] - xcen) * mf_m;
113 Real y = (ProbLoArr[1] + jj *
dx[1] - ycen) * mf_m;
114 Real r = std::sqrt(x*x + y*y);
118 z_arr(i,j,k0) =
num / (r*r + 4.0 * a * a);
121 z_arr(i,j,k0) = hm / (1.0 + r_L*r_L) + z_offset;
125 amrex::Abort(
"Unknown dir in ERF_Prob.cpp");
128 }
else if (custom_terrain_type ==
"ScharMountain") {
130 Real asq = 5000.0 * 5000.0;
132 Real lambda = 4000.0;
137 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
140 Real x = (ProbLoArr[0] + ii *
dx[0] - xcen);
142 Real cosx = cos(
PI * x / lambda);
144 z_arr(i,j,k0) = Hm * std::exp(-x*x/asq) * cosx * cosx;
147 }
else if (custom_terrain_type ==
"HalfCylinder") {
149 Real asq = 0.5 * 0.5;
154 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
157 Real x = (ProbLoArr[0] + ii *
dx[0] - xcen);
162 z_arr(i,j,k0) = pow(asq - rsq, 0.5);
168 }
else if (custom_terrain_type ==
"Hemisphere") {
170 Real asq = 0.5 * 0.5;
175 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
176 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
179 Real x = (ProbLoArr[0] + ii *
dx[0] - xcen);
180 Real y = (ProbLoArr[1] + jj *
dx[1] - ycen);
185 z_arr(i,j,k0) = std::pow(asq-rsq, 0.5);
191 }
else if (custom_terrain_type ==
"MovingSineWave") {
193 Real Ampl = 0.0; pp_prob.query(
"Ampl", Ampl);
194 Real wavelength = 100.; pp_prob.query(
"wavelength", wavelength);
196 Real kp = 2.0 *
PI / wavelength;
203 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
209 Real height = Ampl * std::sin(kp * x -
omega * time);
212 z_arr(i,j,0) = height;
215 }
else if (custom_terrain_type ==
"WindFarmTest") {
220 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
221 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
224 Real x = (ProbLoArr[0] + ii *
dx[0] - xcen);
225 Real y = (ProbLoArr[1] + jj *
dx[1] - ycen);
230 z_arr(i,j,k0) = 100.0 / (1.0 + x_L*x_L + y_L*y_L);
233 }
else if (custom_terrain_type ==
"RaisedFlat") {
234 Real z_offset = 0.0; pp_prob.query(
"z_offset" , z_offset);
237 z_arr(i,j,k0) = z_offset;
240 }
else if (custom_terrain_type ==
"None") {
246 Abort(
"Don't know this custom_terrain_type");
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
@ num
Definition: ERF_DataStruct.H:24
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
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ omega
Definition: ERF_Morrison.H:53
real(c_double), parameter g
Definition: ERF_module_model_constants.F90:19