188 amrex::AsyncArray<amrex::Real> cnt_d(cnt_h.data(), cnt_h.size());
196 amrex::IntVect
ng = amrex::IntVect(0);
200 std::unique_ptr<amrex::iMultiFab> mask = OwnerMask(*
m_field,
m_geom.periodicity(),
ng);
203 #pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
205 for (amrex::MFIter mfi(mfab, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) {
206 amrex::Box tbx = mfi.tilebox();
209 amrex::Box pbx = PerpendicularBox<IndexSelector>(tbx, amrex::IntVect(0));
211 const amrex::Array4<const amrex::Real>& fab_arr = mfab.const_array(mfi);
212 const amrex::Array4<const int >& mask_arr = mask->const_array(mfi);
215 AMREX_GPU_DEVICE(
int p_i,
int p_j,
int p_k,
216 amrex::Gpu::Handler
const& handler) noexcept
220 amrex::Box lbx = ParallelBox<IndexSelector>(tbx, amrex::IntVect{p_i, p_j, p_k});
222 for (
int k = lbx.smallEnd(2); k <= lbx.bigEnd(2); ++k) {
223 for (
int j = lbx.smallEnd(1); j <= lbx.bigEnd(1); ++j) {
224 for (
int i = lbx.smallEnd(0); i <= lbx.bigEnd(0); ++i) {
225 int ind = idxOp.getIndx(i, j, k) +
offset;
230 amrex::Gpu::deviceReduceSum(&cnt_avg[ind], fac, handler);
231 for (
int n = 0; n <
ncomp; ++n) {
232 amrex::Gpu::deviceReduceSum(&line_avg[
ncomp * ind + n],
233 fab_arr(i, j, k, n) * fac, handler);
241 cnt_d.copyToHost(cnt_h.data(), cnt_h.size());
243 amrex::ParallelDescriptor::ReduceRealSum(cnt_h.data(), cnt_h.size());
246 for (
int n(0); n<
ncomp; ++n) {
constexpr amrex::Real one
Definition: ERF_Constants.H:7
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const Real *dx=geomdata.CellSize();const Real x=(i+0.5) *dx[0];const Real y=(j+0.5) *dx[1];const Real Omg=erf_vortex_Gaussian(x, y, xc, yc, R, beta, sigma);const Real deltaT=-(gamma - 1.0)/(2.0 *sigma *sigma) *Omg *Omg;const Real rho_norm=std::pow(1.0+deltaT, inv_gm1);const Real T=(1.0+deltaT) *T_inf;const Real p=std::pow(rho_norm, Gamma)/Gamma *rho_0 *a_inf *a_inf;const Real rho_theta=rho_0 *rho_norm *(T *std::pow(p_0/p, rdOcp));state_pert(i, j, k, RhoTheta_comp)=rho_theta - getRhoThetagivenP(p_hse(i, j, k));const Real r2d_xy=std::sqrt((x-xc) *(x-xc)+(y-yc) *(y-yc));state_pert(i, j, k, RhoScalar_comp)=0.25 *(1.0+std::cos(PI *std::min(r2d_xy, R)/R));})
AMREX_FORCE_INLINE IntVect offset(const int face_dir, const int normal)
Definition: ERF_ReadBndryPlanes.cpp:28
amrex::Real Real
Definition: ERF_ShocInterface.H:19
int ncomp() const
Definition: ERF_PlaneAverage.H:39
@ ng
Definition: ERF_Morrison.H:48