aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/MultiParticleContainer.H43
-rw-r--r--Source/Particles/MultiParticleContainer.cpp39
2 files changed, 46 insertions, 36 deletions
diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H
index d1df20f39..a76fd89e3 100644
--- a/Source/Particles/MultiParticleContainer.H
+++ b/Source/Particles/MultiParticleContainer.H
@@ -52,24 +52,24 @@ public:
const amrex::Vector<std::unique_ptr<amrex::FabArray<amrex::BaseFab<int> > > >& masks);
///
- /// This evolves all the particles by one PIC time step, including charge deposition, the
+ /// This evolves all the particles by one PIC time step, including charge deposition, the
/// field solve, and pushing the particles, for all the species in the MultiParticleContainer.
/// This is the electrostatic version.
///
- void EvolveES (const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3> >& E,
- amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho,
+ void EvolveES (const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3> >& E,
+ amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho,
amrex::Real t, amrex::Real dt);
///
- /// This pushes the particle positions by one half time step for all the species in the
+ /// This pushes the particle positions by one half time step for all the species in the
/// MultiParticleContainer. It is used to desynchronize the particles after initializaton
/// or when restarting from a checkpoint. This is the electrostatic version.
- ///
+ ///
void PushXES (amrex::Real dt);
///
/// This deposits the particle charge onto rho, accumulating the value for all the species
- /// in the MultiParticleContainer. rho is assumed to contain node-centered multifabs.
+ /// in the MultiParticleContainer. rho is assumed to contain node-centered multifabs.
/// This version is hard-coded for CIC deposition.
///
void DepositCharge(amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, bool local = false);
@@ -80,14 +80,14 @@ public:
///
amrex::Real sumParticleCharge(bool local = false);
#endif // WARPX_DO_ELECTROSTATIC
-
+
///
/// Performs the field gather operation using the input fields E and B, for all the species
/// in the MultiParticleContainer. This is the electromagnetic version of the field gather.
///
void FieldGather (int lev,
const amrex::MultiFab& Ex, const amrex::MultiFab& Ey, const amrex::MultiFab& Ez,
- const amrex::MultiFab& Bx, const amrex::MultiFab& By, const amrex::MultiFab& Bz);
+ const amrex::MultiFab& Bx, const amrex::MultiFab& By, const amrex::MultiFab& Bz);
///
/// This evolves all the particles by one PIC time step, including current deposition, the
@@ -97,8 +97,8 @@ public:
void Evolve (int lev,
const amrex::MultiFab& Ex, const amrex::MultiFab& Ey, const amrex::MultiFab& Ez,
const amrex::MultiFab& Bx, const amrex::MultiFab& By, const amrex::MultiFab& Bz,
- amrex::MultiFab& jx, amrex::MultiFab& jy, amrex::MultiFab& jz,
- amrex::MultiFab* cjx, amrex::MultiFab* cjy, amrex::MultiFab* cjz,
+ amrex::MultiFab& jx, amrex::MultiFab& jy, amrex::MultiFab& jz,
+ amrex::MultiFab* cjx, amrex::MultiFab* cjy, amrex::MultiFab* cjz,
amrex::MultiFab* rho, amrex::MultiFab* crho,
const amrex::MultiFab* cEx, const amrex::MultiFab* cEy, const amrex::MultiFab* cEz,
const amrex::MultiFab* cBx, const amrex::MultiFab* cBy, const amrex::MultiFab* cBz,
@@ -108,7 +108,7 @@ public:
/// This pushes the particle positions by one half time step for all the species in the
/// MultiParticleContainer. It is used to desynchronize the particles after initializaton
/// or when restarting from a checkpoint. This is the electromagnetic version.
- ///
+ ///
void PushX (amrex::Real dt);
///
@@ -116,7 +116,7 @@ public:
/// MultiParticleContainer. It is used to desynchronize the particles after initializaton
/// or when restarting from a checkpoint. It is also used to synchronize particles at the
/// the end of the run. This is the electromagnetic version.
- ///
+ ///
void PushP (int lev, amrex::Real dt,
const amrex::MultiFab& Ex, const amrex::MultiFab& Ey, const amrex::MultiFab& Ez,
const amrex::MultiFab& Bx, const amrex::MultiFab& By, const amrex::MultiFab& Bz);
@@ -125,14 +125,14 @@ public:
/// This deposits the particle charge onto a node-centered MultiFab and returns a unique ptr
/// to it. The charge density is accumulated over all the particles in the MultiParticleContainer
/// This version uses PICSAR routines to perform the deposition.
- ///
+ ///
std::unique_ptr<amrex::MultiFab> GetChargeDensity(int lev, bool local = false);
void Checkpoint (const std::string& dir) const;
void WritePlotFile( const std::string& dir,
const amrex::Vector<std::string>& real_names) const;
-
+
void Restart (const std::string& dir);
void PostRestart ();
@@ -174,7 +174,7 @@ public:
const amrex::Real t_boost, const amrex::Real t_lab, const amrex::Real dt,
amrex::Vector<WarpXParticleContainer::DiagnosticParticleData>& parts) const;
- // Inject particles during the simulation (for particles entering the
+ // Inject particles during the simulation (for particles entering the
// simulation domain after some iterations, due to flowing plasma and/or
// moving window).
void ContinuousInjection(const amrex::RealBox& injection_box) const;
@@ -182,10 +182,10 @@ public:
void UpdateContinuousInjectionPosition(amrex::Real dt) const;
int doContinuousInjection() const;
- //
+ //
// Parameters for the Cherenkov corrector in the FDTD solver.
// Both stencils are calculated ar runtime.
- //
+ //
// Number of coefficients for the stencil of the NCI corrector.
// The stencil is applied in the z direction only.
static constexpr int nstencilz_fdtd_nci_corr=5;
@@ -196,7 +196,12 @@ public:
std::vector<std::string> GetSpeciesNames() const { return species_names; }
PhysicalParticleContainer& GetPCtmp () { return *pc_tmp; }
-
+
+ //bw_engine is a public member of the MultiParticleContainer object
+#ifdef WARPX_QED
+ pxrmp::breit_wheeler_engine<amrex::Real, amrex_rng_wrapper> bw_engine;
+#endif
+
protected:
// Particle container types
@@ -221,7 +226,7 @@ private:
// Number of species dumped in BoostedFrameDiagnostics
int nspecies_boosted_frame_diags = 0;
- // map_species_boosted_frame_diags[i] is the species ID in
+ // map_species_boosted_frame_diags[i] is the species ID in
// MultiParticleContainer for 0<i<nspecies_boosted_frame_diags
std::vector<int> map_species_boosted_frame_diags;
int do_boosted_frame_diags = 0;
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index b4abe8b76..d1e28fd1f 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -11,6 +11,11 @@ using namespace amrex;
constexpr int MultiParticleContainer::nstencilz_fdtd_nci_corr;
MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
+#ifdef WARPX_QED
+ :
+ bw_engine{std::move(amrex_rng_wrapper{})}//, default_lambda};//, bw_ctrl};
+#endif
+
{
ReadParameters();
@@ -27,7 +32,7 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
}
allcontainers[i]->deposit_on_main_grid = deposit_on_main_grid[i];
}
-
+
for (int i = nspecies; i < nspecies+nlasers; ++i) {
allcontainers[i].reset(new LaserParticleContainer(amr_core,i, lasers_names[i-nspecies]));
}
@@ -195,7 +200,7 @@ MultiParticleContainer::Evolve (int lev,
const MultiFab& Ex, const MultiFab& Ey, const MultiFab& Ez,
const MultiFab& Bx, const MultiFab& By, const MultiFab& Bz,
MultiFab& jx, MultiFab& jy, MultiFab& jz,
- MultiFab* cjx, MultiFab* cjy, MultiFab* cjz,
+ MultiFab* cjx, MultiFab* cjy, MultiFab* cjz,
MultiFab* rho,
const MultiFab* cEx, const MultiFab* cEy, const MultiFab* cEz,
const MultiFab* cBx, const MultiFab* cBy, const MultiFab* cBz,
@@ -211,7 +216,7 @@ MultiParticleContainer::Evolve (int lev,
for (auto& pc : allcontainers) {
pc->Evolve(lev, Ex, Ey, Ez, Bx, By, Bz, jx, jy, jz, cjx, cjy, cjz,
rho, cEx, cEy, cEz, cBx, cBy, cBz, t, dt);
- }
+ }
}
void
@@ -407,7 +412,7 @@ MultiParticleContainer
{
BL_PROFILE("MultiParticleContainer::GetLabFrameData");
-
+
// Loop over particle species
for (int i = 0; i < nspecies_boosted_frame_diags; ++i){
int isp = map_species_boosted_frame_diags[i];
@@ -416,41 +421,41 @@ MultiParticleContainer
pc->GetParticleSlice(direction, z_old, z_new, t_boost, t_lab, dt, diagnostic_particles);
// Here, diagnostic_particles[lev][index] is a WarpXParticleContainer::DiagnosticParticleData
// where "lev" is the AMR level and "index" is a [grid index][tile index] pair.
-
+
// Loop over AMR levels
for (int lev = 0; lev <= pc->finestLevel(); ++lev){
- // Loop over [grid index][tile index] pairs
- // and Fills parts[species number i] with particle data from all grids and
- // tiles in diagnostic_particles. parts contains particles from all
+ // Loop over [grid index][tile index] pairs
+ // and Fills parts[species number i] with particle data from all grids and
+ // tiles in diagnostic_particles. parts contains particles from all
// AMR levels indistinctly.
for (auto it = diagnostic_particles[lev].begin(); it != diagnostic_particles[lev].end(); ++it){
// it->first is the [grid index][tile index] key
- // it->second is the corresponding
+ // it->second is the corresponding
// WarpXParticleContainer::DiagnosticParticleData value
parts[i].GetRealData(DiagIdx::w).insert( parts[i].GetRealData(DiagIdx::w ).end(),
it->second.GetRealData(DiagIdx::w ).begin(),
it->second.GetRealData(DiagIdx::w ).end());
-
+
parts[i].GetRealData(DiagIdx::x).insert( parts[i].GetRealData(DiagIdx::x ).end(),
it->second.GetRealData(DiagIdx::x ).begin(),
it->second.GetRealData(DiagIdx::x ).end());
-
+
parts[i].GetRealData(DiagIdx::y).insert( parts[i].GetRealData(DiagIdx::y ).end(),
it->second.GetRealData(DiagIdx::y ).begin(),
it->second.GetRealData(DiagIdx::y ).end());
-
+
parts[i].GetRealData(DiagIdx::z).insert( parts[i].GetRealData(DiagIdx::z ).end(),
it->second.GetRealData(DiagIdx::z ).begin(),
it->second.GetRealData(DiagIdx::z ).end());
-
+
parts[i].GetRealData(DiagIdx::ux).insert( parts[i].GetRealData(DiagIdx::ux).end(),
it->second.GetRealData(DiagIdx::ux).begin(),
it->second.GetRealData(DiagIdx::ux).end());
-
+
parts[i].GetRealData(DiagIdx::uy).insert( parts[i].GetRealData(DiagIdx::uy).end(),
it->second.GetRealData(DiagIdx::uy).begin(),
it->second.GetRealData(DiagIdx::uy).end());
-
+
parts[i].GetRealData(DiagIdx::uz).insert( parts[i].GetRealData(DiagIdx::uz).end(),
it->second.GetRealData(DiagIdx::uz).begin(),
it->second.GetRealData(DiagIdx::uz).end());
@@ -461,7 +466,7 @@ MultiParticleContainer
/* \brief Continuous injection for particles initially outside of the domain.
* \param injection_box: Domain where new particles should be injected.
- * Loop over all WarpXParticleContainer in MultiParticleContainer and
+ * Loop over all WarpXParticleContainer in MultiParticleContainer and
* calls virtual function ContinuousInjection.
*/
void
@@ -477,7 +482,7 @@ MultiParticleContainer::ContinuousInjection(const RealBox& injection_box) const
/* \brief Update position of continuous injection parameters.
* \param dt: simulation time step (level 0)
- * All classes inherited from WarpXParticleContainer do not have
+ * All classes inherited from WarpXParticleContainer do not have
* a position to update (PhysicalParticleContainer does not do anything).
*/
void