Direction of incoming particles

Hello Fluka users and experts,

Is there a way to figure out the direction of incoming particles or the incident angle in Fluka? I am plotting the fluence as a functions of R for a given Z but I want to find out whether, for instance, the particles are coming from the left or from the bottom.

Thanks for your help.
Best wishes

Dear Yas Mag,

Maybe it helps to solve your question.
I have two possible options for you:

  1. MGDRAW: This is a routine where you can obtain the trajectory of your particles, If I understand from your question you just need to know from where they are coming, in that case, obtaining all the trajectories you will be able to find this out.

  2. BXDRAW: This is a routine in mgdraw.f, but here you take only the information when you cross from a region to another. You can find it in the user routines in the ‘/src/user/’ folder.

One more thing that could be useful for you is this other thread about MGDRAW:

I hope you can solve the problem with this. In case you need more help (maybe with the routine) or because it does not solve your problem just let me know.

Best,
André

2 Likes

Dear André,

Thank you very much for the detailed answer. I will work on this and let you know shortly.

Best wishes.
Yasser

Hi André,
So I had a look at the manual and at some forums and I think BXDRAW should be fine for me. I added the following line to my input file:
USERDUMP 100. 21. 2. 0. OutFile
I attach here my mgdraw.f (I couldn’t open the mgdraw.f you shared, link not found).
So the run finishes with no apparent problem but I get a huge binary file (15G) and I am not sure how to access the results. I guess it can be opened with Flair but I am actually looking to get an ASCII file with all needed data inside.
Your help is highly appreciated, also if you can look at my mgdraw.f.
Many thanks,
mgdraw_yas.f (14.5 KB)

Dear Yasser,

You should be able to see the tracks from Flair. I tell you the steps:
1 - Go to the Geometry tab.
2 - On your left you will see the subtabs (Geometry, layers, errors) Go to layers and select one of them ( e.g. Media)
3 - Press → Userdump
4 - Below, you will see the Userdump window. From there you can choose the file that you obtained and select the events and particles that you want to see.

#Comment: ‘Start’ means the event from where you want to see your tracks, and ‘# events’ is How many events you want to see, after the one you chose in ‘Start’.


Only one correction to your input:
USERDUMP 100. 21. 2. 0. OutFile

Here with ‘0.’ you are telling FLUKA that you want to use the default MGDRAW. In case you want to use your routine, It should be ‘1.’

Now, for the simulation that you already did, you should be able to plot the tracks with the previous steps.


Finally, I saw yout mgdraw_yas.f. It looks good, but the problem is that you should add the code in the BXDRAW routine.

I propose you 4 options to continue:

1 - Try to see if you can see your tracks with the simulation that you did already. Maybe with that you can solve your doubt

2 - Change the USERDUMP card: 0. → 1. (for user defined routine) Try to run again just doing this

3 - Move the part of code that you use in the BXDRAW subroutine

4 - Delete the part of code that you have in MGDRAW and add the following in BXDRAW:

  ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )

  IF( .NOT. LFCOPF ) THEN
     REGNAM='REGMG1'
     CALL GEON2R ( REGNAM, NSCOREG1, IERR )
     REGNAM='REGMG2'
     CALL GEON2R ( REGNAM, NSCOREG2, IERR )
     FILNAM = CFDRAW
     OPEN ( UNIT = IODRAW, FILE = FILNAM, STATUS = 'REPLACE',
 &        FORM = 'FORMATTED' )
     WRITE (IODRAW, *) '#Boundary crossing at the beginning'
       WRITE (IODRAW, *) '#Region 1: ',NSCOREG1
       WRITE (IODRAW, *) '#Region 2: ',NSCOREG2
     LFCOPF=.TRUE.
  END IF
  IF ( MREG.EQ.NSCOREG1.AND.NEWREG.EQ.NSCOREG2.AND.
 &    JTRACK.EQ.1 ) THEN
     WRITE(IODRAW,'(I8, I7, 8(1PE24.16))') NCASE,
 &   JTRACK, XTRACK(NTRACK),YTRACK(NTRACK),ZTRACK(NTRACK),
 &   CXTRCK,CYTRCK,CZTRCK,ETRACK,PTRACK 
  RETURN
  END IF

With this 4th option you will get an ASCII file with:
JTRACK->Type of particle
[X,Y,Z]TRACK → Position where the particle cross bet
C[X,Y,Z]TRCK-> Angle
ETRACK-> Energy
PTRACK->Momentum
This will be printed in your output file when a particle of type JTRACK crosses from MREG to NEWREG.

#Comments:
JTRACK=1 (protons). You must change that for your case.
Also ‘REGMG1’ and ‘REGMG2’ must be changed to your regions.

I hope it can help.
Let me know if there is something not clear.

Cheers!
André

2 Likes