Re: Problem to set DIVBM in source.f file

From: John Clem (
Date: Tue Sep 06 2005 - 00:30:51 CEST

  • Next message: Sébastien WURTH: "Re: Problem to set DIVBM in source.f file"


    To do this in a single run a random number generator function must be defined in source.f (I've forgotten exactly how to use the fluka internal function, however the Numerical Recipes libraries has various types that can be inserted directly into the code) and then weighted to provide the normalized integral of each Cobalt energy peak. Each time a new beam particle is started "source.f" is called and a new random number (between 0,1) is generated. Employing logical IF statements, the random value determines the energy. As an example...
    if( E= 1.173E-3GeV
    if( E=1.332E-3GeV
    where ranvalue variables are the random values from a flat distribution generator...

    Of course performing multiple runs with different energies and combining output will also achieve the same result..

      ----- Original Message -----
      From: Sébastien WURTH
      Sent: Monday, September 05, 2005 10:46
      Subject: Problem to set DIVBM in source.f file

      Hello all,

      Let me please remind you what brought me here :

      **** First Message ***

      Date: Wed, 31 Aug 2005 15:24:22 +0200
    > From: "[ISO-8859-1] Sébastien WURTH" <>
    > To:
    > Subject: How can I define a non monoenergetic source in FLUKA ?
    > Dear FLUKA developpers,
    > I'm trying to simulate a source of cobalt 60.
    > I've read the manual very carefully, and a large part of the mailing
    > list archive
    > but I didn't find the right answer to my question.
    > How can I define a non monoenergetic source (or beam) ? By using the
    > subroutine source introduced by command SOURCE I guess,
    > but I don't know how to define two energies in source.f. I've tried to
    > define it with the two BEAM cards, but FLUKA seems to overwrite
    > the first one when reading the second one.
    > The answer may be very simple, but I can't find it.
    > Thank you for your help.
    > Best regards.
    > Sébastien WURTH.

    **** Reply of G. BATTISTONI ****

    I would do like in the following:
    suppose that you have 2 different energy lines. The first emission line
    has probability P (0<P<1) and the second 1-P
    Then you create your source.f with a logic in which
    for a fraction of cases proportional to P you assign energi n.1
    and for the complementary fraction of cases you give energy n.2

            if (flrndm(xdummy).Le.prob1) then
                    pbeam = energy1
                    pbeam = energy2

    It is up to you to provide the right values for prob1, energy1 and
    For instance you can pass these values to the source.f using the
    numerical fields of SOURCE card: they appear inside source as the vector
    WHASOU(n) with n =0,1,2,..,6
            Giuseppe Battistoni


    So, there is my new problem :

      I did the changes by calling source.f with SOURCE card, setting my parameters in the WHASOU fields of SOURCE... compiling, linking, etc.
      The run goes to the end, but the results are not quite what I was expecting.

      It seems that FLUKA understands that my source (beam) is not isotropic anymore, but directed to z axis,
      although I gave a value to variable DIVBM in my source.f file.

      I set DIVBM to 1.E4 to describe an isotropic source, value taken from the examples in BEAM card
      description section from the manual. By the way, I discovered a little mistype in the example of an isotropic Cs-137 source,
      kinetic energy should be -661.7E-6 GeV instead of -661.7E-3 GeV, shouldn't it ?

      Anyway, my question is : Is there any particular place in source.f where those assignments have to be made ?
      In the user initialization part for example ? I tried this one though, but nothing changed.
      I tried after the energy part (an analogy to BEAM card in my logic), but nothing changed, once again.
      It appears to me that DIVBM is not read properly (and maybe the energy part too (not sure about that)).

      I did a run without changing anything in the source.f file given in $FLUPRO/usermvax, the results are quite the same when I
      gave a value to DIVBM.

      Thank you for your help.

      Best regards.

      Sébastien Wurth.

  • Next message: Sébastien WURTH: "Re: Problem to set DIVBM in source.f file"

    This archive was generated by hypermail 2.1.6 : Tue Sep 06 2005 - 08:58:45 CEST