33 const auto& dx = geom.CellSizeArray();
34 const auto& prob_lo = geom.ProbLoArray();
42 amrex::Gpu::DeviceVector<amrex::Real> d_xterrain(xterrain_size);
43 amrex::Gpu::DeviceVector<amrex::Real> d_yterrain(xterrain_size);
44 amrex::Gpu::DeviceVector<amrex::Real> d_zterrain(xterrain_size);
54 const auto* xterrain_ptr = d_xterrain.data();
55 const auto* yterrain_ptr = d_yterrain.data();
56 const auto* zterrain_ptr = d_zterrain.data();
59 Box gtbx = mfi.growntilebox();
61 const Array4<const Real>& z_nd =
62 (z_phys_nd) ? z_phys_nd->const_array(mfi) : Array4<const Real>{};
63 ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
65 for (
unsigned ii = 0; ii < xterrain_size; ++ii) {
66 Real ht = zterrain_ptr[ii];
67 Real xt = xterrain_ptr[ii];
68 Real yt = yterrain_ptr[ii];
70 const Real
x = prob_lo[0] + (i + 0.5) * dx[0];
71 const Real
y = prob_lo[1] + (j + 0.5) * dx[1];
72 Real
z = prob_lo[2] + (k + 0.5) * dx[2];
74 z = 0.125 * (z_nd(i, j, k) + z_nd(i + 1, j, k) + z_nd(i, j + 1, k) +
75 z_nd(i + 1, j + 1, k) + z_nd(i, j, k + 1) +
76 z_nd(i + 1, j, k + 1) + z_nd(i, j + 1, k + 1) +
77 z_nd(i + 1, j + 1, k + 1));
80 const Real cell_radius = std::sqrt(dx[0] * dx[0] + dx[1] * dx[1]);
83 std::sqrt((
x - xt) * (
x - xt) + (
y - yt) * (
y - yt));
84 const Real terrain_point =
85 (radius <= cell_radius &&
z <= ht) ? 1.0 : 0.0;
86 levelBlank(i, j, k) = terrain_point;
std::unique_ptr< amrex::MultiFab > m_terrain_blank
Definition: ERF_TerrainDrag.H:31