Source sampling with variable weight and probability

Dear Riya,

the issue is the missing line

WEIPRI = WEIPRI + WTFLK (NPFLKA)

FLUKA stores the total primary weight in the WEIPRI variable.


However, looking at your source routine I have some pointers:

  1. It’s a bit confusing, that you are calculating the area of a circle, using it to set probabilities and weights, but you sample location is a sphere.

  2. You are using the FLRNDM(XDUMMY) function without the XDUMMY variable. (Any double precision variable is acceptable as argument)

  3. I couldn’t figure out why did you set the probabilities / weights as you did, but I think the probabilities needs to be independent from the system. Setting all probabilities to 1.0 is ok.

  4. You used an old source.f template. You can find the current one in /usr/local/fluka/scr/user directory.

  5. You can use a USRBIN scoring to plot a weighted source distribution. For this trick, you need to:

    1. Assign to all regions a non VACUUM material.
    2. Set a photon transport threshold higher that the source energy. This will force all photon primaries stop immediately after they are created and deposit their energy on the spot.
    3. Score ENERGY with USRBIN

    If the weighted sampling work correctly, each bin should have the same value (depending on the statistics).

  6. You coded the direction and spherical sampling by hand. There are build in FLUKA function to take care of this.


Based on these points, I reworked your source routine with the new template. This should work correctly: cloud_source_v4.f (11.3 KB)

Cheers,
David

1 Like