USRBIN - plot fluence of neutrons within specific range of energy

Dear Fluka experts,

I am currently running neutron yield simulations with Fluka. I used the USRBIN card to obtain a heatmap of the neutron fluence.

1.) I wanted to know whether it is possible to request that Fluka only include fluences of neutrons of a specific energy range in these plots.

2.) Related to this question: I also noticed that there are special settings for WHAT(2) if 10.0 <=WHAT(1) <= 18.0. If the condition for WHAT(1) is met, if WHAT(2) is set to 250, Fluka scores the thermal neutron equivalent fluence. I would like to understand what Fluka considers the thermal neutron equivalent fluence to be.

Thanks for your help in advance.

Kind regards,
Dalini

Dear Dalini,

let me address the two points separately.

  1. Selection of energy ranges by hand in a USRBIN scoring of neutron fluence

This can be done with the user routine fluscw.f, to be enabled in the input file with a USERWEIG card. You will need to add a few lines of code to it, for example:

ENEPAR = -PLA
FLUSCW = ONEONE
LSCZER = .FALSE.
IF (ISCRNG.EQ.2 .AND. JSCRNG.EQ.3) THEN
    IF (ABS(PLA) .LT. 10D-3) LSCZER = .TRUE.
ENDIF

Here ISCRNG = 2 represents the track length binning, and you modify the 3rd USRBIN in the input file (identified by JSCRNG) by removing (i.e. not scoring) all particles with E<10 MeV (of course you should put the right JSCRNG value according to the order of the USRBINs in your input file). Note that PLA represents the particle momentum if positive, and the energy if negative. Normally the routine should be called with energy, but to be safe you can add a few lines of code that convert momentum to energy if PLA>0:

INCLUDE 'paprop.inc'
INCLUDE 'usrbin.inc'

ENEPAR = -PLA

IF (PLA .GT. 0) THEN
    ENEPAR = SQRT (PLA**2 + AM (IJ)**2) - AM (IJ)
ENDIF

In case, you should put these lines before the computation on top, and the first snippet should use ENEPAR in place of PLA.

  1. Thermal neutron equivalent fluence

The settings that you refer to are used to select the THNEU-EQ USRBIN scoring (if you use flair, you find this already in the list of available USRBIN scorings, and it will set automatically the WHATs). As you can find in the manual, this scores the ā€œthermal neutron equivalent fluenceā€ which is the fluence of neutrons with a velocity-dependent weight such that a neutron with 25.3 meV is assigned weight 1 and other neutrons are assigned a relative weight proportional to 1/v, which represents the energy dependence of their capture cross sections. (notice that thermal-energy neutrons are non-relativistic, so v is proportional to sqrt(Ekin)

To summarise, if you are interested in neutrons of thermal energies I would advise to consider option 2, which uses the built-in scoring. Option 1 offers more flexibility, but it requires a bit of coding.

Best
Giuseppe

2 Likes

Dear Giuseppe,

Thanks for the comprehensive solutions to both questions. Although option 2 is easier for me to implement, I need to use USRBIN to score neutron fluences for two distinct energetic groups of neutrons. So I will use option 1.

I have not used user defined Fluka routines before, so I will look into it a bit more and follow up with any questions shortly.

Cheers,
Dalini

Dear Giuseppe,

I looked into the details and came up with the input which is attached to this message.
10MeV_Be_1pt5cmProt_r6pt75_t10.inp (2.8 KB)

I have a couple more questions as I am not clear on the syntax as Iā€™ve never used userdefined routines in Fluka.

1.) Does the first snippet of code make USRBIN score neutrons below 10MeV? In my case, I wanted to score neutrons below 200 meV, how would I change the syntax? Would I simply need to change the first snippet of code to:

ENEPAR = -PLA
FLUSCW = ONEONE
LSCZER = .FALSE.
IF (ISCRNG.EQ.2 .AND. JSCRNG.EQ.3) THEN
IF (ABS(PLA) .LT. 200D-12) LSCZER = .TRUE.
ENDIF

?

2.) If I want to score the fluence of neutrons with energies between 0.5eV and 10keV, how do I modify the above code?

3.) Does my input file have all the code + the USRWEIG card in the correct order?

4.) If I make the modifications to the input file by hand, will I have to use the command line to run the simulation with Fluka? Or can FLAIR still read and run my user modified input file?

Thanks for your help and patience. I am a beginner level user and need guidance to ensure I am doing the right thing.

Cheers,
Dalini

Hi Dalini,

I see a few points to fix.

First, the fortran code must be included in a locally modified version of fluscw.f, not in the input file. You then need to recompile FLUKA with the updated version of fluscw.f (this can be done with flair from the ā€˜compileā€™ tab, simply giving it the path to your local fluscw.f) and run the simulation with the new executable that gets produced.

Focusing on the code, this call:

IF (ABS(PLA) .LT. 200D-12) LSCZER = .TRUE.

actually removes from the scoring all particles with abs(PLA) < 200meV (LSCZER = .TRUE. means ā€˜do not score the particleā€™).

The fortran code that I would add to fluscw.f to select only particles below 200 meV would be the following:

INCLUDE 'paprop.inc'
INCLUDE 'usrbin.inc'

ENEPAR = -PLA
IF (PLA .GT. 0) THEN
    ENEPAR = SQRT (PLA**2 + AM (IJ)**2) - AM (IJ)
ENDIF

FLUSCW = ONEONE
LSCZER = .FALSE.
IF (ISCRNG.EQ.2 .AND. JSCRNG.EQ.1) THEN
    IF (ABS(ENEPAR) .GT. 200D-12) LSCZER = .TRUE.
ENDIF

Note that this will be applied only to the first USRBIN card in your input file (due to the JSCRNG.EQ.1 requirement) so you must make sure that the corresponding USRBIN in your input is in the correct position (i.e. the first). Also, please note that the routine a priori applies to any particle type: itā€™s in the USRBIN card in the input file that you select neutrons or something else.

If you want to have a second USRBIN where you score neutrons between 0.5eV and 10keV, you can then add this extra piece of code:

IF (ISCRNG.EQ.2 .AND. JSCRNG.EQ.2) THEN
    IF (ABS(ENEPAR) .LT. 500D-12 .OR. ABS(ENEPAR) .GT. 10D-6) LSCZER = .TRUE.
ENDIF

Again here, note that because of JSCRNG.EQ.2 FLUKA will only apply this requirement to your second USRBIN card in the input file.

Lastly, the USERWEIG card in your input file is correct.
I hope this helps!

Cheers
Giuseppe

1 Like

Dear Giuseppe,

Thanks for clarifying these details, this is much clearer to me now. I will look into modifying fluscw.f in the way you described. Have a good weekend!

Best,
Dalini