Dear FLUKA users,
Now, I want to simulate a uniformly distributions of electrons along the ring. The straight line source is introduced is the manual. However, in my work, the electrons are uniformly looses along the curved ring, and the emitting direction is the tangent direction of the ring, as shown in the picture. Could you please tell me there is any way to achieve this with the source.f? I attached my input file of geometry. Thanks a lot.
ArcSource.inp (1.9 KB)
could you clarify, what do you want to simulate? An electron beam in a ring, or the synchrotron radiation caused by the electron beam?
Sorry for my unclear expression. I want to simulate the electron in the ring, lost as indicated in the figure. Thank you.
Yes, you can achieve that writing your own source routine. In the routine you will have to set the starting position and the momentum of each particle you want to simulate. You can do that either analytically or by reading from a loss file.
Beware that you have geometry errors. Your “BLKBODY” and “VOID” regions overlaps. Specifically, “VOID” zones from 2 to 6 are not enclosed within the body “void”.
Thank you for your kind help. The geometry errors are corrected in the new attached file. Moreover, the analytically method is more suitable in simulatArcSource.inp (1.9 KB) ion, could you give me more suggestions with this method?
Go to the “Compile” tab, click on “Database” and select “source.f”. The fill will then be listed in the flair window (“File” column). You can then double-click to open the default text editor, or open your favorite text editor via command line.
You have to set the coordinates of the particles (XFLK, YFLK, ZFLK) and the direction cosines (TXFLK, TYFLK, TXFLK). The particle momentum is stored in the variable PBEAM which is calculated from what you wrote in the BEAM card in the input.
Yes, the basic parameters in source.f are used to define the coordinate, direction, energy, etc. It can be defined easily, the problem now is how to define a arc track of electron along the ring. Could you give me more advices, thank you.
You might try to use the subroutine SFECFE(SINT,COST), which returns a pair of random numbers SINT and COST such that SINT^2+COST^2 = 1.D+00 and therefore can be interpreted as sin() and cos() of the same random angle, uniformly distributed in the range 0-2\pi
Something along the following lines, where RADIUS is the radius of your arc:
CALL SFECFE( SINT, COST)
XFLK (NPFLKA) = RADIUS * SINT
YFLK (NPFLKA) = RADIUS * COST
It seems that the results are more colser to the goal, however, the emit direction is not the tangent direction of the arc. I attched my .inp and source.f file, any suggestions are warmly welcomed. Thank you.
ArcSource.inp (1.1 KB) source_arc.f (7.4 KB)
You made a mistake in the assignment of the direction cosine.
Reather than having:
UBEAM = SINT
WBEAM = COST
You should have:
UBEAM = -COST
WBEAM = SINT
By the way, you don’t need to do 3 unnecessary assignments:
UBEAM = -COST
VBEAM = 0
WBEAM = SINT
TXFLK (NPFLKA) = UBEAM
TYFLK (NPFLKA) = VBEAM
TZFLK (NPFLKA) = WBEAM
but could just do:
TXFLK (NPFLKA) = -COST
TYFLK (NPFLKA) = 0
TZFLK (NPFLKA) = SINT