aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhotonParticleContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/PhotonParticleContainer.cpp')
-rw-r--r--Source/Particles/PhotonParticleContainer.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp
index 55dc839eb..71202c7fd 100644
--- a/Source/Particles/PhotonParticleContainer.cpp
+++ b/Source/Particles/PhotonParticleContainer.cpp
@@ -21,12 +21,27 @@ using namespace amrex;
PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecies,
const std::string& name)
: PhysicalParticleContainer(amr_core, ispecies, name)
-{}
+{
+
+ ParmParse pp(species_name);
+
+#ifdef WARPX_QED
+ //IF do_qed is enabled, find out if Breit Wheeler process is enabled
+ if(do_qed)
+ pp.query("do_qed_breit_wheeler", do_qed_breit_wheeler);
+#endif
+
+}
void PhotonParticleContainer::InitData()
{
AddParticles(0); // Note - add on level 0
+#ifdef WARPX_QED
+ if(do_qed_breit_wheeler)
+ InitTauBreitWheeler();
+#endif
+
if (maxLevel() > 0) {
Redistribute(); // We then redistribute
}
@@ -99,3 +114,23 @@ PhotonParticleContainer::Evolve (int lev,
t, dt);
}
+
+#ifdef WARPX_QED
+// A function to initialize the Tau component according to the BW engine
+void PhotonParticleContainer::InitTauBreitWheeler()
+{
+ BL_PROFILE("PhotonParticleContainer::InitOpticalDepth");
+ //Looping over all the particles
+ int num_levels = finestLevel() + 1;
+ for (int lev=0; lev < num_levels; ++lev)
+ for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti){
+ auto taus = pti.GetAttribs(particle_comps["tau"]).dataPtr();
+ amrex::ParallelFor(
+ pti.numParticles(),
+ [=] AMREX_GPU_DEVICE (long i) {
+ taus[i] = warpx_breit_wheeler_engine::get_optical_depth();
+ }
+ );
+ }
+}
+#endif