aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2019-10-25 14:28:34 +0200
committerGravatar Luca Fedeli <luca.fedeli@cea.fr> 2019-10-25 14:28:34 +0200
commit31b762139179b9c8dc74429c73f979636d56dc29 (patch)
treef149281407db77705f97f876a9dd915df9ce3150 /Source/Particles/PhysicalParticleContainer.cpp
parent9308efe488a123170eb15e50f0ce15769845f8ad (diff)
downloadWarpX-31b762139179b9c8dc74429c73f979636d56dc29.tar.gz
WarpX-31b762139179b9c8dc74429c73f979636d56dc29.tar.zst
WarpX-31b762139179b9c8dc74429c73f979636d56dc29.zip
Separate PushPX kernels in a dedicated function
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index d12a4dbff..723a35ac1 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -1599,11 +1599,32 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
const Real q = this->charge;
const Real m = this-> mass;
+ PushPX_classical(x, y, z, ux, uy, uz,
+ Ex, Ey, Ez, Bx, By, Bz,
+ q, m, ion_lev, dt, pti.numParticles());
+}
+void PhysicalParticleContainer::PushPX_classical(
+ ParticleReal* const AMREX_RESTRICT x,
+ ParticleReal* const AMREX_RESTRICT y,
+ ParticleReal* const AMREX_RESTRICT z,
+ ParticleReal* const AMREX_RESTRICT ux,
+ ParticleReal* const AMREX_RESTRICT uy,
+ ParticleReal* const AMREX_RESTRICT uz,
+ const ParticleReal* const AMREX_RESTRICT Ex,
+ const ParticleReal* const AMREX_RESTRICT Ey,
+ const ParticleReal* const AMREX_RESTRICT Ez,
+ const ParticleReal* const AMREX_RESTRICT Bx,
+ const ParticleReal* const AMREX_RESTRICT By,
+ const ParticleReal* const AMREX_RESTRICT Bz,
+ Real q, Real m, int* AMREX_RESTRICT ion_lev,
+ amrex::Real dt, long num_particles
+)
+{
//Assumes that all consistency checks have been done at initialization
if(do_classical_radiation_reaction){
amrex::ParallelFor(
- pti.numParticles(),
+ num_particles,
[=] AMREX_GPU_DEVICE (long i) {
Real qp = q;
if (ion_lev){ qp *= ion_lev[i]; }
@@ -1616,7 +1637,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
);
} else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Boris){
amrex::ParallelFor(
- pti.numParticles(),
+ num_particles,
[=] AMREX_GPU_DEVICE (long i) {
Real qp = q;
if (ion_lev){ qp *= ion_lev[i]; }
@@ -1629,7 +1650,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
);
} else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Vay) {
amrex::ParallelFor(
- pti.numParticles(),
+ num_particles,
[=] AMREX_GPU_DEVICE (long i) {
Real qp = q;
if (ion_lev){ qp *= ion_lev[i]; }
@@ -1642,7 +1663,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
);
} else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::HigueraCary) {
amrex::ParallelFor(
- pti.numParticles(),
+ num_particles,
[=] AMREX_GPU_DEVICE (long i) {
Real qp = q;
if (ion_lev){ qp *= ion_lev[i]; }
@@ -1655,7 +1676,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
);
} else {
amrex::Abort("Unknown particle pusher");
- };
+ }
}
void