svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
53 stars 26 forks source link

Genesis runs when using sorting at each step.[BUG] #174

Closed svenreiche closed 2 months ago

svenreiche commented 2 months ago

I run a case with a rather strong energy variation of the electron beam and enable sorting with one4one simulation. After a short distance Genesis crashes.

Error message is:

terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 18446744071562067968) >= this->size() (which is 2)

svenreiche commented 2 months ago

Caused by having a Nan for theta. Not sure if it actually comes from the sorting or the solver. I assume it is strongly connected to the Nan values for a zero current in energy etc. I will continue to investigate.

svenreiche commented 2 months ago

Error was caused by zero current slices (in this case after sorting) which caused a division by zero error when calculating the space charge field (current/size) when the size was evaluated to be zero