Thank you for your help. I’m modelling a lightly more complex problem now with more complex source and geometry. I’m also getting discrepancy between PHITS and FLUKA and I dont suppose you have any suggestions as to what could be causing the difference?
First of all, let’s try to optimize your source definition.
In your case, I would suggest you to utilize source_newgen.f routine. Usage is described here:
There you can define shape, directions and file-based energy spectra.
I am attaching a modified example from this course. histogram.txt (239 Bytes) source_newgen.f (19.2 KB) source_routine.flair (2.9 KB)
In addition, I included a uniform spherical shell generator into source_library.inc, so you need to replace it in /path/to/fluka/include source_library.inc (42.5 KB)
since the source I’m using is a spectrum. When I use this in the file you provided, I get an error. Is this no longer an option in the source_newgen.f file?
to the function declarations in the source_newgen.f file. When I run without any spawns it seems to be working fine, but when I try to run with spawns I’m getting errors. The simulation still carries on but I get ‘Finished with ERRORS’ appearing in the Run tab. I’m not sure if this is an issue, I’m still waiting for the run the finish.
UPDATE: I came across the ‘sample_discrete_momentum_energy’ in FLUKA and when I use this along with ‘etype=8’ in PHITS, which is also a discrete spectrum, I get very good agreement.
I was wondering if you could explain how continuous and discrete spectrums are used in FLUKA, as I’m not sure I understand correctly and this may explain the cause of the previous issues I was having.
My other concern is why there is a discrepancy when using the histogram. I just changed the histogram energies and bin heights in your FLUKA and PHITS model but I was getting quite big discrepancies (see previous reply).
I glad that you found the source of the discrepancy!
The difference between discrete and histogram is that for the second one you will sample
particles with energies within bin width and not discrete lines. It’s more realistic for sources with continuous spectra.
In my example, I have used histogram definition for both FLUKA and PHITS.
Please always check that source types, scoring and especially normalization are consistent between both codes. Your Phits histogram definition was shifted by one bin to the right in comparison with Fluka.
Here is an example how it should be defined in Phits: