diff options
author | 2019-09-30 09:50:03 +0200 | |
---|---|---|
committer | 2019-09-30 09:50:03 +0200 | |
commit | 8f375c0c07f17b27115b61b95d21cf9bb8f554e7 (patch) | |
tree | ee08a45ab27b8a26c5b4806cb9982e53b15e5e7f /Source/Particles/PhysicalParticleContainer.cpp | |
parent | 3e221d910108b9322af0cd127e4cbe44a249bbc6 (diff) | |
download | WarpX-8f375c0c07f17b27115b61b95d21cf9bb8f554e7.tar.gz WarpX-8f375c0c07f17b27115b61b95d21cf9bb8f554e7.tar.zst WarpX-8f375c0c07f17b27115b61b95d21cf9bb8f554e7.zip |
merged with dev
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 3d727af84..f3b1bdce7 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1568,7 +1568,13 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti, const Real q = this->charge; const Real m = this-> mass; - if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Boris){ + + // Boris + RR is enabled only for leptons + auto algo = WarpX::particle_pusher_algo; + if (!AmIALepton() && algo == ParticlePusherAlgo::BorisRR) + algo = ParticlePusherAlgo::Boris; + + if (algo == ParticlePusherAlgo::Boris){ amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { @@ -1581,7 +1587,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti, ux[i], uy[i], uz[i], dt ); } ); - } else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Vay) { + } else if (algo == ParticlePusherAlgo::Vay) { amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { @@ -1594,7 +1600,7 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti, ux[i], uy[i], uz[i], dt ); } ); - } else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::BorisRR) { + } else if (algo == ParticlePusherAlgo::BorisRR) { amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { @@ -1688,21 +1694,27 @@ PhysicalParticleContainer::PushP (int lev, Real dt, // Loop over the particles and update their momentum const Real q = this->charge; const Real m = this-> mass; - if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Boris){ + + // Boris + RR is enabled only for leptons + auto algo = WarpX::particle_pusher_algo; + if (!AmIALepton() && algo == ParticlePusherAlgo::BorisRR) + algo = ParticlePusherAlgo::Boris; + + if (algo == ParticlePusherAlgo::Boris){ amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { UpdateMomentumBoris( ux[i], uy[i], uz[i], Expp[i], Eypp[i], Ezpp[i], Bxpp[i], Bypp[i], Bzpp[i], q, m, dt); } ); - } else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::Vay) { + } else if (algo == ParticlePusherAlgo::Vay) { amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { UpdateMomentumVay( ux[i], uy[i], uz[i], Expp[i], Eypp[i], Ezpp[i], Bxpp[i], Bypp[i], Bzpp[i], q, m, dt); } ); - } else if (WarpX::particle_pusher_algo == ParticlePusherAlgo::BorisRR) { + } else if (algo == ParticlePusherAlgo::BorisRR) { amrex::ParallelFor( pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { UpdateMomentumBorisWithRadiationReaction( ux[i], uy[i], uz[i], @@ -2149,3 +2161,10 @@ PhysicalParticleContainer::buildIonizationMask (const amrex::MFIter& mfi, const } ); } + +//This function return true if the PhysicalParticleContainer contains electrons +//or positrons, false otherwise +bool +PhysicalParticleContainer::AmIALepton(){ + return (this-> mass == PhysConst::m_e); +} |