diff options
author | 2021-01-08 09:41:27 -0800 | |
---|---|---|
committer | 2021-01-08 09:41:27 -0800 | |
commit | 44cd846e965ba0619ea77d63734cc9a63173fbfa (patch) | |
tree | 1b1fe4fa765b34f6371d50cadf82241bae2173b3 /Source/Particles/WarpXParticleContainer.cpp | |
parent | 96e1e7753eca216ced225fc737ab15ff57a3af52 (diff) | |
download | WarpX-44cd846e965ba0619ea77d63734cc9a63173fbfa.tar.gz WarpX-44cd846e965ba0619ea77d63734cc9a63173fbfa.tar.zst WarpX-44cd846e965ba0619ea77d63734cc9a63173fbfa.zip |
Avoid stringent assert statement on GPU (#1597)
* Avoid stringent assert statement on GPU
* Fix Pointer Member Access
* fix nGrow with Vector
* Update Source/Particles/WarpXParticleContainer.cpp
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r-- | Source/Particles/WarpXParticleContainer.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 65107f24d..7d01fcbcf 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -259,9 +259,19 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, // in a neighboring box. However, this should catch particles traveling many // cells away, for example with algorithms that allow for large time steps. const int shape_extent = static_cast<int>(WarpX::nox / 2); +#ifndef AMREX_USE_GPU + // On CPU: Particles deposit on tile arrays, + // which have a small number of guard cells ng_J AMREX_ALWAYS_ASSERT_WITH_MESSAGE( amrex::numParticlesOutOfRange(pti, ng_J - shape_extent) == 0, - "Particles shape does not fit within guard cells used for local current deposition"); + "Particles shape does not fit within tile used for local current deposition"); +#else + // On GPU: Particles deposit directly on the J arrays, + // which usually have a larger number of guard cells + AMREX_ALWAYS_ASSERT_WITH_MESSAGE( + amrex::numParticlesOutOfRange(pti, jx->nGrowVect().min() - shape_extent) == 0, + "Particles shape does not fit within guard cells used for current deposition"); +#endif const std::array<Real,3>& dx = WarpX::CellSize(std::max(depos_lev,0)); Real q = this->charge; @@ -464,9 +474,19 @@ WarpXParticleContainer::DepositCharge (WarpXParIter& pti, RealVector& wp, // deposition algorithm are not trivial, this check might be too strict and // we might need to relax it, as currently done for the current deposition. const int shape_extent = static_cast<int>(WarpX::nox / 2 + 1); +#ifndef AMREX_USE_GPU + // On CPU: Particles deposit on tile arrays, + // which have a small number of guard cells AMREX_ALWAYS_ASSERT_WITH_MESSAGE( amrex::numParticlesOutOfRange(pti, ng_rho - shape_extent) == 0, - "Particles shape does not fit within guard cells used for local charge deposition"); + "Particles shape does not fit within tile used for local charge deposition"); +#else + // On GPU: Particles deposit directly on the rho arrays, + // which usually have a larger number of guard cells + AMREX_ALWAYS_ASSERT_WITH_MESSAGE( + amrex::numParticlesOutOfRange(pti, rho->nGrowVect().min() - shape_extent) == 0, + "Particles shape does not fit within guard cells used for charge deposition"); +#endif const std::array<Real,3>& dx = WarpX::CellSize(std::max(depos_lev,0)); const Real q = this->charge; |