28.11.2014 Views

THE EGS5 CODE SYSTEM

THE EGS5 CODE SYSTEM

THE EGS5 CODE SYSTEM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.6 General Implementation Notes<br />

We have seen in the preceding sections how it is possible, given the total cross sections, branching<br />

ratios, final state joint density functions, and an endless supply of random numbers, to simulate<br />

coupled electron and photon transport. Because of the statistical nature of the Monte Carlo method,<br />

the uncertainty in the results will depend on the number of histories run. Generally, statistical<br />

uncertainties are proportional to the inverse square root of the number of histories[156]. Thus, to<br />

decrease uncertainties by half it is necessary to run four times as many histories. Also, for given<br />

cutoff energies, the CPU time required to simulate a shower history is in general slightly more than<br />

linear in the energy of the incident particle. Because of all of these factors, low-uncertainty Monte<br />

Carlo calculations of high-energy shower simulations can be very time consuming.<br />

The most effective way to ease the computational effort of a Monte Carlo simulation is to<br />

minimize the number of calculations required at the deepest levels inside the particle transport<br />

loops by precomputing the values of as many of the required variables as possible. It is for this<br />

reason that the computational task of almost all Monte Carlo programs is divided into two parts.<br />

First, a preprocessor code (PEGS, for the <strong>EGS5</strong> code system) uses theoretical (and sometimes<br />

empirical) formulas to compute the various physical quantities needed and prepares them in a form<br />

for fast numerical evaluation. A second code (EGS itself, in this work) then uses this data, along<br />

with user-supplied subroutines which describe the problem geometry and control the scoring of<br />

results, to perform the actual simulation. The motivation is to perform in advance (in PEGS)<br />

as much computation as possible, so that amount of work done during actual particle transport<br />

simulation is minimized. In earlier versions of EGS, PEGS was a stand-alone program, because with<br />

the slower CPUs in previous generation computers, the data preparation burdens were sometimes<br />

on the same scale as simulation times. As faster computers have become available, users have<br />

typically applied them to longer simulations, and the ratio of data-preparation time to simulation<br />

time has shrunk dramatically. Therefore, beginning with <strong>EGS5</strong>, PEGS, has been an embedded as<br />

subroutine which can be called by <strong>EGS5</strong> user code at the beginning of each simulation.<br />

To aid in debugging and to help those interested in studying the various physics processes<br />

modeled in EGS, starting with EGS4, the EGS Code System was expanded beyond the minimum<br />

coding necessary to simulate radiation transport. With this in mind, PEGS was written in a<br />

modular form, and now contains almost 100 subprograms. These include functions to evaluate<br />

physical quantities which are either needed by PEGS or are of interest for other reasons. Other<br />

routines necessary for use of PEGS within <strong>EGS5</strong> include fitting routines and routines to write the<br />

data for a given material onto a data file. Included among the PEGS subprograms not needed for<br />

the operation of <strong>EGS5</strong> itself are routines to plot the functions on a lineprinter or a graphic device,<br />

and a routine to compare (on a lineprinter plot) the theoretical final state density functions with<br />

sampled final state distributions. Even though PEGS is now a subroutine in the overall <strong>EGS5</strong><br />

package, all of the plotting and density function computation routines have been preserved, and<br />

may be accessed by appropriate user code.<br />

The new PEGS driving subroutine, P<strong>EGS5</strong>, calls some once-only initialization routines and then<br />

enters an option loop. After reading in the option that is desired, a NAMELIST read establishes other<br />

30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!