diff options
author | 2020-03-23 11:27:34 -0700 | |
---|---|---|
committer | 2020-03-23 11:27:34 -0700 | |
commit | 24aef3703b91c74c9cf049ee863415bb3ce4fbe1 (patch) | |
tree | a10d858f6e6b02df7ff55fa09b9070aacbb8018f /Source/Particles/PhysicalParticleContainer.cpp | |
parent | 90697afc103be5310fc3bf25b52121cad7325cd1 (diff) | |
download | WarpX-24aef3703b91c74c9cf049ee863415bb3ce4fbe1.tar.gz WarpX-24aef3703b91c74c9cf049ee863415bb3ce4fbe1.tar.zst WarpX-24aef3703b91c74c9cf049ee863415bb3ce4fbe1.zip |
Bulk momentum (#831)
* Adding a method to query the bulk rather than total momentum
* update copyright
* use bulk momentum for ballistic correction in add plasma
* also include the ballistic correction for lab frame simulations
* EOL
* bug fixes pointed out in code review
* append bulk to variable names
* in the Langmuir case, the momentum profile does depend on z
* some const
* clarify units of u_over_r in docstring
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 6f634fc25..de0c2d153 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -672,12 +672,20 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) // If the particle is not within the species's // xmin, xmax, ymin, ymax, zmin, zmax, go to // the next generated particle. - if (!inj_pos->insideBounds(xb, yb, z)) { + + // include ballistic correction for plasma species with bulk motion + const XDim3 u_bulk = inj_mom->getBulkMomentum(x, y, z); + const Real gamma_bulk = std::sqrt(1.+(u_bulk.x*u_bulk.x+u_bulk.y*u_bulk.y+u_bulk.z*u_bulk.z)); + const Real betaz_bulk = u.z/gamma_bulk; + const Real z0 = z - PhysConst::c*t*betaz_bulk; + + if (!inj_pos->insideBounds(xb, yb, z0)) { p.id() = -1; return; } - u = inj_mom->getMomentum(x, y, z); - dens = inj_rho->getDensity(x, y, z); + + u = inj_mom->getMomentum(x, y, z0); + dens = inj_rho->getDensity(x, y, z0); // Remove particle if density below threshold if ( dens < density_min ){ p.id() = -1; @@ -697,13 +705,15 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) // // In order for this equation to be solvable, betaz_lab // is explicitly assumed to have no dependency on z0_lab - u = inj_mom->getMomentum(x, y, 0.); // No z0_lab dependency + // + // Note that we use the bulk momentum to perform the ballastic correction + const XDim3 u_bulk = inj_mom->getBulkMomentum(x, y, 0.); // No z0_lab dependency // At this point u is the lab-frame momentum // => Apply the above formula for z0_lab - Real gamma_lab = std::sqrt( 1.+(u.x*u.x+u.y*u.y+u.z*u.z) ); - Real betaz_lab = u.z/(gamma_lab); - Real z0_lab = gamma_boost * ( z*(1-beta_boost*betaz_lab) - - PhysConst::c*t*(betaz_lab-beta_boost) ); + const Real gamma_lab_bulk = std::sqrt(1.+(u_bulk.x*u_bulk.x+u_bulk.y*u_bulk.y+u_bulk.z*u_bulk.z)); + const Real betaz_lab_bulk = u.z/(gamma_lab_bulk); + const Real z0_lab = gamma_boost * ( z*(1-beta_boost*betaz_lab_bulk) + - PhysConst::c*t*(betaz_lab_bulk-beta_boost) ); // If the particle is not within the lab-frame zmin, zmax, etc. // go to the next generated particle. if (!inj_pos->insideBounds(xb, yb, z0_lab)) { @@ -719,6 +729,12 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) } // Cut density if above threshold dens = amrex::min(dens, density_max); + + // get the full momentum, including thermal motion + u = inj_mom->getMomentum(x, y, 0.); + const Real gamma_lab = std::sqrt( 1.+(u.x*u.x+u.y*u.y+u.z*u.z) ); + const Real betaz_lab = u.z/(gamma_lab); + // At this point u and dens are the lab-frame quantities // => Perform Lorentz transform dens = gamma_boost * dens * ( 1.0 - beta_boost*betaz_lab ); |