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) {
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);} } })
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