aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhotonParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-05-16 17:46:58 -0700
committerGravatar MaxThevenet <mthevenet@lbl.gov> 2019-05-16 17:46:58 -0700
commitc238eab6e20f732facdef32909f368b9436fb964 (patch)
treebc1200e2ba6d2b334d373fcc74049836f8dd491b /Source/Particles/PhotonParticleContainer.cpp
parent415ba8efd434f1501d943def457fb0ed1555a7df (diff)
downloadWarpX-c238eab6e20f732facdef32909f368b9436fb964.tar.gz
WarpX-c238eab6e20f732facdef32909f368b9436fb964.tar.zst
WarpX-c238eab6e20f732facdef32909f368b9436fb964.zip
Photons are derived class from PhysicalParticleContainer
Diffstat (limited to 'Source/Particles/PhotonParticleContainer.cpp')
-rw-r--r--Source/Particles/PhotonParticleContainer.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp
new file mode 100644
index 000000000..14af6c0d9
--- /dev/null
+++ b/Source/Particles/PhotonParticleContainer.cpp
@@ -0,0 +1,87 @@
+#include <limits>
+#include <sstream>
+#include <algorithm>
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#include <PhotonParticleContainer.H>
+#include <WarpX_f.H>
+#include <WarpX.H>
+#include <WarpXConst.H>
+
+using namespace amrex;
+
+PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecies,
+ const std::string& name)
+ : PhysicalParticleContainer(amr_core, ispecies, name)
+{
+
+ // This will read <species>.[...] from the inputs file
+ // where <species> is the name of your species
+ ParmParse pp(species_name);
+
+ // read <species>.size_in_inches in the input file, and
+ // store it into member data.
+ pp.query("size_in_inches", size_in_inches);
+
+}
+
+void PhotonParticleContainer::InitData()
+{
+ AddParticles(0); // Note - add on level 0
+ if (maxLevel() > 0) {
+ Redistribute(); // We then redistribute
+ }
+}
+
+void
+PhotonParticleContainer::PushPX(WarpXParIter& pti,
+ Cuda::ManagedDeviceVector<Real>& xp,
+ Cuda::ManagedDeviceVector<Real>& yp,
+ Cuda::ManagedDeviceVector<Real>& zp,
+ Cuda::ManagedDeviceVector<Real>& giv,
+ Real dt)
+{
+ // This wraps the call to warpx_particle_pusher so that inheritors can modify the call.
+ auto& attribs = pti.GetAttribs();
+ auto& uxp = attribs[PIdx::ux];
+ auto& uyp = attribs[PIdx::uy];
+ auto& uzp = attribs[PIdx::uz];
+ auto& Exp = attribs[PIdx::Ex];
+ auto& Eyp = attribs[PIdx::Ey];
+ auto& Ezp = attribs[PIdx::Ez];
+ auto& Bxp = attribs[PIdx::Bx];
+ auto& Byp = attribs[PIdx::By];
+ auto& Bzp = attribs[PIdx::Bz];
+ const long np = pti.numParticles();
+
+ // Probably want to push photons in some way here.
+ // WarpXParticleContainer::PushX(int lev, Real dt) is probably
+ // a good start.
+ // In particular grep ParallelFor thing if you want
+ // to write GPU-compatible code.
+}
+
+void
+PhotonParticleContainer::Evolve (int lev,
+ const MultiFab& Ex, const MultiFab& Ey, const MultiFab& Ez,
+ const MultiFab& Bx, const MultiFab& By, const MultiFab& Bz,
+ MultiFab& jx, MultiFab& jy, MultiFab& jz,
+ MultiFab* cjx, MultiFab* cjy, MultiFab* cjz,
+ MultiFab* rho, MultiFab* crho,
+ const MultiFab* cEx, const MultiFab* cEy, const MultiFab* cEz,
+ const MultiFab* cBx, const MultiFab* cBy, const MultiFab* cBz,
+ Real t, Real dt)
+{
+ PhysicalParticleContainer::Evolve (lev,
+ Ex, Ey, Ez,
+ Bx, By, Bz,
+ jx, jy, jz,
+ cjx, cjy, cjz,
+ rho, crho,
+ cEx, cEy, cEz,
+ cBx, cBy, cBz,
+ t, dt);
+}