How to get readable output in MGDRAW

Dear FLUKA experts,

I am using USERDUMP routine to record the energy and trajectories of e+ and e-. I want my mgdraw.f file to produce the data in a readable format (.csv) but it is only generating unreadable _MGDRAW file that is ~10GB large, no other readable data generated. In Scoring, I also two USERYIELD card or e+ and e- respectively. The USERYIELD is working fine.

I have read the user guide and searched other posts in the forum but still don’t know how to fix this issue.

Here are my .inp file and .f file
BTF_e+730MeV.inp (9.6 KB)
mgdraw_730MeV.f (11.4 KB)

Thank you in advance!
Kail

Hi Kail, the fact that you obtain the default mgdraw unformatted output means that you are running the standard executable and not the one that you are supposed to build embedding your own mgdraw version in mgdraw_730MeV.f. For this purpose, use the Compile tab of Flair.
Also, note that the logic you implemented is extremely inefficient, since it implies a continuous search for the current region names. You should rather get once forever the numbers of the two regions of your interest (calling the dedicated geometry routine GEON2R the first time only) and then use the region numbers (and not the names) in the IF condition.

Hi Francesco, thanks for the advice. Before running, I compiled an executable file mgdraw_730MeV.exe using the compile in flair from right top corner, typed in the executable file name in Executable and then build and used this as the executable when running. But I still got the unreadable _MGDRAW file.

I am not familiar with the fortran used in FLUKA, is this the right modification you meant:

      CALL GEOR2N ( "out1", OUT1, IERR1 )
      CALL GEOR2N ( "precell", PRECELL, IERR2 )
      IF(IERR1 .NE. 0 .OR. IERR2 .NE. 0) STOP "Error in name conversion"

     
      IF(JTRACK .EQ. 3) WRITE(31,'(1P,8G25.15)')
     &      XSCO, YSCO, ZSCO, ETRACK, CXTRCK, CYTRCK, CZTRCK, WTRACK
      IF(JTRACK .EQ. 4) WRITE(32,'(1P,8G25.15)')
     &      XSCO, YSCO, ZSCO, ETRACK, CXTRCK, CYTRCK, CZTRCK, WTRACK

naming region ‘out1’ as OUT1 and ‘precell’ as PRECELL. Which one is the region numbers?

This is because you are using the same 31 and 32 units that you already reserved as unformatted for USRYIELD in your input.

Have a careful look at this modified mgdraw version mgdraw_rev.f that should provide the desired output on the selected 99 and 98 units.

Hi Francesco, thank you for fixing my script(especially for those comments!). Unfortunately, using the modified script, my run stopped with error immediately after the run started, the error message said ’ No ranBTF_e+730MeV002 generated! ’ and error code 12. I also tried again with my original script(i realised I did not compile the original mgdraw,f properly at first). It doesn’t have the 10GB _MGDRAW file anymore, and instead produced two files _e+ and _e-, from the code

OPEN ( UNIT = 31, FILE = "e-", STATUS = 'UNKNOWN')
OPEN ( UNIT = 32, FILE = "e+", STATUS = 'UNKNOWN')

however, the _e+ and _e- files are empty, the source code did not seem to have written anything into them…

Please find in my second post above a corrected mgdraw version, which now produces BTF_e+730MeV001_fort.99 and BTF_e+730MeV001_fort.98 files with the desired information.
In my previous version, there was an issue with the region names (that, according to your input, requires capital letters).
Also, from the ancient names in the INCLUDE statements, it appears that you are not running a FLUKA version supported in this forum. The latter shall be downloaded from fluka.cern

Thanks! After changing my region name to capital letters, it started recording data.