19 BL_PROFILE(
"thinbody_wall_dist()");
21 const auto prob_lo = geomdata.ProbLoArray();
22 const auto dx = geomdata.CellSizeArray();
26 Error(
"Thinbody wall dist calc not implemented for terrain yet");
29 Gpu::DeviceVector<IntVect> xfaces_d(xfaces.size());
30 Gpu::DeviceVector<IntVect> yfaces_d(yfaces.size());
31 Gpu::DeviceVector<IntVect> zfaces_d(zfaces.size());
32 Gpu::copyAsync(Gpu::hostToDevice, xfaces.begin(), xfaces.end(), xfaces_d.begin());
33 Gpu::copyAsync(Gpu::hostToDevice, yfaces.begin(), yfaces.end(), yfaces_d.begin());
34 Gpu::copyAsync(Gpu::hostToDevice, zfaces.begin(), zfaces.end(), zfaces_d.begin());
35 auto const* xfaces_d_ptr = xfaces_d.data();
36 auto const* yfaces_d_ptr = yfaces_d.data();
37 auto const* zfaces_d_ptr = zfaces_d.data();
38 const auto n_xfaces = xfaces_d.size();
39 const auto n_yfaces = yfaces_d.size();
40 const auto n_zfaces = zfaces_d.size();
42 for (MFIter mfi(*wdist); mfi.isValid(); ++mfi) {
43 const Box& bx = mfi.validbox();
46 auto wd_arr = wdist->array(mfi);
49 ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) {
54 for (std::size_t iface=0; iface < n_xfaces; ++iface) {
55 int ii = xfaces_d_ptr[iface][0];
56 int jj = xfaces_d_ptr[iface][1];
57 int kk = xfaces_d_ptr[iface][2];
64 Real yn = amrex::min(amrex::max(yr, y0), y1);
65 Real zn = amrex::min(amrex::max(zr,
z0), z1);
66 Real wd2 = wd_arr(i, j, k) * wd_arr(i, j, k);
67 wd2 = min(wd2, (xfc-xr)*(xfc-xr) + (yn-yr)*(yn-yr) + (zn-zr)*(zn-zr));
68 wd_arr(i, j, k) = std::sqrt(wd2);
71 for (std::size_t iface=0; iface < n_yfaces; ++iface) {
72 int ii = yfaces_d_ptr[iface][0];
73 int jj = yfaces_d_ptr[iface][1];
74 int kk = yfaces_d_ptr[iface][2];
81 Real xn = amrex::min(amrex::max(xr, x0), x1);
82 Real zn = amrex::min(amrex::max(zr,
z0), z1);
83 Real wd2 = wd_arr(i, j, k) * wd_arr(i, j, k);
84 wd2 = min(wd2, (xn-xr)*(xn-xr) + (yfc-yr)*(yfc-yr) + (zn-zr)*(zn-zr));
85 wd_arr(i, j, k) = std::sqrt(wd2);
88 for (std::size_t iface=0; iface < n_zfaces; ++iface) {
89 int ii = zfaces_d_ptr[iface][0];
90 int jj = zfaces_d_ptr[iface][1];
91 int kk = zfaces_d_ptr[iface][2];
98 Real xn = amrex::min(amrex::max(xr, x0), x1);
99 Real yn = amrex::min(amrex::max(yr, y0), y1);
100 Real wd2 = wd_arr(i, j, k) * wd_arr(i, j, k);
101 wd2 = min(wd2, (xn-xr)*(xn-xr) + (yn-yr)*(yn-yr) + (zfc-zr)*(zfc-zr));
102 wd_arr(i, j, k) = std::sqrt(wd2);
Real z0
Definition: ERF_InitCustomPertVels_ScalarAdvDiff.H:12
const Real dx
Definition: ERF_InitCustomPert_ABL.H:44
const GpuArray< Real, AMREX_SPACEDIM > prob_lo
Definition: ERF_InitCustomPert_CloudChamber.H:33
const bool use_terrain
Definition: ERF_InitCustomPert_SLM.H:19
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19