# Re: special beams in FLUKA

From: Markus Brugger <Markus.Brugger_at_cern.ch>
Date: Mon, 24 Nov 2008 10:53:19 +0100

Hi Luis,

the problem you describe requires a user defined source-routine. As you
already mentioned, a good source of explanations can be found not only
in the manual but also in the respective course documentation, the

To produce the concentric rings (elliptical) of source particles you'll
have to sample the particle positions accordingly (e.g., in X and Y).
What concerns the particle type, perhaps a quick trial how to do it
based on a cummulative sampling:

source.f:
---------

*
* first initialization
*
DO 1 I=3D1,MAXUBP
K =3D 2*I-1 + IWSHIFT
IF ((WHASOU(K).GT.ZERZER).AND.(WHASOU(K+1).GE.ZERZER)) THEN
NUBP =3D NUBP+1
IDUBP(NUBP) =3D INT(WHASOU(K))
FRCUBP(NUBP) =3D WHASOU(K+1)
SUMFRC =3D SUMFRC+FRCUBP(NUBP)
ENDIF
SAMUBP(I) =3D ZERZER
1 CONTINUE

....

*
* later in the sampling part
*
* sample/modify particle type
SUMFRC =3D ZERZER
*
* use the FLUKA random number generator to sample the particle fraction
FRAC =3D FLRNDM(0.0)
DO 10 I=3D1,NUBP
* sampling cummulative particle type fractions
SUMFRC =3D SUMFRC+FRCUBP(I)
IF (FRAC.LE.SUMFRC) THEN
ILOFLK(NPFLKA) =3D IDUBP(I)
SAMUBP(I) =3D SAMUBP(I)+ONEONE
NALL =3D NALL+1
GOTO 11
ENDIF
10 CONTINUE
11 CONTINUE

hope this helps, cheers

Markus

> -----Original Message-----
> From: owner-fluka-discuss_at_mi.infn.it [mailto:owner-fluka-
> discuss_at_mi.infn.it] On Behalf Of Fernandez-Hernando, JL (Juan)
> Sent: Mittwoch, 19. November 2008 15:54
> To: fluka-discuss_at_fluka.org
> Subject: special beams in FLUKA
>=20
> Dear all,
>=20
> I want to perform a few simulations with special beams and I was
> wondering
> if perhaps someone has already done this before and modified her/his
> source routine in a very similar way than I would need to.
>=20
> In one of the simulations I would like to have a beam made of
> concentric rings. Each ring has a different particle density.
>=20
> In another simulation I want to be able to have two different
> beams of different particles in the same run. And I also wonder
> if it is possible to have ellipsoidal rings instead of circular ones.
>=20
> If anyone has already made source routines to achieve what I describe
> above I would be really grateful if they would allow me to use them.
> Otherwise I bet I will send more emails to this group asking for clues
> on how to do what I intend to. I am also trying to make sense of the
> 'how to modify the source routine' lecture.
>=20