diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index a1ea7533bc6..1dbcf242acd 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -422,12 +422,12 @@ MultiParticleContainer::InitData () void MultiParticleContainer::PostRestart () { - InitMultiPhysicsModules(); // TODO: move down? - for (auto& pc : allcontainers) { pc->PostRestart(); } pc_tmp->PostRestart(); + + InitMultiPhysicsModules(); } void @@ -443,8 +443,8 @@ MultiParticleContainer::InitMultiPhysicsModules () mapSpeciesProduct(); CheckIonizationProductSpecies(); #ifdef WARPX_QED - CheckQEDProductSpecies(); InitQED(); + CheckQEDProductSpecies(); #endif } diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 4160864eb15..813670e0643 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -7,6 +7,7 @@ */ #include "PhotonParticleContainer.H" +#include "Particles/SpeciesPhysicalProperties.H" #ifdef WARPX_QED # include "Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H" #endif @@ -47,6 +48,12 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, const std::string& name) : PhysicalParticleContainer(amr_core, name) { + // this is a physical photon + physical_species = PhysicalSpecies::photon; + charge = species::get_charge( physical_species ); + mass = species::get_mass( physical_species ); + + // other properties and methods, e.g., QED const ParmParse pp_species_name(species_name); #ifdef WARPX_QED @@ -56,6 +63,7 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, //If Breit Wheeler process is enabled, look for the target electron and positron //species if(m_do_qed_breit_wheeler){ + AddRealComp("opticalDepthBW"); pp_species_name.get("qed_breit_wheeler_ele_product_species", m_qed_breit_wheeler_ele_product_name); pp_species_name.get("qed_breit_wheeler_pos_product_species", m_qed_breit_wheeler_pos_product_name); } @@ -73,6 +81,8 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, void PhotonParticleContainer::InitData() { + PhysicalParticleContainer::InitData(); + AddParticles(0); // Note - add on level 0 Redistribute(); // We then redistribute diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index e536fb30519..6cb26a7cfea 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -251,6 +251,21 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, species_name(name) { BackwardCompatibility(); + +#ifdef WARPX_QED + if (!species_name.empty()) { // TODO: remove this if once pc_tmp is removed from WarpX + const ParmParse pp_species_name(species_name); + pp_species_name.query("do_qed_quantum_sync", m_do_qed_quantum_sync); + if (m_do_qed_quantum_sync) { + AddRealComp("opticalDepthQSR"); + } + + if (m_do_qed_quantum_sync) { + pp_species_name.get("qed_quantum_sync_phot_product_species", + m_qed_quantum_sync_phot_product_name); + } + } +#endif } PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core) @@ -400,23 +415,6 @@ void PhysicalParticleContainer::InitData () "Radiation reaction can be enabled only if Boris pusher is used"); //_____________________________ -#ifdef WARPX_QED - pp_species_name.query("do_qed_quantum_sync", m_do_qed_quantum_sync); - if (m_do_qed_quantum_sync) { - AddRealComp("opticalDepthQSR"); - } - - pp_species_name.query("do_qed_breit_wheeler", m_do_qed_breit_wheeler); - if (m_do_qed_breit_wheeler) { - AddRealComp("opticalDepthBW"); - } - - if(m_do_qed_quantum_sync){ - pp_species_name.get("qed_quantum_sync_phot_product_species", - m_qed_quantum_sync_phot_product_name); - } -#endif - // User-defined integer attributes pp_species_name.queryarr("addIntegerAttributes", m_user_int_attribs); const auto n_user_int_attribs = static_cast(m_user_int_attribs.size()); diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index bc16fa473f1..3b45c1ba55f 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -71,6 +71,8 @@ RigidInjectedParticleContainer::RigidInjectedParticleContainer (AmrCore* amr_cor void RigidInjectedParticleContainer::InitData() { + PhysicalParticleContainer::InitData(); + // Perform Lorentz transform of `z_inject_plane` const amrex::Real t_boost = WarpX::GetInstance().gett_new(0); const amrex::Real zinject_plane_boost = zinject_plane/WarpX::gamma_boost