aboutsummaryrefslogtreecommitdiff
path: root/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2022-09-02 18:08:06 +0200
committerGravatar GitHub <noreply@github.com> 2022-09-02 09:08:06 -0700
commitd73bfa1f13efe9efcebc97f823aca8c96ac1f723 (patch)
tree9edcb2270ca6c3d12e2936d8d2341254f2744ced /Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp
parent09940d721ac2cbb6173f7a3855a969f1f6e98bce (diff)
downloadWarpX-d73bfa1f13efe9efcebc97f823aca8c96ac1f723.tar.gz
WarpX-d73bfa1f13efe9efcebc97f823aca8c96ac1f723.tar.zst
WarpX-d73bfa1f13efe9efcebc97f823aca8c96ac1f723.zip
Remove some magic numbers (#3355)
* remove some magic numbers * fixed unreachable code issue * fixed issue with unreachable code * fixed issue with unreachable code * remove type traits * revert one change in Gaussian Laser * improved ParticleExtrema * fix bug
Diffstat (limited to 'Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp')
-rw-r--r--Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp
index 1440222c5..6ea8070db 100644
--- a/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp
+++ b/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp
@@ -69,10 +69,21 @@ WarpXLaserProfiles::HarrisLaserProfile::fill_amplitude (
// time envelope is given by the Harris function
Real time_envelope = 0.;
+
+ constexpr auto norm = 1._rt/32._rt;
+ constexpr auto c_0 = 10._rt;
+ constexpr auto c_1 = -15._rt;
+ constexpr auto c_2 = 6._rt;
+ constexpr auto c_3 = -1._rt;
+ constexpr auto a_1 = 1._rt;
+ constexpr auto a_2 = 2._rt;
+ constexpr auto a_3 = 3._rt;
+
if (t < m_params.duration)
- time_envelope = 1._rt/32._rt * (10._rt - 15._rt*std::cos(arg_env) +
- 6._rt*std::cos(2._rt*arg_env) -
- std::cos(3._rt*arg_env));
+ time_envelope = norm * (c_0 +
+ c_1*std::cos(a_1*arg_env) +
+ c_2*std::cos(a_2*arg_env) +
+ c_3*std::cos(a_3*arg_env));
// Copy member variables to tmp copies for GPU runs.
const auto tmp_e_max = m_common_params.e_max;