I am running a second transport calculation based on a phase-space file generated by FLUKA at a selected interface. The calculation appears to complete the predefined number of particles/histories, but the expected fort.* output file is not generated.
The log file reports the following error:
Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.
Since the .dat file is too large to upload in full, I have attached only a portion of the relevant information.
I am not sure what is causing this floating-point exception. Could it be due to an invalid particle entry in the phase-space file, an issue in the source routine, geometry/region settings, or the scoring cards?
Could you please advise what the possible reasons are and how I should modify the input or source routine to resolve this issue?
I am not sure what is causing this floating-point exception. (…) Could you please advise what the possible reasons are and how I should modify the input or source routine to resolve this issue?
The floating-point exception (SIGFPE) you are encountering is a division-by-zero error and, just as you noted, it occurs at the very end of the simulation during the generation of the fort.* output files. It is caused by an issue in your source_generic_phsp v3.f routine regarding the WEIPRI variable.
To calculate the final USRBIN results, FLUKA normalizes the total accumulated energy by the total statistical weight of all simulated primaries (WEIPRI) and the volume of the region. In your case, the global WEIPRI value is 0, triggering the crash.
This happens because the sumcou.inc common is missing at the top of your routine. As a result, WEIPRI is treated as a temporary local variable and the global WEIPRI that FLUKA actually relies on for the normalization is never updated and remains 0. To fix this, please add INCLUDE 'sumcou.inc' below the other include statements at the top of source_generic_phsp v3.f.
Furthermore, your source routine currently sets WEIPRI = ZERZER at the start of every event (please remove this initialization so you don’t erase the global counter), and then overwrites it with WEIPRI = WTFLK (NPFLKA). Since WEIPRI is intended as the total accumulated weight of all primary histories simulated during the run, it should be accumulated as WEIPRI = WEIPRI + WTFLK (NPFLKA).
With the indicated changes, the simulation finishes without crashing and the fort.* output files are successfully produced.
For more details on source.f, please consult the dedicated section in the FLUKA manual.