From a6fdf159cc15c46e5c2fbe711086b4e094935d55 Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Wed, 17 Mar 2021 08:15:50 +0100 Subject: 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 --- Source/Particles/LaserParticleContainer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Source/Particles/LaserParticleContainer.cpp') 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); -- cgit v1.2.3