diff options
author | 2019-08-02 09:24:01 -0700 | |
---|---|---|
committer | 2019-08-02 09:24:01 -0700 | |
commit | ae96f412292262174bd89a2fe4e559b517f5b0d1 (patch) | |
tree | f0cdd196d14ab0ac31c9d6c67814ffa2bdc82e68 /Source/Particles/PhysicalParticleContainer.cpp | |
parent | d2b7952caeccf6fad0a45d8dea3dfb84d6559a04 (diff) | |
download | WarpX-ae96f412292262174bd89a2fe4e559b517f5b0d1.tar.gz WarpX-ae96f412292262174bd89a2fe4e559b517f5b0d1.tar.zst WarpX-ae96f412292262174bd89a2fe4e559b517f5b0d1.zip |
remove particles below or above density thresholds
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index a34fb69e2..2d15c51b1 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -320,6 +320,8 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) Real gamma_boost = WarpX::gamma_boost; Real beta_boost = WarpX::beta_boost; Real t = WarpX::GetInstance().gett_new(lev); + Real density_min = plasma_injector->density_min; + Real density_max = plasma_injector->density_max; #ifdef WARPX_RZ bool radially_weighted = plasma_injector->radially_weighted; @@ -519,6 +521,11 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) } u = inj_mom->getMomentum(x, y, z); dens = inj_rho->getDensity(x, y, z); + // Remove particle if density below threshold + if ( (dens < density_min) || (dens > density_max) ){ + p.id() = -1; + return; + } } else { // Boosted-frame simulation // Since the user provides the density distribution @@ -546,6 +553,11 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) } // call `getDensity` with lab-frame parameters dens = inj_rho->getDensity(x, y, z0_lab); + // Remove particle if density below threshold + if ( (dens < density_min) || (dens > density_max) ){ + p.id() = -1; + return; + } // At this point u and dens are the lab-frame quantities // => Perform Lorentz transform dens = gamma_boost * dens * ( 1.0 - beta_boost*betaz_lab ); |