What is a stack? How many stacks does FLUKA have?
A stack is a set of arrays containing all information about particles to be transported. The values can be accessed via an integer index (“stack pointer”) and the same index in different arrays corresponds to different attributes of the same particle. There is one array per each of the phase space coordinates (position coordinates, direction cosines, energy, age), others for the particle type, statistical weight, momentum, generation, various flags, etc. In other codes the stack is called the bank.
At the beginning of a history (or event), a primary is loaded onto the stack with all its properties (particle ID, position, direction cosines, energy, age, generation number, etc.). The next available stack index is increased by 1.
Then the particle is “unloaded” (i.e., a copy is made for transport, and the stack index is decreased by 1). The particle is transported and during its life any produced secondary is loaded onto the stack, increasing the stack index by 1 with each new particle. (Secondaries include delta ray electrons, evaporation particles, photon-produced pairs, capture gammas, split particles, photoneutrons, etc.) At the end of a particle’s life (by energy cutoff, absorption, escape, etc.), the program looks if there are still any particles left on the stack. If there are, the top one (i.e., the one with the largest pointer value) is unloaded and transported, and during transport, again, any new produced particle is stored on the stack.
A primary history is completed when the stack is empty. Then FLUKA calls a subroutine called feeder (or a user-supplied source) to get a new primary to load onto the stack. And so on.
Note that when a particle changes its energy during transport, this is not reflected by the value found on the stack: on the stack you have only the initial energies, ages, weights etc., and anyway they are deleted at the time that the particle is unloaded. Any change affects the “copy”. Note that the stack is a collection of arrays in a
COMMON: XFLK(I), YFLK(I) etc., but the copy is a collection of local scalars
XTRACK, YTRACK, etc., contained in a COMMON called
In addition to the main stack, called FLKSTK, FLUKA has several secondary stacks, each contained in a Fortran COMMON:
- the electromagnetic stack (EMFSTK),
- the stack of optical photons (OPPHST),
- the hadron generator stack (GENSTK),
- the stack of heavy secondaries created in nuclear evaporation (FHEAVY),
- the stack of radioactive decays (RDPSTK)