diff options
author | 2021-11-02 17:34:08 -0700 | |
---|---|---|
committer | 2021-11-03 00:34:08 +0000 | |
commit | 55e5528cfebd958ba341a059f01bdde4ea288e61 (patch) | |
tree | 60eb2fe94e54d76e29bd8d2277ee42190e50799d /Source/Particles/LaserParticleContainer.cpp | |
parent | 3b09e5199b0cd880f9a30d0eb433ca600c2096ec (diff) | |
download | WarpX-55e5528cfebd958ba341a059f01bdde4ea288e61.tar.gz WarpX-55e5528cfebd958ba341a059f01bdde4ea288e61.tar.zst WarpX-55e5528cfebd958ba341a059f01bdde4ea288e61.zip |
Change the way in which the laser particle weight is calculated. (#2417)
* Minor fixes to the laser particles
* Update calculation of the weights for laser antenna particles
* Correct name of the constant epsilon_0
* Correct unused variables
* Update 2D benchmarks
* Update 3D benchmarks
* Update RZ tests
* Update benchmark for pml_x_psatd
* Update energy value
Diffstat (limited to 'Source/Particles/LaserParticleContainer.cpp')
-rw-r--r-- | Source/Particles/LaserParticleContainer.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Source/Particles/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp index 1790f3019..559489f34 100644 --- a/Source/Particles/LaserParticleContainer.cpp +++ b/Source/Particles/LaserParticleContainer.cpp @@ -650,27 +650,26 @@ LaserParticleContainer::ComputeSpacing (int lev, Real& Sx, Real& Sy) const void LaserParticleContainer::ComputeWeightMobility (Real Sx, Real Sy) { - constexpr Real eps = 0.01_rt; - constexpr Real fac = 1.0_rt / (2.0_rt * MathConst::pi * PhysConst::mu0 * PhysConst::c * PhysConst::c * eps); - m_weight = fac * m_wavelength * Sx * Sy / std::min(Sx,Sy) * m_e_max; - // The mobility is the constant of proportionality between the field to // be emitted, and the corresponding velocity that the particles need to have. - m_mobility = (Sx * Sy)/(m_weight * PhysConst::mu0 * PhysConst::c * PhysConst::c); + // We set the mobility so that the particles do not exceed a fraction + // `eps` of the speed of light, at the peak of the laser field. + constexpr Real eps = 0.05_rt; + m_mobility = eps/m_e_max; + m_weight = PhysConst::ep0 / m_mobility; + // Multiply by particle spacing +#if (AMREX_SPACEDIM == 3) + m_weight *= Sx * Sy; +#elif (AMREX_SPACEDIM == 2) + m_weight *= Sx; + amrex::ignore_unused(Sy); +#else + amrex::ignore_unused(Sx,Sy); +#endif // When running in the boosted-frame, the input parameters (and in particular // the amplitude of the field) are given in the lab-frame. // Therefore, the mobility needs to be modified by a factor WarpX::gamma_boost. m_mobility = m_mobility/WarpX::gamma_boost; - - // If mobility is too high (caused by a small wavelength compared to the grid size), - // calculated antenna particle velocities may exceed c, which can cause a segfault. - constexpr Real warning_tol = 0.1_rt; - if (m_wavelength < std::min(Sx,Sy)*warning_tol){ - WarpX::GetInstance().RecordWarning("Laser", - "Laser wavelength seems to be much smaller than the grid size." - " This may cause a segmentation fault", - WarnPriority::high); - } } void |