aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/MultiParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-05-16 17:46:58 -0700
committerGravatar MaxThevenet <mthevenet@lbl.gov> 2019-05-16 17:46:58 -0700
commitc238eab6e20f732facdef32909f368b9436fb964 (patch)
treebc1200e2ba6d2b334d373fcc74049836f8dd491b /Source/Particles/MultiParticleContainer.cpp
parent415ba8efd434f1501d943def457fb0ed1555a7df (diff)
downloadWarpX-c238eab6e20f732facdef32909f368b9436fb964.tar.gz
WarpX-c238eab6e20f732facdef32909f368b9436fb964.tar.zst
WarpX-c238eab6e20f732facdef32909f368b9436fb964.zip
Photons are derived class from PhysicalParticleContainer
Diffstat (limited to 'Source/Particles/MultiParticleContainer.cpp')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 6d618c096..b4abe8b76 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -22,6 +22,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]->deposit_on_main_grid = deposit_on_main_grid[i];
}
@@ -78,9 +81,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
deposit_on_main_grid.resize(nspecies, 0);
std::vector<std::string> tmp;
pp.queryarr("deposit_on_main_grid", tmp);
@@ -93,9 +98,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);
@@ -104,6 +109,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);