aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/LaserParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <maxence.thevenet@desy.de> 2021-03-17 08:15:50 +0100
committerGravatar GitHub <noreply@github.com> 2021-03-17 00:15:50 -0700
commita6fdf159cc15c46e5c2fbe711086b4e094935d55 (patch)
tree928c7e697a7b2d17a9d36245ef2c9848a2e62c07 /Source/Particles/LaserParticleContainer.cpp
parent349a7797845e4a14b87fb256e860bdc377017892 (diff)
downloadWarpX-a6fdf159cc15c46e5c2fbe711086b4e094935d55.tar.gz
WarpX-a6fdf159cc15c46e5c2fbe711086b4e094935d55.tar.zst
WarpX-a6fdf159cc15c46e5c2fbe711086b4e094935d55.zip
Add option to specify a0 instead of e_max for the laser (#1770)
* add option to pass a0 instead of e_max for the laser e_max xor a0 must be specified * update doc for laser a0 * a0: Update Examples Using all options so they are tested. * reset benchmarks (precision E0->a0) Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/Particles/LaserParticleContainer.cpp')
-rw-r--r--Source/Particles/LaserParticleContainer.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/Particles/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp
index 1f3036f94..b3c07b16c 100644
--- a/Source/Particles/LaserParticleContainer.cpp
+++ b/Source/Particles/LaserParticleContainer.cpp
@@ -52,7 +52,20 @@ LaserParticleContainer::LaserParticleContainer (AmrCore* amr_core, int ispecies,
pp.query("pusher_algo", m_pusher_algo);
getWithParser(pp, "wavelength", m_wavelength);
- getWithParser(pp, "e_max", m_e_max);
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
+ m_wavelength > 0, "The laser wavelength must be >0.");
+ const bool e_max_is_specified = queryWithParser(pp, "e_max", m_e_max);
+ Real a0;
+ const bool a0_is_specified = queryWithParser(pp, "a0", a0);
+ if (a0_is_specified){
+ Real omega = 2._rt*MathConst::pi*PhysConst::c/m_wavelength;
+ m_e_max = PhysConst::m_e * omega * PhysConst::c * a0 / PhysConst::q_e;
+ }
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
+ e_max_is_specified ^ a0_is_specified,
+ "Exactly one of e_max or a0 must be specified for the laser.\n"
+ );
+
pp.query("do_continuous_injection", do_continuous_injection);
pp.query("min_particles_per_mode", m_min_particles_per_mode);