Energy Spectrum Sampling Issue in FLUKA's `source_newgen.f` for Neutron Source Terms

Dear experts,

I have implemented two source terms using the FLUKA’s source_newgen.f file. However, I have encountered an issue with the energy spectrum sampling of one of them. In my configuration, I intended to set up a continuous sampling for neutrons at 4-5MeV and 5-6MeV, but the results are showing an unexpected range of 0-1MeV (as shown in the figure). I would be grateful if you could kindly review the issue. I have attached all the files that I have modified for your reference.

Thank you for your time and assistance.

neutronSp.txt (18 Bytes)
photonSp.txt (20 Bytes)
pos.inp (1.8 KB)
source_library1.inc (33.6 KB)
source_newgen.f (32.7 KB)

Dear @lway97 ,

The old version of the source_library.inc you modified cannot handle multiple histogram files at the same time. This was added in a later version.

I would suggest that not to use a modified version of source_library.inc, instead you can put any customized function (with a different name) at the end of the source routine file (or even in a separate file).

Edit: I just noticed, that you duplicated the history sampling routine, which should make it work. However, I can’t compile your routine, since you didn’t remove the [ and ] brackets from the arguments.

Cheers,
David

1 Like

Dear @horvathd

Thank you very much. I truly appreciate your guidance. Would updating the FLUKA version alone be sufficient to resolve the issue, without the need to alter the source_library.inc file? Your expertise is invaluable, and I’m grateful for the assistance you’ve provided.

Cheers,
Leway

Dear Leway,

yes, upgrading FLUKA to the latest release will give you also the latest version of source_library.inc. It is always recommended to update as support is only provided for the latest release.

The cause of you issue is that you didn’t enable the line energy_logical_flag = .true., so the values in the histogram files vere interpreted as particle momentum, not kinetic energy.

Cheers,
David

1 Like

Dear @horvathd

Thank you! I will adjust my program according to your suggestions and will continue to communicate with you. I am extremely grateful for your detailed and prompt response.

Cheers,
Leway

Dear @horvathd

I am immensely grateful for your advice, and it has been successfully implemented! Thank you once again for your assistance to me!

Cheer,
Leway