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);
52 amrex::Print() <<
"IN CUSTOM TERRAIN WITH TYPE = " << custom_terrain_type << std::endl;
54 amrex::Box
zbx = terrain_fab.box();
55 if (
zbx.smallEnd(2) <= k0)
57 amrex::Array4<Real>
const& z_arr = terrain_fab.array();
59 if (custom_terrain_type ==
"WoA") {
62 int dir = 0; pp_prob.query(
"dir", dir);
64 Real L = 100.0; pp_prob.query(
"L" , L);
65 Real z_offset = 0.0; pp_prob.query(
"z_offset" , z_offset);
68 Real hm = 0.0; pp_prob.query(
"hmax" , hm);
72 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
75 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
78 Real x = (ProbLoArr[0] + ii * dx[0] - xcen) * mf_m;
82 z_arr(i,j,k0) =
num / (
x*
x + 4 * a * a);
85 z_arr(i,j,k0) = hm / (1 + x_L*x_L) + z_offset;
88 }
else if (dir == 1) {
89 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
92 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
95 Real y = (ProbLoArr[1] + jj * dx[1] - ycen) * mf_m;
99 z_arr(i,j,k0) =
num / (
y*
y + 4.0 * a * a);
102 z_arr(i,j,k0) = hm / (1.0 + y_L*y_L) + z_offset;
105 }
else if (dir == 2) {
106 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
109 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
110 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
113 Real x = (ProbLoArr[0] + ii * dx[0] - xcen) * mf_m;
114 Real y = (ProbLoArr[1] + jj * dx[1] - ycen) * mf_m;
115 Real r = std::sqrt(x*x + y*y);
119 z_arr(i,j,k0) =
num / (r*r + 4.0 * a * a);
122 z_arr(i,j,k0) = hm / (1.0 + r_L*r_L) + z_offset;
126 amrex::Abort(
"Unknown dir in ERF_Prob.cpp");
129 }
else if (custom_terrain_type ==
"ScharMountain") {
131 Real asq = 5000.0 * 5000.0;
133 Real lambda = 4000.0;
135 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
138 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
141 Real x = (ProbLoArr[0] + ii * dx[0] - xcen);
143 Real cosx = cos(
PI * x / lambda);
145 z_arr(i,j,k0) = Hm * std::exp(-x*x/asq) * cosx * cosx;
148 }
else if (custom_terrain_type ==
"HalfCylinder") {
150 Real asq = 0.5 * 0.5;
152 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
155 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
158 Real x = (ProbLoArr[0] + ii * dx[0] - xcen);
163 z_arr(i,j,k0) = pow(asq - rsq, 0.5);
169 }
else if (custom_terrain_type ==
"Hemisphere") {
171 Real asq = 0.5 * 0.5;
173 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
176 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
177 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
180 Real x = (ProbLoArr[0] + ii * dx[0] - xcen);
181 Real y = (ProbLoArr[1] + jj * dx[1] - ycen);
186 z_arr(i,j,k0) = std::pow(asq-rsq, 0.5);
192 }
else if (custom_terrain_type ==
"MovingSineWave") {
194 Real Ampl = 0.0; pp_prob.query(
"Ampl", Ampl);
195 Real wavelength = 100.; pp_prob.query(
"wavelength", wavelength);
197 Real kp = 2.0 *
PI / wavelength;
201 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
204 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
210 Real height = Ampl * std::sin(kp * x -
omega * time);
213 z_arr(i,j,0) = height;
216 }
else if (custom_terrain_type ==
"WindFarmTest") {
218 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
221 int ii = amrex::min(amrex::max(i,domlo_x),domhi_x);
222 int jj = amrex::min(amrex::max(j,domlo_y),domhi_y);
225 Real x = (ProbLoArr[0] + ii * dx[0] - xcen);
226 Real y = (ProbLoArr[1] + jj * dx[1] - ycen);
231 z_arr(i,j,k0) = 100.0 / (1.0 + x_L*x_L + y_L*y_L);
234 }
else if (custom_terrain_type ==
"RaisedFlat") {
235 Real z_offset = 0.0; pp_prob.query(
"z_offset" , z_offset);
236 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
238 z_arr(i,j,k0) = z_offset;
241 }
else if (custom_terrain_type ==
"None") {
242 ParallelFor(
zbx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int)
247 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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:233
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