[fluka-discuss]: »Ø¸´: Question about user routine for gauss distribution

From: lzf neu <lzfneu_at_live.com>
Date: Wed, 10 Feb 2021 03:13:15 +0000

Dear Dr. Santana, Mario,

Thanks for your reply.
I have one more question to consult you:

If my beam has an annular gaussian profile, its radius is from 2 ¦Ò to 3 ¦Ò and is there a method to confine the probability of FLNRRN(RGAUSS) to get |numbers| between 2 to 3.
I modify your code and try to write the following in source.f :

      IF (FLNRRN(RGAUSS)>=2 .AND. FLNRRN(RGAUSS)<=3) THEN
      radius=sigma*FLNRRN(RGAUSS)
      angle=TWOPIP*FLRNDM()
      XFLK(NPFLKA) = radius*sin(angle)
      YFLK(NPFLKA) = radius*cos(angle)
      END IF

However, the program cannot be run and the following error messages in xxx.out file is:
0 !!! Exit being called from Flklkz !!!
 **** Particle in position X = -1.00000000E+30, Y = -1.00000000E+30, Z = 1.91956648E+18
 **** with energy 0.000000E+00 GeV, discarded ****

Thank you.

Zhefu
________________________________
·¢¼þÈË: Santana, Mario <msantana_at_slac.stanford.edu>
·¢ËÍʱ¼ä: 2021Äê2ÔÂ9ÈÕ 21:36
ÊÕ¼þÈË: lzf neu <lzfneu_at_live.com>; Fluka Discuss <fluka-discuss_at_fluka.org>; Paola Sala <paola.sala_at_mi.infn.it>
Ö÷Ìâ: Re: Question about user routine for gauss distribution

Hi,

See answers below
________________________________

>>I have two quesitons to consult you:

>>1) what is the value range of the gaussian-distributed random numbers: FLNRRN(RGAUSS)

Technically the range is "+/-infinite' although the probability to get |numbers| above 10 is very small, which you can compute from the usual gauss function tables. Please see the attached figure for 10000 tests.
(You might be interested to check the Box-Muller transform, to obtain gaussian distributed numbers from uniform distributions)


>2) If ¦Ò=1cm and I try to plot fluence of electron beam spot with gauss distribution from 2 ¦Ò to 3 ¦Ò, how to write X, Y position in source file. I try to write the >following commands, but it doesn't work correctly;
>I expect that an annular circle of gauss distribution should be plotted from 2 ¦Ò to 3 ¦Ò, but the following commands show me a circle. I have no idea how to do.

>sigma=1
>XFLK(NPFLKA) = sigma*FLNRRN(RGAUSS)
>YFLK(NPFLKA) = sigma*FLNRRN(RGAUSS)
>ZFLK(NPFLKA) = ZBEAM

First off, you should write 'sigma=1.0D+00', or 'sigma=ONEONE'.
If your beam has a circular gaussian profile, I would go somewhere like:
radius = sigma*FLNRRN(RGAUSS)
angle = TWOPIP * FLRNDM()
XFLK(NPFLKA) = radius * sin(angle)
YFLK(NPFLKA) = radius * cos(angle)
...

-M

Thank you very much.


__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Wed Feb 10 2021 - 06:06:27 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 10 2021 - 06:06:32 CET