Targeting in Source Routine

Hello Fluka experts,

I’ve written a muon source file that samples angles and energies from two spectra. This works fine. What I’d like to do is target a particular region of interest (ROI) in order to increase statistical yield. I treat the muons as straight trajectories and check a few parametric equations to determine if the muon will in fact intersect the ROI. The function I’ve written works if called in a standalone f90 file, but not in the simulation. The only error I get is: executable returned RC=136. I’ll attach the source file, the input file, and the spectra for sampling. I’d appreciate anyone explaining why this doesn’t work.

Extra details:

  • Running the latest FLUKA on MacOS with gcc version 10.4.0

Thank you!

mu_e_hist.txt (3.1 KB)
mu_zen_hist.txt (350 Bytes)
muon_source.f (26.9 KB)
NEWINPUT.inp (5.1 KB)

Dear Regan,

there are a couple issues:

  1. You are using the sample_spectrum function (which is now available as the built in function sample_spectrum_momentum_energy), where you only ony one energy value, but your files has a minimum and maximum energy value, thus the appropriate sampling function is sample_histogram_momentum_energy.

  2. These sampling function can handle only one file at the moment, so you need to duplicate them with a different name, to be able to use for the energy and direction sampling separately.

  3. For the direction sampling you need to use GeV instead of MeV to avoid the unit conversion

  4. Finally, the line

    azimuth = acos(cos_x/sin(zenith))

    creates an arithmetic error, probably because the cos_x, cos_y, and cos_z values are independently sampled and are not normalized.


P.S.: You can find the traceback of the error in the fluka_<nnnnn>/<inputfile>001.log file.

1 Like