CERN homepage INFN homepage
CERN homepage INFN homepage
FLUKA: 17.4} Code structure Previous Index Next

17.4} Code structure

 --------------------

 One of the first changes which led to the modern FLUKA was a complete
 redesign of the code structure. The main change was a general
 dynamical allocation scheme allowing to obtain a great flexibility
 while keeping the global memory size requirements within reasonable
 limits. Other improvements were a re-arrangement of COMMON blocks to
 optimise variable alignment, a parameterisation of constants making
 the program easier to maintain and update, the possibility to insert
 freely comments in input, and a special attention devoted to
 portability (FLUKA87 could run only on IBM under VM-CMS).

 The greatest importance was attached to numerical accuracy: the whole
 code was converted to double precision (but the new allocation scheme
 allowed for implementation also in single precision on 64-bit
 computers). As a result, energy conservation was ensured within
 10^{-10}.

 A decision was also made to take systematically maximum advantage from
 the available machine precision, avoiding all unnecessary rounding and
 using consistently the latest recommended set of the physical constant
 values. Such an effort succeeded in strongly reducing the number of
 errors in energy and momentum conservation and especially the number
 of geometry errors.

 A double precision random number generator was also adopted, kindly
 provided by Fred James (CERN) [Jam90], and based on the algorithm of
 RANMAR by Marsaglia and Zaman of Florida State University [Mar87,Mar91].
 The possibility to initialise different independent random number
 sequences was introduced in 2001. In 2005, the newly proposed
 double-precision generator proposed by Marsaglia and Tsang [Mar04] has
 been implemented.

 A deliberate choice was made at an early stage to give preference to
 table look-up over analytical parameterisations or rejection
 sampling. The burden of large file management was more than
 compensated by the better accuracy and increased
 efficiency. Cumulative tabulations optimised for fast sampling were
 initialised at run-time for the materials of the problem on hand, and
 were obtained mainly from complete binary data libraries stored in
 external files.

 The concern for self-consistency was and still is the main guiding
 principle in the design of the code structure.  The same attention has
 been devoted to each component of the hadronic and of the
 electromagnetic cascade, with the aim of obtaining a uniform degree of
 accuracy.  For this reason, FLUKA can now be used just as well to
 solve problems where only a single component is present (pure hadron,
 neutron, muon or electromagnetic problems). It has also been tried to
 give a complete description of the mutual interaction between the
 different components, preserving the possible correlations.

 A set of default settings recommended for several applications
 (shielding, radiotherapy, calorimetry etc.) was introduced in 1996 to
 help the user in a difficult task, but essential to get reliable
 results.


Previous Index Next