aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles')
-rw-r--r--Source/Particles/PhysicalParticleContainer.H7
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp12
2 files changed, 14 insertions, 5 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H
index 08682c581..8e3bfdb86 100644
--- a/Source/Particles/PhysicalParticleContainer.H
+++ b/Source/Particles/PhysicalParticleContainer.H
@@ -200,7 +200,7 @@ public:
void MapParticletoBoostedFrame (amrex::ParticleReal& x, amrex::ParticleReal& y, amrex::ParticleReal& z,
amrex::ParticleReal& ux, amrex::ParticleReal& uy, amrex::ParticleReal& uz,
- amrex::ParticleReal t_lab = 0._prt);
+ amrex::Real t_lab = 0._prt);
void AddGaussianBeam (
const amrex::Real x_m, const amrex::Real y_m, const amrex::Real z_m,
@@ -226,7 +226,7 @@ public:
amrex::Gpu::HostVector<amrex::ParticleReal>& particle_uy,
amrex::Gpu::HostVector<amrex::ParticleReal>& particle_uz,
amrex::Gpu::HostVector<amrex::ParticleReal>& particle_w,
- amrex::ParticleReal t_lab= 0._prt);
+ amrex::Real t_lab= 0._prt);
/**
* \brief Default initialize runtime attributes in a tile. This routine does not initialize the
@@ -359,6 +359,9 @@ protected:
bool do_backward_propagation = false;
bool m_rz_random_theta = true;
+ // Impose t_lab from the openPMD file for externally loaded species
+ bool impose_t_lab_from_file = false;
+
Resampling m_resampler;
// Inject particles during the whole simulation
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index e5cb281e7..7fd85833e 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -393,7 +393,7 @@ void PhysicalParticleContainer::InitData ()
}
void PhysicalParticleContainer::MapParticletoBoostedFrame (
- ParticleReal& x, ParticleReal& y, ParticleReal& z, ParticleReal& ux, ParticleReal& uy, ParticleReal& uz, ParticleReal t_lab)
+ ParticleReal& x, ParticleReal& y, ParticleReal& z, ParticleReal& ux, ParticleReal& uy, ParticleReal& uz, Real t_lab)
{
// Map the particles from the lab frame to the boosted frame.
// This boosts the particle to the lab frame and calculates
@@ -592,7 +592,13 @@ PhysicalParticleContainer::AddPlasmaFromFile(ParticleReal q_tot,
// assumption asserts: see PlasmaInjector
openPMD::Iteration it = series->iterations.begin()->second;
- double const t_lab = it.time<double>() * it.timeUnitSI();
+ const ParmParse pp_species_name(species_name);
+ pp_species_name.query("impose_t_lab_from_file", impose_t_lab_from_file);
+ double t_lab = 0._prt;
+ if (impose_t_lab_from_file) {
+ // Impose t_lab as being the time stored in the openPMD file
+ t_lab = it.time<double>() * it.timeUnitSI();
+ }
std::string const ps_name = it.particles.begin()->first;
openPMD::ParticleSpecies ps = it.particles.begin()->second;
@@ -816,7 +822,7 @@ PhysicalParticleContainer::CheckAndAddParticle (
Gpu::HostVector<ParticleReal>& particle_uy,
Gpu::HostVector<ParticleReal>& particle_uz,
Gpu::HostVector<ParticleReal>& particle_w,
- ParticleReal t_lab)
+ Real t_lab)
{
if (WarpX::gamma_boost > 1.) {
MapParticletoBoostedFrame(x, y, z, ux, uy, uz, t_lab);