Beam width definition in source routine

Dear FLUKA experts,
I am trying to get familiar with source_newgen.f and to do that I compared the USRBIN plot given by this source definition:


and the one is given by the user routine
DEMO.f (18.7 KB)

The two plots are different. The only difference that I can see between the two source definitions is the beam width, but I am not able to find the location in the user routine file where I can define the width of the beam.

image
image

Kind regards,
Lovepreet

Dear Lovepreet,

the beam size settings on the BEAM card is overwritten by the source routine.

To specify an extended source, you need to sample the random position. This can be easily done with the sample_flat_distribution() function described at section 5.2.1 in the source_newgen.f file.

Remember, you need to specify the numbers in the source routine as double precision, like 20.0D0.

Cheers,
David

Thanks for your reply, Sir.
I tried to change the file following your guidlines, however, the results I get have different order of magnitude even if I have written the same values. Could you please suggest me away to check where I am doing wrong?
DEMO1.f (18.7 KB)
DEMOwithSource1.inp (6.1 KB)


Regards,
Lovepreet

Dear Lovepreet,

there are two issues with your source routine:

  1. The coordinate_x variable needs to be sampled between -5 and 45 to match the BEAM card

  2. The beam direction is also not correct. To match the settings on the BEAMPOS card you need set direction_cosy to zero and direction_flag to 1. Or of you don’t set direction_cosx then the values from the BEAMPOS card will be used from all the components.

Cheers,
David

Thanks Sir,
Now the results are comparable. I have just 1 question related to correction 1: why is it not between 0 and 50 if my x_coordinate goes from 0 to 50 in the geometry?

Best regards,
Lovepreet

Dear Lovepreet,

you set x = 20 cm on the BEAMPOS card, and a width of 50 cm. So the minimum and maximum value of x is 20 cm +/- 25 cm = -5 and 45 cm.

Cheers,
David