Run Names Available for Two-Step Simulaiton with Phase Space

I am modelling a rather inefficient process (x-rays through a partial transmission target). I know I can use biasing, and I do, but the statistics are still lower than I would like for reasonable run time. As such, I want to use the two-step method, i.e. collect a phase space immediately after the transmission target and then use that phase space as the input for the rest of the geometry. From other forum posts I have gathered from other posts


  1. I need to kill particles crossing my phase space boundary so I don’t double count backscatter particles.
  2. A good approach is to generate multiple phase space files (through Cycles and Spawns) and then use each phase space file as the source of its own run. For example, step one would produce a phase space file “Transmission_Target_PhaseSpace_Write_001_phsspc” and the second step would use “Transmission_Target_PhaseSpace_Read_001.inp” as the input file for the corresponding phase space.

Are the input file name and run cycle number available in FLUKA user routines?

I would like to programmatically choose a phase space to read for the second step based on which input file that wrote it for the first step. Since FLUKA prepends any file I open in the user-routines with the input file name, all my phase space files get prepended as well. I thought that if I had the input file name, I could do some simple string replacement to read the corresponding phase space file.

Dear Dirk,

The input file name is available with the variable CHINPF defined in the include file, but unfortunately the cycle number are not available in FLUKA as a global variable.

A solution for the problem would be to write an external script (bash, python, etc.) to run each FLUKA job in separate directories, then you can use the directory names to differentiate the phase space files with the same name.


1 Like

2 posts were split to a new topic: How to pass longer filenames to source routine?