From d48db8b433b165a7822e914b8fda7636924f1c32 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Thu, 12 Sep 2019 13:52:36 +0200 Subject: Added initialization of tau for photons via BW engine --- Source/Particles/PhotonParticleContainer.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 399892959..e6712657a 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -43,6 +43,11 @@ 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 } @@ -118,3 +123,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_get_optical_depth(); + } + ); + } +} +#endif -- cgit v1.2.3