aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/MultiParticleContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/MultiParticleContainer.cpp')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index d5ad7a366..8a4d1cf18 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -8,8 +8,16 @@
using namespace amrex;
+#ifdef WARPX_QED
+MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core):
+ bw_engine{std::move(init_warpx_breit_wheeler_engine())}
+#else
MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
+#endif
{
+
+
+
ReadParameters();
allcontainers.resize(nspecies + nlasers);
@@ -20,6 +28,9 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
else if (species_types[i] == PCTypes::RigidInjected) {
allcontainers[i].reset(new RigidInjectedParticleContainer(amr_core, i, species_names[i]));
}
+ else if (species_types[i] == PCTypes::Photon) {
+ allcontainers[i].reset(new PhotonParticleContainer(amr_core, i, species_names[i]));
+ }
allcontainers[i]->m_deposit_on_main_grid = m_deposit_on_main_grid[i];
allcontainers[i]->m_gather_from_main_grid = m_gather_from_main_grid[i];
}
@@ -57,9 +68,11 @@ MultiParticleContainer::ReadParameters ()
BL_ASSERT(nspecies >= 0);
if (nspecies > 0) {
+ // Get species names
pp.getarr("species_names", species_names);
BL_ASSERT(species_names.size() == nspecies);
+ // Get species to deposit on main grid
m_deposit_on_main_grid.resize(nspecies, false);
std::vector<std::string> tmp;
pp.queryarr("deposit_on_main_grid", tmp);
@@ -82,9 +95,9 @@ MultiParticleContainer::ReadParameters ()
species_types.resize(nspecies, PCTypes::Physical);
+ // Get rigid-injected species
std::vector<std::string> rigid_injected_species;
pp.queryarr("rigid_injected_species", rigid_injected_species);
-
if (!rigid_injected_species.empty()) {
for (auto const& name : rigid_injected_species) {
auto it = std::find(species_names.begin(), species_names.end(), name);
@@ -93,6 +106,18 @@ MultiParticleContainer::ReadParameters ()
species_types[i] = PCTypes::RigidInjected;
}
}
+ // Get photon species
+ std::vector<std::string> photon_species;
+ pp.queryarr("photon_species", photon_species);
+ if (!photon_species.empty()) {
+ for (auto const& name : photon_species) {
+ auto it = std::find(species_names.begin(), species_names.end(), name);
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(it != species_names.end(), "ERROR: species in particles.rigid_injected_species must be part of particles.species_names");
+ int i = std::distance(species_names.begin(), it);
+ species_types[i] = PCTypes::Photon;
+ }
+ }
+
}
pp.query("use_fdtd_nci_corr", WarpX::use_fdtd_nci_corr);
@@ -129,6 +154,31 @@ MultiParticleContainer::InitData ()
// For each species, get the ID of its product species.
// This is used for ionization and pair creation processes.
mapSpeciesProduct();
+
+#ifdef WARPX_QED
+
+ //Helper function
+ auto does_file_exist = [](const char *fileName)
+ {return (std::ifstream{fileName}).good(); };
+
+ //Initialize the lookup tables
+ //Generates tables if they do not exist
+ if(!does_file_exist("bw_engine_dndt.bin")){
+ bw_engine.compute_dN_dt_lookup_table(&std::cout);
+ bw_engine.write_dN_dt_table("bw_engine_dndt.bin");
+ }
+ else{
+ bw_engine.read_dN_dt_table("bw_engine_dndt.bin");
+ }
+
+ if(!does_file_exist("bw_engine_pair.bin")){
+ bw_engine.compute_cumulative_pair_table(&std::cout);
+ bw_engine.write_cumulative_pair_table("bw_engine_pair.bin");
+ }
+ else{
+ bw_engine.read_cumulative_pair_table("bw_engine_pair.bin");
+ }
+#endif
}