I’m trying to model the process of gathering photons from big bulk scintillator by using wavelength shifting fiber. To solve this problem I found the wvlnsh.f user routine. But I can not find the description of this routine anywhere. Can anyone please answer me to a number of questions about this user routine:
How can I implement this routine in Fluka, which card is responsible for switching on of this routine?
What does this routine return to the program? As far as I understand, it returns new wavelength and a fraction of newly generated photons, but I’m not sure.
3). What direction does the new wavelength shifted photon have? I assume that the process is similar to the generating of ordinary optical photons: initial optical photon is absorbed, new wavelength shifted photon is generated with random initial direction. Can anyone clarify this moment?
Dear @Alexy ,
you are right about the lack of specific documentation (the wvlnsh routine is presently a ghost in the manual).
Once you have activated optical photon transport by OPT-PROP and OPT-PROD and an absorption event takes place, the wvlnsh.f routine is automatically called with no need for a dedicated card.
You have to code wvlnsh.f in order to return the output variables indicated in the header:
Nwvshp = number of produced secondary photons (integer)
Wvshph(i) looping from 1 to Nwvshp, real number whose absolute value is interpreted as the i_th produced photon’s energy (GeV) if > 0 or wavelength (cm) if < 0
Dwvshp(i) looping from 1 to Nwvshp, production delay (s) of the i_th produced photon
Right, new wavelength shifted photons are generated isotropically.
Thank you for the detailed explanation. May I ask you two more questions. In my program I want to model wavelength shifting fiber, where for each absorbed initial photon there is production of only a partial amount of secondary wavelength shifted photons which is usually less then 1. As you said Nwvshp is an integer. Is it ok to model this process through FLKRNDM command, where the length of the interval represents the fraction of generated wavelength shifted photons? Say if FLKRNDM is more than some number the secondary photon is generated.
I’m not quite understood how to return Nwvshp and Wvshph to the program. Should I write:
RETURN (Nwvshp, Wvshph)
or I just should assign:
Nwvshp = number1
Wvshph = number2
in the program and leave RETURN without any changes? I’ve done it with rfrndx.f user routine. But this routine returns only one number by itself, and I just assigned RFRNDX = number3 in the body of the program, without modifying RETURN.
If I understand correctly you want to produce a secondary photon only with a known probability PRO.
You would still have to observe the instructions given above, slightly extended to fit your needs: you throw a uniformly sampled random number XI from 0 to 1 and fill the subroutine’s output variables only if XI<PRO.
For the sake of example let PRO=0.7. Still in the same subroutine wvlnsh you could try something along the following lines (starting at the 7th column of the text file):
PRO = 0.7D+00
XI = FLRNDM(1.D+00)
IF (XI .LT. PRO) THEN
NWVSHP = 1
WVSHPH(1) = <INSERT HERE PHOTON ENERGY in GeV>
DWVSHP(1) = <INSERT HERE PRODUCTION DELAY IN s>
ELSE
NWVSHP = 0
END IF
RETURN
With this you have populated all requested output variables (see header documentation) and the subroutine returns control via the keyword RETURN (which remains unaltered).
Hopefully this (or an adapted version as needed) is helpful!