Skip to content

Commit

Permalink
Fix QED Physics Init
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jul 19, 2024
1 parent 2e3d17a commit dc71c1c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Source/Particles/MultiParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ MultiParticleContainer::InitData ()
void
MultiParticleContainer::PostRestart ()
{
InitMultiPhysicsModules(); // TODO: move down?

for (auto& pc : allcontainers) {
pc->PostRestart();
}
pc_tmp->PostRestart();

InitMultiPhysicsModules();
}

void
Expand All @@ -443,8 +443,8 @@ MultiParticleContainer::InitMultiPhysicsModules ()
mapSpeciesProduct();
CheckIonizationProductSpecies();
#ifdef WARPX_QED
CheckQEDProductSpecies();
InitQED();
CheckQEDProductSpecies();
#endif
}

Expand Down
10 changes: 10 additions & 0 deletions Source/Particles/PhotonParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#include "PhotonParticleContainer.H"

#include "Particles/SpeciesPhysicalProperties.H"
#ifdef WARPX_QED
# include "Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H"
#endif
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand All @@ -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
Expand Down
32 changes: 15 additions & 17 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<int>(m_user_int_attribs.size());
Expand Down
2 changes: 2 additions & 0 deletions Source/Particles/RigidInjectedParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc71c1c

Please sign in to comment.