From 1b58d52a8ab84ccfce1a992c5d5d65f2aea97a0e Mon Sep 17 00:00:00 2001 From: Ilian Kara-Mostefa <95044023+IlianCS@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:57:59 -0700 Subject: t_lab optionally imposed for externally loaded species in the boosted frame (#4153) * added guidelines * added impose t_lab from file as an option * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * removed unused comment * fixed unconsistent variable type * removed space * rearranged code changes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- Source/Particles/PhysicalParticleContainer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Source/Particles/PhysicalParticleContainer.cpp') 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() * 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() * 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& particle_uy, Gpu::HostVector& particle_uz, Gpu::HostVector& particle_w, - ParticleReal t_lab) + Real t_lab) { if (WarpX::gamma_boost > 1.) { MapParticletoBoostedFrame(x, y, z, ux, uy, uz, t_lab); -- cgit v1.2.3