ascot4fusion / ascot5

ASCOT5 is a high-performance orbit-following code for fusion plasma physics and engineering
https://ascot4fusion.github.io/ascot5/
GNU Lesser General Public License v3.0
31 stars 9 forks source link

Improve input error detection #104

Open miekkasarki opened 7 months ago

miekkasarki commented 7 months ago

Numerous scientist/engineer hours have been wasted on pondering why the simulation results look bad, when the cause has been some trivial mistake in input. For example, I just spent days in bug hunting only to realize my hydrogen mass was in kg when amu was expected.

Let's use this issue to write down similar mistakes and how they could be detected (semi)automatically. For example, the whole purpose of the unyt module is to prevent mistakes like above, but it's not yet fully incorporated to preprocessing.

miekkasarki commented 7 months ago

Headache: Ion mass was in kg when amu was expected.

Suggestion: Check species mass in plasma/neutral/marker inputs. Use unyt module wherever possible, but if quantity is not in unyts, checking that the mass is > 0.005 is a good sanity check.

miekkasarki commented 7 months ago

Headache: Exceeding the number of allowed plasma species / mhd modes / Poincaré planes.

Suggestion: The code should terminate with error message if this happens.