Re: Problem to set DIVBM in source.f file

From: Sébastien WURTH (
Date: Tue Sep 06 2005 - 15:49:58 CEST

  • Next message: John Clem: "Re: Problem to set DIVBM in source.f file"

    Thank you very much John, indeed it helps.
    I was trying to think about such a method when I received your mail and
    suddenly it went much faster, because my fortran is not so "fluent".
    Like I said in my previous mails, I was unable to set properly DIVBM
    value in source.f, I always had that beam directed to Z axis (the
    default settings) and nothing changed.
    So much for DIVBM then, your method defines exactly what I need.

    Thanks again.

    John Clem a écrit :

    > Sebastien,
    > The directional cosines (as well as the vertices, particle type,
    > energy, etc) can also be completely controlled within source.f
    > The modifications should take place in the code where the values
    > UBEAM,VBEAM,WBEAM are defined. Below is an example for generating a
    > 4pi isotropic angular distribution
    > * Cosines (tx,ty,tz)
    > ONEONE and TWOPIP are define in the common DBLPRC and RAN* are
    > externally defined random number generators.
    > I hope this helps,
    > John
    > >>
    > >>Dr. John Clem
    > >>Senior Research Scientist
    > >>Bartol Research Institute
    > >>University of Delaware
    > >>Newark, DE 19716 USA
    > >>302-831-4354
    > >>302-831-1843 Fax
    > >>
    > >>
    > ----- Original Message -----
    > *From:* Sébastien WURTH <>
    > *To:* John Clem <>
    > *Sent:* Tuesday, September 06, 2005 03:08
    > *Subject:* Re: Problem to set DIVBM in source.f file
    > John Clem a écrit :
    >> Sebastien,
    >> 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..
    >> John
    >> ----- Original Message -----
    >> *From:* Sébastien WURTH <>
    >> *To:*
    >> <>
    >> *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
    >> else
    >> pbeam = energy2
    >> endif
    >>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.
    > John,
    > Thank you for your answer, but it's not exactly what I was asking
    > for. Your solution is quite the same that G. Battistoni gave me a
    > few days ago and that a good way to simulate a cobalt source, no
    > doubt. But actually my new problem is how to define an isotropic
    > source in source.f routine. When using SOURCE card in Fluka this
    > overrides the beam divergence given in BEAM card. My question was
    > where do I exactly define this DIVBM value in source.f file since
    > it doesn't seem to be properly read at the location I put it so far...
    > Regards.
    > Sebastien.

  • Next message: John Clem: "Re: Problem to set DIVBM in source.f file"

    This archive was generated by hypermail 2.1.6 : Wed Sep 07 2005 - 10:31:34 CEST