diff --git a/KEMField/Source/ExternalFields/MagfieldCoils/CMakeLists.txt b/KEMField/Source/ExternalFields/MagfieldCoils/CMakeLists.txt index a492cd90e..22b8cee53 100644 --- a/KEMField/Source/ExternalFields/MagfieldCoils/CMakeLists.txt +++ b/KEMField/Source/ExternalFields/MagfieldCoils/CMakeLists.txt @@ -48,6 +48,7 @@ target_link_libraries (KEMMagfieldCoils # KEMCore # KEMMath # KEMFieldSolverCore + KEMFieldExceptions ) kasper_install_headers (${MAGFIELDCOILS_HEADERFILES}) diff --git a/KEMField/Source/ExternalFields/MagfieldCoils/src/MagfieldCoils.cxx b/KEMField/Source/ExternalFields/MagfieldCoils/src/MagfieldCoils.cxx index 304c76aea..e9052b21c 100755 --- a/KEMField/Source/ExternalFields/MagfieldCoils/src/MagfieldCoils.cxx +++ b/KEMField/Source/ExternalFields/MagfieldCoils/src/MagfieldCoils.cxx @@ -1,4 +1,5 @@ #include "MagfieldCoils.h" +#include "KEMSimpleException.hh" MagfieldCoils::MagfieldCoils(string inputdirname, string inputobjectname, string inputcoilfilename, int inputNelliptic, @@ -14,6 +15,9 @@ MagfieldCoils::MagfieldCoils(string inputdirname, string inputobjectname, string fcoilfilename = inputcoilfilename; // name of coil input file fNelliptic = inputNelliptic; // radial numerical integration parameter for magnetic field calc. with elliptic integrals + if(inputnmax <= 1) { + throw KEMField::KEMSimpleException("MagfieldCoils: nmax can't be <= 1. A recommended value for nmax is 500.\nThis error was added in May 2024, before results in this case could not be trusted."); + } fnmax = inputnmax; // number of source coefficients for fixed source point: nmax+1 fepstol = inputepstol; // small tolerance parameter needed for the symmetry group definitions // Recommended values: inputNelliptic=32, inputnmax=500, inputepstol=1.e-8.