diff options
author | 2019-08-02 11:31:39 -0700 | |
---|---|---|
committer | 2019-08-02 11:31:39 -0700 | |
commit | 0c6441b735a4226bd9e1b51a7efdf48111745c1b (patch) | |
tree | 6f453ec68fbde4384c3413fb36cc124ca359ff43 /Source | |
parent | ae96f412292262174bd89a2fe4e559b517f5b0d1 (diff) | |
download | WarpX-0c6441b735a4226bd9e1b51a7efdf48111745c1b.tar.gz WarpX-0c6441b735a4226bd9e1b51a7efdf48111745c1b.tar.zst WarpX-0c6441b735a4226bd9e1b51a7efdf48111745c1b.zip |
add max plasma density
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 2d15c51b1..4ece22580 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -522,10 +522,12 @@ 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) ){ + if ( dens < density_min ){ p.id() = -1; return; } + // Cut density if above threshold + dens = amrex::min(dens, density_max); } else { // Boosted-frame simulation // Since the user provides the density distribution @@ -554,10 +556,12 @@ 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) ){ + if ( dens < density_min ){ p.id() = -1; return; } + // Cut density if above threshold + dens = amrex::min(dens, density_max); // At this point u and dens are the lab-frame quantities // => Perform Lorentz transform dens = gamma_boost * dens * ( 1.0 - beta_boost*betaz_lab ); |