aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/PlasmaInjector.cpp
diff options
context:
space:
mode:
authorGravatar Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> 2022-02-16 20:11:35 +0100
committerGravatar GitHub <noreply@github.com> 2022-02-16 11:11:35 -0800
commitcb79a956f70204b12ed37646ea1bb5a2eea307f4 (patch)
tree3014adf4893c8797ab80f6d14add39ab36b67bd5 /Source/Initialization/PlasmaInjector.cpp
parent64e8c51a26202def1d9aec73ec43ed07cb82a9e2 (diff)
downloadWarpX-cb79a956f70204b12ed37646ea1bb5a2eea307f4.tar.gz
WarpX-cb79a956f70204b12ed37646ea1bb5a2eea307f4.tar.zst
WarpX-cb79a956f70204b12ed37646ea1bb5a2eea307f4.zip
Gaussian particle beam: add error message when using y_rms = 0 in 2D (#2862)
Diffstat (limited to '')
-rw-r--r--Source/Initialization/PlasmaInjector.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp
index 1912f3679..6026f28a6 100644
--- a/Source/Initialization/PlasmaInjector.cpp
+++ b/Source/Initialization/PlasmaInjector.cpp
@@ -55,6 +55,8 @@ PlasmaInjector::PlasmaInjector () {}
PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
: species_id(ispecies), species_name(name)
{
+ using namespace amrex::literals;
+
amrex::ParmParse pp_species_name(species_name);
#ifdef AMREX_USE_GPU
@@ -211,6 +213,19 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
pp_species_name.query("do_symmetrize", do_symmetrize);
gaussian_beam = true;
parseMomentum(pp_species_name);
+#if defined(WARPX_DIM_XZ)
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( y_rms > 0._rt,
+ "Error: Gaussian beam y_rms must be strictly greater than 0 in 2D "
+ "(it is used when computing the particles' weights from the total beam charge)");
+#elif defined(WARPX_DIM_1D_Z)
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( x_rms > 0._rt,
+ "Error: Gaussian beam x_rms must be strictly greater than 0 in 1D "
+ "(it is used when computing the particles' weights from the total beam charge)");
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE( y_rms > 0._rt,
+ "Error: Gaussian beam y_rms must be strictly greater than 0 in 1D "
+ "(it is used when computing the particles' weights from the total beam charge)");
+#endif
+
}
// Depending on injection type at runtime, initialize inj_pos
// so that inj_pos->getPositionUnitBox calls