Re: How to use the SOURCE card in FLUKA

From: Alberto Fasso' <fasso_at_SLAC.Stanford.EDU>
Date: Fri, 30 Apr 2010 09:48:34 -0700 (PDT)

Dear Shaikh,

first of all I would like you to send your questions to the FLUKA
discussion list, and not to me personally. I take the liberty to
send my answer to the list, together with your questions.

I think that you should read the manual more carefully. Read first
the Notes following the description of the SOURCE command.
Then read the introduction to Chapter 13 (User routines), and the
description of the source routine (section 13.2.19). That information
is very detailed and I am surprised that you find it insufficient.

Anyway, I attach a simple example that you can adjust to fit your case.
In this example, you need to do the following:
1) Put in the input file a card BEAM with energy larger than the largest
    energy you can find in your data file
2) Put a card SOURCE, very simple in this case, with all the WHAT = 0.

In the attached routine, I call your attention to the following features:
   This is the number of lines in the assumed data file. You need to
   adjust it to your case
   these variables refer respectively to the particle id, x,y,z coordinates,
   kinetic energy, x and y cosines, weight. You must adjust them to the
   way they appear in your data file. Note that you must use only two cosines:
   the third one will be determined by normalizing the sum of the squares.
   This is VERY IMPORTANT, to avoid tracking errors.
   KOUNT is a counter, in order to print to a test file the first 50
   particles sampled. It is not really necessary, remove it if you want.
- User initialization: the routine is made to print to standard output
   some information about the data file used. Then a file called
   "collfile" (= collision file) is opened in the upper directory with
   unit number 88. The upper directory is the directory where the input file
   is, because FLUKA will be running in a subdirectory. In the same way,
   a file "testsource" is opened with unit number 89.
   Then, the whole data lines are read in memory.
   All this is done in the IF(LFIRST)...END IF block, which is executed
   only once, at the first call to the routine.
- Then, at every call, a line is sampled randomly from the data file,
   containing all the particle variables needed. The first 50 lines sampled
   are written to the test file.
   The particle weight in stack is set according to the line just read
   Same thing for the particle id.
   Same thing for the particle energy. The momentum is calculated from
   the energy.
      & - TYFLK (NPFLKA)**2 )
   Set on stack the x and y cosines as read, and the z cosine as calculated
   from the normalization
   Set on stack the coordinates as read

I hope that this information will be sufficient.
Good luck!


On Thu, 29 Apr 2010, ??? wrote:

> Dear FLUKA expert,
> Nowadays I have been working for the neutron spectra produced by
> Muon+ through the granite rock with FLUKA. However, I am a beginner and
> when I want to read from an external data file(the Muon+'s energy
> ,theta,phi,etc.) with the SOURCE card, I faced with a problem that ,from
> the FLUKA manual,I cannot find enough information to help me.In fact
> ,till now,I have not known how to use the SOURCE card and the user
> routine to read data from an external file.
> Therefore , could you please to tell how to do it or where I can
> find some useful documents or other information that could help me out?
> Thank you very much!
?? ?
> Sincerely,
?? ?
> Shaikh
> *********************
> School of Physics, Nankai University ,Tianjin ,China
> an undergraduate Shaikh(my chinese name:Sun Haokai)

Received on Sat May 01 2010 - 14:07:57 CEST

This archive was generated by hypermail 2.2.0 : Sat May 01 2010 - 14:07:58 CEST