diff --git a/Source/Particles/Deposition/CurrentDeposition.H b/Source/Particles/Deposition/CurrentDeposition.H index 8b788f6f80e..7f59b8c35f8 100644 --- a/Source/Particles/Deposition/CurrentDeposition.H +++ b/Source/Particles/Deposition/CurrentDeposition.H @@ -1353,7 +1353,7 @@ void doVillasenorDepositionShapeNImplicit ([[maybe_unused]]const amrex::Particle const amrex::Real dt, const amrex::XDim3 & dinv, const amrex::XDim3 & xyzmin, - const amrex::XDim3 & xyzmax, + const amrex::RealBox & prob_domain, const amrex::GpuArray, AMREX_SPACEDIM> & is_absorbing, const amrex::Dim3 lo, const amrex::Real q, @@ -1421,9 +1421,9 @@ void doVillasenorDepositionShapeNImplicit ([[maybe_unused]]const amrex::Particle amrex::Real xp_np1_c = xp_np1; amrex::Real yp_np1_c = yp_np1; amrex::Real zp_np1_c = zp_np1; - ParticleUtils::crop_at_boundary(xp_n[ip], yp_n[ip], zp_n[ip], xp_np1_c, yp_np1_c, zp_np1_c, xyzmin.x, xyzmax.x, is_absorbing[0]); - ParticleUtils::crop_at_boundary(yp_n[ip], zp_n[ip], xp_n[ip], yp_np1_c, zp_np1_c, xp_np1_c, xyzmin.y, xyzmax.y, is_absorbing[1]); - ParticleUtils::crop_at_boundary(zp_n[ip], xp_n[ip], yp_n[ip], zp_np1_c, xp_np1_c, yp_np1_c, xyzmin.z, xyzmax.z, is_absorbing[2]); + ParticleUtils::crop_at_boundary(xp_n[ip], yp_n[ip], zp_n[ip], xp_np1_c, yp_np1_c, zp_np1_c, prob_domain.lo(0), prob_domain.hi(0), is_absorbing[0]); + ParticleUtils::crop_at_boundary(yp_n[ip], zp_n[ip], xp_n[ip], yp_np1_c, zp_np1_c, xp_np1_c, prob_domain.lo(1), prob_domain.hi(1), is_absorbing[1]); + ParticleUtils::crop_at_boundary(zp_n[ip], xp_n[ip], yp_n[ip], zp_np1_c, xp_np1_c, yp_np1_c, prob_domain.lo(2), prob_domain.hi(2), is_absorbing[2]); // Keep these double to avoid bug in single precision double const x_new = (xp_np1_c - xyzmin.x)*dinv.x; @@ -1666,8 +1666,8 @@ void doVillasenorDepositionShapeNImplicit ([[maybe_unused]]const amrex::Particle amrex::Real const vz = (zp_np1 - zp_n[ip])/dt; amrex::Real zp_np1_c = zp_np1; - ParticleUtils::crop_at_boundary(xp_n_c, zp_n[ip], xp_np1_c, zp_np1_c, xyzmin.x, xyzmax.x, is_absorbing[0]); - ParticleUtils::crop_at_boundary(zp_n[ip], xp_n_c, zp_np1_c, xp_np1_c, xyzmin.z, xyzmax.z, is_absorbing[1]); + ParticleUtils::crop_at_boundary(xp_n_c, zp_n[ip], xp_np1_c, zp_np1_c, prob_domain.lo(0), prob_domain.hi(0), is_absorbing[0]); + ParticleUtils::crop_at_boundary(zp_n[ip], xp_n_c, zp_np1_c, xp_np1_c, prob_domain.lo(1), prob_domain.hi(1), is_absorbing[1]); // Keep these double to avoid bug in single precision double const x_new = (xp_np1_c - xyzmin.x)*dinv.x; @@ -1855,7 +1855,7 @@ void doVillasenorDepositionShapeNImplicit ([[maybe_unused]]const amrex::Particle #elif defined(WARPX_DIM_1D_Z) amrex::Real zp_np1_c = zp_np1; - ParticleUtils::crop_at_boundary(zp_np1_c, xyzmin.z, xyzmax.z, is_absorbing[0]); + ParticleUtils::crop_at_boundary(zp_np1_c, prob_domain.lo(0), prob_domain.hi(0), is_absorbing[0]); // Keep these double to avoid bug in single precision double const z_new = (zp_np1_c - xyzmin.z)*dinv.z; diff --git a/Source/Particles/Gather/FieldGather.H b/Source/Particles/Gather/FieldGather.H index c2f9dd94c68..acad8cae173 100644 --- a/Source/Particles/Gather/FieldGather.H +++ b/Source/Particles/Gather/FieldGather.H @@ -888,7 +888,7 @@ void doGatherPicnicShapeN ( [[maybe_unused]] const amrex::IndexType Bz_type, const amrex::XDim3 & dinv, const amrex::XDim3 & xyzmin, - const amrex::XDim3 & xyzmax, + const amrex::RealBox & prob_domain, const amrex::GpuArray, AMREX_SPACEDIM> & is_absorbing, const amrex::Dim3& lo, const int n_rz_azimuthal_modes) @@ -927,9 +927,9 @@ void doGatherPicnicShapeN ( amrex::Real xp_np1_c = xp_np1; amrex::Real yp_np1_c = yp_np1; amrex::Real zp_np1_c = zp_np1; - ParticleUtils::crop_at_boundary(xp_n, yp_n, zp_n, xp_np1_c, yp_np1_c, zp_np1_c, xyzmin.x, xyzmax.x, is_absorbing[0]); - ParticleUtils::crop_at_boundary(yp_n, zp_n, xp_n, yp_np1_c, zp_np1_c, xp_np1_c, xyzmin.y, xyzmax.y, is_absorbing[1]); - ParticleUtils::crop_at_boundary(zp_n, xp_n, yp_n, zp_np1_c, xp_np1_c, yp_np1_c, xyzmin.z, xyzmax.z, is_absorbing[2]); + ParticleUtils::crop_at_boundary(xp_n, yp_n, zp_n, xp_np1_c, yp_np1_c, zp_np1_c, prob_domain.lo(0), prob_domain.hi(0), is_absorbing[0]); + ParticleUtils::crop_at_boundary(yp_n, zp_n, xp_n, yp_np1_c, zp_np1_c, xp_np1_c, prob_domain.lo(1), prob_domain.hi(1), is_absorbing[1]); + ParticleUtils::crop_at_boundary(zp_n, xp_n, yp_n, zp_np1_c, xp_np1_c, yp_np1_c, prob_domain.lo(2), prob_domain.hi(2), is_absorbing[2]); // Keep these double to avoid bug in single precision double const x_new = (xp_np1_c - xyzmin.x)*dinv.x; @@ -1193,8 +1193,8 @@ void doGatherPicnicShapeN ( #endif amrex::Real zp_np1_c = zp_np1; - ParticleUtils::crop_at_boundary(xp_n_c, zp_n, xp_np1_c, zp_np1_c, xyzmin.x, xyzmax.x, is_absorbing[0]); - ParticleUtils::crop_at_boundary(zp_n, xp_n_c, zp_np1_c, xp_np1_c, xyzmin.z, xyzmax.z, is_absorbing[1]); + ParticleUtils::crop_at_boundary(xp_n_c, zp_n, xp_np1_c, zp_np1_c, prob_domain.lo(0), prob_domain.hi(0), is_absorbing[0]); + ParticleUtils::crop_at_boundary(zp_n, xp_n_c, zp_np1_c, xp_np1_c, prob_domain.lo(1), prob_domain.hi(1), is_absorbing[1]); // Keep these double to avoid bug in single precision double const x_new = (xp_np1_c - xyzmin.x)*dinv.x; @@ -1426,7 +1426,7 @@ void doGatherPicnicShapeN ( #elif defined(WARPX_DIM_1D_Z) amrex::Real zp_np1_c = zp_np1; - ParticleUtils::crop_at_boundary(zp_np1_c, xyzmin.z, xyzmax.z, is_absorbing[0]); + ParticleUtils::crop_at_boundary(zp_np1_c, prob_domain.lo(0), prob_domain.hi(0), is_absorbing[0]); // Keep these double to avoid bug in single precision double const z_new = (zp_np1_c - xyzmin.z)*dinv.z; @@ -1744,7 +1744,7 @@ void doGatherShapeNImplicit ( const amrex::IndexType bz_type, const amrex::XDim3 & dinv, const amrex::XDim3 & xyzmin, - const amrex::XDim3 & xyzmax, + const amrex::RealBox & prob_domain, const amrex::GpuArray, AMREX_SPACEDIM> & is_absorbing, const amrex::Dim3& lo, const int n_rz_azimuthal_modes, @@ -1784,25 +1784,25 @@ void doGatherShapeNImplicit ( Exp, Eyp, Ezp, Bxp, Byp, Bzp, ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, ex_type, ey_type, ez_type, bx_type, by_type, bz_type, - dinv, xyzmin, xyzmax, is_absorbing, lo, n_rz_azimuthal_modes); + dinv, xyzmin, prob_domain, is_absorbing, lo, n_rz_azimuthal_modes); } else if (nox == 2) { doGatherPicnicShapeN<2>(xp_n, yp_n, zp_n, xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp, ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, ex_type, ey_type, ez_type, bx_type, by_type, bz_type, - dinv, xyzmin, xyzmax, is_absorbing, lo, n_rz_azimuthal_modes); + dinv, xyzmin, prob_domain, is_absorbing, lo, n_rz_azimuthal_modes); } else if (nox == 3) { doGatherPicnicShapeN<3>(xp_n, yp_n, zp_n, xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp, ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, ex_type, ey_type, ez_type, bx_type, by_type, bz_type, - dinv, xyzmin, xyzmax, is_absorbing, lo, n_rz_azimuthal_modes); + dinv, xyzmin, prob_domain, is_absorbing, lo, n_rz_azimuthal_modes); } else if (nox == 4) { doGatherPicnicShapeN<4>(xp_n, yp_n, zp_n, xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp, ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, ex_type, ey_type, ez_type, bx_type, by_type, bz_type, - dinv, xyzmin, xyzmax, is_absorbing, lo, n_rz_azimuthal_modes); + dinv, xyzmin, prob_domain, is_absorbing, lo, n_rz_azimuthal_modes); } } else if (depos_type == CurrentDepositionAlgo::Direct) { diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 52219306ef9..90e162f6acc 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -2832,9 +2832,9 @@ PhysicalParticleContainer::ImplicitPushXP (WarpXParIter& pti, // Lower corner of tile box physical domain (take into account Galilean shift) const amrex::XDim3 xyzmin = WarpX::LowerCorner(box, gather_lev, 0._rt); - const amrex::XDim3 xyzmax = WarpX::UpperCorner(box, gather_lev, 0._rt); const WarpX& warpx = WarpX::GetInstance(); + amrex::RealBox const prob_domain = warpx.Geom(0).ProbDomain(); amrex::Box const& domain_box = warpx.Geom(0).Domain(); auto const & field_boundary_lo = warpx.GetFieldBoundaryLo(); auto const & field_boundary_hi = warpx.GetFieldBoundaryHi(); @@ -3002,7 +3002,7 @@ PhysicalParticleContainer::ImplicitPushXP (WarpXParIter& pti, doGatherShapeNImplicit(xp_n, yp_n, zp_n, xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp, ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr, ex_type, ey_type, ez_type, bx_type, by_type, bz_type, - dinv, xyzmin, xyzmax, is_absorbing, lo, n_rz_azimuthal_modes, nox, + dinv, xyzmin, prob_domain, is_absorbing, lo, n_rz_azimuthal_modes, nox, depos_type ); } diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 58118e21210..1974d0e89b5 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -477,7 +477,8 @@ WarpXParticleContainer::DepositCurrent (WarpXParIter& pti, const Dim3 lo = lbound(tilebox); // Take into account Galilean shift const amrex::XDim3 xyzmin = WarpX::LowerCorner(tilebox, depos_lev, 0.5_rt*dt); - const amrex::XDim3 xyzmax = WarpX::UpperCorner(tilebox, depos_lev, 0.5_rt*dt); + + amrex::RealBox const prob_domain = warpx.Geom(0).ProbDomain(); amrex::Box const& domain_box = warpx.Geom(0).Domain(); auto const & field_boundary_lo = warpx.GetFieldBoundaryLo(); @@ -717,7 +718,7 @@ WarpXParticleContainer::DepositCurrent (WarpXParIter& pti, GetPosition, wp.dataPtr() + offset, uxp_n.dataPtr() + offset, uyp_n.dataPtr() + offset, uzp_n.dataPtr() + offset, uxp.dataPtr() + offset, uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, - jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, xyzmax, is_absorbing, lo, q, + jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, prob_domain, is_absorbing, lo, q, WarpX::n_rz_azimuthal_modes); } else if (WarpX::nox == 2){ doVillasenorDepositionShapeNImplicit<2>( @@ -725,7 +726,7 @@ WarpXParticleContainer::DepositCurrent (WarpXParIter& pti, GetPosition, wp.dataPtr() + offset, uxp_n.dataPtr() + offset, uyp_n.dataPtr() + offset, uzp_n.dataPtr() + offset, uxp.dataPtr() + offset, uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, - jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, xyzmax, is_absorbing, lo, q, + jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, prob_domain, is_absorbing, lo, q, WarpX::n_rz_azimuthal_modes); } else if (WarpX::nox == 3){ doVillasenorDepositionShapeNImplicit<3>( @@ -733,7 +734,7 @@ WarpXParticleContainer::DepositCurrent (WarpXParIter& pti, GetPosition, wp.dataPtr() + offset, uxp_n.dataPtr() + offset, uyp_n.dataPtr() + offset, uzp_n.dataPtr() + offset, uxp.dataPtr() + offset, uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, - jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, xyzmax, is_absorbing, lo, q, + jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, prob_domain, is_absorbing, lo, q, WarpX::n_rz_azimuthal_modes); } else if (WarpX::nox == 4){ doVillasenorDepositionShapeNImplicit<4>( @@ -741,7 +742,7 @@ WarpXParticleContainer::DepositCurrent (WarpXParIter& pti, GetPosition, wp.dataPtr() + offset, uxp_n.dataPtr() + offset, uyp_n.dataPtr() + offset, uzp_n.dataPtr() + offset, uxp.dataPtr() + offset, uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, - jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, xyzmax, is_absorbing, lo, q, + jx_arr, jy_arr, jz_arr, np_to_deposit, dt, dinv, xyzmin, prob_domain, is_absorbing, lo, q, WarpX::n_rz_azimuthal_modes); } }