Download as pdf or txt
Download as pdf or txt
You are on page 1of 348

A Monte Carlo Primer

A Monte Carlo Primer


A Practical Approach to Radiation Transport

Stephen A. Dupree
and
Stanley K. Fraley
Sandia National Laboratories
Albuquerque, New Mexico

SPRINGER SCIENCE+BUSINESS MEDIA,LLC


ISBN 978-1-4613-4628-9 ISBN 978-1-4419-8491-3 (eBook)
DOI 10.1007/978-1-4419-8491-3

©2002 Springer Science+Business Media New York


Originally published by Kluwer Academic/Plenum Publishers, New York in 2002
Softcover reprint of the hardcover lst edition 2002
http://www.wkap.com
10987654321
A C.I.P. record for this book is available from the Library of Congress
AII rights reserved
No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by
any means, electronic, mechanical, photocopying, microfilming, recording, or otherwise, without written
permission from the Publisher
To Pat and Hurl
Preface

The mathematical technique of Monte Carlo, as applied to the transport


of sub-atomic particles, has been described in numerous reports and books
since its formal development in the 1940s. Most of these instructional
efforts have been directed either at the mathematical basis of the technique
or at its practical application as embodied in the several large, formal
computer codes available for performing Monte Carlo transport calculations.
This book attempts to fill what appears to be a gap in this Monte Carlo
literature between the mathematics and the software. Thus, while the
mathematical basis for Monte Carlo transport is covered in some detail,
emphasis is placed on the application of the technique to the solution of
practical radiation transport problems. This is done by using the PC as the
basic teaching tool.
This book assumes the reader has a knowledge of integral calculus,
neutron transport theory, and Fortran programming. It also assumes the
reader has available a PC with a Fortran compiler. Any PC of reasonable
size should be adequate to reproduce the examples or solve the exercises
contained herein. The authors believe it is important for the reader to
execute these examples and exercises, and by doing so to become
accomplished at preparing appropriate software for solving radiation
transport problems using Monte Carlo. The step from the software described
in this book to the use of production Monte Carlo codes should be
straightforward. However, instead of using these production codes as "black
boxes" that must be taken on faith, the reader should be able to understand
the functions being performed by the various components of the production
software, and in most cases be capable of modifying or expanding it to suit
the needs of a particular calculation.

vii
viii Preface

Mathematical procedures can be expressed in many different ways using


high-level computer languages. Fortran is no exception to this generality.
Thus there is no "best" way to write a Fortran procedure, and many
individual styles, all of which can produce equally valid results, are possible.
In our examples we employ executable statements based on Fortran-90, but
have often retained the style of older versions of Fortran. We have done this
because of our particular experience in using various versions of Fortran.
Hopefully readers will be able to follow the constructs easily and to re-cast
them into a form compatible with their preferences. To save space we have
frequently placed several executable statements in a line of coding.
We have adopted several conventions in the presentation of the text and
examples. Fortran subroutines and variable names are designated by single
quotation marks. Numerical exponents are expressed either by using the
base 10 with a superscript or using the convention of '+' or '-' to designate
the exponent; i.e., 1.0+5 = 1.0E+5 = 1.0 x 105. Tabulated results are
rounded, with the number of significant digits shown being that which seems
appropriate for the example in hand. All calculations that involve using
computed results to obtain additional results use the values prior to rounding.
Therefore, if the derived results are reproduced using the rounded values
presented in the tables the numbers obtained may differ from those cited in
the text. Because compilers and execution speeds differ, the user should not
expect to reproduce the problem run times cited in this book. However, the
relative efficiencies of a series of calculations should be similar regardless of
the compiler and computer used.
We gratefully acknowledge the assistance of our friends and colleagues
who reviewed the manuscript. Kevin O'Brien and Jim Renken provided
thorough and detailed reviews of the entire text, and Eleanor Walther
reviewed the appendix. In all cases their comments were well considered
and informative, and they saved us from numerous omissions, obfuscations,
and errors. Special thanks go to Len Connell and Tom Laub, who not only
reviewed the text but also devoted considerable effort to checking and using
the Monte Carlo routines. Long before the manuscript was completed Len
Connell was the first user of the probabilistic framework code. Tom Laub
provided independent solutions and numerous corrections to the example
problems. The time and efforts of these reviewers are much appreciated and
this book has greatly benefited from their support. Needless to say, any
errors remaining in the text are the responsibility of the authors.

Stephen A. Dupree
Stanley K. Fraley
Albuquerque, NM
July 2001
Contents

Chapter 1. Introduction

1.1 The Monte Carlo Method 1


1.2 The Evaluation of Random Processes 4
Example 1.1 Predicting the average outcome of a
physical process 6
Example 1.2 Another Monte Carlo estimate of 1t 11
1.3 Monte Carlo Evaluation of Definite Integrals 14
Example 1.3 Evaluation of a definite integral using
Monte Carlo 16
Exercises 18

Chapter 2. Monte Carlo Sampling Techniques

2.1 Probability Theory and Statistics 21


2.1.1 Random Variables and Sample Spaces 21
2.1.2 Distributions 24
2.2 Sampling 25
2.2.1 Sampling from the Inverse of the Cumulative
Distribution Function 27
Example 2.1 Uniform sampling inside a sphere 28
2.2.2 The Rejection Technique 30
2.3 Means and Variances 32
2.4 Estimations of Means and Variances 35
Example 2.2 Calculation of mean and variance of a
distribution 36

ix
x Contents

2.5 Introduction to Variance Reduction Techniques 38


Example 2.3 Variance reduction by repeated samples 39
2.5.1 Stratified Sampling 42
Example 2.4 Use of stratified sampling to evaluate a
definite integral 44
2.5.2 Biased Sampling Schemes 51
Example 2.5 Biasing a Monte Carlo estimate of a
definite integral 53
Exercises 55

Chapter 3. Monte Carlo Modeling of Neutron Transport

3.1 Introduction 57
3.2 Neutron Interactions and Mean Free Path 57
3.3 Neutron Transport 59
3.4 A Mathematical Basis for Monte Carlo Neutron Transport 62
3.5 Monte Carlo Modeling of Neutron Motion 65
Example 3.1 Monoenergetic point source with
isotropic scattering 67
Example 3.2 Self-attenuation in a spherical source
of gamma rays 75
Example 3.3 Beam of neutrons onto a slab shield 77
3.6 Particle Flight Path in Complex Geometries 80
Example 3.4 Mean distance to the next collision 81
3.7 Multi-Region Problems 83
Example 3.5 Two-region slab with a void 83
Exercises 87

Chapter 4. Energy-Dependent Neutron Transport

4.1 Elastic Scattering of Neutrons 89


Example 4.1 Average number of collisions to
thermalize neutrons 92
4.2 Transformation of Post-Collision Direction to Laboratory
System 97
Example 4.2 Average direction of travel after two
collisions 103
4.3 Energy-Dependent Cross Sections 105
Example 4.3 Neutron slowing down and Fermi age
in water 106
Exercises III
Contents xi

Chapter 5. A Probabilistic Framework Code

5.1 Introduction to PFC 113


5.2 Problem Definition in PFC 116
5.2.1 Problem Geometry and Tracking 116
5.2.2 Additional Input and Array Initialization 122
5.3 The Random Walk in PFC 124
5.4 Computing the Response 133
Example 5.1 Using PFC to solve Example 3.1 133
Exercises 13 7

Chapter 6. Variance Reduction Techniques

6.1 Introduction 139


6.2 Source Biasing 140
Example 6.1 Leakage of particles from a slab 141
6.3 Survival Biasing 150
Example 6.2 Particles passing through a slab 151
6.4 Russian Roulette 154
Example 6.3 Russian roulette in the slab problem
of Example 6.2 155
6.5 Splitting 159
Example 6.4 Slab problem with splitting and
Russian roulette 162
6.6 Exponential Transform 168
Example 6.5 Transmission through a slab with
exponential transform 170
Exercises 173

Chapter 7. Monte Carlo Detectors

7.1 Introduction 175


7.2 The Next-Event Estimator 176
Example 7.1 Next-event flux estimates in an
isotropic scattering material 179
7.3 Volumetric Flux Detectors 185
Example 7.2 Collision-density and track-length
flux estimates 186
7.4 Surface-Crossing Flux Estimator 192
Example 7.3 Surface-crossing flux estimates 197
7.5 Expectation Surface-Crossing Flux Estimator 201
xii Contents

Example 7.4 Expectation surface-crossing


flux estimates 203
7.6 Time-Dependent Detectors 206
Example 7.5 Time-dependence of the flux from a
point isotropic source 207
Example 7.6 Time dependence in neutron slowing
down 217
Exercises 224

Chapter 8. Nuclear Criticality Calculations with Monte Carlo

8.1 Multiplying Assemblies 227


8.2 The Generation Method 229
Example 8.1 Criticality in a homogeneous sphere
by ratio of generations 230
8.3 The Matrix Method 242
Example 8.2 k for a homogeneous sphere using
matrix method 245
8.4 Combination of Generation and Matrix Methods 250
Example 8.3 Multi-generation matrix calculation 251
8.5 Criticality Calculations Using Multigroup Cross Sections 258
Example 8.4 Critical mass of the Godiva assembly 259
Exercises 268

Chapter 9. Advanced Applications of Monte Carlo

9.1 Correlated Sampling 269


Example 9.1 Generating correlated strings of
random numbers 274
Example 9.2 Sensitivity of the number of particles
passing through a slab to the thickness
of the slab 276
9.2 Adjoint Monte Carlo 281
Example 9.3 Detector response function using
adjoint transport 286
Example 9.4 A point-detector response using
adjoint transport 294
9.3 Neutron Thermalization 302
Example 9.5 Neutron spectrum in thermal
equilibrium 309
Exercises 314
Contents xiii

Appendix
Random Number Generators 317

Bibliography 329

Index 335
Chapter 1

Introduction

1.1 The Monte Carlo Method

The Monte Carlo method can be used to solve a wide range of physical
and mathematical problems. Its utility has increased with the general
availability of fast computing machines, and new applications are
continually forthcoming. However, the basic concepts of Monte Carlo are
both simple and straightforward, and can be learned by using a personal
computer. In this book we will use such a computer as the basis for
developing and explaining the fundamental concepts of Monte Carlo as
applied to neutral particle transport. As each topic is addressed a
corresponding set of software instructions will be developed. The software
that results will be assembled into a program configuration that is
representative of a full-scale Monte Carlo radiation transport program. The
components of the program will be explained and combined in a fashion that
will allow the reader to understand the function and contribution of each to
the final, and sometimes daunting, whole.
The Monte Carlo method is a technique of numerical analysis that is
based on the use of sequences of random numbers to obtain sample values
for the problem variables. The calculational process used in Monte Carlo is
an artificial construct, usually a computer program that is mathematically
equivalent to the problem being analyzed. Sample values for the problem
variables are obtained by selecting specific numbers from appropriate ranges
for the variables in the problem using probability distributions for such
variables. The desired solution can be obtained, along with estimates of
uncertainties in the solution, by analyzing the results from the sample
values. The sample evaluation in a Monte Carlo calculation is somewhat
equivalent to conducting an experiment. Both an experiment and a Monte
2 Chapter 1

Carlo calculation will yield a result that is a possible, or representative,


outcome of the process being modeled, and both contain uncertainties that
can often be reduced by repeated measurements and quantified by the use of
statistical analysis.
The variety of problems to which the Monte Carlo technique can be
applied can only be suggested here. However, to indicate the utility of the
method, and to assist the reader in developing practical skills in applying
Monte Carlo or using any of the existing, standardized Monte Carlo
transport computer codes, we will make use of example problems
throughout the text to illustrate and expand the principles and application of
the technique.
The use of random processes to solve mathematical problems has been
known in one fonn or another for some time. For example, in the 18th
century, the- well-known naturalist and mathematician Georges-Louis
Leclerc, Comte de Buffon, developed an experimental method of obtaining
the ratio of the diameter to the circumference of a circle; i.e., of detennining
the reciprocal of 1t.t This experiment attained a modicum of notoriety, as
reported in 1873 by Hall.2 Buffon's experiment consisted of dropping a
needle randomly onto a surface on which was drawn a series of equally
spaced parallel lines. If the length of the needle is equal to half of the
distance between the lines, then the probability p that the needle touches one
of the lines is

p=lI1t (1.1)

If the needle is tossed randomly onto the plane of parallel lines n times, and
it is found by observation to intersect a line k times, then

p~k/n (1.2)

By the weak law of large numbers, this expression becomes exact in the
limit of large n,

lim ~ =.!. (1.3)


0-+00n 1t

The basis for this result is as follows. If parallel lines are spaced a
distance d apart, and a needle of length A;S; d is tossed randomly among
them, then the angle between the needle and the lines is random over [O,1t].
The position of the center of the needle, "0, is randomly distributed over the
interval [O,d] in a coordinate x that is perpendicular to the parallel lines, as
measured from the nearest "bottom" line (see Figure 1.1.)
J. Introduction 3

Needle

r
Coordinate
X Parallel
Lines
d

Figure 1.1. Coordinate System for Buffon's Problem

The projected length of the needle onto the coordinate x is A. sin a, where
a is the angle between the needle and the parallel lines. If Xc < 0.5 A. sin a,
or if Xc > d - 0.5 A. sin a, the needle will intersect a line. Thus two distinct
regions in the space ofa and x can be defined as shown in Figure 1.2: the
region 0 in which the needle does not touch a line, and the region L in
which it does touch a line. The probability p that the needle will touch a
line is the ratio of the area of L to the total area 0 + L = 1td. Thus

p =_L_ = 2.
ltJA. sina da = 2A. (1.4)
D+L 1td 02 1td

If the needle is half as long as the lines are apart, A. = dl2 and, by equation
(eqn) 1.4, p = lI1t.
a
ltt-:--------::::~

Figure 1.2. Regions L and D in Buffon's Problem

Significant uses of random sampling techniques occurred early in the


twentieth century. Lord Kelvin applied what today would be called the
Monte Carlo technique to the Boltzmann equation. 3 The statistician Student
used the technique of random sampling to assist him in the determination of
the correlation coefficient.4 Student also used sampling methods in studies
of the t-distribution. However, the practical use of calculations involving
4 Chapter 1

random variables, and the coining of the name "Monte Carlo," was begun at
Los Alamos during the Manhattan Project of World War II by John von
Neumann and Stanley Ulam. The Los Alamos researchers introduced the
use of variance reduction, particularly the techniques known as Russian
roulette and splitting,s to increase the efficiency with which random
variables can be evaluated and solutions obtained.
The original Monte Carlo calculations performed at Los Alamos were
executed using slide rules and mechanical calculators, with the "random"
numbers being obtained by several different methods. Availability and
improvement of computers following World War II greatly extended the use
of the Manhattan Project Monte Carlo technique. The first set of random
numbers6 and the first lengthy monograph on Monte Carlo methods 7 were
published in the mid-1950s. Since that time the Monte Carlo method has
been extended to numerous areas of science and technology and has been
used as an analysis or engineering design tool in many fields of research.
Today it is a standard mathematical tool applied to complex problems not
tractable by other methods and is the method of choice in certain
applications.

1.2 The Evaluation of Random Processes

As defined in the previous section, the Monte Carlo technique consists of


mathematical procedures that evaluate random variables using random
numbers. Typically these random variables are part of a series of
parameters that must be evaluated to obtain the solution to a problem. That
is, the solution requires evaluation of a random, or stochastic, process by
which the random variables in the problem take on specific values. A
random variable is a measurable quantity associated with a random
experiment. For example, a numerical quantity associated with an event in a
game of chance is a random variable. A random variable can be discrete,
such as the point resulting from the throw of a pair of dice, or continuous,
such as the final position of a pointer on a spinning wheel. The overriding
characteristic of a random variable is that it cannot be predicted
deterministically and acquires a value only after a procedure is conducted to
select a value, or sample, from the range, or sample space, available to the
variable.
In order to obtain practical solutions to problems involving random
variables a sequence of evaluations of the random variables must be made.
Suppose one wished to produce a possible point sequence from the throwing
of a pair of dice. Dice can actually be used to generate such a sequence
experimentally. However, this may not always be convenient, and there
may be a question of whether a particular pair of dice is unbiased or is being
1. Introduction 5

thrown in an unbiased manner. Furthermore, unlike the throwing of dice,


for many problems it may be impossible to evaluate the random variables
experimentally. In these cases, calculations must be used to produce the
desired sequence of values.
As an example let us consider a class of bolts that has been certified to a
certain torque. While this certification may be useful information, it
provides no knowledge of the failure point of any specific bolt. Such
knowledge can only be obtained by testing the bolt to failure. Even then, if
one could reconstruct the failed bolt exactly as it was and re-test it, one
would expect to measure a different failure point, because of changes in the
measuring instrument if for no other reason. A series of tests on random
samples of bolts, or a series of properly constructed Monte Carlo
calculations could be used to predict, within some limited accuracy, the
fraction of the members of the class that, on the average, would fail at a
given torque. Thus specific, quantitative knowledge about the population of
bolts is possible, but even with such knowledge one still has no way of
predicting the failure point of the next bolt removed from the bin. Just as
this type of uncertainty is a feature of the real world, it is a feature of the
Monte Carlo method.
Repeated estimates of a random variable can provide information about
the variable that cannot be determined in a single estimate. For example, a
single throw of a die provides little information about the numbers on the
faces of the die. From a single throw one could not determine whether the
die was "fair" - i.e., whether the values one through six were each
represented on the faces of the die and whether they appeared with equal
probability - or whether the die was biased. To determine the numbers that
are on the faces of the die without conducting a visual examination,
numerous samples, or throws of the die, would be required, along with
careful evaluation of the data to provide confidence in the result.
The postulated sequence of integers required to simulate the throwing of
a die or the breaking of a bolt could be obtained in a number of ways, such
as flipping a coin to form a sequence, or "string," of binary digits, or picking
numbers from the Manhattan telephone directory. Both of these methods
have been used successfully to evaluate random variables. However,
modem digital computers provide a more convenient method of obtaining a
string of randomly distributed numbers.
A random number is a numerical quantity that is selected from a uniform
distribution of numbers between some limits. The boundaries of this
interval are not important since any interval can be obtained from another by
a simple coordinate transformation. However, most random number
generators use the interval from zero to one, usually exclusive of one or both
end points. As discussed in the Appendix, random number generators are
mathematical algorithms that produce "random" numbers from simple
6 Chapter 1

calculations typically involving the use of low order bits in digital computer
words. The number strings produced by such mathematical algorithms are
called pseudorandom because the string of numbers they produce can be
reproduced at will. However, the sequence of a good quality random
number generator will exhibit a reasonable degree of randomness.
Randomness in this application means that sequential numbers are
uncorrelated and, in the limit as many numbers are selected, the density of
numbers is uniformly distributed over some interval.
To reiterate, random processes can be evaluated by modeling the
physical process involved or by solving equations that describe the process.
The direct, or analog method of solution, in which the physical process itself
is modeled, is usually the easiest to understand since the steps involved in
the solution follow the steps in the physical process. The solution of
mathematical models is the more flexible and useful application, however,
since such models are not constrained to physical processes. Mathematical
Monte Carlo also lends itself readily to the incorporation of variance
reduction methods. Such methods can greatly reduce the time required to
achieve a result of satisfactory accuracy in a Monte Carlo calculation.

Example 1.1 Predicting the average outcome of a physical process

By observation you have determined that a certain child learning to walk


on a balance beam takes an average of ten steps on the beam before falling;
i.e., the ratio of steps to falls is 10 to 1. Therefore, assuming a constant
probability of falling per step taken - that the child does not tire or become
distracted with success and therefore is as likely to fall on the first step as on
any other step in a sequence - the probability of falling is 0.1 per step.
Assume the child requires five steps to traverse the beam. Determine the
average number of times the child will successfully complete five steps, and
therefore walk the entire length of the beam, out of ten starts.
This problem is not deterministic; one cannot predict with certainty the
actual number of successes in ten specific attempts to walk the beam.
Instead the number of successes will vary in a random fashion around some
average, sometimes equaling the average and ·sometimes being more or less
than the average. Thus there is a probability po that the child will succeed
zero times in ten tries, a probability PI that the child will succeed one time,
etc., up to a probability PIO that the child will succeed all ten times. From
the theory of a priori probability for mutually exclusive events, the sum of
these individual probabilities must be 1.0 since every possibility has been
included and every set of ten tries must have some outcome. Monte Carlo
can be used to obtain an estimate of each of these eleven probabilities and
thereby "solve" the problem.
1. Introduction 7

Our approach will be to simulate the child walking the balance beam and
then count the number of successful walks as a fraction of the total number
of trials. By repeating this simulation a large number of times an estimate
can be obtained of both the average number of times out of ten tries the
child will succeed and the distribution of the number of successes about this
average. The latter estimate is particularly important since without it one is
unable to evaluate the precision of the answer. When evaluating a random
variable, often the only method available for estimating the variance of the
mean is to obtain mUltiple estimates, compute the average, and then estimate
the variance of this average based on the distribution of the estimates. It
should be noted that a Monte Carlo estimate of a value without an
associated uncertainty is essentially meaningless. It is similar to a statement
that, "People weigh 157.3 pounds, because that is what I measured when I
weighed somebody once."
The Monte Carlo method of solution assumes there is an unlimited
supply of random numbers available in the range (0,1). These random
numbers will be used one-by-one to decide whether an event, which has a
certain probability of occurring, will be evaluated as having occurred. For
example, if an event has a 0.1 chance of occurring under a particular
circumstance, then a random number that is selected from the interval (0,1)
and has a value less than 0.1 could indicate the event occurred, and a
random number (selected from the same interval) greater than or equal to
0.1 could indicate that the event did not occur.
In a formal sense, the question of whether to include the single point on
the boundary between domains in a numerical space for a random number in
the "lower" of "upper" portion of the space is irrelevant. That is, in the
above example, inclusion of the point for which the random number equals
0.1 in the domain representing an event, instead of the absence of the event,
makes no difference in the result. Because there are an unlimited number of
points on a line between any two values of the coordinate along the line -
i.e., because the number of numerical values between any two different
numbers is unbounded - the probability of selecting a particular point, or
numerical value, such as 0.1, from the continuum of values available to a
truly random number, is zero.
However, in practice, the word length of a computer is finite. Therefore
the probability of selecting a particular value from the available set of
numbers between two limits is not zero. Nevertheless, good quality random
number generators use a high order of precision (at least 32 bits) and the
probability of selecting one particular value is small. In this case the
definition of domain boundaries is of little consequence. On the other hand,
when a small number of significant digits is used for the random number
sequence, as will be the case in the present example, it becomes important
that the correct end of the range of the variable be included in the definition
8 Chapter 1

of each domain. We assume the present random number generator covers


the range [0,1), and hence can take on the value of zero but not of one. It
would seem reasonable, therefore, that for this example the point 0.1 be
included in the "upper" domain and if the random number generator
produces a value of 0.1 we will assume the event has not occurred.
In the present problem the Monte Carlo process assumes the child
attempts to take a first step. The child has a probability of 0.1 of falling off
the balance beam in attempting this first step. Thus if the first random
number picked is less than 0.1 the simulation assumes the child has fallen,
otherwise the child takes a second step. If the second random number is less
than 0.1 then the child has fallen while taking the second step, otherwise the
child takes a third step, etc. If after completing the fifth step the child has
not fallen - if five consecutive random numbers in the string have values
greater than or equal to 0.1 - then the child has successfully walked the
beam and the scoreboard is marked with a one. If the child fails to complete
five steps in sequence, the child's scoreboard is marked with a zero and a
new trial is begun.
The scores may be tabulated after every series of ten tries, with the
number of successful tries in that series tallied as an estimate of the desired
answer. After simulating many such series of ten tries, the scores can be
averaged to estimate the mean number of successes per ten tries.
Alternatively, each of the simulated trials can be considered individually and
the probability of success per trial determined. The "expected," or average,
number of successes per ten trials will then be ten times this value. In
general, many (100 or more) series should be calculated in order to obtain a
reasonably accurate estimate ofthe answer.
A string of random numbers can be obtained from many pocket
calculators. One such string is shown to two significant digits in Table 1.1.
To solve the current problem, we will look for five consecutive numbers in
the random number string greater than or equal to 0.1. Thus we step through
the simulation, using the random numbers in the sequence in which they
arise, in order to obtain the desired answer.
From Table 1.1 one can follow the sequence of simulations in the
following manner. Starting with the first random number we find five
consecutive values greater than or equal to 0.1; therefore, the child succeeds
in walking the full length of the beam on the first try and gets a score of one.
Likewise all the random numbers six through ten are greater than or equal to
0.1 so the child also succeeds on the second try. In fact, the first random
number less than 0.1 is the 16th entry in the table, so the first three trials are
successful while the fourth trial fails on the first step. Therefore after four
tries we find three successes and one failure, giving a success rate of 0.75.
1. Introduction 9

J A Random Number Set from a Pocket Calculator


Table J..
Seq. Rand Seq. Rand Seq. Rand Seq. Rand
# # # #
I 0.10 26 0.57 51 0.54 76 0.09
2 0.74 27 0.97 52 0.51 77 0.17
3 0.32 28 0.26 53 0.27 78 0.62
4 0.35 29 0.06 54 0.92 79 0.94
5 0.87 30 0.22 55 0.48 80 0.07
6 0.28 31 0.49 56 0.22 81 0.31
7 0.36 32 0.32 57 0.34 82 0.97
8 0.11 33 0.84 58 0.54 83 0.41
9 0.26 34 0.70 59 0.91 84 0.12
10 0.93 35 0.15 60 0.24 85 0.14
II 0.56 36 0.65 61 0.79 86 0.08
12 0.34 37 0.78 62 0.78 87 0.14
13 0.52 38 0.28 63 0.53 88 0.30
14 0.44 39 0.91 64 0.03 89 0.76
15 0.51 40 0.88 65 0.18 90 0.81
16 om 41 0.09 66 0.79 91 0.70
17 0.45 42 0.09 67 0.71 92 0.95
18 0.41 43 0.34 68 0.81 93 0.90
19 0.08 44 0.33 69 0.38 94 0.65
20 0.05 45 0.94 70 0.96 95 0.Q7
21 0.31 46 0.02 71 0.19 96 0.15
22 0.42 47 0.31 72 0.61 97 0.53
23 0.67 48 0.03 73 0.43 98 0.57
24 0.40 49 0.58 74 0.28 99 0.Q7
25 0.71 50 0.40 75 0.98 100 0.92

If we proceed through the set of random numbers in Table 1.1 we find 13


successes in the 27 trials simulated by the first 99 numbers in the table.
These results are summarized in Table 1.2. The calculated probability of
success is therefore 13/27 ~ 0.48, which agrees intuitively with the premise
of the child falling roughly every ten steps. Thus this small sample appears
to provide a fairly reasonable average success rate.
One can easily solve this problem exactly. Because the probability of the
child falling off the beam at any step is Pr = 0.1 the probability of not falling
on the same step is Pnr = 1 - Pr = 0.9. Therefore the probability of the child
completing exactly one step is Pnr times the probability of falling on the
second step, Pr , and PI = Pr Pnr . The probability of completing exactly two
steps is P2 = PrPn/. The probability of the child completing exactly n steps
successfully (for n < 5 because the child covers the length of the beam in
five steps), is

(l.5)
10 Chapter J

Table J.2. Resu ts 0 fE xample


1 1. 1
Trial Steps Taken Score Trial Steps Taken Score
Number Successfully Number Successfully
1 5 1 IS 5 I
2 5 1 16 5 1
3 5 I 17 5 I
4 0 0 18 0 0
5 2 0 19 5 1
6 0 0 20 5 1
7 5 1 21 I 0
8 3 0 22 3 0
9 5 I 23 5 1
10 5 1 24 0 0
11 1 0 25 5 1
12 0 0 26 3 0
13 3 0 27 3 0
14 1 0

That is,

(1.6)

for values of n from 0 through 4. The probability of the child completing


the five steps required to walk the beam is one minus the sum of the
probabilities of falling on any step, or the sum of the Pn for n = 0 through 4,

Ps =(0.9)s ~ 059 (1.7)

since the child cannot fall on the sixth step, there being no sixth step. One
would thus expect about 16 successes in 27 tries whereas our short Monte
Carlo calculation produced 13 successes in 27 tries.
It is clear that this Monte Carlo estimate contains some degree of error.
If our result were normally distributed, a concept we will discuss in Chapter
2, the standard deviation of our estimate would be the square root of the
number of successes and we would say that the average number of successes
per 27 tries is 13 ± 3.6. Normalizing to ten trials, as specified in the problem
definition, we would estimate the number of successes per ten trials to be
4.8 ± 1.3. From eqn 1.7 the exact value is slightly larger than 5.9, which is
within our estimated standard error.
There is more information in the results shown in Table 1.2 than this
simple average. For example, we have coincidentally produced an estimate
of the probability of the child falling after zero through four steps, as well as
the probability of completing the walking of the beam. To obtain these
1. Introduction 11

estimates we need merely count the number of times each result was
obtained in the simulation. Access to these results was a simple matter of
recording the relevant data as the calculation proceeded. In a computer
calculation one may either record the entire sequence of events in the
simulation, as was done in Table 1.2, record some relevant portion of that
sequence, or record just the event data one wishes to use. In the latter case
the entire sequence of events would have to be recalculated to score
alternative results. Planning for the scoring is desirable in Monte Carlo and
will be discussed in Chapter 7.
Table 1.2 shows that the child fell off the beam on the second step three
times during the 27 trials conducted. This gives a probability per trial of
0.11 ± .06 of falling on the second step. From eqn 1.6 we see the correct
probability is 0.09. Because of the small number of times this result will
occur, relative to the successful walking of the beam (which has a
probability of 0.59), many more simulations of the type considered here
would be required to improve the accuracy of the Monte Carlo estimate for
the probability of falling on the second step than are included in Table 1.2.
However, if one were interested in obtaining an accurate estimate of this
quantity while running as few simulations as possible, one could attempt to
do so using variance reduction, as will be discussed in Chapter 6.

Example 1.2. Another Monte Carlo estimate of 1t

Consider a circle of unit radius with its center at the origin. We wish to
estimate the area within the portion of the circle that is in the positive
quadrant; i.e., the area of the portion of the circle in the quarter space in
which both x and yare positive. In a sense this problem is similar to
Buffon's Monte Carlo determination of lI1t since this area is, of course,
proportional to 1t. Thus this result will provide us with an additional method
to estimate 1t.
A Monte Carlo solution for the area can be made using the following
process. A pair of random numbers, each distributed uniformly over the
range (0,1), is used to select a random point in the square defined by 0 ~ x ~
1 and 0 ~ y ~ 1. The point so selected is then examined to see whether it is
inside or outside the unit circle centered at the origin. If the point is outside
the unit circle it is rejected; i.e., it is not included in the tally of points found
to be inside the circle. If the point is inside the circle the result is included
in the tally. This process is repeated many times to obtain a number of
points inside the circle. By comparing this tally with the total number of
points evaluated one can obtain an estimate of the probability of a point in
the unit square, selected randomly, being inside the circle. That is, the ratio
of the number of points not rejected, which are those inside the circle, to the
12 Chapter 1

total number of trials is equal to the ratio of the area of the quadrant of a unit
circle (1t/4) to the area of the unit square (1.0). Thus the ratio is an estimate
of the quantity 1t/4. This method of solution is known as the rejection
technique.
This problem involves more than the mere selection and counting of
random numbers as was done in Example 1.1. Here we must compare the
location of the point selected with the arc of the unit circle to determine
whether the point is inside or outside the circle. Thus, after we select the
point (x,y), we must find whether x2 + y2 ~ 1. This would be tedious to
calculate by hand but is simple to program on a computer. A sample Fortran
program to determine the ratio of points inside the circle to total points
selected is shown in Table 1.3.
The function 'fltm,' used in the program of Table 1.3, returns a
pseudorandom number in the range (0,1). The starting point in the random
number string could be set by the subroutine 'mdin.' The argument of
'mdin' must be an integer from one through 231_2. The purpose of using
'mdin' would be to enable the user to repeat a sequence of pseudorandom
numbers should this be desired in order to check or debug a calculation, or
to resume a calculation without repeating any part of the random number
string already used. These concepts, along with the operation of the random
number generator and the routines associated with it, are described in the
Appendix. The user may substitute another random number generator, such
as the one supplied by the Fortran compiler being used, but should be aware
that such generators may be of poor quality. Finally, the random number
generator is not shown explicitly in the Fortran examples in this book, and
the appropriate routines from the Appendix, or elsewhere, must be linked to
the executable files.
The program shown in Table 1.3 consists essentially of a 'do' loop that
retrieves two sequential random numbers, 'x' and 'y,' and tests whether the
resulting point (x,y) is inside the unit circle. If so a score is added to the
running tally, 'npi,' and the square of the score is added to a second tally
called 'sumsq.' The latter, as we shall see, enables us to estimate the
uncertainty in the result. As given, the program uses 109 points and
calculates the expected value of 1t, as well as the standard deviation of the
expected value, on the basis of these points.
The results of executing the program in Table 1.3 are shown in Table
1.4. This table provides the results for several different sample sizes. The
approach to the correct value of 1t is evident as the number of samples
increases. From Table 1.4 it is clear that, using this unbiased rejection
calculation, almost 109 points must be selected in order to obtain an estimate
of 1t accurate to five significant digits. Even allowing for the speed of
modern computers this is not a very efficient method of calculating 1t.
1. Introduction 13

Table 1.3. Program for Estimating Pi Using Unit Circle


A M::lnte carlo program to cala.llate Pi using rejectioo. Points are selected
unifoDllly fran a unit square. Those points inside a unit circle are cconted, others
rejected. The area of the square is 1, that of the enclosed circle is pi/4.

roJBLE PREr:ISICN fltm, S\.ll\Sq, pi, tries


OPEN(unit=6,file='ranpi.txt')
notries=1000000000 ! notries is the number of samples (tries)
s\.IlLSCf'O •0; npi=0 ! initialize variables for scoring
DO 100 i=l,notries
x=fltmO ! fltm gives a randan number (0,1)
y=fltmO ! selects a randan pt (x,y) within square
IF (x**2 + y**2 .LE. 1.0)THEN ! SCXlre points inside circle
npi=npi+1 ! add one, rrultiply by 4 later
sunsq=S\.Il\Sq+1. 0 ! keep sun of squares to estimate variance
ENDIF
100 CXNI'INUE
tries=~(notries); pi=FLOAT(npi)/tries
stdev = ~ ({s\.ll\Sq/tries-pi**2) /tries)
WRITE (6, 14)notries,pi*4.OdO,stdev*4.0d0
14 FtH1A.T (lx,'notries: ',ilO,' pi: ',flO.6,' stddev :',flO.6)
STOP

Table 1.4. Estimates of Pi from Area of Unit Circle


No. of Estimate of Pi Standard Deviation
Samples of Estimate
104 3.149600 0.016366
105 3.138520 0.005200
106 3.142096 0.001642
107 3.141878 0.000519
108 3.141438 0.000164
109 3.141588 0.000052

The uncertainty in the answer following the selection of a given number


of points, as recorded in the last column of Table 1.4, can be quantified
using elementary statistics. As we will see in Chapter 2, the mean value of a
random variable is the average of the realized measures of that variable, and
the variance is a measure of the dispersion of the realized values of the
random variable about that mean. The variance is equal to the square of the
standard deviation, (J, the latter being the quantity most commonly cited as
an error estimate in experimental work. The variance in the measured mean
is given by the second central moment ofthe measurement results,

00

(J2 = J(t - J.l)2 f(t)dt (l.8)


-00

where J.l is the mean and f(t) is the probability density function of the
random variable t (see Chapter 2).
14 Chapter 1

We will show that the second central moment of the distribution is the
difference between the mean of the square of the estimated quantity, (x2 ),
and the square of the mean of the estimated quantity, (x)2. Here, angle
brackets are used to denote the estimated mean of a random variable. We
will further show that the estimate of the standard deviation obtained from n
samples is a/"n; i.e.,

a= (1.9)
n

The values of a associated with the interim estimates of 1t obtained using


eqn. 1.9 are shown in Table 1.4. It is apparent from these results that the
uncertainty associated with an estimate decreases with increasing numbers
of points used in making the estimate.

The uncertainties in Monte Carlo results arise from several sources.


These include the fidelity of the mathematical model to the physical
problem being solved, the accuracy of the basic data used, and the statistical
error in the numerical results: The first two sources of uncertainty are
systematic and must be considered by the user in judging the value or utility
of the calculated result. The third source of error is random and is subject to
statistical analysis. Unless otherwise specified, discussions of uncertainty in
this book will refer only to the third source of error.

1.3 Monte Carlo Evaluation of Definite Integrals

Although, by its nature, Monte Carlo appears to be a technique for


solving probabilistic problems, the technique can also be used to estimate
the answer to deterministic problems. In particular, it is ideally suited to
solve problems that can be written in the form of a definite integral. As a
class, such applications constitute one of the major uses of the method.
Many of the methods devised to improve the accuracy of Monte Carlo
calculations in other applications can be used to improve the accuracy with
which definite integrals are evaluated, and vice versa. Thus the application
of Monte Carlo to the estimation of integrals provides a foundation for
understanding and using the technique in many fields. Although Monte
Carlo is most useful for evaluating definite integrals in multi-dimensional
spaces, we will consider only one-dimensional integrals.
1. Introduction 15

Evaluation of a definite integral using Monte Carlo is based on the fact


that, by the theorem of the mean, the integral of a well-behaved function can
be written as a product

Jf(x)dx =(b - a)[


b
(1.10)
a

- -
where f is a constant. Formally, f is the "average" value of the function
f(x) over the interval (a,b). One way to calculate this average is to evaluate
the functi.Qn at many random points xi within the domain of the integral and
estimate f by

(1.11)

By the weak law of large numbers,

lim (f) =[ (1.12)


n.... '"

To calculate (t) using Monte Carlo methods, one samples the integrand
over the range (a,b) and computes the sum of eqn 1.11 based on those
samples. Byeqn 1.10 the estimated value of the integral is then (t) times the
range of the integral, b - a. In its simplest form, the Monte Carlo sample
points are all treated the same; i.e., the "weights" of the sampled points are
equal. Such a calculation, in which the points xi are selected at random
regardless of how the function f(x) varies over the interval (a,b), is called
simple, unbiased, or analog Monte Carlo. It is also sometimes known as
"crude" or "brute force" Monte Carlo.
Since the Monte Carlo estimate of the average, (t), is based on a finite
number of points, n, all estimates of the integral will have an uncertainty
associated with them. To reduce this uncertainty, repeated calculations can
be made. If independent random number strings are used to select the xi'
each estimate will give a different result since the randomly selected xi will
vary from calculation to calculation. Therefore each such calculation will
provide an independent estimate of (t), and these estimates can be averaged
to improve the accuracy of the overall result; i.e., the information obtained
from previous evaluations is not lost but can be combined with the new
information to improve the accuracy of the result. In contrast, to increase
the accuracy of a deterministic result obtained from a given numerical
approximation to a definite integral one must increase the number of
16 Chapter J

intervals used in the calculation and discard any results obtained with fewer
intervals.
As we have seen, with Monte Carlo the process of estimating the answer
can also provide an estimate of the standard deviation of the answer. Thus
from the same calculation the user can obtain both the estimated result and
an objective measure of the statistical uncertainty in the result.

Example 1.3. Evaluation of a definite integral using Monte Carlo

We wish to evaluate the following definite integral using Monte Carlo:

1- J1+xdx
5

2
(1.13)
o

The analog Monte Carlo solution to this problem begins by picking n


random values xi over the limits of the definite integral to be solved, which
in this case is the range (0,5). This selection of points is typically
accomplished by multiplying random numbers picked over the interval (0, I)
by the actual width ofthe interval, which is here equal to 5.0, and adding the
lower bound, which here is equal to zero. The estimate of the integral is
then obtained by calculating

b-a n 5 n 1
I ~-Lf(x)=-L-2 (1.14)
n i =1 n i =1 1+ Xi

As a simple example of this calculation, consider the 100 random


numbers of Table 1.1. We can transform these numbers to the proper range,
use them to evaluate the integrand at each of the resulting points, and sum
them according to eqn 1.14 to obtain an estimate of I. A Fortran program to
estimate the solution to this problem is shown in Table 1.5. This program
includes the 100 random numbers from Table 1.1 in a 'data' statement.
These numbers are retrieved in a 'do' loop where they are used to estimate
the integrand and the square of the integrand of eqn 1.13. The latter are
used to estimate the standard deviation of the calculated mean of the integral
using eqn 1.9.
To three significant digits, the estimate of the integral found by running
the program in Table 1.5 is I = 1.56 ± 0.15. The actual value of the integral
can be obtained exactly by integration as I = arctan(5) ~ 1.37. Thus the
Monte Carlo estimate of the integral is in error by slightly more than one
estimated standard deviation.
1. Introduction 17

Table 1.5. Fortran Program for Evaluation ofIntegral in Example 1.3


! Integral of 1/(1+X**2) fram x - [0,5]
! calculate integrand, ser, at 100 points randanly distributed over the range of
! the definite integral.
! Because the randan rn.mbers are distributed over the range (0, 1) while the
! integral is over the range (0,5), the variable rand nust be nultiplied by 5 before
! being used to evaluate scr.
sum = 0.; sumsq = O. ! Initialize variables
IX) 2 i = 1,100 ! Wcp over 100 points
CALL randan(rand); WRITE(*, *) ' RANIXM: , ,i, rand ! Pick randan point
scr = 5./(1.+(5.*rand)**2) ! M..!ltiply integral by delta x=5
sun = sun+scr; sumsq = sumsq+scr**2 ! sum of scores, squares of score
2 <XNI'INUE
sun = sum/100 . ; sumsq = sumsq/100. ! averages of sum and sumsq
sig = SQRT«sumsq-sum**2)/100 . ) ! calculate standard deviation
WRITE(*, *), INI'EGRAL=',surn,', SIG1A = ',sig
srop
END
SUBroJI'INE randan (r)
Returns the 100 randan ntIlbers fram Table 1.1
DIMENSION rand(100); ~ j/O/, (rand(i),i=1,100)/ &
. 1, .74, .32, .35, .87, .28, .36, . 11, .26, .93, .56, .34, . 52, . 44, .51, . 01, . 45, . 41, . 08, .05,&
.31, .42, .67, . 4, . 71, . 57, . 97, .26, .06, .22, .49, .32, . 84, . 7, . 15, . 65, . 78, . 28, . 91, .88,&
. 09, . 09, . 34, .33, .94, .02, . 31, .03, .58, .4, . 54, .51, .27, .92, .48, .22, . 34, .54, .91, .24,&
.79, .78, .53, .03, . 18, .79, .71, .81, .38, .96, .19, .61, .43, .28, . 98, . 09, . 17, .62, . 94, . 07,&
.31, .97, .41, .12, .14, .08, .14, .3, .76, .81, .7, .95, .90, .65, . 07, . 15, .53, .57, .07, .92/
j = j+1; r = rand(j)
REruFN
END

This example uses only 100 points to evaluate the integrand and
produces a result with a fractional standard deviation (the standard deviation
divided by the mean) of approximately 10%. Furthermore, because the
random number list includes only two significant digits, several numbers are
duplicated. Thus the integrand is evaluated at the same point more than
once. Normally many more points would be selected, and more significant
digits in the random numbers would be used to avoid duplication.

Monte Carlo methods are well suited for the solution of problems that
can be cast in the form of an integral equation. In particular, the transport of
subatomic particles through matter lends itself to an integral form of the
Boltzmann equation that can be solved even in complex geometries using
relatively simple Monte Carlo techniques. Such Monte Carlo solutions to
transport problems have direct analogy to the physical processes of particle
interactions in the material involved, and the degree of detail modeled in the
particle interactions can vary with the objectives ~f the user.
The mathematical technique of Monte Carlo is a practical tool for
solving complex physical or mathematical problems. As computers have
improved in memory capacity and speed, and as research interests have
changed, the areas of application have expanded. The technique itself has
proved to be enduring, however, and knowledge of its application provides a
18 Chapter 1

tool to the researcher for use in many different fields. The present book will
introduce the reader to' practical approaches and use of computer solutions
of neutral particle transport problems using the Monte Carlo technique.

Exercises

1. The probability of throwing "box cars" (two sixes) with a standard pair of
dice is 1/62 ~ 0.02778. Use Monte Carlo sampling to verify this result and
to determine the probability of throwing box cars twice in a row.

2. Using the rejection technique, calculate the area under a half wavelength
of a sine wave,
It

Y = JSinx dx
o
Estimate the standard deviation using eqn 1.9, and show that the standard
deviation is reduced by approximately a factor of 2 if the number of samples
taken is increased by a factor of four.

3. The normal curve is given by


~( ) _ 1 -x 2 /2
"" X ---e
..&
Evaluate
4

1= J<l>(x)dx
0.25

using Monte Carlo and show that I ~ 0.4. Estimate the standard deviation of
your result.

4. Using the random number generator 'fltrn' model Buffon's experiment


and obtain an estimate of 1t.

I G. Comte de Buffon, "Essai d'arithm6tique morale," Supplement a I'Histoire Naturelle 4,


1777. Buffon's method is described in numerous texts. See, for example, Y. A. Shreider,
ed., The Monte Carlo Method, Pergamon Press, Oxford, 1966, pp. 4·5. The variance in the
estimate of 1t using Buffon's method is given by Hammersley and Handscomb, Monte
Carlo Methods, Chapman and Hall, London, 1964, pp. 74·75. See also B. C. Kahan, "A
Practical Demonstration of a Needle Experiment Designed to Give a Number of Concurrent
Estimates oh." 1. Roy. Statist. Soc. A, 124, 1961, pp. 227-239.
2 A. Hall, "On an Experimental Determination of1t," Messeng. Math. 2, 1873, pp. 113·14.
1. Introduction 19

) Lord Kelvin, "Ninteenth Century Clouds over the Dynamical Theory of Heat and Light,"
Phil Mag 6,2, 1901, pp. 1-40.
4 W. S. Gosset, "Probable Error ofa Correlation Coefficient," Biometrika 6, 1908, p. 302.

s A. S. Householder, G. E. Forsythe, and H. H. Germond, eds., Monte Carlo Method, U.S.


Department of Commerce, National Bureau of Standards Applied Mathematics Series 12,
U.S. Government Printing Office, Washington, D.C., 1951.
6 The Rand Corporation, A Million Random Digits with 100,000 Normal Deviates, Free Press
Publishers, Glencoe, IL, 1955.
7 Herman Kahn, "Applications of Monte Carlo," U.S. Atomic Energy Commission Report
AECU-3259, Rand Corporation, Santa Monica, CA, 1954. Revised 1956.
Chapter 2

Monte Carlo Sampling Techniques

2.1 Probability Theory and Statistics

To understand the mathematical basis of Monte Carlo calculations, to


develop means of increasing the efficiency of such calculations, and to
estimate the statistical uncertainty in the results obtained, it is necessary to
have some understanding of statistics and probability theory. A brief
description of the terminology that will be used in the remainder of this
book is also necessary. The intent of this chapter is to introduce the
mathematical concepts that underlie the Monte Carlo method and provide a
basis for further development of selected topics. To obtain a broader and
more rigorous development of the underlying mathematical concepts than is
presented here the interested reader may consult any of a number of
standard textbooks and references on statistics and probability.!

2.1.1 Random Variables and Sample Spaces

An intuitive definition of a random variable is: a measurable quantity


associated with a random experiment. If we are measuring the daily rainfall,
for example, the random variable is the amount of water collected in the
sampling tubes. This quantity is not deterministic a priori; i.e., one may
assign a probability to a certain amount of rain falling tomorrow, but one
will know with certainty the amount of rain (within experimental error) only
after the fact. A random variable has two properties of interest: it is a real
number, and it is related to a stochastic eventB of interest. The set of all

B A stochastic event is one for which the outcome cannot be predicted with certainty. Games
of chance such as the throwing of dice involve stochastic events.
21
22 Chapter 2

possible events accessible to the random variable is called the sample space
for the random variable. The mathematical definition of a random variable
is:

Definition: A random variable V on a sample space U is a function


from U into the set of real numbers R such that the inverse image of
every interval in R is an event in U.

Requiring that "the inverse image of every interval in R is an event in U"


means that the set {u in U:a ~ V(u) ~ b} corresponds to an event in U.b The
argument on the random variable V, defined on the sample space U, refers
to the fact that the random variable V is taken on the sample space variable
u in U. The probability of a random variable V being in the set {s} will be
designated P{s}. Since U is a sample space, the probability of any event in
U is well defined and, therefore, the probability P{a ~ V(u) ~ b} is well
defined.
Both the random variable and the sample space can be either continuous
or discrete. As an example of a discrete random variable on a discrete
sample space consider the throwing of a pair of dice, one of which is blue
and the other red. The sample space U consists of the 36 different possible
combinations of the two dice that can result from each throw, as shown in
Table 2.1. Although the blue die is presented first in the table, we are not
distinguishing the order in which the dice are thrown; i.e., a blue five in
combination with a red six is considered equivalent to a red six in
combination with a blue five. Only the former appears in the table. The
opposite assumption is also appropriate under some conditions; i.e., that the
two dice are distinguishable and that the order in which the dice are thrown
is relevant.
The sum of the numbers on the dice is a random variable since the sum is
a function from the event to the set of real numbers. This random variable
can take on 11 possible values, the numbers two through 12. The sum of the
numbers on the dice is not the only random variable that can be defined for
this event space, however. Other random variables include the product of
the numbers on the two dice, and the largest number on either die. The
distribution of these three random variables over the sample space, as
determined from an examination of all the possible combinations, is also
shown in Table 2.1. For this discrete case, the probability with which each
value occurs can be determined by counting the number of times a random
variable takes on a particular value, and dividing by the total size of the
sample space. Such a set of numbers, which is associated with the specific

b A word on notation: {u in U:a ~ V(u) ~ b} denotes the set ofu in U such that a ~ V(u) ~ b.
This set will also be abbreviated as {u:a ~ V(u) ~ b}, {a ~ V(u) ~ b} or {a ~ V ~ b}.
2. Monte Carlo Sampling Techniques 23

random variable selected, is called the probability density function C (pdf) of


that random variable. The pdf of the three random variables shown in Table
2.1 are given in Table 2.2 for this event space.

Table 2.1. Sam pIe Sspace 0 fTh ree Ran dom V'
anabl es
Blue Die and Red Die Sum Product Largest
Combinations Number
blue one and red one 2 I I
blue one and red two 3 2 2
blue one and red three 4 3 3
blue one and red four 5 4 4
blue one and red five 6 5 5
blue one and red six 7 6 6
blue two and red one 3 2 2
blue two and red two 4 4 2
blue two and red three 5 6 3
blue two and red four 6 8 4
blue two and red five 7 10 5
blue two and red six 8 12 6
blue three and red one 4 3 3
blue three and red two 5 6 3
blue three and red three 6 9 3
blue three and red four 7 12 4
blue three and red five 8 IS 5
blue three and red six 9 18 6
blue four and red one 5 4 4
blue four and red two 6 8 4
blue four and red three 7 12 4
blue four and red four 8 16 4
blue four and red five 9 20 S
blue four and red six 10 24 6
blue five and red one 6 5 5
blue five and red two 7 10 5
blue five and red three 8 15 5
blue five and red four 9 20 5
blue five and red five \0 25 5
blue five and red six 11 30 6
blue six and red one 7 6 6
blue six and red two 8 12 6
blue six and red three 9 18 6
blue six and red four 10 24 6
blue six and red five 11 30 6
blue six and red six 12 36 6

C In some literature the "probability density function" is referred to as the "density function,"
the "probability distribution function," the "distribution function," or even as the
"distribution."
24 Chapter 2

Tab Ie 2.2. The Probability of Various Values ofthe Random Variables


Value of Probability Value of Probability Value of Probability
'Sum' ' Product' 'Largest'
Random Random Random
Variable Variable Variable
I 0 I 1/36 I 1/36
2 1136 2 2/36 2 3/36
3 2/36 3 2/36 3 5/36
4 3/36 4 3/36 4 7/36
5 4/36 5 2/36 5 9/36
6 5/36 6 4/36 6 11/36
7 6136 8 2/36
8 5/36 9 1136
9 4/36 10 2/36
10 3/36 12 4/36
11 2/36 15 2/36
12 1136 16 1136
18 2/36
20 2/36
24 2/36
25 1136
30 2/36
36 1136

2.1.2 Distributions

The cumulative distribution function d F(x) of a random variable V is


defined as the monotonically increasing function from R to [0,1] given by:

F(x) = P{u: V(u)::; x} (2.1)

The random variable V is said to be continuous if and only if its cumulative


distribution function F is a continuous function on R. For this case a pdf
f(x) exists and is defined by:

ff(t)dt
x

F(x) = (2.2)
-00

By its definition, f(x) is non-negative and the integral off(x) over R is unity,

ff(t)dt == 1
00

(2.3)
-00

d In some literature the ~'cumulative distribution function" is referred to as the "distribution


function." We will denote the cumulative distribution function as F(x) and the probability
density function as flx).
2. Monte Carlo Sampling Techniques 25

The probability of the random variable V taking on a value less than or


equal to x is equal to the are'a under its pdf f(t) frein t = -00 to t = x. The
probability of V taking on a value in the interval (a,b] is given by the area
under the function f(t) between these values of the independent variable;
that is, from eqns 2.1 and 2.2,

f
b
F(b)- F(a) = f(t)dt = P{u:a < V(u) ~ b} (2.4)
a

Since the total area under f(t), from t = -00 to t = +00, is unity, the probability
of V taking on some value is unity. Expressions similar to eqns 2.2 - 2.4
exist when the pdf, and thus the cumulative distribution function, is a
function of more than one variable, but the present description will be
limited to functions of a single variable.
The random variable Vis said to be discrete if the set of values that V
can take is finite (or countable). For this case, the probabilities P{V = x}
take on non-zero values only for the possible discrete values of Xi. The pdf
is then defined by:

(2.5)

and, as for the continuous case,

(2.6)

Further,

F(xj ) = L f(t) (2.7)


t :S;Xj

Whether the random variable is discrete or continuous is usually not


significant in the discussion that follows. For convenience, the continuous
case will most often be assumed. Treatment of the discrete case typically
involves changing integrals to summations.

2.2 Sampling

The selection of events from a sample space is an important process in


Monte Carlo calculations. Such events, chosen from among all possible
26 Chapter 2

events, represent those that have occurred for the purpose of the calculation.
This process is called sampling. To remain consistent with the
mathematical or physical process being modeled, the procedure for
performing the sampling must be a "fair game;" i.e., it must select events
from the sample space and count, or weight, them in such a manner that the
result obtained is identical to one that could occur in an experimental
realization of the process.'
The simplest way of playing a fair game is to insure that the probability
with which an event is selected for evaluation is equal to the probability
assigned to that event in the sample space. However, this is not the only
way to play a fair game. Selecting an event with a frequency that is
different from the probability assigned to it in the sample space while still
maintaining fair game conditions is called biasing. Biasing is an important
part of Monte Carlo and will be discussed in Chapter 6.
There are, from the above definitions, two funptions that may be
available for selecting an event from a sample space: the cumulative
distribution function and the pdf. The sampling of events uses the following
information:
• The sample space from which a particular event or sample is to be selected,
• The value of the random variables associated with every event in the sample
space (this is required so that the Monte Carlo model can deal with real
numbers),
• The cumulative distribution and/or the pdf for the random variables
involved in the problem, and
• A method of obtaining a sequence of random numbers.
These four elements are used in a Monte Carlo calculation in the following
manner:
• One or more random numbers are selected.
• These random numbers are used to select a point that is either in or is
associated with the domain of the appropriate probability function. This
point determines the value of a random variable for purposes of the
calculation.
• The random variable is either the result of the calculation or is in one-to-one
correspondence with the result.
Given a random number~, the corresponding random variable associated
with the cumulative distribution function F(x) and pdff(x) is given by

f
x
~ = p{ u: V(u) ~ x} = F(x) = f(t)<1t (2.8)
-00

Eqn 2.8 forms the basis for a significant portion of the Monte Carlo
technique. With this equation, random numbers distributed over the interval
2. Monte Carlo Sampling Techniques 27

from 0 to 1 can be used to select random events from a sample space; i.e.,
the random number ~ is used to select F(x), which assures a fair game.

2.2.1 Sampling from the Inverse of the Cumulative Distribution


Function

If the inverse of the cumulative distribution function exists then, by eqn


2.8, x can be found from

(2.9)

If F-l(~) does not exist, or ifthe difficulty of solving for x using eqn 2.9 (or
a functionally equivalent inverse) is prohibitive, other methods of solving
for x must be used. For example, the function f(x) may be integrated
numerically. Tabular methods based on evaluations of F(x) over an
appropriate range can also be used. In practice, the mathematical models of
a number of real processes lead to cumulative distributions for which an
inverse does not exist. c In this case some indirect method, such as the
rejection technique, introduced in Example 1.2 and discussed below, must
be used to sample the random variable.
One commonly used distribution for which an inverse can be easily
calculated is the exponential distribution. The exponential distribution is
defined by

f(x) = 'Y)e-T]X, 0 ~ x (2.10)

Of, equivalently,

0, x<o
F(x) ={ 1- e -T]X ,_
0< x (2.11 )

where 'Y) is a constant. For example, F(x) as defined by eqn 2.11 may be the
fraction of particles removed from a parallel beam of particles by scattering
or absorption after passing a distance x through a uniform material, or it may
be the fraction of a population of radioactive nuclei that have decayed after

C If the set {x:f(x)=O}, where f(x) is a pdf, is a Lebesque measurable set with measure greater
than zero, for x in the range of interest, then F') does not exist for x in that range. Consider
a beam of particles passing through two slabs separated by a vacuum. The probability of a
particle interaction in either of the slabs will be greater than zero. The probability of an
interaction while in the vacuum will be zero. The cumulative distribution function for this
configuration does not have an inverse.
28 Chapter 2

time x. Sampling from the exponential distribution means that, given a


random number ;, the "distance" to corresponding event, x, is found from

(2.12)

Solving this for x gives

x =-(In(l- ;)) / 11 (2.13)

Since; is a random number evenly distributed over (0,1), 1 - ; is also a


random number evenly distributed over (0,1). Using this second random
number distribution gives

1
x = - - InC;) (2.14)
11

Eqn 2.14 is commonly used to sample from an exponential distribution. 2


The equation transforms the uniform distribution of points ; over the
interval (0,1) into the exponential distribution of points x over the interval
(0,00). The transformation is a one-to-one, deterministic mapping.

Example 2.1. Uniform sampling inside a sphere

Using random numbers uniformly distributed over the range (0,1), we


wish to select radii for a set of points distributed uniformly over a spherical
volume of unit radius centered at the origin. Since the points to be selected
are distributed uniformly in space, the number of points N in the spherical
shell between radii rand r + dr is proportional to the volume of the shell,
dV, bounded by these radii. Thus

dN = ndV = 41tr2ndr (2.15)

where the density of points throughout the sphere is n per unit volume. The
cumulative distribution function for the points N is thus the ratio of the
number of points in a sphere of radius r ~ 1 to the total number of points in
the sphere of unit radius; i.e.,
2. Monte Carlo Sampling Techniques 29

J41tnp 2 dp
F(r) = ~ = r3 (2.16)
J41tnp 2dp
o

Therefore, by eqn 2.8, to select a point at random within a unit sphere using
a random number ~, we have

(2.17)

Solving for the inverse, eqn 2.9, we obtain an expression for the radius r in
terms of the random number ~,

r=~ (2.18)

Using the random numbers from Table 1.1 we can evaluate 100 radial
points using eqn 2.18. Obviously the results will be somewhat coarsely
distributed because only two significant digits are available in that set of
random numbers. More significant digits would be required in the random
numbers to obtain a smooth distribution of cube roots.
The results are plotted in Figure 2.1 and are shown in Table 2.3. In the
figure the results of Table 2.3 have been grouped into intervals of one tenth
the total radius; i.e., the figure shows the number of times the cube root was
found to be in each radial interval {O.-O.l, 0.1-0.2, ... , 0.9-1.0} of the sphere.

'"
::J
'C
30
Eqn 2.18
~
25 Table 2.3
6
20
~
~ 15

~ 10
'0
5
~
E
::J
Z
0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Radial n
I tervals

Figure 2.1. Distribution of Cube Roots from Table 2.3 Compared with Eqn 2.18
The volume of each of these spherical shells, normalized to the total volume
is also shown in the figure. This normalized volume is proportional to the
30 Chapter 2

distribution given in eqn 2.18. We see that the distribution of cube roots of
the random number string of Table 1.1 matches the density function of eqn
2.18 reasonably well considering that only one hundred random numbers of
two significant digits were used.

. 'b ute d over a SSplhere


able 2.3. Selection 0 f 100 Pomts Um ormly Dlstn
Seq Rand Cube Seq Rand Cube Seq Rand Cube Seq Rand Cube
# Root # Root # Root # Root
I .10 .464 26 .57 .829 51 .54 .814 76 .09 .448
2 .74 .905 27 .97 .990 52 .51 .799 77 .17 .554
3 .32 .684 28 .26 .638 53 .27 .646 78 .62 .853
4 .35 .705 29 .06 .391 54 .92 .973 79 .94 .980
5 .87 .955 30 .22 .604 55 .48 .783 80 .07 .412
6 .28 .654 31 .49 .788 56 .22 .604 81 .31 .677
7 .36 .711 32 .32 .684 57 .34 .698 82 .97 .990
8 .11 .479 33 .84 .944 58 .54 .814 83 .41 .743
9 .26 .638 34 .70 .888 59 .91 .969 84 .12 .493
10 .93 .976 35 .15 .531 60 .24 .621 85 .14 .519
II .56 .824 36 .65 .866 61 .79 .924 86 .08 .431
12 .34 .698 37 .78 .921 62 .78 .921 87 .14 .519
13 .52 .804 38 .28 .654 63 .53 .809 88 .30 .669
14 .44 .761 39 .91 .969 64 .03 .311 89 .76 .913
15 .51 .799 40 .88 .958 65 .18 .565 90 .81 .932
16 .01 .215 41 .09 .448 66 .79 .924 91 .70 .888
17 .45 .766 42 .09 .448 67 .71 .892 92 .95 .983
18 .41 .743 43 .34 .698 68 .81 .932 93 .90 .965
19 .08 .431 44 .33 .691 69 .38 .724 94 .65 .866
20 .05 .368 45 .94 .978 70 .96 .986 95 .07 .412
21 .31 .677 46 .02 .271 71 .19 .575 96 .15 .531
22 .42 .749 47 .31 .677 72 .61 .848 97 .53 .809
23 .67 .875 48 .03 .311 73 .43 .755 98 .57 .829
24 .40 .737 49 .58 .834 74 .28 .654 99 .07 .412
25 .71 .892 50 .40 .737 75 .98 .993 100 .92 .973

2.2.2 The Rejection Technique

In Example 2.1 the inverse of a cumulative distribution function was


used to evaluate a random variable. An alternative method of sampling
using a pdf is to make use of the fact that the integral of the pdf from -00 to x
is the area under the curve of f(x) over this interval. Any technique that is a
means for selecting uniformly from the area under the curve of f(x) over the
appropriate range can be used for evaluating random variables. One very
2. Monte Carlo Sampling Techniques 31

simple technique for selecting points uniformly within the area under a
curve, and thereby calculating the associated area, is called the rejection
technique. This technique was introduced in Example 1.2.
Consider a pdf f(x) that has a maximum value less than or equal to some
number M, and that is zero outside the range x E (a,b); i.e., the function is
zero for x S; a or x ~ b, and 0 S; f(x) S; M for all x. Therefore the area under
the curve defined by f(x) is enclosed within the rectangle bounded by 0 S; y
S; M and a < x < b. To use the rejection technique, one first picks a point
(x,y) uniformly within this rectangle. This is accomplished by using two
random numbers, ~I and ~2' one to select a y value uniformly from within
the interval [O,M],

(2.19)

and the other to select an x value uniformly from within the interval (a,b),

x=a+(b-a)~2 (2.20)

The point (x,y) is then examined to determine whether it falls under the
curve f(x). If the point is outside the area of interest, y > f(x), it is rejected
and another point is chosen. If the point is under the curve, y S; f(x), it is
accepted and the random variable is set to x.
In general terms, the rejection technique uses two or more random
numbers to select points uniformly in a space S that encloses the desired
space S'. The space S over which the points are selected is chosen to
simplify the calculation of the uniformly distributed random points; i.e., the
sample space is S rather than S'. Therefore only the inverse of the function
defining S is used in the sampling process, the inverse function defining S'
not being required. Any points selected from S that are outside S' are
rejected. Points that are inside S' are accepted. Since the points are selected
from a uniform distribution over the space S, the distribution of the accepted
points is also uniform over the enclosed space S'.
For the rejection technique to be efficient, it is necessary to ensure that
the fraction of points that are rejected is small. This means that the volume
of S should not be much larger than the volume of S', since the ratio of the
volumes S'/S will determine the expected fraction of all the points chosen
that will be accepted. It is also important that the process for choosing the
randomly selected points within S be as simple as possible so that a
minimum amount of time is spent in accepting or rejecting the points.
32 Chapter 2

2.3 Means and Variances

Given a discrete set of numbers X = {XI. X2, ... , xn }, the expected value
of X, also referred to as the mean value of X, is given by

- 1 n
E(X)=X=-
n i=l
L>i (2.21 )

The variance of this set of numbers, which is a measure of the dispersion of


the numbers about the mean, is given by

var(X) = cr 2 = -
1 n
n i=l
(Xi L - X)2 (2.22)

Finally, the standard deviation, cr, of the set of numbers is the positive
square root of the variance.
In analogy with the above, the expected value or mean value of a
continuous random variable V specified by the pdf f(x) is the weighted
average of the variable over its density function,

+00

E(V) = V = J V(x)f(x)dx (2.23)


-00

This is also referred to as the first moment of V. The nth moment of V is


given by

+00

E(Vn)= JVn(x)f(x)dx (2.24)


-00

and the nth central moment of V is given by

00

E[(V - v)n] = f[ V(x) - Vr f(x)dx (2.25)


-00

The variance of a continuous random variable V is the second central


moment of V, which is the expected value of [V - E(V)f, or
2. Monte Carlo Sampling Techniques 33

+00

var(V) = E[(V - E(V»2] = cr 2 = f[V(x) - vf f(x)dx (2.26)


-00

Again, the standard deviation cr of a continuous random variable V is the


positive square root of the variance of V.
Expanding eqn 2.26 gives

var(V) = E[ V 2 - 2VE(V) + (E(V» 2] (2.27)

Since E(V) is a constant,

f
00 00

E[2VE(V)] = f2VE(V)f(x)dx = 2E(V) Vf(x)dx = 2(E(V»2 (2.28)


- 00

and thus

var(V) = E(V2) - [E(V) Y (2.29)

The expression for the variance given by eqn 2.29 is useful for
calculating or estimating the variance of a random variable. It is valid for
both discrete and continuous random variables. However, the expected
value of a random variable may not exist, or may not be finite. If the
expected value is not finite, the variance does not exist. If the expected
value is finite, the variance exists but may not be finite. We will see
examples of the latter in Chapter 7.
The above expressions can be used, in some cases, to calculate the means
and variances of random variables analytically. Analytical calculations are
useful in examining various variance reduction techniques. To illustrate
this, consider Example 1.3. In that example we used Monte Carlo to
estimate the value of the definite integral

5 1
I=f-dx (2.30)
o 1+ x
2

Using the notation developed in this chapter, let us define the function

I / 5, 0::S;x::s;5
f(x) = { (2.31 )
0, otherwise
34 Chapter 2

With this definition

00

ff(x)dx = 1 (2.32)
-00

and therefore, since f is also non-negative, it is a pdf. Let us now define a


random variable Y, with the pdf given by eqn 2.31, such that

5
Y(x)=-- (2.33)
1+ x 2

By eqn 2.23, the expected value ofY is

f f--2 dx
00 5 1
E(Y) = Y(x)ftx)dx = (2.34)
-00 ol+x

which, when the integral is evaluated analytically, gives

E(Y) = tan-I (5) - tan-I (0) ~ 1.373400 (2.35)

Similarly we can find the mean value ofy2 from

fy2 (x)ftx)dx ~ 3.914270


00

E(y2) = (2.36)
-00

Thus, by eqn 2.29, the variance of the random variable Y is

var(Y) = E(y2) - [E(y)]2 ~ 2.028042 (2.37)

The standard deviation of Y is thus

(J ~ .J2.028042 ~ 1.424093 (2.38)

These analytical calculations will be used later to illustrate the value of


stratified sampling as a variance reduction technique.
2. Monte Carlo Sampling Techniques 35

2.4 Estimations of Means and Variances


The mean value of a continuous random variable V with pdf f(x) is
defined by eqn 2.23. Although we have shown one case in which this
equation can be evaluated analytically, often this is not possible. Instead we
must estimate V by taking samples from the appropriate distribution as
indicated by eqn 2.8. Given a discrete set of n samples of the random
variable, which consists of the numbers S = {v), V2, .. . vn }, the mean value
of S is given by eqn 2.21,

_ 1
I>i
n
S=- (2.39)
n i=)

Although the sample provides only incomplete knowledge of the variable V,


the sample mean, S, is the best estimate we can make of V .
The variance of S is given by

2 1~ - 2
var(S) =s) = - L..(v i - S) (2.40)
n i=)

Again, based on our incomplete knowledge of the random variable V, this is


a valid estimate, but only an estimate, for the variance ,i of the variable V.
For small values of n, a correction is necessary in order to obtain an
unbiased estimate of the variance of V, and in this case the estimate is given
by

2 1 ~ - 2 (2.41 )
S2 =--L..(v i - S)
(n -1) i=)

If the true mean of V is known, J.I. = V , then a third estimate of the variance
of V is

2 1~ 2
(2.42)
S3 =- L..(v i - f.I.)
n i= )

Only eqn 2.40 gives the variance of the sample S although all three
equations (2.40, 2.41, and 2.42) provide estimates of the variance of V, the
random variable from which the sample is taken. Eqns 2.41 and 2.42
provide unbiased estimates of the variance of V. However, none of the
36 Chapter 2

above three equations provides an unbiased estimate for the standard


deviation of V, as we will see in a subsequent example.
In practice, we will use a large value of n and we will not know the true
mean of V. For n greater than about 30, both the difference between the
results of eqns 2.40 and 2.41 and the bias of the estimate of the resulting
standard deviations are sufficiently small that they can be ignored.
Therefore through the remainder of the book we will normally use eqn 2.40
to estimate the variance of random variables. Designating this variance as
S2, we can cast eqn 2.40 into the form of eqn 2.29 to give

2
2 1 n 2 ( 1 n )
s =-Lvi - -Lvi (2.43)
n i=1 n i=1

When n samples are used to estimate the mean of a random variable, by


the Central Limit Theorem the variance of the resulting estimate of the mean
is lin times the variance ofthe population; that is/

- 1 a2
var(S) =-var(V) = - (2.44)
n n

The standard deviation of the estimate of the mean is then

StdDev(S) = Std~(V) = J-; (2.45)

In Monte Carlo the standard deviation is frequently divided by the mean


of the random variable, the result being called the fractional standard
deviation (fsd). Generally speaking, the accuracy to which one can estimate
the uncertainty of a random variable will be less than the accuracy to which
the variable itself can be determined. Therefore large fsd values usually
indicate that the variance is poorly known and the calculated quantity is
suspect over and above the error implied by the variance estimate.
Experience indicates that, for non-zero random variables with finite
variances, a result with fsd greater than about 0.1 should be considered
questionable.

Example 2.2. Calculation of mean and variance of a distribution

Consider a scheme that samples two numbers at random from the_set


V={1, 3,5, IS}. From eqns 2.21 and 2.22, the mean ofthe set V is Il = V =
2. Monte Carlo Sampling Techniques 37

6, the variance is (J2 = 29, and the standard deviation is (J ~ 5.3852. The first
column of Table 2.4 provides the set of all samples of two numbers taken
from V. A typical Monte Carlo sampling scheme does not remove the
numbers selected during the sampling process and thus values previously
selected are available for subsequent selection. Hence a number can be
repeated in a single sample. This is referred to as sampling with
replacement.

Table 2.4. Means an dV anances


. f;or Samples
S m S,2 sl s/ S, S2 S3

{I,I} I 0 0 25 0 0 5
{1 ,3} 2 I 2 17 I 1.4142 4.1231
{1,5) 3 4 8 13 2 2.8284 3.6055
{ 1,15} 8 49 98 53 7 9.8994 7.2801
{3,1} 2 I 2 17 I 1.4142 4.1231
{3,3} 3 0 0 9 0 0 3
{3,5} 4 I 2 5 I 1.4142 2.2360
{3,15} 9 36 72 45 6 8.4852 6.7082
{5,1 } 3 4 8 13 2 2.8284 3.6055
{5,3} 4 I 2 5 I 1.4142 2.2360
{5,5} 5 0 0 I 0 0 I
{5,15} 10 25 50 41 5 7.0710 6.4031
{15, I} 8 49 98 53 7 9.8994 7.2801
{15,3 } 9 36 72 45 6 8.4852 6.7082
{15,5) 10 25 50 41 5 7.0710 6.4031
{15,15} IS 0 0 81 0 0 9
Mean 6 14.5 29 29 2.75 3.8891 4.9195

The expected value of the mean, m, of the samples can be evaluated by


averaging the means of all possible samples, since all samples have equal
likelihood of occurring. The second column in the table shows the mean of
each sample. The remaining columns provide estimates of the variance of V
using eqns 2.40, 2.41 and 2.42, respectively, followed by estimates of the
standard deviations based on these variances. Although the means of the
individual samples range from 1 to 15, the expected value of the mean of the
samples shown in the table is equal to the mean of the population from
which the samples are taken. This is an illustration of why eqn 2.39 for S
is the best estimate we can make of V. However, the variance of the
samples determined by eqn 2.40, as given in the third column of Table 2.4,
has an expected value of 14.5 rather than 29. The error in applying eqn 2.40
to small samples is apparent. On the other hand, the expected values of the
variance calculated using eqns 2.41 and 2.42, shown in the last entry of the
38 Chapter 2

4th and 5th columns, are equal to the true variance of the population.
Regarding the expected values for the standard deviations, none of the
equations used to provide estimates for the variance provides a correct
estimate of the standard deviation.
The variances of the estimates of the means - i.e., the variance of the mi
shown in the second column of Table 2.4, where i indicates the row number
in the table - can be calculated by

1 16 1 16
var(m .)=-"(m . _m.)2 =-"(m. _6)2 (2.46)
1 16 ~ 1 1 16 L.J 1
1=1 1=1

The result, using the mi from the table, is var(mi) = 14.5. Since each
individual mean in the example is calculated by taking two samples from the
total population V, from eqn 2.44 the variance ofthe mean is expected to be

- 1 0'2 29
var(S)=-var(V)=-=-= 145 (2.47)
n n 2

The variance of the mean of the estimates improves by a factor of lin as


the size of the sample increases. The standard deviation thus improves by
one over the square root of the number of samples. For large n the estimates
of the mean frequently approach a Normal or Gaussian distribution. 4 A
Gaussian distribution is defined by

1 _(X-Jl)2
Y=--e 20 2 (2.48)
0'.[2;.

where J.l is the mean and 0' is the standard deviation of the distribution. Here
Y is the probability of finding a sample value from a normally distributed
popUlation within X of the mean. This means that approximately 68.27% of
the time the estimate of the mean will be within one standard deviation of
the correct value, 95.45% of the time the estimate will be within two
standard deviations of the correct value, and 99.73% of the time the estimate
will be within three standard deviations of the correct value.

2.5 Introduction to Variance Reduction Techniques

As indicated above, the purpose of a Monte Carlo calculation is usually


to obtain an estimate of the expected value of a random variable. The usual
measure of the accuracy of the result is the standard deviation of the
2. Monte Carlo Sampling Techniques 39

estimate obtained. From eqn 2.44 it is apparent that improvement in the


accuracy of an estimate of the mean of a random variable can be made by
increasing the number of samples calculated. However, improvements are
typically expensive to obtain using this "brute force" method. For example,
obtaining a factor of ten improvement in the accuracy of the result requires
increasing the number of samples by a factor of 100. Other methods to
reduce the variance are usually preferred in order to obtain accurate results
with reasonable computation times.

Example 2.3. Variance reduction by repeated samples

Let us again consider a Monte Carlo estimate of the integral in Example


1.3, eqn 2.30,

5 I
I=J-dx (2.30)
o I +x
2

From the results ofthe Section 2.3, we know that defining the pdf

I /5, 0::;; x::;; 5


f(x)= { (2.31 )
0, otherwise

and defining a random variable V with this pdf gives an expected value of V
equal to the desired integral:

J
~
E(V) = V(x)f(x)dx =
_~
J--2
s 1

ol+x
dx (2.34)

The above combination of V(x) and f(x) is not unique. An infinite


number of such combinations is possible, each of which results in the
expected value of the random variable being equal to the desired integral.
As we will see, this allows us to vary the way we sample from a distribution
and fonns the basis of variance reduction techniques.
Eqns 2.34 and 2.29 give E(V) ~ 1.37340 and var(V) ~ 2.02804. From
these results we can estimate the accuracy to which a "brute force" Monte
Carlo calculation should be able to detennine the value of the integral I in
eqn 2.30. By eqn 2.45 the standard deviation of a Monte Carlo estimate of
the mean of I, in which points are chosen with unifonn probability over the
40 Chapter 2

interval from 0 to 5, would have an expected standard deviation of


approximately 1.424/..Jn.
A Fortran program to calculate the integral in eqn 2.30 is given in Table
2.5, and the result of processing 106 samples is shown in Table 2.6. The
calculated value of the integral using 106 samples, 1.37271, is within one
standard deviation of the exact solution of 1.37340. The estimate of the
standard deviation of this result is 0.01422 with 104 samples, and 0.0014235
with 106 samples. These results compare favorably with the analytic results.
In all Monte Carlo calculations it is essential to ensure that all regions of
importance in the calculation - in this case all portions of the independent

Table 2.5. Fortran Program to Calculate Integral in Egn 2.30


DOUBLE PRECISION x,a,b,score,sumf,sumsq,stdev,f,fltrn,r
f(x)=1.00/(1.00+x**2) ! f(x) is the function to be integrated
OPEN (unit=8, file='Iout . txt')
WRITE(*,10); 10 FaMIT(' What is the l~r limit of the integral? ')
RE1'ID (* , *) a ! a is the l~r limit of the integral
WRITE(* ,11); 11 FaMIT(' What is the 1.J!:Per limit of the integral? ')
RE1'ID (* , *) b ! b is the 1.J!:Per limit of the integral
sumf=O.O; sumsq=O.O ! Initialize variables
WRITE(*, 12)
12 R:.FMA.T (' Please enter the nurrber of sarrples to be perfomecl. ')
RE1'ID(*,*)nsamples ! nsamples is nurrber of samples
WRITE (8, 13) nsamples, a,b
13 R:.FMA.T(' no of sarrples=' ,i9, , laNer Lllnit=', flO. 6, ' Uf:per Lllnit=', flO.6)
nprint=nsamples/l0 ! nprint used for intemecliate prints
WRITE (8, 20)
20 R:.FMA.T (/ /, 'Sample avg f stdev of f', ' stdev of avg')
[X) 100 j=l, nsamples
r=fltrn (); fltrn generates a randan nl.llber in (0,1)
x=a+ (b-a) *r ! pick x at randan between limits
score= (b-a) *f (x) ! score rrultiplied by width to get area
sumf=sumf+score; sumsq=sumsq+score**2 ! keep sum of scores, squares of scores
IF (j . EQ.10000 .OR.MOD(j,nprint).EQ.0)THEN
stdev = DSQRT(DABS(sumsq/FLOAT(j) - (sumf/FLOAT(j))**2))
WRITE (8, 14) j,sumf/FlLlP.T(j) ,stdev,stdev/~(FLOAT(j)) ! write results
END IF
100 OONI'INUE
14 R:.FMA.T (lx,i9,', ',fl4.8,', ',f14 . 8,', ',fl4 . 8)
STOP
END

variable over the range of integration - are thoroughly sampled. A good


quality random number generator is necessary, but not sufficient, to
guarantee such sampling. It is not unusual to encounter "perverse" cases
where both the estimate of the result and the estimate of the variance appear
"reasonable," yet for which both results are incorrect. A few such perverse
cases, and methods to gain confidence that adequate sampling of phase
space has been achieved, will be discussed in Chapter 7.
2. Monte Carlo Sampling Techniques 41

Table 2.6. Results of Monte Carlo Calculation ofIntegral in Egn 2.30 - File 'Iout.txt'
no ofsamples= 1000000 Lower Limit= 0.000000 Upper Limit= 5.000000
Sample avg f stdev of f stdev of avg
10000, 1.36775816, 1.42216040, 0.01422160
100000, 1.37200967, 1.42437706, 0.00450428
200000, 1.37222952, 1.42399500, 0.00318415
300000, 1.37090677, 1.42269016, 0.00259746
400000, 1.37552614, 1.42602732, 0.00225475
500000, 1.37508446, 1.42528822, 0.00201566
600000, 1.37417428, 1.42447134, 0.00183898
700000, 1.37376240, 1.42457564, 0.00170269
800000, 1.37344235, 1.42427806, 0.00159239
900000, 1.37341085, 1.42379958, 0.00150082
1000000, 1.37270580, 1.42347290, 0.00142347

In the above example, three significant digits of accuracy were obtained


from one million samples. Using the analog approach, about one hundred
million samples would be needed to obtain four significant digits of
accuracy. Eqn 2.30 is a relatively simple integral involving samples that
vary in magnitude by only a factor of 25 over the range of interest.
However, it is obvious that even here variance reduction techniques could
be useful. It is not unusual to encounter problems where the value of
samples may differ in magnitude by factors of 108 over the range of interest.
In such problems the standard deviation of the mean of the random variable
will be much larger than that obtained for this simple integral, for the same
number of samples and assuming the use of analog Monte Carlo. Accurate
results from calculations of such a mean would be essentially impossible
without some use of variance reduction.
From eqn 2.26,

+00

var(V) = E[(V - E(V))2] = f[V(x) - V]2 f(x)dx (2.26)


-00

it can be seen that, if all of the samples from a population are equal to the
mean value of the population, the variance is zero and each estimate is equal
to the mean. Even if the estimates cannot be made equal to the mean, the
closer they are to the mean the smaller the variance will be. The only way
the estimates can be made close to the mean is to change the distribution
from which the samples are taken. Of course, to be of practical use the
expected value of the random variable in the new problem must be the same
as the expected value of that in the original problem. It is not necessary,
however, to retain the original probability distributions. In fact, these must
42 Chapter 2

be modified if the variance of the estimate is to be improved without


increasing the number of samples taken.
In order to calculate the statistical uncertainty in estimates of random
variables, a few rules regarding the sums and products of variances and
standard deviations are needed. From the definition of the expected value
E(V) of a random variable V, it can be seen that

E(aV) = aE(V) (2.49)

where a is a constant, and

(2.50)

This gives

var(aV) = a 2 var(V) (2.51)

and

cr( aV) = acr(V) (2.52)

2.5.1 Stratified Sampling

One effective technique for reducing the variance of a Monte Carlo


estimate of a random variable is stratified sampling. With this technique the
range over which the independent variable is sampled is divided into strata,
and each stratum is sampled separately.
As a specific example, consider again the integral of eqn 2.30. We wish
to select subranges of the independent variable x to serve as strata for a
demonstration of stratified sampling. From a graph of the function 1I( 1+x\
shown in Figure 2.2, we note that the function varies from 1 to 0.5 as the
independent variable ranges from 0 to 1. Over the range x = 1 to 5, the
function varies from 0.5 to 0.04. Let us consider a simple sampling
technique using these two strata. Thus we will do the following:
• Evaluate the integral from 0 to 1, using half of the samples.
• Evaluate the integral from 1 to 5, using half of the samples.
• Combine the two results to get an estimate of the total integral.
• Estimate the standard deviation for this total.
For this two-strata calculation we define the pdf for the first stratum as .
2. Monte Carlo Sampling Techniques 43

I, O~x~1
f) (x) = { (2.53)
0, elsewhere

and the random variable corresponding to this stratum as

1
V) (X) =--2 (2.54)
l+x

1.0 2.0 3.0 0.0 5.0


x
Figure 2.2. A Graph of the Function 1/(l+x2) for xe[O,5]

Similarly, we define the pdf for the second stratum as

f 2 (x) = { 0.25, 1 ~ x ~ 5 (2.55)


0, elsewhere

and the corresponding random variable as

4
V2 (x) = - - 2 (2.56)
l+x

The normalization is selected such that f} and f2 are pdfs and the product
fj(x)Vj(x), for i = 1,2, is everywhere equal to the desired integrand. Let us
denote the expected value of V in the first stratum as E(V I), and the
expected value of V in the second stratum as E(V2)' Then

= f--2
) 1
E(V) dx~ 0.7853982 (2.57)
l+x
o

1 )2
E(V/) = f) ( 1+x 2 dx~ 0.6426991 (2.58)
o
44 Chapter 2

and the variance for the first stratum is

(2.59)

Similarly, for the second stratum we have

(2.60)

E(V 2) ==
2
f(_4_)2
5
1+x 2
dx ~ 0.5606200
4
(2.61)

(2.62)

The value of the original integral is then E(V 1) + E(V 2), and the variance of
this value is var(V) = var(V 1) + var(V 2). Thus

E(V) == E(V.) + E(V2 ) ~ 1.373400 (2.63)

var(V) == var(V\) + var(V2 ) ~ 0.2407217 (2.64)

and the standard deviation is

cr(V) = ~var(V) ~ 0.4906339 (2.65)

Comparing eqn 2.38 with eqn 2.65 shows that the use of these two strata
reduces the standard deviation of the random variable associated with the
integral from about 1.424 to 0.491, or by a factor of approximately 2.9.
Since the total number of samples is split between the two strata, the
improvement obtained using the same total number of samples is 2.9 divided
by the square root of two, or 2.05. This reduces the number of samples
needed to obtain the result to a given level of accuracy by a factor of (2.05)2,
or 4.2. A similar calculation using four strata with the ranges (0,0.5),
(0.5,1), (1,2) and (2,5), gives an expected standard deviation of 0.1646. The
value of stratified sampling is therefore potentially large in this problem.

Example 2.4. Use of stratified sampling to evaluate a definite integral


2. Monte Carlo Sampling Techniques 45

A Fortran program to calculate the integral of eqn 2.30 using Monte


Carlo with 100 strata evenly spaced over the range (0,5) is shown in Tables
2.7 and 2.8. The collection of data for estimating the mean and the variance
is done at entry points in subroutine 'Stats,' as shown in Table 2.8. The
calculation will use one million samples total; i.e., an average of 104
samples randomly distributed within each stratum. For comparison
purposes, this example retains the same set of points used in the unstratified
solution of Example 2.3. Similar results would have been obtained if we
had forced an equal number of samples to be selected in each stratum.

Table 2.7. Program to Implement Stratification


! Program to inplanent stratificatioo
arrays will be d:iIrensiooed to handle up to 100 strata
DOUBLE PRECISION dK,a,b,score,delta,f,fltrn,delta2
OOMMON/scores/score,n
f(dK)=l./(l.+dx**2) ! f (x) is the functioo to be integrated
OPEN (unit=8, file='lptl')
a = 0 .0; b = 5.0 ! a,b are l~r,t.q:.per limits of integral
nsamples = 1000000 ! nsamples-nl.l!lber of sanples to be perfooned
WRITE (8, 13)nsamples,a,b
13 F1:lMI.T(' noofsanples=',i8,' ~rLimit=',flO.6,' UJ;perLimit=',flO.6)
WRITE(*,15)
15 F1:lMI.T(' Please enter the nU!lber of strata up to 100.')
READ (* , *) nstrata ! nl.l!lber of strata to be used
IF((nstrata.LT. 1) .OR.(nstrata.GT.100))nstrata=100
CALL stats
delta=(b-a)/nstrata ! delta x value for each stratun
delta2=(b-a) ! delta x for IIDStratified calculatioo
00 100 j=l,nsamples
dK=fltrn () ! fltrn () generates a randan nU!lber in (0, 1)
n=linstrata*dK ! cala.1late the strata associated with dK
dK=a+(b-a)*dK; score=delta*f(dK) ! calculate score at dK
CALL statlp ! store statistics for score
score=delta2*f (dK) ! calculate score for IIDStratified case
n=nstrata+1 ! store IIDStratified scores in last strata
CALL statlp ! store statistics for IIDStratified case
100 CCNl'INUE
n=nstrata
CALL statend ! calculate and print results
S'IOP; END

The results of executing the program are:


Estimated value ofintegral (Istrata) = 1.373366
Estimated standard deviation of distribution under integral = 0.0020215
Estimated standard deviation ofistrata = 0.000020218
The Monte Carlo results from the same one million samples without the use
of stratified sampling were:
Estimated value of Integral (Inostra~ = 1.372706
- Estimated standard deviation of distribution under integral = 1.4235
- Estimated standard deviation ofinostrata = 0.0014235
Thus, by the simple step of collecting the same set of samples produced in
Example 2.3 into 100 uniform strata over the range of the desired integral,
46 Chapter 2

instead of in a single bin, the uncertainty in the result was reduced by a


factor of 70.4. This is an equivalent reduction in computer time of almost
5000.

Table 2.B. Subroutine to Calculate Results with Associated Statistics


SUBRCUI'INE stats
DOUBLE PRECISION score,sumf(101),sumsq(101),stdev,var,tvarl,tvar2,totals,dj
DIMENSION nstsam(lOl)
c:c:Mrn/scores/score, n
sunf=O.; sumsq=O. ; nstSd!lFO ! Initialize variable arrays
REIURN
ENI'RY statlp ! Entry point to increrrent arrays after earn score
sumf(n)=sumf(n)+score; sumsq(n)=sumsq(n)+score**2; nstsam(n)=nstsam(n)+l
REIURN
ENIRY statend ! Entry point to finalize and print results
nstrata=n; totals=O.; tvarl=O.; tvar2=O.
00 200 i=l,nstrata ! Get sums for integral and standard deviatioo
var=O. ! of distribJtioo and answer when stratified
j=nstsam(i); dj=DFlGIT (j)
IF (j.Gr.l)var = (sumsq(i)/dj - (sumf(i)/dj)**2)
totals=totals+sumf (i) /dj; tvarl=tvar1+var; tvar2=tvar2+var/dj
200 CCNI'INUE
WRITE (8, 16)totals,DSQRT(tvarl),DSQRT(tvar2)
16 ~T(' sum:', flO . 6,' stdevof distr:', flO. 7,' stdev of sun:' ,eI4.6)
var=O . OdO ! calaJ.late results without stratificatioo
j=nstsam(nstrata+l) ; dj=DFlGIT(j)
IF(j.Gr.l)var=(sumsq(nstrata+l)/dj-(sumf(nstrata+l)/dj)**2)
stdev=DSQRT (var)
WRITE(8,l8)j,sumf(nstrata+l)/j,stdev,stdev/DSQRT(dj)
18 RH1I'.T(lx, 'No stratificatioo: Nurrber of sanples',i8,/,&
, sun:',flO.6,' stdev of distr: ',fl0 . 7,' stdevof sum:',eI4 . 6)
REIURN
END

For many random variables of interest, the range over which a Monte
Carlo estimate varies within a stratum can be less than that for the total
sample space. Since the variance of the variable depends upon this range,
and reducing the range reduces the variance, stratification generally reduces
the variance. In fact, provided the sampling is distributed pro rata among
the strata (the number of samples in each stratum is proportional to the
"size" of the stratum), in no case will stratified sampling reduce the
accuracy of a Monte Carlo estimate. Furthermore, unless the function being
sampled is a constant, or is cyclical with the stratification selected such that
each stratum contains an integral number of cycles, dividing Monte Carlo
sampling into strata and distributing the sampling pro rata or better - i.e.,
using certain biasing in the distribution of samples per stratum, to be
discussed later - will always reduce the variance of an estimate made from a
given number of samples. This means that it is difficult to reduce the
accuracy, and easy to improve the accuracy, of Monte Carlo results by using
stratified sampling.
2. Monte Carlo Sampling Techniques 47

This property of stratification is demonstrated by the following theorem. 5


For the purpose of the statement of the theorem it is useful to introduce the
nomenclature associated with conditional probabilities: P{X = xlB} is the
probability of X = x given condition B. The notation of E(VIA) is the
expected value of random variable V over the set A. As before, the set of
real numbers is designated R. A tilde, -, is used to indicate the subtraction
of one set from another.

Theorem: Given a random variable V and a measurable f set A of real


numbers such that E(VIA), E(V) and var(V) exist and are finite, if E(VIA)
does not equal E(V) then the variance of the estimate of E(V) using the
strata defined by A and R-A is less than the variance of the estimate
without stratification.

Proof: Let f(x) be the pdf ofV(x) and let

a = Jf(x)dx (2.66)
A

Then

I - a = J f(x)dx (2.67)
R-A

Define

f(X) , for x in A
f.(x) = { a (2.68)
0, otherwise

and

f(X) , for x not in A


f 2 (x) = { 1- a (2.69)
0, otherwise

Let VJ(x) and V 2(x) be random variables with pdfs fJ(x) and f2(x),
respectively, but with the same values as V(x) for each x in R; i.e.,

f For the purpose ofthis proof, a measurable set A of real numbers is any set that is a union of
intervals of real numbers.
48 Chapter 2

(2.70)

Then

E(V1) = fV1(x)fl(x)dx= fVI(x) f(x) dx=.!. fV(x)f(x)dx (2.71)


R A a aA

E(V2) = fV2(X)f2 (x)dx = f V2(x) f(x)


I-a
dx = _1_
I-a
fV(x)f(x)dx (2.72)
R R-A R- A
and

E(V) = a E(V \) + (I-a) E(V2) (2.73)

Since E(V \) ~ E(V), defining 0 = E(V \) - E(V) gives

E(V2) = E(V) - -
ao (2.74)
I-a

Therefore, if 0 > 0 - i.e., E(V \) > E(V) - then E(V 2) < E(V), and vice versa.
The variance of V is given by

t
var(V) = f[V(x) - E(V) f(x)dx
R
(2.75)
= f[V(x)- E(V)tf(x)dx + f[V(x)- E(V)tf(x)dx
A R- A

The variance of the estimate of the mean of V, V , based on n samples is


then [var(V)]/n, or

var(V) = ~ f[V(x)-E(V)tf(x)dx+ ~ f[V(x)-E(V)tf(x)dx (2.76)


A R- A

The variance of [aV\ + (l-a)V 2] is given by


2. Monte Carlo Sampling Techniques 49

var[aV\ + (1-a)V2] = a 2 J[V-E(V\)]2f\(x)dx


A

+ (1- a)2 J[V - E(V2 )]2 f2 (x)dx (2.77)


R-A

a J[V - E(V\ )]2 f(x)dx + (1- a) J[V - E(V2 )]2 f(x)dx


A R-A

In an unbiased sampling scheme with n samples for these two strata,


nP(A) or na samples will be used for stratum A, and nP(R~A) or n(1-a) will
be used for stratum R~A. Therefore, the variance of the mean of
[aVl+(I-a)V2] is

var(aV\ +(1-a)v2)=_1 var(av\)+[ 1 ]var[(1-a)v2] (2.78)


an (l-a)n

=~ J[V - E(v\)ff\(x)dx
nA
(2.79)
+ (1:a) J[V -E(V2)]2f2(x)dx
R- A

=.!. J[V - E(V\)]2 f(x)dx


nA
(2.80)
+~ J[V -E(V2)ff(x)dx
R- A

If E(V) = E(V l ) = E(V 2) then, comparing eqn 2.76 with eqn 2.80 gives
var(V) = var(aVl+(I-a)V2)' For the case where E(V l) does not equal E(V),
which is the assumption of the theorem, consider a function g(m) defined by

g(m)= J[V - mff(x)dx (2.81)


A

Taking the derivative of g with respect to m gives


50 Chapter 2

~ = -2 f[V - m]f(x)dx = -2 f Vf(x)dx + 2 f mf(x)dx


dm A A A (2.82)
=-2aVI +2am=2a(m- VI)

and dg/dm = 0 implies m = VI .


Noting that the second derivative of g with respect to m is 2a, and
therefore positive, we have m = V 1 as the minimum value for gem). This
means that if E(V I) does not equal E(V) then

f[V - E(VI )]2 f(x)dx < f[V - E(V)]2 f(x)dx (2.83)


A A

Similarly, ifE(V2) does not equal E(V) (and this follows ifE(V 1) does not
equal E(V» then

J[V - E(V2)f f(x)dx < J[V - E(V)]2 f(x)dx (2.84)


R- A R-A

Therefore, if E(V 1) does not equal E(V),

var( aVI + (1- a)v2) < var(V) (2.85)

QED

The above theorem assumed an unbiased sampling scheme whereby the


number of samples from each stratum was proportional to the size of the
stratum. The proof did not, however, depend upon this assumption. As long
as the fraction of samples used for solving the problem was the same in each
stratum for both the stratified and unstratified schemes, the above proof,
suitably modified, would follow.
Based on the preceding proof we can consider first an optimal scheme
for selecting the fraction of the number of samples that should be used in
each stratum of a stratified sampling process. Let w denote the variance of
the mean of the stratified sample; i.e.,

(2.86)

made with n total samples, with m samples used for the first stratum and
n-m samples used for the second stratum. This gives
2. Monte Carlo Sampling Techniques 51

a I-a
w( m) = - var(V\ ) + - - Var(V2 ) (2.87)
m n-m

Setting the derivative ofw with respect to m equal to zero, and solving for m
such that 0 S; m S; n gives

n
m=---= (2.88)
1+£

where

k = (1- a)var(V2)
(2.89)
a var(V\)

That is, there exists an optimum partitioning of the n samples among the
strata. This optimization depends on the variances of the random variables
associated with the strata. Biasing stratified sampling schemes can further
reduce the variance of estimates of the means of random variables.
Optimum partitioning of a problem space for stratified sampling with Monte
Carlo is discussed in several texts. 6

2.5.2 Biased Sampling Schemes

As was noted earlier, the pdf of eqn 2.31 and the resulting random
variable of eqn 2.33 are not the only pdf and random variable that can be
defined that have an expected value equal to the value of the integral in eqn
2.30. One may analyze eqn 2.30 and determine alternative definitions of the
pdf and random variable such that the problem is not only solved, but the
variance of the result is reduced.
In the general case of biased sampling (not just biased per a stratification
scheme), the samples are picked from a modified pdf. Consider the random
variable Vex) with pdff(x). The expected value of V, E(V), is then given by

J
E(V) = V(x)f(x)dx (2.90)
R

Given a different pdf g(x), such that g(x) > 0 everywhere that V(x)f(x) >0,
we have
52 Chapter 2

E(V) = J V(x)f(x) g(x)dx (2.91)


R g(X)

The random variable V' associated with the pdf g(x) is

V'(x) = V(x)f(x) (2.92)


g(x)

and E(V') = E(V). However, it is not necessarily the case that the variance
of V' is the same as the variance of V. The proper selection of g(x) can
result in the variance being significantly reduced.
To illustrate the potential for reducing the variance of the estimate of the
expected value ofV(x), assume that g(x) can be found such that

V'(x) = V(x)f(x) = c (2.93)


g(x)

where c is a constant. For this case

E(V') = E(V) = JV(x)f(X) g(x)dx= Jcg(x)dx=c (2.94)


R g(x) R

and

var(V') = J[V' - E(V,)]2 g(x)dx = 0 (2.95)


R

Therefore, in theory it is possible to choose a modified density function


such that the sampling process gives a zero-variance answer; i.e., one for
which every sample yields the correct value for E(V'). However, in order to
obtain this exact result, the problem must be solved for E(V'). In other
words, if the problem can be solved analytically, then the analytical solution
can be used to construct a zero-variance Monte Carlo estimate. This is not a
particularly useful result by itself. However, adjoint solutions to the
transport equation, discussed in Chapter 9, can be used for approximating
the optimum function g.
The above discussion indicates that the proper selection of a modified
pdf can result in a reduced variance estimate. It also suggests the approach
needed to obtain variance reductions: that g(x) should be chosen to have
2. Monte Carlo Sampling Techniques 53

essentially the same shape as V(x)f(x) so that the quantity V'(x) =


V(x)f(x)/g(x) of eqn 2.92 is approximately constant.

Example 2.5. Biasing a Monte Carlo estimate of a definite integral

Consider the variable Vex) = eX and the pdf

I, for x in (0,1)
f(x) = { (2.96)
0, elsewhere

Then

E(V) = fexdx~1.71828 (2.97)


o

Consider a Monte Carlo estimate of this integral. The results of using 106
samples to estimate the integral without biasing are
- Value ofIntegral = 1.71825757
- Standard Deviation of Random Variable = 0.49168896
- Standard Deviation of Estimate ofIntegral = 0.00049169
In order to select a possible pdf for biasing, we note that a straight line
from (0,1) to (1,2.718) has somewhat the same shape as the function we
wish to evaluate. Using this line, with the appropriate normalization, to
define a modified pdf g(x) gives

(x) = 1+ 1.718x (2.98)


g 1.859

The Monte Carlo results for this biased sampling scheme are
- Value ofIntegral = 1.71823566
- Standard Deviation of Random Variable = 0.06507303
- Standard Deviation of Estimate ofIntegral = 0.00006507

The program for performing both of these calculations is given in Table


2.9. The unbiased result is closer to the true answer than the biased result in
this case because of the particular random number sequence used. In the
biased case, however, for the same 106 samples, the standard deviation of
the associated random variable is reduced from 0.4917 to 0.06507. This is
approximately the reduction expected if the sample size were increased by a
factor of 50. The reduction in the standard deviation indicates that the
54 Chapter 2

biased result is more reliable than the unbiased result. The modified pdf
chosen here is not an optimal scheme in any normal sense of the word. It
was chosen because it was easy to define and easy to implement. Yet even a
simple scheme such as this produces a significant reduction in the variance
of the result.

Table 2.9. Program to Illustrate the Effects of Biasing


DOUBLE PRECISION x,a,b,soore,surnf,sumfsq,stdev,f,r,sumg,sumgsq,g
f (x) =EXP (x) ! f (x) is the fimctioo to be integrated
g(x)=(1+1.718/2.0)*EXP(x)/(1+1.718*x) ! g(x) is the biased ftmctioo
OPEN(unit=6,fi1e='lpt1')
a=O.; b=1. ! a, b are lCMer and uwer limits of integral
surnf=O.O; surnfsq=O.O; sumg=O.OdO; sumgsq=O.OdO ! Initialize variables
nsanples=1000000 ! nsarrples is the nllllber of sanples
~(6,13)nsarrples,a,b
13 FC:R1/I.T(' no of sanples=',i8,' LcMer Limit=' ,flO.6,' lJfper Limit=',flO.6)
IX)100 j=l,nsanples
r=fltrn() ! fltm() generates a randan nllllber in (0,1)
x=a+ (o-a) *r ! pick unbiased x
score=f (x); sl.lllf=sumf+score; sumfsq=sumfsq+soore**2 ! score unbiased ftmctioo
x=(DSQRT(1.718*(2.+1.718)*r+1.)-1.)/1.718 ! pick biased x for a=O, b=1
soore=g(x); sumg=sumg+soore; sumgsq=sumgsq+score**2 ! score biased fimction
100 CCNI'INUE
j=nsanples
stdev = DSQRT(DABS(sumfsq/j - (sumf/j)**2))
WRITE(6,14)j,sumf/j,stdev,stdev/SQRT(~T(j)) ! unbiased results
stdev = DSQRT(DABS(sumgsq/j - (sumg/j)**2))
~(6,14)j,sumg/j,stdev,stdev/SQRT(~T(j)) ! biased results
14 FC:R1/I.T (lx,i7,f14.8,f14.8,f14.8)
STOP
END

To use the mathematics associated with random variables, it has been


convenient to consider a new random variable that is defined for a modified
pdf. In Monte Carlo this process is referred to as "weighting." The new
random variable associated with the modified pdf is given by eqn 2.92,
V'(x) = V(x)f(x)/g(x). The ratio off(x)/g(x) is then the weighting factor that
is applied to the random variable V to compensate for selecting from the
modified pdf. This concept has direct application to the Monte Carlo
solution of particle transport problems. Particles typically start their Monte
Carlo random walk with a weight of one. If an event involving the particle
is selected from a modified pdf, then the weight of the particle can be
suitably modified to compensate for the biasing. We will see examples of
this in subsequent chapters.
2.,Monte Carlo Sampling Techniques 55

Exercises

1. Using eqns 2.8 and 2.9 derive a sampling scheme for selecting the radii of
points unifonnly distributed over
a. a disk of radius ro
b. an annulus of inner radius ri and outer radius roo
c. a spherical shell of inner radius ri and outer radius roo

2. Using the rejection technique derive a sampling scheme to select a


random value for cos e, assuming that e is unifonnly distributed from [0,
21t]. The sampling scheme should not use a function to calculate the cosine
of an angle. Calculate an average value for the cosine over [0, 1t/2] and for
[0, 21t]. For each case, estimate the variance of the distribution, the variance
of the estimate of the mean, and the fsd. Show why the fsd is not a useful
measure for the average of the cosine over [0, 21t]. [Hint: IfR = x2+ =:; 1, y
cose = xI..JR].

3. Repeat exercise 3 of Chapter 1 using stratified sampling. Segment the


integral into several different numbers of strata of equal size and, for the
same total number of start particles, show how the standard deviation
changes with the number of strata.

4. Calculate the value of the integral

using analog Monte Carlo. Implement several different numbers of strata


and detennine the gains in efficiency produced thereby. Define a modified
pdf that appears to offer an improvement in efficiency and recalculate the
integral. How much improvement was obtained?

1 See, for example, L. Lyons, Statistics for nuclear and particle physicists, Cambridge
University Press, Cambridge, 1986. A discussion of random variables is given in Chapter 2
of 1. Honerkamp, Statistial Physics, Springer-Verlag, New York, 1998.
2 In the early days of Monte Carlo it was time consuming to evaluate a logarithm on a
computing machine and techniques were developed to permit sampling from the exponential
distribution without such an evaluation. For examples see John von Neumann, "Various
Techniques Used in Connection With Random Digits," Monte Carlo Method, A. S.
Householder, G. E. Forsythe, and H. H. Germond, eds., National Bureau of Standards
Applied Mathematics Series 12, U. S. Government Printing Office, Washington, D.C.,
56 Chapter 2

1951, p. 38; and E. D. Cashwell and C. J. Everett, A Practical Manual on the Monte Carlo
Methodfor Random Walk Problems, Pergamon Press, New York, 1959, pp. 119-20.
3 Robert B. Ash, Real Analysis and Probability, Academic Press, New York, 1972, pp. 321 ff.
4 Lyons, op. cit., pp. 13ff.

5 This theorem is similar to the "parallel axis theorem" in physics. See Numerical Recipes in
Fortran 77: The Art of Scientific Computing, Cambridge University Press, 1986-1992,
Chapter 7, p. 308.
6 See Reuven Y. Rubinstein, Simulation and The Monte Carlo Method, John Wiley and Sons,
New York, 1981, p. 133
Chapter 3
Monte Carlo Modeling of Neutron Transport

3.1 Introduction

One of the most important applications of the Monte Carlo technique, in


the sense of the number of users and the amount of computer time devoted
to problem solution, is the transport of subatomic particles - neutrons,
protons, mesons, electrons, and the high-energy photons associated with
atomic and nuclear processes. The interactions of these particles with
atoms and nuclei can be complex and the mathematical models of the
interactions, as well as the statistical equations describing the gross motion
of the particles, cannot be solved exactly except in a few simple cases.
Thus computer analysis is normally required to address problems in
radiation transport. There are numerous deterministic techniques for
obtaining solutions to radiation transport problems for various geometries
and special situations. However, in many cases Monte Carlo is the only
practical technique available for obtaining a solution.
In this book we will focus on the transport of neutrons. It is beyond our
scope to provide the reader with a detailed description of neutron transport
theory. However, the following brief introduction to the subject should
help orient the non-specialist. The notation that will be used will also be
introduced. The interested reader is referred to any of the many texts
devoted to the subject of radiation transport, some of which are listed in the
bibliography.

3.2 Neutron Interactions and Mean Free Path

The movement of a neutron through a material consists of a series of


straight flight paths interrupted by interactions between the neutron and one
57
58 Chapter 3

of the constituent nuclei or nucleons of the material. This interaction, or


collision, can result in a change in the direction in which the neutron is
traveling and a change in the energy of the neutron. It can also result in
absorption, or the incorporation of the neutron into the target nucleus, and
the production of secondary particles including neutrons and gamma rays.
The probability of a neutron having an interaction with the nuclei of a
material, per unit length of its fight path through the material, is defined as
the macroscopic cross section,~. This cross section has the dimension of
reciprocal length, usually taken as cm- I . A corresponding microscopic
cross section, cr, is related to the macroscopic cross section by the density of
nuclei, N cm-3, in the material,

~=Ncr (3.1)

Since ~ has the dimension of reciprocal length, and N of reciprocal


volume, cr has the dimension of area and is conveniently visualized as the
effective, projected area of a target nucleus as "seen" by a neutron. The
microscopic neutron cross section is commonly given in the unit of "barns"
rather than cm2, one barn being equal to 10-24 cm2• Nuclear cross sections
for neutrons vary with the energy of the neutron, the number of protons and
neutrons in the target nucleus, and the type of reaction being considered.
The total neutron interaction cross section for a material is equal to the sum
of the cross sections for all of the physically permitted interactions with the
target nuclei at the neutron energy in question. Thus if only scattering and
absorption are possible, the total cross section is

(3.2)

where the subscripts refer to total, scattering, and absorption reactions,


respectively. The non-absorption probability is 1 - ~JLt.
A neutron traveling through a material characterized by the total cross
section ~t will leave one collision site and travel in a straight line until
experiencing another collision. For an isotropic, homogeneous material, the
probability of a collision is constant along the neutron's path independent
of the direction of travel. Thus the distribution of collisions along the path
is described by

dn
-=-~ n (3.3)
dx t
3. Monte Carlo Modeling ofNeutron Transport 59

where n is the number of neutrons completing a flight path of length x prior


to suffering a collision. The negative sign indicates that the neutrons are
removed from the population with increasing x. Thus

n(x) = n(O)e-l:,x (3.4)

This means that the expected number of neutrons traveling a distance x


between collisions decreases exponentially with increasing x. In particular,
the average distance Athat a neutron travels before experiencing a collision
is given by

ct>

Jxe-l:,Xdx
A=..!Co_ _ _ =_ (3.5)
ct>
I: t
Je-l:,Xdx

°
The quantity A, the mean distance a particle with a total interaction cross
section I:t travels between collisions, is called the mean free path (mfp).

3.3 Neutron Transport

For present purposes a neutron may be treated as a classical point


particle; i.e., the neutron's quantum mechanical reduced wavelength Ii/p,
where Ii is Planck's constant divided by 21t and p is the neutron's momentum,
is small compared with the problem parameters such as material thickness
and neutron mean free paths for neutron energies of interest. Thus the
neutron can be completely defined by designating its location, r, its
direction of travel, Q, and its energy, E, at time t. Apart from the time
variable, these coordinates form a six-dimensional phase space - three
position, two direction, and one energy variable - that fully describes the
particle. Alternatively, the direction of travel and the energy can be
combined into three momentum vectors which, combined with the three
position vectors, form the six-dimensional phase space in which the neutron
can be tracked.
A population of neutrons inside a material acts as a rarefied neutron
"gas." Movement of the neutron gas particles can be described by gas
dynamic equations and, in particular, their motion can be described by the
Boltzmann equation from statistical mechanics. We will assume the
neutron density is always sufficiently low to neglect neutron-neutron
collisions, which means the statistical equation describing neutron transport
60 Chapter 3

is linear. Being a statistical equation, the mathematical model of neutron


transport describes only the average behavior of the neutron population.
When the density of free neutrons in a material is low, local statistical
perturbations can cause the actual population to differ significantly from the
average distribution. The Monte Carlo method, which models the motion
of individual neutrons, can also produce an answer that differs significantly
from average behavior in local regions.
The basic physical quantity used to describe a population of neutrons is
the neutron angular density N(r,n,E,t). This function defines the density of
neutrons in volume dr about r, traveling in direction dn about n, with
energy dE about E, and at time dt about t. The product of the velocity v and
the neutron angular density vN(r,n,E,t) is called the neutron vector angular
flux) or the vector flux. However, a more useful quantity in radiation
problems is the angular flux, 'P, which is the magnitude of the vector flux;
i.e., the product of the angular density and the speed v,

'P=Nv (3.6)

Here we distinguish between the particle's vector velocity v and its speed v,

v=vn (3.7)

The angular flux has the units of cm-2sec- 1steradian- 1.


The angular flux, when integrated over all directions, is proportional to
the rate at which neutrons of a given energy, at a given location and time,
interact with the nuclear constituents of the material through which they are
passing. This neutron reaction rate per unit volume, per unit energy, per
unit time, is frequently of interest in neutron transport problems. The
interaction rate determines quantities that are physically measurable such as
the energy deposition or radiation dose rate, the production rate of
radioactive materials by neutron activation, and the fission rate or power
level inside a nuclear reactor. This integral of the angular flux over
direction is called the scalar or total flux (sometimes contracted to "flux,")
<1>, and is given by

(3.8)

Here the integral over 41t refers to integration over the entire solid angle
about the point r. The constant of proportionality relating the neutron
scalar flux to the neutron reaction rate per unit volume, R, is the
macroscopic interaction cross section, ~, for the reaction of interest,
3. Monte Carlo Modeling of Neutron Transport 61

(3.9)

The time-integrated angular flux is called the angular fluence, which is


the total number of particles per unit area and per unit energy passing the
point r in the direction dO about o. In analogy with the scalar flux, the
scalar or total fluence is the integral of the angular fluence over all
directions. The net neutron current, J, is a vector given by

J(r,E, t) = fvN(r,O,E, t)dO = fO'¥(r,O,E, t)dO (3.10)


411 411

The neutron current in a given direction D, where D is a unit vector, is given


by the scalar product of D and J.
To solve neutron transport problems, the Monte Carlo method models
the particle flight paths and the various interactions between the neutrons
and the material nuclei. This simulation of a neutron's path is called a
random walk. It involves evaluation of the random variables associated
with the physical processes of neutron transport. Each particle trajectory is
a mathematical realization of one of the physically possible paths that a
neutron could follow through the material being modeled. Calculating a
series of random walks is equivalent to performing an experiment in which
a number of neutrons, equal to the number of random walks calculated, is
released from a source into the problem geometry and some physical
measurement is made on the resulting population. For a well-modeled
problem, in the limit of a large number of random walks, the results of a
Monte Carlo calculation and those of an analogous physical measurement
will approach the same value.
The Monte Carlo random walks produce a set of neutron collision points
along with information about the consequences of these collisions. The
latter information can include the energy of the neutron after the collision,
and the direction in which the neutron leaves the collision site. These data
provide considerable information about the neutron motion but they are not
measurable quantities and in general they do not constitute the desired
result of the calculation. Therefore, additional processing is normally
required in order to complete the Monte Carlo analysis.
The usual "result" of a Monte Carlo transport calculation consists of
scores in a "detector" or tally. These scores can be used to estimate
measurable quantities of interest. For example, one measurable quantity is
the neutron reaction rate. From eqn 3.9, if we know Lt and if we count
collisions in some sample volume, this tally of collisions can be used to
estimate the flux, <1>, in this sample volume. Once the flux has been
62 Chapter 3

detennined, a measurable quantity, such as the reaction rate for an


activation foil, can easily be estimated.

3.4 A Mathematical Basis for Monte Carlo Neutron


Transport

Mathematically, the Monte Carlo simulation of neutral particle transport


can be seen as equivalent to the evaluation of a definite integral. In tenns
of the angular flux '1', the Boltzmann equation may be written

I 8
- - 'I'(r,n,E, t) + n. V'I' + L t 'I' - S =
vat (3.11)
fJ I " n E ~ n , E) dE dn
'I'(r, n , E , t)L s(r'
I I I I I

where S is a source that does not depend on '1'. The scattering kernel Ls in
eqn 3.11 refers to a change in the neutron coordinates from the primed to
the unprimed values during a collision at r. Using the method of
characteristics, we can obtain an expression for the flux at the point r, in the
direction n, at the time t. 2 We introduce the line through r in the direction
n and call the coordinate along this line s. We note that
d'l' 8'1' dt 8'1' dx 8'1' dy 8'1' dz
-=--+--+--+-- (3.12)
ds at ds 8x ds 8y ds 8z ds

and that, in Cartesian coordinates,

(3.13)

Because the right sides of eqns 3.12 and 3.13 are the same, we can equate
the left sides of these two expressions to obtain

(3.14)

Finally, by equating orthogonal tenns we can derive expressions for the


time and space variables
3, Monte Carlo Modeling ofNeutron Transport 63

1 8\f 8\f dt dt 1 s
--=--~-=-~t=t +-
v at at ds ds v 0 v

8\f 8\f dx dx
~-=--~-=~~x=x +s~ (3.15)
ax ax ds ds 0

8\f 8\f dy dy
~-=--~-=~ ~y=Yo +s~
By By ds ds

8\f 8\f dz dz
~-=--~-=~~z=z +s~
8z 8z ds ds 0

where "0, Yo, Zo, and to are arbitrary constants. The latter three equations
can be combined into

(3.16)

We may now write the transport equation

(3.17)
JJL s(ro + sO;O', E' -+ O,E)\f(ro + sO,O',E ',t o + ~)dO'dE'
v

Defining the right-hand-side of eqn 3.17 to be q(ro+sO,O,E,to+s/v) and


introducing the integrating factor

f
s

1:, (ro +s'O.E)ds'

e- (3.18)

gives


f1:,(ro +s'o.E)ds' S

=e '" q(ro +sO,O,E,t o +-) (3.19)


ds v

Integrating this equation over s from - 00 to 0, assuming that over all phase
space
64 Chapter 3

lim \I'(s) = 0 (3.20)


s.... --<o

gives

o s
J1:, (ro +s'O,E)ds' 0 J1:, (ro +s'O,E)ds'
\l'e -'" = Ie -'" qds (3.21 )

Using

] 1:ds' ] 1:ds' Illis'


e-'" =eO e-'" (3.22)

and the fact that the integral from -00 to 0 in the exponential is not a
function of s gives

o j 1:, (ro +s'O,E)ds'


'P(ro,!l,E,t o)= Ie 0 q(ro+s!l,!l,E,t o + :)ds (3.23)
-00

Changing signs for both sand s', changing variables so that ro = r and to = t,
and expanding q according to the right-hand side of eqn 3.17 gives the
desired form of the Boltzmann transport equation,

\I'(r,!l, E, t) =

fe-~[ ffLs(r- s!l;!l',E' ~ !l,E)'P(r - s!l,!l',E',t -~)d!l'dE'}S


00

+ Ie-~S(r-s!l,!l,E,t-~)ds
o v
(3.24)

Here 13 is the optical thickness, which is defined as

s
13= ILt(r-s'!l,E)ds' (3.25)
o
3. Monte Carlo Modeling of Neutron Transport 65

Thus, by eqn 3.24, the angular flux at a point can be expressed as integrals
over all possible sources and neutron flight paths leading to that point and
meeting the appropriate energy, direction, and time restrictions.
In operator notation, eqn 3.24 can be written as

'I' = K'I' + Sf (3.26)

where K is the integral operator and Sf is the attenuated source. A solution


of eqn 3.26 can be obtained by defining

(3.27)

Ifthe series converges, then a solution to eqn 3.26 is

(3.28)

This solution is called the von Neumann series. '1'0 is the angular flux from
the source that arrives at the point in question without undergoing
collisions, '1', is the angular flux arriving that has undergone exactly one
collision, and so on. The Monte Carlo tracking of source particles that have
not undergone a collision provides an estimate for '1'0' the continued
tracking of particles that have undergone one collision provides an estimate
of '1'" etc. The tracking process therefore estimates the von Neumann
series solution to the integral formulation of the transport equation.

3.5 Monte Carlo Modeling of Neutron Motion

The procedure by which the movement of neutrons in a material is


simulated by analog Monte Carlo consists of a sequence of steps that mimic
the physical phenomena involved in such movement. However, before the
calculation can begin, the user must define the problem. The definition of
the problem must include such factors as the geometry and the neutron
source. Once the problem is defined, the random walk of the particles
through the problem geometry can be executed. The steps followed in this
execution may vary with the problem to be solved or with the programmer's
selection of technique or options, but a basic set of such steps might consist
ofthe following:
66 Chapter 3

1. Problem Definition
a. Define the problem geometry
The physical description of the problem geometry and material constituents
is fundamental to a proper definition of the problem. All particle
interactions, flight paths, and escapes from the problem geometry are based
on this description.
b. Define the source
Even in eigenvalue calculations (discussed in Chapter 8) a source must be
defined for the random walk procedure to be initiated. This source may be
a pdf from which the calculation selects start particles, or may be a specific
set of particle start points, directions, energies, and times. The initial
source is externally applied; Le., it does not arise from prior interactions of
the neutrons being tracked with the material constituents of the problem.
2. Random Walk
a. Select a Source Particle
A neutron is selected from the source distribution. The neutron is given an
initial position, energy, time, and direction of travel, according to the
problem parameters.
b. Determine a collision point
A collision site for the neutron is selected from the exponential distribution
of collisions along its flight path. The cross sections of the materials
through which the neutron is traveling are used to obtain the probability of
collision per unit path length.
c. Determine the type of interaction
Once a point of interaction is chosen, the total cross section is apportioned
pro rata among the nuclear species present. After selecting a nuclear
species, the cross section for that species is used to determine which type
of interaction has occurred. An alternative technique for handling
interaction cross sections is to average, or "mix," the cross sections so that
one combined set contains the features of all the constituents. A
multigroup formulation is also possible, in which the neutron energies are
cast into a set of discrete bins or groups, and a table of group-averaged
cross sections is used to determine the interactions.
d Determine the result of the interaction
The result of the interaction is selected from one or more of the following
alternatives: death of the neutron by absorption (or reduction of the
"weight" of the particle by the non-absorption probability); scattering of
the tracked particle through some angle selected from the particular angular
scattering characteristics of the nucleus encountered; or production of
secondary particles, including fission.
e. Complete the history
All secondary particles (or a statistically valid sampling from them), as
well as the scattered neutron, are tracked to determine subsequent collision
points and products. This process is continued until the initial neutron, and
all secondary particles produced by the initial neutron, either die by some
direct or statistical means, or escape from the geometry.
3. Monte Carlo Modeling ofNeutron Transport 67
3. Compute the response
Use the result of the random walk to calculate the detector response being
modeled by the calculation. This is most commonly done simultaneously
with the random walk, but may be done by means of a post-random-walk
event file.
The execution of the steps listed above can entail a time-consuming
calculation. In practical terms a Monte Carlo calculation must be able to
produce statistically meaningful results using relatively few particle tracks
to simulate the average effect of a large population of neutrons. This may
require a high degree of care on the part of the practitioner. In many cases a
careful study of the problem to cast it in appropriate terms for Monte Carlo
analysis can result in considerable savings in computation time. Some of
the techniques available for increasing the efficiency of Monte Carlo
calculations are discussed in Chapter 6.

Example 3.1. Monoenergetic point source with isotropic scattering

Let us consider the problem, described by Case, de Hoffmann, and


Placzek,3 of a point isotropic source of monoenergetic neutrons in an
infinite medium with no absorption and isotropic scattering in the
laboratory coordinate frame. The objective is to calculate the scalar flux as
a function of distance from the source point.
Isotropic scattering in the laboratory coordinate system is a special case
that is approximated in practice only by low-energy neutron scattering from
heavy nuclei. Therefore the scattering model in this example is not
representative of most practical neutron transport. In laboratory isotropic
scattering, the incoming and outgoing particle directions are uncorrelated in
the laboratory coordinate system. As a consequence, the post-collision
direction need not be transformed from the local collision coordinates to
laboratory coordinates. In the more general case, in which the post-
collision direction of travel is correlated with the incoming direction of
travel, one must retain this correlation. We will see examples of the latter
in Chapter 4.
For simplicity in the modeling of the current example we consider the
case with no absorption. We will define a large but finite volume for the
analysis. Thus at equilibrium, for the steady-state solution, the same
number of particles will leak from the system as are released by the source
per unit time. We will score the particle collisions as a function of distance
from the point source. By eqn 3.9 this will enable us to obtain an estimate
ofthe average flux in each sample volume.
We will follow the steps listed above for the definition of a Monte Carlo
calculation:
68 Chapter 3

1. Problem Definition
a. Define the problem geometry
Consider a spherical geometry with a radius of 10 mfp centered around a
point source. For convenience we will assume ~t = 1; i.e., all distances
will be measured in units ofmfp. For the purpose of obtaining reasonable
spatial resolution of the flux, the geometry description will allow for the
Monte Carlo tally, or scoring, of collisions that take place in shells of
thickness 0.1 mfp centered around the point source.
b. Define the source
Because both the problem geometry and the method used for scoring
collisions are spherically symmetric, the initial direction selected for the
start particles is arbitrary. Therefore we will place the origin of our
coordinate system at the location of the source and assume all start
particles are emitted in the +Z direction. The problem is monoenergetic
so definition of the energy of the source particles is unnecessary.
2. Random Walk
Tables 3.1 and 3.2 show the Fortran code used to estimate the collisions in
the geometry defined above as a function of radius. The steps in the
calculation follow the random walk steps defined above. The radial bin
boundaries could be input by the user, but for this example they are
calculated based on a fixed O.I-mfp thickness.
3. Compute the response
The number of collisions is tallied in each radial bin.
After requesting the number of particles to be tracked and the start
random number seed, the program tracks the particles through the problem
geometry. The flight path for the first particle is along the +Z axis and a
first collision point is picked using eqn 2.14. Following this first collision
the direction for the second flight path is determined by selecting a random
unit vector. The length of this second flight path is obtained and, by eqn
3.16, the second collision point is determined. Each collision is scored by
testing the radius of the collision point, finding the radial bin that contains
this point, and incrementing a counter for that radial bin.
Calculating a new random vector originating at a point r is equivalent to
finding a random point on the surface of a unit sphere. The differential area
of a conic section of the spherical surface between the polar angles e and e
+ de is proportional to cos e. Hence the random point is found by first
calculating a random cosine for the polar angle over the range (-1,1), after
which a random azimuthal angle <p is selected over the range (0,21t) (see
Figure 3.1). The coordinate transformation for selecting random points
over a range different from that of the random number generator being used
is given by eqns 2.19 and 2.20.
3. Monte Carlo Modeling ofNeutron Transport 69

Table 3.1. Program for Example 3.1


Exanple program for isotrcpic point source of neutrrns
in a finite rredium with isotrepic scatter and no absorption
Score collisirn density flux in units of 0.1 mfp.
For <Xt1VeI1ience assure SIQ1A. = 1 an**-l
U,V,W = particle cartesian directirn cosines
X, Y, Z = particle locatirn cartesian ccordinates
o = particle flight path length uprn leaving =rent collisicn
ncolsn(I) = nurber of collisicns as a flmctirn of radius, 0.1 MFP resoluticn
IXUBIE PREI::ISICN Ind, fltm
DIMENSICN ncolsn(100)
OPEN (unit=8, file= I output. txt I , carriageccntrol= I Fortran I )
New Case Locp: ro ! The locp teIIllinates i f NS=O
- WRITE (*, I (lX, A\) I ) I Enter nurrber of start particles I Read input data
RE1ID (* , *) ns ! nurrber of start particles
IF (ns.LE.O) E){!T New Case Locp ! set ns=O to step
WRITE(*, I (lx,a\) ') I sero 1 -
RE1ID(*,*)iseed read seed for randan nll!lber generator
CALL mdin (iseed) set initial randan nll!lber
WRITE(B, I (lx,a\) ') I seed '; WRITE(B,10)iseed
10 FORMAT (lx, lIB)
ncolsn=O.O initialize ncolsn array to zero
ro 300 n=l,ns Begin particle tracking
u = 0.0; v = 0.0; w = 1.0 set initial directirn cosines
xo = 0.0; yo = 0.0; zo = 0.0 set initial positirn
ro 200
md = fltm() randan nurrber for picking distance
d = -DLCG(md) distance to collisicn
x = xo+u*d; y = yo+v*d; z = zo+w*d ccordinates of collision point
r = SQRT(x**2+y**2+z**2) radius of collisicn point in sphere

Note: it is not necessary to determine the type of reacticn -


- the prcblan involves scatter cnly
i=INT(10. OdO*r)+1 calculate mfp for bin nurrber
IF(LGl'.100)E){!T ! exit ro 200 locp if r>10 teIIllinate particle
ncolsn(i) = ncolsn(i)+l score collision in bin i
CALL ISCXUI'(u,v,w) get new directicn cosines
xo = x; yo = y; zo = z update particle positirn
200 CXNI'INUE
300 CXNI'INUE
Prcb1an exnplete. Present results
WRITE(B,14)ns
14 FORMAT (' NLiTber of start particles = I, I 10)
WRITE (B,13) (ncolsn(i),i=1,100)
13 FORMAT (' NIl!lber of collisicns per bin = I, / (10 (IB, I, ') ))
END ro New Case Locp
CALL- ~(iseed)
WRITE(B,' (lx,a\) ') I end seed '
WRITE (B, 10) iseed ending seed
STOP; END

Table 3.2. Subroutine 'Isoout'


SUbroutine ISCXUI'(u,v,w)
CATA PI/3.14159265/
Find new directicn cosines U, V, W
by selecting a randan cosine over [-1, +1] ,
and a randan azinuthal directirn by selecting a randan
angle over 2*pi.
COSTH = 2.*fltm()-1.
PHI = fltm()*2.*PI
SINTH = SQRT(1.-GOSTH**2)
U = COS(PHI)*SINTH; V = SIN(PHI)*SINTH; W = COSTH
return
end
70 Chapter 3

For the isotropic, post-collision unit vector defined by the angles e and
<p, the Cartesian direction cosines are obtained from

u = sin e cos <p


v = sin e sin <p (3.29)
w = cos e

Having defined the post-collision direction of travel the program loops back
to repeat the previous steps. Since particle escape is the only means for
terminating a track, because of the assumption of no absorption, the looping
is continued until the particle escapes from the problem geometry. Another
particle is then tracked.

~--+--7-Y

sine coscp-r----~

Figure 3. J. Cartesian Direction Cosines

Particle tracking is facilitated by the use of Cartesian coordinates to


denote position, since the direction of travel of a particle in these
coordinates can be set by direction cosines that are independent of the
position of the particle. One reason that Monte Carlo transport techniques
work well in complex geometries is that, to perform a random walk, it is not
necessary to cast the transport equation into the coordinate system of the
problem geometry.
The dimensions of the Monte Carlo score will depend on the assumed
dimensions of the source. This problem does not include time dependence
so the source can be thought of as a 3-function pulse in time and space with
a total strength equal to the number of neutrons tracked. In this case the
scattering events that are scored represent the total number of such events
over the lifetime of the neutrons in the problem geometry. In effect we are
determining the number of collisions produced by the fluence of particles
resulting from this source pulse. On the other hand we may think of the
calculation as a steady-state problem in which the total number of particles
tracked in the calculation is emitted per unit time. In this case, after
3. Monte Carlo Modeling of Neutron Transport 71

equilibrium is reached, the number of collisions calculated in each spatial


bin will be the number that occur per unit time. The results are collisions
per number of tracked source particles emitted per unit time interval.
Running the program in Table 3.l produces a file of the number of
collisions in each O.I-mfp spherical shell around the source point. The
results from 104 start particles are given in Table 3.3. a The total number of
collisions tallied in each bin is plotted in Figure 3.2. The number of
collisions per bin ranges from just over 1000 in the first bin, to more than
8000 near a radius of 5 mfp.
The effect of the outer boundary of the geometry at 10 mfp is not
obvious from this figure. However, it is clear that since the particle tracks
are tenninated when the particles reach 10 mfp there is the equivalent of a
vacuum boundary condition at this radius. Thus in the outer radial bins
there is no contribution from particles reflected back from radii greater than
10 mfp. This leads to a depression of the flux near this boundary.

T.able 3.3. Resu Its fior Example


I 3.1
1114 1241 1431 1604 1902 1967 2215 2516 2713 3055
3179 3275 3448 3741 3877 4020 4255 4381 4707 4812
5075 5235 5437 5531 5695 5922 6061 6173 6395 6386
6534 6695 6904 6815 7061 7188 7326 7499 7655 7712
7484 7842 7767 7671 7917 7990 8052 8029 7884 8205
8019 8119 7947 7993 8162 7972 7975 7841 8023 7954
7808 7894 7882 7668 7914 7634 7568 7467 7373 7265
7159 7023 7025 7190 6916 6700 6556 6475 6232 6127
5996 5854 5717 5573 5425 5170 5020 4946 4678 4473
4237 4086 3735 3566 3382 2977 2743 2520 2106 1808

From eqn 3.9, the scalar flux cI> ( cmo2seco1 ) is related to the collision rate
density R (cm o3sec·1) by

(3.30)

where cl>i is the average flux in bin i and nj is the average number of
collisions in bin i per start particle. The nonnalization constant k is equal to
the reciprocal of the volume of the region over which the collisions are
summed. This nonnalization converts the number of collisions per second
in the bin into a collision rate density.

a Unless otherwise indicated, the start random number used for examples in this text that use
= I. Uncertainties are not shown in Table 3.3. They could be
'fltrn' will be unity, 'seed'
calculated using eqns 2.43 and 2.44, as will be shown in Chapter 5.
72 Chapter 3

9000,---------------,

c:
~c:
o
~
"0
()

o~-~--~--~--~-~
o 2 4 6 8 10
Radius (mfp)
Figure 3.2. Collisions Versus Radius for Example 3.1

Because the macroscopic cross section assumed for this problem is unity
(1 cm-\ the flux is equal to the collision rate density. Thus we can plot the
flux as a function of radius by dividing the number of collisions in a bin per
start particle by the volume of the bin. The result is shown in Figure 3.3. In
this figure a depression in the flux caused by the vacuum boundary
condition at r = lOis apparent.
When possible it is desirable to compare Monte Carlo results with
analytic results. This is straightforward for the current example. We know4
that for small r,

(3.31 )

where in this example the source S = I. This is the equation for the flux as
a function of distance from a point source for particles streaming in a
vacuum. In the example problem, at locations near the source, collisions
will be negligible and this approximation should hold. Thus for small r, <I> -
0.08/r2. Using the Monte Carlo results from Table 3.3 with eqn 3.30, the
average flux in the first bin, 0 ~ r ~ 0.1, is

<I> ~ 0.1114 ~ 26.59 (3.32)


I 0.004189

For this bin the average flux estimated by eqn 3.31 is

I S0.1 I 0.1 S 2 0.1


<1>1 =- J---=--r<IV = - J--24nr dr = - ~ 23.87 (3.33)
VI 0 4nr VI 0 4nr VI
3. Monte Carlo Modeling of Neutron Transport 73

1.E+2 . - - - - - - - - - - - - - - ,

1.E+1

1.E+O

1.E-1

1.E-2

1.E-3 L--_~_--'- _ _ _ _~_--l


o 2 468 10
Radius (mfp)
Figure 3.3. Flux Versus Radius for Example 3.1

where Viis the volume of the first tally bin. Although the results of eqns
3.32 and 3.33 are in fair agreement, eqn 3.31 underestimates the flux even
in the first space point because the streaming approximation neglects
scattering events. Scattering events can allow particles to pass through a
region more than once, thereby increasing the flux.
An estimate of the flux at a significant distance from a point source can
be obtained from diffusion theory. Diffusion theory results are useful
because they can often be expressed analytically.s However, the results
obtained from diffusion theory are approximate. The diffusion theory
solution for the flux at radius r from a point source at the center of a
uniform sphere with pure scattering is

cI>= 3EtS[.!._~] (3.34)


41t r R

where R is the outer radius of the sphere. In order to increase the accuracy
of the diffusion solution, the outer radius of the sphere can be adjusted by
an extrapolation distance to compensate for the fact that diffusion theory
does not have an exact equivalence for a vacuum boundary condition. We
can do this by setting R to the actual outer radius plus 0.71 mfp.6
In addition to its limitations at the outer boundary, diffusion theory also
provides inaccurate results in the vicinity of a source. Comparing the
diffusion theory result of eqn 3.34 with eqn 3.31, the latter of which is a
good approximation very close to the point source, it can be seen that the
diffusion equation gives a Ifr dependence where the better result has a IIr2
dependence.
A "hybrid" diffusion theory solution can be derived by using the first
collision events from the point source as the source for the diffusion theory
problem.7 The total flux is then obtained by adding the uncollided flux to
74 Chapter 3

the result obtained from diffusion theory using the first collision source.
This hybrid result is

Ei(-R)]} (3.35)

where Ei(x) is the 1st order exponential integral 8

co -u
Et(x}= feu dU=-Ei(-x} (3.36)
x

and R is the radius of the sphere plus the extrapolation distance. Figure 3.4
shows the results of eqns 3.34 and 3.35 compared with the Monte Carlo
results for r < 4. The figure shows that the hybrid diffusion results are in
reasonable agreement with the Monte Carlo results at small radii, where the
pure diffusion results are low, and that all three results agree for r greater
than about two mfp. Based on this comparison it appears that the Monte
Carlo results are accurate and, further, that the variances are likely to be
small.

1.E+2

1.E+1

1.E+O
)(
::l
u::
1.E-1

1.E-2

1.E-3
0 2 3 4
Radius (mfp)

Figure 3.4. Comparison of Monte Carlo, Diffusion, and Hybrid Results

Gamma rays obey the same transport equation as neutrons. Therefore,


with appropriate cross sections, we can apply the techniques we have
developed for neutron transport to the solution of problems involving
gamma ray transport.
3. Monte Carlo Modeling ofNeutron Transport 75

Example 3.2. Self-attenuation in a spherical source of gamma rays

A practical problem of gamma-ray transport is the self shielding of a


volume-distributed source of gamma rays. The key issue in this problem is
to determine the fraction of gamma rays produced by nuclear decay in the
source that escape without suffering a collision. Any gamma ray that
experiences an interaction within the source material will (almost certainly)
suffer a change in energy. Thus the number of uncollided gamma rays that
escape, as a fraction of the total number of gamma rays emitted by the
source, is important in determining such quantities as the relative strength
of gamma rays of different energies, the absolute efficiency of a detector,
and the total activity of a source.
Case, de Hoffmann and Placzek9 have shown that, for a uniform,
isotropic, spherical source of radius R, with gamma attenuation coefficient
(or, equivalently, total macroscopic cross section) J.l cm- I , the ratio of the
number of gammas escaping without suffering a collision to the total
number produced within the source material is

(3.37)

Francois lO has published the same result and eqn 3.37 uses his notation.
Monte Carlo techniques can be used to verify this result by modeling a
pure absorber. For this problem, the location of start particles uniformly
distributed over a spherical volume is taken from Example 2.1. Eqn 2.18
provides the estimator for selecting a radius r in a spherical volume. The
direction in which a gamma ray is emitted is random, as in the laboratory
isotropic scatter model in Example 3.1. Thus we will take pieces of the
coding we have developed in the past examples and build a specialized
program to determine J/J o•
In order to determine the number of gamma rays that escape from the
source volume without experiencing a collision we need to tally all random
walks whose initial flight path would produce a collision point outside the
source volume. For a source gamma born with random initial direction at
position r o, and flight path determined by eqn 2.14, we can easily
accomplish this by finding the pseudo-collision point r from eqn 3.16. If
the radius of the sphere R is less than Irl the particle escapes without
suffering a collision. Otherwise the particle has an interaction within the
source material.
76 Chapter 3

By symmetry, the location of the start particle on the spherical surface of


radius r determined by eqn 2.18 can be any point on that surface. For
convenience we choose to place the origin of our coordinate system at the
center of the spherical source and start all particles on the +Z axis. Having
chosen a start location we need to select a random start direction. Using the
method described in connection with Example 3.1 we can obtain the
direction cosines for a random vector located at position z on the Z axis.
Because of symmetry, the azimuthal angle need not be selected randomly.
Instead it can be chosen in the most convenient manner. We choose to set
the azimuthal angle <p = O. Thus the selection of a random start direction
can be simplified to the calculation of the vector
u = sin e
v=O (3.38)
w = cos e
where e is the polar angle ofthe flight trajectory (see Figure 3.1).

Table 3.4. Program for Gamma Self Attenuation


Self shielding of a 5P1erical source
DiIrensions in units of rrean free path
!MIX = Nurtber of start particles
IXXJBLE J?REx::ISICN fltm
WRITE(*,*)
New case Loq:>: IX) ! 'Ihe locp terminates i f !MIX=O
- WRiTE (*, ' (lX, A\) , )' Enter nUTber of start particles' ! Read input
READ(*, *)!MIX ! Nurtber of particles
IF (!MIX. IE. 0) EXIT New case Loq:>
WRITE(*,' (lx,a\) ') , Enter sPhere radius in mfp ,
READ(*, *) r; rsq = r*r ! Fadius of 5P1ere
WRITE(*,' (lX,A\)')' Enter start randannurrber seed'
READ(*, *)ISErn ! Randan nurrber seed
CALL mdin (ISErn) ! Set start randan nUTber
nr = 0
IX) 300 n=1,!MIX Begin particle tracking -- locp over !MIX particles
z = r*fltm()**0.333333333 ! pick uniformly fram sphere
costh = 2.*fltmO-1. ! carpcnent in z-directioo
sinth = ~(l.-costh*costh) ! sinth is perpendicular ccrcponent
d = -DI.CG(fltm0 ) ! Get a flight path distance
zc = z+d*costh ! distance to collisioo along z-axis
xc = d*sinth ! distance to collision perpendicular to z
rcsq = xc*xc+zc*zc ! square of radius to collisioo point
IF(rcsq.GI'.rsq) nr=nr+l ! did the particle escape sphere?
300 CXNI'INUE
proo = FU:l!\.T (nr) /FU:l!\.T (max) Calculate expected escape prOOability
StDev=SI,YT (proo-proo**2) /~ (FIJ:lP.T (max» ! Standard deviatioo fram eqn 2.29 for
WRITE (O,13)nr, prOO, StDev ! estirrate of rrean for a binomial distributioo
13 FCiM'.T (' Particles escaping =', 19, " prOOabili ty of escape =', fll. 4, &
/, 'standard deviation = ',f12. 5)
END IX) New case Loq:>
STOP; END

Following the above model, a Fortran program to calculate J/Jo is shown


in Table 3.4. The program allows the user to set the radius of the source
region, J.lR, in mfp. It also allows the user to set the number of start
3. Monte Carlo Modeling of Neutron Transport 77

particles, and the start random number seed. Using 106 start particles for
selected values of the source radius, the probabilities of source particles
escaping are shown in Table 3.5. Shown for comparison are the results
from eqn 3.37. The results are in excellent agreement.

Table 3.5. Fra'


ctton 0 fG amma Rays Escapmg
. from SeIf-Sh'Ie Id ed Source
Source Monte Carlo Eqn 3.37
Radius (mfp)
1 0.5269 ± 0.00050 0.5273
2 0.3322 ± 0.00047 0.3324
5 0.1471 ± 0.00035 0.1470

Example 3.3. Beam of neutrons onto a slab shield

Consider the problem of estimating the probability with which neutrons


that are normally incident onto a slab pass through the slab. Assume the
slab consists of two layers. The total cross sections of the two layers are
the same but the first layer is a pure scatterer, Lt = Ls, with isotropic
scattering in the laboratory coordinate system, while the second layer is a
pure absorber, Lt = La. For simplicity we will assume that the neutrons are
monoenergetic and therefore that the cross sections are constant. The
scattering slab will be assumed to be two mfp thick while the absorbing slab
is one mfp thick. We will calculate the probability that a neutron will pass
through the slab.
First, the expected number of neutrons that pass through the slab without
undergoing a collision is easily determined by calculating the probability of
a particle traveling three mfp without suffering a collision,

N Uncl =N(0)e-3 ~0.05N(0) (3.39)

where N(O) is the number of incident neutrons. However, the effect of the
scattering layer in changing the direction of the neutrons, and the possibility
that some of the scattered neutrons will eventually pass through the slab, is
not accounted for in this uncollided estimate.
A Fortran program that tracks particles within this two-layer slab and
scores those passing through the slab is shown in Tables 3.6 - 3.8. The
particle tracks can be terminated only by a particle passing through the slab,
experiencing an absorption in the second layer, or being backscattered out
of the first layer. The program keeps track of the fate of all particles -
those reflected, absorbed, or transmitted - in order to tally all of the input
particles and verify the particle balance.
78 Chapter 3

Table 3.6. Fortran Program for Parallel Beam on a Two-Layer Slab - Example 3.3
! NR - I1IJ!li:Jer of particles passing thru slab (to right)
NL = nunber of particles reflected fran slab (to left)
NA = nunber of particles absorbed in the slab

IXUBLE PREI:ISICN md, fltm


CCMnI/scoring/NA,NR,NL,NS
DATA PI/3.14159265/,Zl/2./,Z2/1./ ! Slab layer thicknesses Zl and Z2
New Case lJxp: IX) ! 'Ihls locp tenninates in subroutine input if NS={)
- CALL rnror Get input data, initialize scoring arrays
IX) 300 N=l,NS Locp over NS particles
U = 0.; V = 0.; W = 1. Initial direction cosines
X = 0.; Y = 0.; Z = -Zl Initial particle position
ZC=Z
200 WHILE (ZC.GE.-Z1.AND.ZC.LE.O.O) ! particle in scattering region
IX)
md = fltm () ! Get randan nunber for flight path
D = -DL03(RND) ! distance in mean free paths mfps
XC = X+D*U; YC = Y+D*V; ZC = Z+D*W ! Collision site determined
IF(ZC.LT .-Zl) THEN
NL = NL+1 Reflection, tenninate tracking
EIBEIF (ZC.LE.O.) THEN
CALL ISOOUT(U,V,W) direction cosines for isotrcpic scatter
X=XC; Y=YC; Z=ZC Up:late particle position
EIBEIF (ZC.GI'.Z2) THEN
NR = NR+l particle passed through slab
EIBE
NA = NA+1 particle absorbed
ENDIF
200 END IX)
300 CCNTINUE
CALL CXJl'FUI' Prcblem ccnplete. ilitpJt results
END IX) New_Case_ Locp
END

Table 3.7. Subroutine 'Input' for Example 3.3


SUBPaJI'INE rnror ! Read input data
c:QMN/scoring/NA, NR, NL, NS
WRITE(*,' (lX,A\) ')' Enter mnber of start particles'
READ(*,*)NS
IF (NS.LE.O) S'IOP
WRITE(*,' (lx,a\) ')' enter seed '
READ(*, *)iseed
CALL mdin (iseed)
NA = 0; NR = 0; NL = 0 Initialize event counts
REIURN

Table 3.B. Subroutine 'Output' for Example 3.3


SUBPaJI'INE CXJl'FUI' ! Prcblem ccnplete. Calculate results
CCMnI/scoring/NA, NR, NL, NS
StDe~ (FLCro' (NR) *Fla\.T (NS-NR) /FLCro' (NS) ) standard dev fran eqn 2.29
StDevL=S(JIT (FLCro' (NL) *Fla\.T (NS-NL) /FLCro' (NS) ) for estimate of mean for a
StDevA-~ (Fla\.T (NA) *FLQAT (NS-NA) /Fla\.T (NS) ) binanial distribution
WRITE (*,13)NR,StDevR,NL,StDevL,NA,StDevA
13 RDlAT(' Nunber of particles transmitted = 'fI9,' + or - ',F10.2,/,&
, Nunber of particles reflected ',19,' + or - ',FlO.2,/,&
, Nunber of particles absorbed ',19,' + or - ',FlO.2)
3. Monte Carlo Modeling ofNeutron Transport 79

The lateral (x,y) position of the particle is unimportant so only the Z


coordinate, normal to the slab, is considered in the tracking. The isotropic
scattering in the laboratory system is identical to that used in the program of
Example 3.1 . Subroutine 'Isoout' (Table 3.2) must be linked to this
program, along with the random number routines, before execution. To
determine the post-collision direction of travel one would normally select an
azimuthal scattering angle as well as a polar angle. However, in the present
problem the slab is assumed to be infinite in the X-Y plane. Thus only the
angle between the flight path and the normal to the slab need be considered
because only this angle determines the relation between the length of the
flight path and the z position of the particle.
The program first requests the user to specify the number of start
particles to be tracked, then sets local variables for tallying results and
counting particles. Start particles all originate at z = -zl with Z-coordinate
direction cosine w = + I. If a particle leaves a collision at z with Z-direction
cosine w, and has a flight path of length A, the next collision will be located
at the Z-coordinate point given by eqn 3.16. The program must determine in
which of the two zones the collision point is located, or whether the particle
has escaped from the slab. To do this we need only determine the Z
coordinate of the collision point, z, and perform the following tests:
z < -z 1 ~ Particle reflected
-zl < z < 0 ~ Scatter in fIrst layer, zone 1
o< z < z2 ~ Absorption in second layer, zone 2
z2 < z ~ Particle transmitted through slab
Running 10 particle histories with this program resulted in 1256 ± 33
4
transmitted particles, 5176 ± 50 reflections, and 3568 ± 48 absorption events.
The probability of a neutron passing through the slab is thus estimated to be
0.126 ± 0.003 while the probability of a neutron being reflected from the
slab is 0.518± 0.005. Because the probability of an incident neutron passing
through the slab without suffering a collision was calculated to be 0.05, we
see that about 40% of those found to pass through the slab by the Monte
Carlo calculation were uncollided.
Despite the small values determined for the standard deviations of the
results, we have offered no proof of the accuracy of the results obtained.
The fraction of uncollided particles passing through the slab appears to be
consistent with the Monte Carlo results, and the percent of incident
particles that are reflected is consistent with that from a slab of about one
diffusion length in thickness. I I While this lends some credence to the
results, there has been no verification of adequate sampling of the portions
of phase space important to the result. We are unable to state, solely on the
basis of the current calculation, whether the results are representative of the
80 Chapter 3

correct answer. We will defer considerations of this problem for the


moment and return to the topic in Chapter 6.

3.6 Particle Flight Path in Complex Geometries

The determination of the flight path of a particle requires selection from


an exponential distribution. As we have seen, this selection is simple for
any geometry with a constant cross section. In general, however, full
advantage of the Monte Carlo method is realized when particles are tracked
through complex geometries that include numerous materials with different
cross sections. In such cases the simple flight-path determination used for
homogeneous materials does not apply.
When the track followed by a particle between collisions passes through
two or more regions containing materials with different total cross sections,
the selection of the distance between the collisions must take this into
account. One way to do this is to use a straightforward conversion of the
flight path in units of mfp to the flight path in units of coordinate length.
That is, first a path length in mfp is determined. Then the particle is tracked
through the problem geometry and the appropriate cross sections of the
different materials encountered are used to find the equivalent distance in
units of coordinate length. Alternatively, a new flight path may be selected
as the particle enters each new material. These two methods provide
equally valid solutions for the collision point since the mean flight to the
next collision is independent of the distance the particle has already
traveled from its previous collision. This fact may not be intuitively
obvious so let us consider the problem in some detail.
The mathematical description of the mean distance to the next collision
for a neutron moving through a material is identical to the mathematical
description of the mean time to decay of a radioactive nucleus. For a
substance with decay constant f... sec-I, the population of undecayed nuclei,
N, changes with time according to

dN =-f...N (3.40)
dt

Thus if the number of atoms in a sample at an arbitrary time to is No, the


average number at time t > to is

(3.41 )
3. Monte Carlo Modeling of Neutron Transport 81

This is valid for any No and to one wishes to choose, independent of the age
of the sample and the number of atoms that have already decayed. The
mean time to decay of the population No at time to is

(3.42)

which is independent of the time to. That is, no matter how long a
radioactive nucleus has existed in the past, its mean time to decay is always
1IA. from the present time.
In direct analogy, the mean distance a neutron will travel to its next
collision is always its mean free path, independent of the distance it has
traveled since its last collision. Therefore, when tracking a particle in
Monte Carlo, at any point along the particle's trajectory we can discard the
flight path already traveled and select a new flight path for the particle from
its current position. We can do this as often as we wish without changing
the answer to the problem. Obviously the new flight path will not be the
same as the previous one, but the average number of mean free paths
between collisions will remain the same.

Example 3.4. Mean distance to the next collision

Consider a uniform, homogeneous, semi-infinite slab of material with


total macroscopic cross section Lt. A beam of neutrons is traveling along
the Z axis, in the positive Z direction, and is normally incident on the slab.
We wish to determine the mean distance to the first collision for these
neutrons using two different methods. First, we will use a direct sampling
of the exponential distribution in eqn 3.4 by applying eqn 2.14. This gives

1
Z= --In(~) (3.43)
~t

where ~ is a random number between 0 and 1. Second, we will use a


repetitive sampling scheme that recalculates the flight path whenever the
particle passes a point z that is an integral multiple of O.lI~h where z is the
distance from the face of the slab on which the neutrons are incident. In
this second case we effectively introduce a series of equally spaced,
artificial surfaces parallel to the face of the slab. As the particle passes
82 Chapter 3

through each surface we discard the old flight path and select a new one.
For this case we must determine the total distance to a collision by adding
the piecewise segments until a new flight path less than O.1/~t is selected.
When this happens the collision occurs before the next artificial surface is
reached and hence the flight path is terminated.
A Fortran program that calculates the mean distance to a collision using
these two methods is shown in Table 3.9. A unit macroscopic cross section
is assumed. In the first part of the program values of z are selected
according to eqn 3.43, and are averaged to obtain an estimate for f... In the
second part of the program values of z are selected by summing segments of
O.I~t until a ~ value greater than e-o.! ~ 0.9048 is selected. When this
occurs, a flight path less than O.I~t has been found. If n random numbers
less than 0.9048 were generated before selecting ~ greater than this amount,
the total flight path, in mean free paths, is then f.. = O.1n + (-ln~)/~t.

Table 3.9. Fortran Program for Estimating Mean Free Paths


! calculate the rrean free path using unit cross secticn
by direct and indirect nethods

DOUBLE PRECISION rnd,fltrn,X,Y


WRITE(*,' (lx,a\)')' seed '
READ(*, *) iseed
CALL mdin (iseed)
lD::p: ro
WRITE (*, , (lX,A\) , )' Enter NlIrber of Start Particles: '
READ(*, *)tMIX
IF (tMIX.El;l.O) STOP
X = 0.000 ! Start direct nethod calculaticn
ro 100 I ~ 1,tMIX
rnd = fltmO
X = X-DLCX;(RNO)
100 CXNI'INUE
X = X/F'I..a>.T (tMIX) The average nean free path by direct nethod
Y = 0.000 Start S\m!laticn of segrrents nethod
ro 400 I = 1,tMIX
rnd = fltmO
ro WHILE (rnd.LE.0.90483741803596000)
Y = Y + 0.100
md=f1trn()
rno ro
Y = Y-DLCX; (RNO)
400 CXNI'INUE
Y = Y/FIJ:AT (tMIX) ! The average rrean free path by S\m!Iaticn nethod
WRITE(*,10)X,Y
10 FC:R>1AT ( , Mean free path direct =', flO. 7, , Indirect = " flO. 7)
rno ro lD::p
rno

The result of running the program in Table 3.9 for various numbers of
samples, and for ~t = 1, is shown in Table 3.10, starting with a seed of one
for the first run. Even using only 1000 samples the two techniques give
results very close to unity. In the limit of a large number of flight paths,
assuming a good quality random number generator is used, the two results
3. Monte Carlo Modeling ofNeutron Transport 83

will converge on the exact answer within the limits of computer word
length.

Table 3.10. Results of Direct and Indirect Calculations of Mean Free Paths
No. trials Direct Indirect
10" 1.0036740 0.9892778
104 0.9973210 1.0070934
105 0.9997291 1.0019236
106 0.9983103 1.0001979

3.7 Multi-Region Problems

In most practical Monte Carlo problems, several different materials in


various geometric configurations must be considered. Whether the particle
is "stopped" at the boundary between the materials and a new flight path
selected using the properties of the material the particle is entering, or the
path continues by converting from units of mean free path to actual distance
traveled in the new material, the location at which the particle crosses the
geometric boundary must be determined. In general this involves solving
simultaneously the equations for the straight line along which the particle is
traveling and those for the surfaces or bodies that constitute the geometric
boundaries. The simultaneous solution of these equations provides the
points at which the path of a particle changes regions.

Example 3.5. Two-region slab with a void

Consider the slab problem of Example 3.3 but assume a spherical void or
bubble exists in the slab. The center of the spherical void is located at the
interface between the two materials. The diameter of the void can be a
variable quantity but, for this illustration, will be assumed to be unity. The
bubble is situated directly in front of the point at which the beam strikes the
slab, with its center at the origin of a Cartesian coordinate system. The
neutron beam is incident along the Z axis in the +Z direction. The
geometry is shown in Figure 3.5.
Because this problem has an axis of symmetry along the beam, it is not
essential to track the particles in three dimensions. However, in transport
problems requiring the full capability of Monte Carlo, tracking in three
dimensions will be required. Therefore, because the complexity of this
problem will not be substantially increased by three-dimensional tracking,
and because the concept is necessary in later problems, three-dimensional
tracking will be used.
84 Chapter 3

Slab I Slab 2

Bubble
Incident
Neutron r--+--+--Z
Beam

Figure 3.5. Geometry of Two-Layer Slab Containing a Spherical Void

Since the interior of the sphere is a void, it has zero total cross section
and all particles entering it will simply stream across to enter the material
on the other side. Calculation of the flight path of the particles must take
this into account. Assume a collision has taken place at a point p, with
coordinates Xo, Yo, Zo inside slab 1. The particle leaves the collision in
direction n, with direction cosines u, v, w along the Cartesian axes. We
introduce the path length variable, s, along the flight path to specify the
particle's location according to eqn 3.16,

x = xo+us
y=yo+vs (3.44)
z= zo+ws

In order to determine the intersection of this flight path with the bubble we
will also need the equation for a sphere of radius ro at the origin

(3.45)

To solve these equations we substitute the expressions 3.44 into eqn 3.45
and, after simplifying, obtain

(3.46)

where p is the radial distance from the origin to the point p. Here p is used
to designate both the collision point and the vector p = (Xo,yo,Zo). Thus

(3.47)
3. Monte Carlo Modeling ofNeutron Transport 85

and

p. n = uxo + vy + wZo
0 (3.48)

Equation 3.46 has the solutions

(3.49)

where subtracting or adding the second term determines the entry and exit
points of the particle's path through the spherical void, respectively. If the
discriminant (the term in brackets in eqn 3.49) is negative, the particle's
current flight path does not pass through the sphere. If both solutions for a
non-negative discriminant are negative, the backward extension of the flight
path passes through the sphere. In this case the particle is directed away
from the origin and its path will not pass through the bubble.
If eqn 3.49 has two positive, real solutions, the particle will pass through
the sphere if the flight path is sufficiently long to reach the void. In this
case either any remaining flight path must be added after the particle
streams across the void and strikes the material on the other side, or a new
flight path must be chosen beginning at the latter point. For this problem
we will use the former method. Finally, if there is both a positive and a
negative real solution of eqn 3.49, the particle's current location is inside
the sphere. Since there can be no collisions in the void this should not
occur in the present problem.
A Fortran program to calculate the movement of particles through the
geometry of Figure 3.5 is shown in Tables 3.11 and 3.12. The subroutines
'Input' and 'Output' are the same as those shown in Tables 3.7 and 3.8, and
are not repeated here. This program is more complicated than the program
of Tables 3.6 - 3.8, but still has readily recognized features in common with
that program. The geometry module performs the tests outlined above to
determine whether a flight path encounters the bubble. The scattering
routine 'Isoout' is from Table 3.2.
The results obtained by executing the program in Tables 3.11 and 3.12
for a bubble diameter of one mfp using various numbers of incident particles
are shown in Table 3.13. These results show that the probability of an
incident particle passing through this slab is 0.2083 ± 0.0004 compared with
0.126 ± 0.003 for the slab without the spherical void. Thus the bubble
increased the probability of particles passing through the slab by about a
86 Chapter 3

Table 3.11. Fortran Program for Two-Layer Slab with Void


NR = nll!ber of particles passing thru slab (to right)
NL = nll!ber of particles reflected fran slab (to left)
NIl. = nll!ber of particles absorbed in the slab

Bul::ble radius RO, Slab layer thiclmesses Zl and Z2


can be set by the user

IXXJBLE PREX:ISIrn rnd, fltm


lffiICAL HIT
CCIt1JN/particle/X,Y,Z,U,V,w
CCIt1JN/scoring/NA, NR, NL, NS
CCIt1JN/geametry/RO,Zl,Z2
~ PI/3.14159265/,RO/0.5/,Zl/2./,Z2/1./
New case lDcp: [X) ! This loq:> terminates in subroutine inp.lt if NS=O
- CALL INFUI' ! Read inp.lt data and initialize scoring arrays
[X) 300 N=l,NS lDcp over NS particles
U = 0.: v = 0.: W = 1. ! Initial directioo cosines
X = 0.: Y = 0.: Z = -Zl ! Initial particle positioo
ZO=Z
[X)200 WHILE (ZC.GE.-Z1.AND.ZC . IE .O. O) ! particle in scattering regioo
rnd = fltm() Get randan nll!ber for flight path
D = -Dlffi(RND) ! distance in nean free paths mfps
CALL SPH (HIT, DIN, rom ! To see if track intersects l::A.lI:ble
IF(HIT.AND.D.GI'. DIN)D=DtrouT-DIN! Intersect l::A.lI:ble? add free flight distance
XC = X+D*U: YC = Y+D*V; ZC = Z+D*W ! Collisioo site determined
IF(ZC.LT .-Zl) THEN
NL = NL+l Reflectioo, terminate tracking
EISEIF (ZC.IE.O.) THEN
CALL ISOOUT(U,V,W) directioo cosines for isotrcpic scatter
X = XC; Y = YC; Z = ZC Upjate particle position
EISEIF (ZC.GI'. Z2) THEN
NR = NR+l particle penetrated slab
EISE
NIl. = NII.+1 particle absorbed
ENDIF
200 END [X)
300 CXNI'INUE
CALL amur PrOOlen cx::nplete. Oltplt results
END [X)New_Case_lDcp
END

Table 3.12. Subroutine 'Sph' for Example 3.5


SUBRa1I'INE SPH (HIT, DIN, rouT)
CCIt1JN/particle/X,y,Z,U,V,w
CCIt1JN/geametry/RO,Zl,Z2
lffiICAL HIT
HIT=.rnISE.
A = X*U+Y*V+W*Z to see if track intersects l::A.lI:ble
RHOSQ = X**2+Y**2+Z**2-RO**2
AR = A**2-RHOSQ
IF (AR. LT.O . ) REIURN if track does not intersect l::A.lI:ble
IlX = ~(AR) track intersects l::A.lI:ble
DIN = -IlX-A entry distance to l::A.lI:ble
rouT = +IlX-A exit distance through l::A.lI:ble
IF (rouT .LE.O.O) REI'URN intersect in wrong directioo
HIT=.TRIlE.
3. Monte Carlo Modeling ofNeutron Transport 87

factor of 1.65. The probability of an incident particle being reflected by the


slab with the bubble appears to be slightly less than that for the perfect slab,
0.4883 ± 0.0005 compared to 0.518 ± 0.005. Finally, the respective
absorption probabilities for the flawed and perfect slabs are 0.3034 ± 0.0005
and 0.357 ± 0.005. This indicates that the unit diameter bubble, which
reduces the total slab thickness in front of the beam to two mfp, reduces
absorption of the incident particles by a small amount but significantly
increases the number of particles that pass through the slab. However, as
with Example 3.3, we have not shown that the important regions of phase
space have been sampled adequately, and thus these results are tentative.

esuItsf0Example
Table3 13 R I 3 .5
No. source Transmission Reflection Absorption
particles
104 0.206 ± 0.004 0.489 ± 0.005 0.305 ± 0.005
lOS 0.2090 ± 0.0013 0.4870 ± 0.0016 0.3040 ± 0.0015
106 0.2083 ± 0.0004 0.4884 ± 0.0005 0.3034 ± 0.0005

Exercises

1. By converting the collision density distribution of eqn 3.4 into a pdf, show
that the "expected value" of the distance traveled is liLt.

2. Start the source particles in Example 3.2 at random locations and


directions (i.e., ignore the symmetry of the example geometry) and show that
the results do not change, within the statistical accuracies of the calculations.

3. Consider the slab with the bubble in Example 3.5.


a. Reduce the size of the bubble and show that the result approaches that
of Example 3.3 as the bubble radius goes to zero.
b. Modify the program such that the incident pencil beam is tangent to
the bubble. How do the results compare with those of Examples 3.3 and
3.5?

4. The variances in the results of Example 3.3 were obtained assuming a


binomial distribution in the estimates. This is done in subroutine 'Output'
of Table 3.8. Using eqn 2.29 derive the expression for the variance of a
binomial distribution as encoded in Table 3.8. Apply this variance estimate
to the results of Example 1.2.
88 Chapter 3

1 The definitions of tenns used here follow those of G. I. Bell and S. Giasstone, Nuclear
Reactor Theory, Van Nostrand Reinhold Co., New York, 1970, pp. 4-6.
2 Ibid., pp. 22 ff. See also K. M. Case and P. F. Zweifel, Linear Transport Theory, Addison-
Wesley, Reading, MA, 1967, pp. 43ff.
3 K. M. Case, F. de Hoffinann, and G. Placzek, "Introduction to the Theory of Neutron
Diffusion," Los Alamos Scientific Laboratory, Los Alamos, NM, June 1953,pp. 66 ff.
4 Ibid., p. 70.
s A. V. Weinberg and E. P. Wigner, The Physical Theory of Neutron Chain Reactors,
University of Chicago, Chicago, 1958, Chapter VIII, pp. 181 ff.
6 Case, de Hoffinan, and Placzek, op. cit., p.136.
7 Ibid., pp. 71 ff.
S M. Abramowitz and I. Stegun, eds., Handbook of Mathematical Functions, Dover
Publications, Inc., New York, 1965, p. 245 .
9 Case, de Hoffinann and Placzek, op. cit., p. 28, eqn 13.
10 J.-P. Francois, "On the Calculation of the Self-Absorption in Spherical Radioactive
Sources," Nuc Inst Meth 117, 1974, pp. 153-56.
11 Robert V. Meghreblian and David K. Holmes, Reactor Analysis, McGraw-Hill, New York,
1960, p. 419.
Chapter 4
Energy-Dependent Neutron Transport

4.1 Elastic Scattering of Neutrons

Fast neutrons generally lose energy when they undergo collisions with
nuclei. When the incident neutron energy exceeds the lowest excitation
level of the target nucleus such interactions can be inelastic. In this case the
target nucleus absorbs some of the neutron's kinetic energy and the system
kinetic energy is not conserved in the interaction. Therefore the energy loss
may be uncorrelated with the scattering angle. However, under some
conditions the internal energy of the target nucleus may not be changed by
the neutron interaction. Classically this occurs when the neutron energy is
below the lowest excitation energy of the target nucleus. In this case the
scattering is elastic and kinetic energy is conserved. In many materials the
slowing down of neutrons from a few hundred keV to thermal energies may
be described to a reasonable degree of accuracy by the physics of elastic
collisions. For hydrogen, this range of validity extends from a few MeV to
thermal energies.
Let us consider the elastic interaction of a point neutron with an unbound
point nucleus. Such an interaction will consist of isotropic, elastic
scattering in the center of mass of the interacting particles. For practical
purposes we can assume the target mass is an integral multiple of the
neutron mass and use the atomic mass, A, to characterize the target.
The neutron-nucleus interaction is shown schematically in the laboratory
and center of mass coordinate systems in Figure 4.1. In the laboratory
coordinate system, which we will designate the L system, we assume the
neutron moves toward a stationary target nucleus with speed Vb where the
subscript L designates quantities measured in the L system. The total mass

89
90 Chapter 4

of the two colliding particles is A+l, and the speed Vern of the center of
mass, as measured in the L system, is

vL
V =-- (4.1)
em A +1

The speed of the neutron in the center of mass coordinates, which we will
designate the C system, prior to the collision is therefore

(4.2)

where the subscript c designates quantities measured in the C coordinates.


The total momentum ofthe system in the C coordinates prior to the collision
is zero. Therefore, if the neutron and nucleus are approaching each other
with velocities of Ve and Ve, respectively, in the C coordinates,

(4.3)

y'

yc - -........

/
£v c

v~
Laboratory (L) Center of Mass (C)

Figure 4.1. Neutron-Nucleus Collision Parameters in the Laboratory


and Center-of-Mass Coordinate Systems

By conservation of momentum, the total momentum in the C frame after


the collision must also be zero. Hence the post-collision speeds of the
interacting particles in the C system must obey the similar relation

v~+AV~=O (4.4)

where the primes denote post-collision variables. For elastic collisions, the
total energy of the interacting particles, in either system, must be unchanged
by the collision. This requires

V
e
2 + AVe 2 = v,2
e
+ AV,2
e (4.5)
4. Energy-Dependent Neutron Transport 91

Solving eqns 4.3 - 4.5 simultaneously gives

(4.6)

and

(4.7)

Thus an observer in the C frame sees the particles approaching each other
along a straight line, interacting, and separating along another straight line.
The post-collision trajectory line passes through the collision point but is
rotated with respect to the pre-collision line. Each of the particles leaves the
collision site at the same speed with which it approached. The interaction is
e
completely defined by the angle of rotation between the incoming and
outgoing linear trajectories (see Figure 4.1.)
The relation between the post-collision neutron velocity in the C and L
coordinates is shown in Figure 4.2. From this figure, by the law of cosines,

V,2=V 2 +v,2-2v v'cos'" (4.8)


L em e em e 'I'

or

V,2
L
2 +v,2 +2v v' cos
=v em e em e
e (4.9)

Substituting eqns 4.1, 4.2, and 4.6 into eqn 4.9 gives

V,2 -v 2 A 2 + 2A cos e + 1 (4.10)


L - L (A+l)2

For non-relativistic energies, the ·neutron energy in the L system before


the collision is (vd/2, and that after the collision is (VL,)2/2. Thus, from eqn
4.10, the post-collision energy in tenns of the pre-collision energy and the
center-of-mass scattering angle is given by

-=-------
e
E' A 2 + 2A cos + 1
(4.11 )
E (A+l)2
92 Chapter 4

V
em

Figure 4.2. Relation Between Neutron Scattering Angles \II and e in Land C Coordinates

In order to relate the scattering angle of the neutron in the L system to


that in the C system, we must find a relation between", and e. From Figure
4.2, the vector sum ofve' and Vern must equal VL', giving

v Lcos '" = v ~ cos e + Vern (4.12)

where '" is the scattering angle in the laboratory coordinates. Substituting


eqn 4.12 into eqn 4.10, and substituting for Vcm and VL', we find

A cos e + 1
cos'" = --;======= (4.13)
~ A 2 + 2A cos e + 1

The equations relating the scattering angle in the C system to the


scattering angle in the L system, and the consequent energy loss of the
neutron following the collision, allow us to account for changes in neutron
direction and energy in elastic collisions. We are not considering
thermalization of the neutrons by this model. Neutron thermalization is a
gas-dynamic phenomenon described by equilibrium thermodynamics. The
elastic scattering equations as we use them here assume the target nucleus is
initially at rest. Although this is an incomplete physical picture, it is a
reasonable assumption to make when modeling the interactions of neutrons
having energies well above the mean thermal energy of the scattering
material. For neutrons at thermal equilibrium, the most probable neutron
energy is kT, where k is Boltzmann's constant and T is the absolute
temperature. At room temperature this is approximately 0.0253 eV. For
present purposes we can simply assume no further energy loss is possible
after the neutron energy drops to this value.

Example 4.1 . Average number of collisions to thermalize neutrons


4. Energy-Dependent Neutron Transport 93

High energy, or fast, neutrons are slowed down by collisions with


moderator nuclei. The latter are typically materials with low atomic mass.
The average neutron energy loss per collision with a moderator nucleus can
be calculated, but analytical solutions for the average number of collisions
required to slow neutrons from some initial energy Eo to a final energy Er are
based on various models. Monte Carlo solutions can be used to validate
these analytical models.
For elastic scattering, ifEI is the energy of the neutron before a collision,
and E2 its energy after the collision, the average value of the ratio E21E1
depends only on the atomic mass A of the target nucleus; i.e., it is
independent of the energy of the incident neutron. Therefore the average
number of elastic collisions required to reduce the energy of a neutron from
Eo to Er is also a function only of the ratio of these energies and the target
massA.
The average post-collision energy can be calculated from eqn 4.11.
Recall from Example 3.1 that, for isotropic scattering, the selection of a
random polar scattering angle requires selection of a random cosine over the
range (-1,1). For a given initial energy Eo, the average energy Er after a
single collision is

(4.14)

This is commonly written as

-E - 1+a. E (4.15)
r --2- 0

where a.Eo is the lowest possible post-collision energy. From eqn 4.11, E' is
a minimum for e = 1t, and thus

_(A_1)2
0.- - - (4.16)
A+ 1

If there were a constant fractional change in the neutron energy at each


collision, the number of collisions required to effect a given total energy
change could be calculated as a ratio of logarithms. For example, assume
the neutron energy decreases by a factor of ten at each collision. If a
94 Chapter 4

particle started with an energy of 1000, after one collision it would have an
energy of 100, after two collisions the energy would be 10 and after three
collisions the energy would be 1. That is, using logarithms to the base ten,
the number of collisions required to reduce the neutron energy from 1000 to
1 would be equal to the logarithm of EJEr divided by the logarithm of the
factor by which the energy decreases at each collision; i.e., three. Therefore
one estimate of the average number of collisions required to reduce the
energy of a neutron from an initial energy Eo to a final energy Er is to
assume that each collision produces exactly the average loss. By eqn 4.15
this gives

ln~
N - Eo (4.17)
L - l+a
In--
2

Eqn 4.17 gives the linear average of the number of collisions required to
reduce the energy of a neutron from Eo to Er. However, for neutron
downscatter a linear average is considered less accurate than a geometric
average. The geometric average number of collisions is

- 1 Eo
NG =-In- (4.18)
~ Er

Here ~ is the average logarithmic energy decrement per collision,'

(4.19)

where p(E2)dE2 is the probability that a neutron with initial energy E, will
have a post-collision energy between E2 and E2 + dE2. This can be shown2
to be

(4.20)

Evaluating eqn 4.19 using eqn 4.20 gives


4: Energy-Dependent Neutron Transport 95

r _ I (A - Ii I A-I
~- + n-- (4.21)
2A A+l

In order to determine the average number of collisions required to slow


neutrons from Eo to Er using Monte Carlo, we will consider an infinite
volume of homogeneous material of atomic mass A. We will assume that no
neutrons are absorbed, and that only elastic scattering collisions are
possible. We further assume that all of the nuclei in the material are at rest
in the laboratory system prior to being struck by a neutron. We wish to
determine the average number of collisions required to reduce the energy of
the neutrons from a user-determined energy to the Cd cutoff energy of 0.415
eV.a
To solve this problem we will apply eqn 4.11 to a series of scattering
events that are isotropic in the center of mass of the interacting particles.
The selection of a random polar scattering angle is accomplished by
selecting a random cosine from the range (-1,1), corresponding to scattering
over the range of (0,1t) radians. We repeatedly evaluate eqn 4.11, beginning
with a start particle at energy Eo and continuing until the post-collision
energy is less than the Cd cutoff energy. In this manner we can estimate the
mean number of collisions required to reduce the neutron energy to or below
this cutoff energy.
A Fortran program to solve this example problem is shown in Tables 4.1
and 4.2. The main program, shown in Table 4.1, reads the input data and
repeatedly calls subroutine 'IsocoI2' to obtain the post-collision energy. A
tally is then made of the number of collisions required for the neutron
energy to fall below the cutoff value, and an error estimate is made on the
results. Subroutine 'IsocoI2,' shown in Table 4.2, solves eqn 4.11. The user
must specify the target mass, the start energy, the number of start particles to
be tracked, and the random number seed. Sample results obtained from
running this program are shown in Table 4.3.
From Table 4.3 the Monte Carlo estimate of the average number of
collisions that a neutron must undergo to slow from 100 keY to 0.415 eV in
hydrogen is 13.395l±0.0003. For comparison, the linear average from eqn
4.17 is 17.9 collisions, while the geometric average from eqn 4.18 is 12.4
collisions. For a neutron slowing down in carbon from 1.5 MeV to the Cd
cutoff energy the Monte Carlo result is 96.39593 ± 0.00007. The result from

a The Cd cutoff corresponds to a sharp rise in the Cd absorption cross section with decreasing
neutron energy. The energy chosen for the cutoff is typically 0.415 eV. Cd is often used to
differentiate between fast and slow neutrons in detectors. See S. Glasstone and M. C.
Edlund, The Elements ofNuclear Reactor Theory, D. Van Nostrand, Princeton, NJ, 1952, p.
55; G. F. Knoll, Radiation Detection and Measurement, J. Wiley and Sons, New York, 3rd
ed., 2000, p. 505.
96 Chapter 4

Table 4.1. Program to Evaluate Number of Elastic Collisions to Reduce Neutron Energy to
Cd Cutoff
Determine the rrean m.rrber of oollisioos to Cd cutoff (0.415 eV)
for a target of atonic nass A, neutroos with start energy E (M:!V)
~ ECD/0 . 415E-6/
4 WRITE (*,' (lX,A\) ' ) , Enter target nass A, set=O to step: Inplt variables
READ (*, *) A; IF (A.LE.0 . 1) S'roP
WRITE (*,' (lX,A\) ') , Enter neutron energy E (~V):
READ (*, *) EO; IF (EO. LT. ECD) S'roP
WRITE (*,' (lX,A\) ') , Enter nUTber of start particles N:
READ (*, *) N; IF(n.LE. O) S'roP
WRITE (*,' (lX,A\) ' ) , Enter randan m.rrber seed (an integer): '!
READ (*, *) ISEED; CALL m::li.n(iseed) Inplt a:nplete
TAI1..Y = 0.; TAI1..YSQ = O. ! set tally variables to zero
lJ:x:p Oller Particles :[X) I = 1,N 'Track' particles, locp over N start particles
EP = ill start each particle with energy EO
NSCAT = 0 NSCAT is the nUTber of scatterings
lJ:x:p Oller Energy:[X) locp while above cutoff energy
IF (l:P.LT .ECD) EXIT lJ:x:p Oller Energy ! score i f belCM cutoff energy
E = EP - - ! update pre-collision energy
CALL ISCXXlL2(E, EP,A) ! get post oollision energy EP
NSCAT = NSCAT + 1 !
IF(NSCAT .LT . 10000)CYCIE lJ:x:p_OIIer_Energy

(If 10000 scatterings do not suffice to reach the Cd cutoff, the


clcwnscatter is terminated. User set the energy very high or the target
nass very large so the prd:llem is unrealistic. )

WRITE (*, *) , M::>re than 10000 oollisioos required, particle ',I


CYCLE Uxp Oller Particles
END [X) lJ:x:p ~r Energy
TAI1..Y = TAu.y + NSCAT; TAI1..YSQ = TAI1..YSQ + N&'.AT**2 ! belCM cutoff, tally
particle
END [X) lJ:x:p Oller Particles
Start-particle locp a:nplete, detemri.ne rrean, starrlard deviation
and fractional starrlard deviation of rcean n\Jlber of oollisioos

XOOL = TAI1..YIN; XOJL2 = TAI1..YSQ/N


StDev = S(1\T( (X<XlL2-xmL**2) IN) /X<XlL; FSlFStDev/XOOL
WRITE(*, *)' ~ n\Jlber of oollisioos to Cd cutoff = ',xmL
WRITE(*, *)' Starrlard deviation = ',StDev
WRITE(*, *) ' Fractional starrlard deviation = ',FSD
00 TO 4
END

Table 4.2. Subroutine to Calculate Post-Collision Energy


SUBKUl'INE ISCXXlL2 (E,EP,A)

SUbrootine ISCXXlL2 calculates the result of isotrcpic oollisioos


of neutroos of energy E with nucleii of nass A. '!be post-collision
energy EP in the laboratory system is detenni.ned asslllling
isotrcpic scattering in the center of nass system.

IXX.JBLE mEX::ISICN fltm


C03'lH = 2.*fltm()-1. cosine of randan polar angle
EP = E*(A*A+2 . *A*C03'lH+1.)/(A+I.)**2 Qltgoing energy EP
REIURN
END

eqn 4.17 is 98.6 and that from eqn 4.18 is 95.7. It is apparent that the Monte
Carlo results lie between the two analytic estimates but favor the geometric
4. Energy-Dependent Neutron Transport 97

average over the linear average. However, the analytic result accounts for a
fraction of a collision in calculating the average number of collisions
required to reach a certain energy, while the Monte Carlo calculation
scores an integral number of collisions required to reduce the neutron energy
to or below the cutoff energy. Hence we expect the Monte Carlo result to be
a fraction of a collision larger than any analytic estimate.

Table 4.3. Samples 0 fO utput t;or Example


I 41
Enter target mass A, set=O to stop: 1
Enter neutron energy E (MeV): 0.1
Enter number of start particles: 1000000
Enter random number seed (an integer): 1
Mean number of collisions to Cd cutoff= 13.39507
Standard deviation = 0.00026
Fractional standard deviation = 1.9E-5
Enter target mass A, set=O to stop: 12
Enter neutron energy E (MeV): 1.5
Enter number of start particles N: 1000000
Enter random number seed (an integer): 7
Mean number of collisions to Cd cutoff = 96.39593
Standard deviation = 7.IE-05
Fractional standard deviation = 7.4E-07

4.2 Transformation of Post-Collision Direction to


Laboratory System

Consider a neutron traveling in the positive direction along the Z axis


toward a target nucleus. Its speed in the C system will be different from its
speed in the L system, but its position and direction of travel will be the
same. A scatter through a polar angle e with respect to the Z axis in the C
system is equivalent to a scatter through the polar angle", in the L system,
where e and", are related by eqn 4.13. However, in three-dimensional
tracking, a second angle has to be considered - the azimuthal angle <p (see
Figure 3.1.) Because the azimuthal angle is in the plane perpendicular to the
pre-collision direction of motion of the neutron, it is the same in both
coordinate systems.
The Cartesian direction cosines of a unit vector (u,v,w) in the L system
are given by eqns 3.29,

u = sin e cos <p


v = sin e sin <p ( 4.22)
w =cose
98 Chapter 4

Thus, by selecting e and q> in the C system, and calculating the equivalent \jJ
in the L system, one can easily detennine the post-collision direction of a
neutron in the L coordinates for a pre-collision trajectory along the Z axis.
For an arbitrary pre-collision neutron direction, the conversion of the
post-collision direction from C to L coordinates is made in two steps. First,
the post-collision vector Oc in the C system is detennined based on the
assumption of incidence along the +Z axis. This is then converted into an
equivalent vector OL in the laboratory coordinates using eqns 4.13 and 4.22.
Finally, the vector is rotated to the final orientation OF by a coordinate
transfonnation that relates the +Z direction to the actual pre-collision
direction of the incident neutron in the L system.
To detennine the rotational transfonnation,a let A be a unit vector
oriented in the direction of the pre-collision neutron,

A = ui+ vj + wk (4.23)

The rotation of the +Z axis to direction A is not uniquely detennined. A


solution can be found either by first rotating the Z axis around the X axis or
by first rotating the Z axis around the Y axis. We will consider the fonner
option first (see Figure 4.3).

z
z"

z'

~---------y

X Projection~
onto X-V plane

Figure 4.3. Coordinate Transformation by first Rotating the Z Axis Around the X Axis

a To transform a vector X' = [xj'] in primed Cartesian coordinates to X = [xiJ in unprimed


coordinates we have Xi = aijxj', where the sum over j is implied. The transformation matrix
is given by T = aij = aXi'/ OXj = OXj/OXi'. The matrix satisfies llijajk = Oik, where the summation
over j is implied and 0 is the Kronecker delta. Using this fact it is easy to show that a\3 = u,
a23 = v, and a33 = w. We will see these results in eqns 4.43 and 4.44. .
4. Energy-Dependent Neutron Transport 99

Step 1. Rotate the Z axis by an angle e around the X axis so that the new
Z' axis is in the plane formed by the X axis and A. The primed coordinate
axes will now be

i' = i
j' = cosej - sinek (4.24)
k' = sinej + cosek

and we have

k'e(ixA)=O (4.25)

Using equation 4.23,

ixA = -wj + vk (4.26)

and we obtain

k' e (i x A) = v cose - w sin e =0 (4.27)

Since u 2 + v 2 + w 2 =1 and sin 2e + cos2e =1, eqn 4.27 gives

. e=
SIn
v
r:---? (4.28)
v1- u 2
w
cos e = r:---? (4.29)
v1- u 2

Therefore, the primed coordinate axes after this first rotation are defined by

i' =i
., w. v k
J = J--=== (4.30)
Jh7 Jh7
k ' == v . _=w==k
J+
Jh7 Jh7
Step 2. Rotate the Z' axis by an angle <p around the Y' axis so that Z" is
aligned with A. This gives
100 Chapter 4

."., w. v k
J =J = J--===
~1-u2 ~ (4.31 )
k" = ui + vj + wk

Because i" is defined by j" x kIt,

." ~1
1 ="I-u~l-
2. uv.J--===
uw k (4.32)
~1-u2 ~

The components of the post~collision vector in terms of the laboratory


coordinates after the desired rotation are therefore

."
1 =" ~1 2.
1- u~ 1-
uv.
~1-u2
J- uw
~1-u2
k

."
J =
w.
J-
v k (4.33)
~ ~1-u2
k" = ui + vj + wk

This rotational transformation does not work if the original vector A is


aligned with the X axis. In this case u = 1, v = 0 and w = 0 and eqns 4.33
are indeterminate. In practice, because of the finite word length in digital
computers, eqn 4.33 will lose accuracy whenever u is close to one. For this
case we reverse the order of the rotations, starting with a rotation about the
Yaxis:
Step 1. Rotate the Z axis by an angle 8 around the Y axis so that Z' is in
the plane defined by the X axis and A. Solving this rotation as before, we
obtain

i' = cos8i - sin8k


j' = j
k' = sin8i + cos8k
A x j=-wi+ uk (4.34)
k'. (A x j) = ucos8 - wsin8 = 0

SID
. 8= ~
U
,,1-
v2
w
cos8= ~
"1- v 2
4. Energy-Dependent Neutron Transport 101

which results in

., w. u k
1 = 1---===
~~
j' = j (4.35)

k' = w
u .1+--=== k
~~
Step 2. Rotate the Z' axis about the X' axis so that Z" is aligned with A .

." . ,
1 =1=
u
w .1--=== k
~ ~1-v2
j" =kIf xi" (4.36)
kIf = ui + vj + wk

Solving for j" gives

k "·"
XI =
uV·,-:---:)l
2•
,-:---:) 1 +"1/ 1- v- J -
vw k
,-:---:) (4.37)
"l/1-v 2 "l/1-v 2

The coordinate axes after the desired rotation are therefore given by

."
1 =
w .1---===
u k
~~
J." = - uv.1 + "1/~1 2· VW
1 - v- J - --===
k (4.38)
~ ~
k" = ui + vj + wk

Either ofthe above two rotational transformations, eqns 4.33 or 4.38, can
be used to convert from the post-collision coordinates with respect to the +Z
direction to the L coordinates. In our calculations the first transformation
I I
will be used unless u > 0.9, in which case the second transformation will
be used.
Given a post-collision direction nL, which is a unit vector in the
laboratory system assuming an incident direction in the +Z" direction, let

(4.39)
102 Chapter 4

The final vector n F is the same vector as n L but is expressed in the original
coordinate system. Let

(4.40)

Then

n F =nL
u F =nL -i=(i-i")u L +(i-j")v L +(i-k")w L
(4.41)
v F =nL -j=(j-i")u L +(j-j")v L +(j-k")w L
w F =nL -k=(k-i")u L +(k-j")v L +(k-k")w L

The above transformation can be written in matrix form

i-i" i-j" i_kIt]


[
T= j-i" j-j" j - kIt (4.42)
k-i" k-j" k- kIt

For the first rotational transformation defined in eqn 4.33 (the case where
Iu I ~ 0.9) this matrix is given by

~ 0 u
-uv w
Tx= v (4.43)
~ ~
-uw -v
w
~ ~

and for the case where Iu I > 0.9 we have

w -uv
u
~ ~
T=
y 0 ~ v (4.44)

-u -vw
w
~ ~
4. Energy-Dependent Neutron Transport 103

Our procedure for tracking isotropic scatter in the center of mass will be
to assume the initial particle direction is along the +Z axis. We obtain a
post-collision isotropic vector Oc in the C system and convert it to the vector
OL in the L system using eqns 4.13 and 4.22. However, the actual incident
direction is 00'

(4.45)

I I
Therefore if Uo ~ 0.9 we calculate the final orientation of the J?ost-
collision vector OF = Tx • !lo using the transfer matrix of eqn 4.43. If I Uo I
> 0.9 the calculation is performed using eqn 4.44, OF = T y • 0 0 ,

Example 4.2. Average direction of travel after two collisions

For elastic scattering, isotropic in the C system, the average polar


scattering angle e in the C system will always be 1t/2. By eqn 4.13, when A
= 1 and e = 1t/2, the polar angle in the L system will be 1t/4. The maximum
scattering angle in the L system under these conditions, that for e = 1t, is 1t/2.
Therefore after two elastic scatterings, when A = 1, the probability of the
neutron's direction of travel having a component antiparallel to its incident
direction will be small. At the other extreme, in the limit of large A, the
cosine of the average polar scatter angle in the L system will be 11A and the
average laboratory polar angle \JI will approach 1t/2. In this case, the
probability of the neutron's direction of travel having a component
antiparallel to its incident direction after two collisions is 112. Using eqns
4.13,4.22, and either 4.43 or 4.44 as appropriate, we can verify these results
using Monte Carlo.
Tables 4.4 and 4.5 show a Fortran program that determines the neutron's
direction of travel after two isotropic collisions in the C system in a pure
scatterer of atomic mass A. We will assume azimuthal symmetry about the
Z axis in the center-of-mass, post-collision direction, which is equivalent to
assuming azimuthal symmetry in the L system. To determine the
backscatter probability using the above equations, it is necessary to follow
the post-collision particle track in three dimensions. The program in Table
4.4 allows the user to specify the mass of the scattering target, the number
of start particles to track, and the random number seed. It assumes the
initial direction of the neutron is along the +Z axis and calculates the Z-
direction cosine after two consecutive collisions. If this direction cosine, w,
is negative the program scores a backscatter. The square of w is also scored
to allow variance estimation for this cosine.
104 Chapter 4

Table 4.4. Program for Example 4.2


Detennine the prcbability of a neutron having noo-zero backscatter
velocity carpcnent after two elastic scatter events
INI'EX>ER* 4 !'MAX, I
4 WRITE (*,' (lX,A\) ') , Enter target ness A:
READ (*, *) A; IF (A.lE. O) S'roP ! A IE zero to step
WRITE (*,' (lX,A\) ') , Enter nl.1!lber of start particles: '
READ (*, *) !'MAX
WRITE (*,' (lX, A\) ') , Enter randcrn nl.1!lber seed (an integer) :
read (*,*) ISEED; CALL rndin(ISEED) catplete :inp.lt
TALLY = 0.; TALLYSQ = 0.; NBS = 0; XN = !'MAX zero tally variables
I.ocp Over Particles:1X) I = 1,!'MAX locp over !'MAX start particles
- U =-0.; V = 0 . ; W = 1. start directioo (0,0,1)
IX) NSCAT = 1,2 locp for two collisioos
CALL ISCX::OLl (U, V,W,A) get directioo after collisioo
END IX)
TALLY = TALLY + W; TALLYSQ = TALLYSQ + W**2 score Z~rectioo cosine
IF (W. GI' . 0.) CYCLE I.ocp Over Particles
NBS = NBS+l -- score nU!lber of backscatters
END IX) I.ocp Over Particles
XW = TALLY/XN; XW2 = TALLYSQ!XN; SIG = O. detemrine rrean and
IF(ABS(XW) .GE.1.E-8)SIG = SQU'( (XW2-XW**2)/XN)/ABS(XW) fractiooal standard
XNBS = NBS; PBS = XNBS/XN; SIGPBS = O. deviatioo of results
IF(PBS.GI' .0.)'lllEN
SIGPBS = SQU' (XNBS* (XN-XNBS) /XN) /XN; SIGPBS = SIGPBS/PBS
ENDIF
WRITE (* , *)' Maan Z~rectioo cosine = ',XW
WRITE (* , *)' Fractiooal standard deviatioo = ',SIG
WRITE(*, *)' NLIrber of backscattered neutroos = ',NBS
WRITE(*, *)' Prcbability of backscatter = ',PBS
WRITE(*, *)' Fractiooal standard deviatioo = ',SIGPBS
00 TO 4

Table 4.5. Subroutine 'Isocoll'


SUB!OJTINE ISCCOL1 (U, V, W,A)
Subroutine lsa::aLl calculates the result of elastic collisioos
of neutroos with nuclei of ness A. The post-collisioo
directioo in the laboratory system is detemrined assuning
isotrepic scattering in the center of ness system for neutroo
incident with directioo cosines U, V, W.
IXlJBIE PREJ::ISICN fltrn, PI, o:::srn, EHI, UL, VL, WI.., UF, VF, WF, SR, SINIH, T
PI=2.0d0*DAOOS(0.0d0)
o:::srn = 2.oo*fltm()-1.000 ! Cosine of randcrn p:>lar scatter angle selected
EHI = fltm()*2.oo*PI ! Randcrn azinuthal angle selected
WI.. = (A*o:::srn+1.oo)/DSQRT(A**2+2.oo*A*o:::srn+1.oo) ! z~r cosine,lab ccordinates
SINIH = DSQRT(1.L'O-WL**2) Azinuthal angle in lab ccordinates
UL = SINIH*lXXS(EHI) directioo cosine in lab ccordinates
VL = SINIH*I:sIN(EHI) directioo cosine in lab ccordinates
IF(ABS(U).LT.0.9)'lllEN select apprcpriate transformatioo
SR=DSQRT (1. Ooo-U*U) Prinary transformatioo T sub x
UF-=SR*UL+U*WL final directioo cosine U
VF-=-U*V*UL/SR+W*VL/SR+V*WL final directioo cosine V
WF=-U*W*UL/SR-V*VL/SR+W*WL final directioo cosine W
ELSE
SR=DSQRT (1. Ooo-V*V) Alternate transformatioo T sub y
up..w*UL/SR-U*V*VL/SR+U*WL final directioo cosine U
VF=SR*VL+V*WL final directioo cosine V
WF=-U*UL/SR-V*W*VL/SR+W*WL final directioo cosine W
ENDIF
T=DSQRT (UF*UF+VF*VF+WF*WF) renormalize to fix possible rooncbff errors
U=UFIT; V=VFIT; W=WFIT set values for return
RE:IUm
4. Energy-Dependent Neutron Transport 105

The results of several runs of the program are shown in Table 4.6. The
error estimates are given as fractional standard deviations; i.e., the standard
deviation divided by the estimated mean of the associated random variable.
The results confirm that the neutron backscatter probability after two
collisions with heavy targets is 0.5, and that the mean Z-direction cosine
after two collisions is zero. In addition, the program predicts that, for A = 1,
the mean Z-direction cosine after two collisions is about 0.446, while the
backscatter probability after two collisions is about 0.165.
For large A, the program appears to produce an erratic variance estimate
for the mean Z-direction cosine. The fractional standard deviation for these
results takes on values much greater than one, and does not show a
consistent decrease with the number of particles tracked. The erratic nature
of this estimator does not reflect a lack of convergence in the estimation
procedure, but rather the fact that the true mean of the estimated average
cosine is zero. As the accuracy of the estimate of this mean increases, the
fractional standard deviation becomes a poor way to present the uncertainty
in the mean. In fact, in the limit of a large number of particles, both the
mean and the standard deviation will vanish but, in practice, the fractional
standard deviation will not. For a null result it would be better to express
the uncertainty in the physical units of the estimator rather than as a fraction
of the mean.
. . Resu Its f;or Example
Table 46 I 42
Seed Start Target MeanZ- Frac std Backseat Frac
Particles MassA dir cos dey Prob std dey
II 103 I 0.457 0.029 0.165 0.071
12 104 I 0.445 0.009 0.166 0.022
13 10 5 1 0.446 0.003 0.166 0.007
21 103 100 -8.60-4 21.41 0.496 0.032
22 104 100 7.81-3 0.737 0.494 0.010
23 10 5 100 9.91-4 1.85 0.501 0.003

4.3 Energy-Dependent Cross Sections

Using the coding developed in Example 4.2, along with that used in the
examples in Chapter 3, it is possible to simulate the transport of neutrons
through elastic scattering materials with physically correct angular and
energy dependence. However, even with this improved collision model we
have not addressed the question of the energy dependence of the interaction
cross sections. The variation of cross sections with energy, and the
correlation of the angular dependence of the post-collision particle direction
with energy, can be complicated. Angular- and energy-dependent cross
sections may be included in Monte Carlo calculations by using tabulated
106 Chapter 4

data or by a Legendre expansion of multigroup cross sections. Specific


cross section values are obtained by interpolation from the tabulated entries
or by calculations using the multigroup data. The following example
illustrates the use of tabulated, energy-dependent cross section data.

Example 4.3. Neutron slowing down and Fermi age in water

The neutron slowing down density q(E) is defined as the number of


neutrons per unit volume per unit time that slow down past an energy E. In
the limit of E « a.Eo, where a. is given by eqn 4.16 and Eo is the source
energy, the function q is given by

(4.46)

Here l; is the average logarithmic energy decrement given by eqn 4.21 and u
is the neutron lethargy,

E
u=ln-o (4.47)
E

Let us introduce the Fermi age t/

U D
t(u} = f-du' (4.48)
o l;~s

where D is the diffusion coefficient. 8 For fixed energies E and Eo. t is


constant. The slowing down density q is related to t by the Fermi age
equation

(4.49)

For a point source of fast neutrons in an infinite, homogeneous medium, the


solution of eqn 4.49 is

8 The diffusion coefficient arises in the kinetic theory of gases, specifically from Fick's Law,
J = -D grad +.
The diffusion coefficient D is approximately equal to l/3~t. See A. M.
Weinberg and E. P. Wigner, The PhYSical Theory of Neutron Chain Reactors, University of
Chicago, Chicago, 1958, Chapter VIII, pp. 181 ff.
4. Energy-Dependent Neutron Transport 107

(4.50)

Calculating the average r for a given 't gives


CIO CIO

J r2 41tr 2q(r, 't)dr J r 4e- r2 /4t dr


r2 ( 't) = 0 CIO = ! = 6't (4.51)
J41tr 2q(r, 't)dr Jr2e-r2/4tdr
o 0

Thus the age of a neutron is equal to one-sixth of the mean square distance
from the point at which it was born to the point at which its age is 't,

(4.52)

We wish to determine the value of't for neutrons at the indium resonance
from a fission source in light water. A Fortran code for calculating this
quantity is shown in Tables 4.7 - 4.10. The user may set both the source
energy and the cutoff energy as input to the calculation. The input data are
read in subroutine 'Input,' shown in Table 4.8. An energy-dependent
version of subroutine 'Isocol' is shown in Table 4.9. For the present
example we are interested in using a fission source, which is activated by
setting the source variable to zero. For this purpose the Watt fission
spectrum is used beginning at statement 65 of Table 4.7. Source neutron
energies are selected from this spectrum using the rejection technique of
Kalos as described by Everett and Cashwel1. 4 Neutron slowing down in
water is almost entirely the result of elastic scattering interactions between
the neutrons and the hydrogen and oxygen nuclei of the water. Because the
absorption cross sections in these materials are small, in this example we
will neglect absorption.
To obtain a reasonable estimate of the slowing down density we will
need a model for the hydrogen and oxygen scattering cross sections. For
present purposes we have made a rough tabulation of the total cross sections
for Hand 0 from published values.s The cross section data bases are
contained in subroutines 'Hydrogen' and 'Oxygen,' shown in Table 4.10.
Relatively few points are included because the purpose is merely to
illustrate the concept of using tabulated cross sections without encumbering
the coding. The energy values 'epoint,'. and the microscopic cross sections
108 Chapter 4

'xspoint' corresponding to each energy value, are contained in data


statements in the subroutines. Both semi-log and log-log interpolations are
used, depending on the energy region. The cross sections obtained from
these subroutines are plotted as a function of energy in Figure 4.4.

Table 4.7. Main Program for Example 4.3


PRXiPJ\M for Exarrple 4. 3 SFhere
Cross secticos for H, 0 (H in rrolecular fomr-not a gas)
(cross secticos fran 0.01 eV to 10 MeV ooly)
Point source of neutrcos into uniform sphere, score distance to cutoff energy
Scattering is energy-oependent, elastic, isotrepic in center of ll'c3SS.
For water (1. Og/ee) , set 1klens=O.06692, 0:Iens=0.03346
EO = Source energy, a Watt fissioo spectrum is used if set=O
Ef = cutoff energy; E = Energy of particle after collisioo
U, V, W = Directioo cosines, X, Y, Z = cartesian coordinates of particle
tM\X = NtJtber of start particles
r an sphere
double precisioo fltrn
~TA PI/3.14159265/
Locp OJer Prd::>lem: IX)
- CAI.L INEUI' (tM\X, EO, Ef, radius, helens, edens, iseed)
IF (tM\X.IE.O) STOP tM\X=O to step
CALL m:tin (iseed) set starting randan nt.llber
nr=O; n1=O; SCCR=O . ; r2bar=O . ; r2barsq=O.; N=O initialize for scoring
Locp OJer Particles: IX) N = 1, tM\X
ij = 0-:; V = 0. ; W = 1. Source directioo cosines
X = 0.; Y = 0.; z = O. Source locatioo
IF(eO.le.O.) THEN If EO=O.O, use Watt fissioo spectrum
65 xtest=-dlog(fltm0 ) ;ytest=-dlog(fltrn() ! pick a point
IF«ytest-xtest-1.)**2.gt.4.*xtest) ooro 65 ! reject i f fails test
e = 2.*xtest*1.e6 value selected fran fissioo spectrum
ElSE i f not using fissioo spectrum
E = EO ! Use inplt starting energy
ENDIF
IX) WHILE (e.Gl'.ef) ! while above cutoff energy
CALL hydrogen(hxs,e,helens);CALL oxygen{oxs,e,odens) ! cross secticos at energy E
xs =hxs+OXS ! nacro cross sectioo xs in an**-l
d = -dlog (fltrn 0 ) /xs ! Get a flight path D in an
X = X+D*U; Y = Y+D*V; Z = Z+D*W ! collisioo site
r2 = x**2+ y**2+z**2; r = sqrt (r2) ! radius of collisioo site
IF (r.GE.radius) THEN i f still in sphere, go to 12
n1 = n1 + 1 ! particle escaped (leaked)
CYCIE Locp OJer Particles ! get next particle
ENDIF --
rand = fltm () randan # to select type of atan
IF (rand. It.hxs/xs) THEN i f collisioo in h}tirogen
a = 1. then A=1
ElSE otherwise collisioo in oxygen
a = 16. and A=16
ENDIF
CALL ISCXXlL (u,v,w,A,E) get new directioo and energy
END IX)
r2bar=r2bar+r2; r2barsq=r2barsq+r2*r2 bel~ cutoff energy, score r**2
END IX) Locp OJer Particles leq:> to next particle
r2bar=r2bar/float (nmax); r2barsq=r2barsq/float (nmax) ! prd::>lem c:cnplete
stdev = sqrt«r2barsq - r2bar*r2bar)/float(nmax»
WRITE(*,27)r2bar,stdev,r2bar/6.0
27 Em1AT(' Meansqdisttoabs ',lp2e12 . 3,' age ',lpe12.3)
WRITE (*, 13)NL
13 Fm1A.T(' Particles leaking above ef =',16)
END IX) Locp_ OJer_ Prd::>lem
END
4. Energy-Dependent Neutron Transport 109

Table 4.8. Subroutine 'Input' for Example 4.3


SUbrootine Inp..It (l'I1AX,EO, Ef, radius,hdens,odens, ISEED)
WRITE (* , *) ! Read inpJt
WRITE(*,' (lX,A\) ')' Enter mIlDer of start particles'
READ(*,*)l'I1AX; IF(l'I1AX.eq.O)RE'IURN ! NuTber of start particles
WRITE(*,' (lX,A\) ')' Enter start particle energy (MeV) ,
READ(*,*)EO set=O for fiss ~
write(*, '(lx,a\)')' Enter cutoff energy (eV) ,
read(*,*) ef; if(eO.gt.O.)eO = eO*1.e+6 cutoff energy in eV
WRITE(*,' (lX,A\) ')' Enter ooter radius of system (an) ,
READ(*, *) radius radius of SI=ilere
WRITE(*,' (lX,A\) ')' Enter atanic density of hytirogen '
READ(*,*)hdens ! density of hytirogen
WRITE(*,' (lX,A\) ')' Enter atanic density of oxygen ,
READ(*,*)odens density of oxygen
WRITE(*,' (lX,A\) ')' Enter start randan nU!li:Jer seed '
READ(*,*)ISEED
RE'IURN
END

Table 4.9. Subroutine 'Isocol' for Example 4.3


SUBFOJI'INE ISCXXJ.L (U,V,W,A,E)
SUbrootine ISCXXJ.L calculates the result of elastic collisicns
of neutrcns with nucleii of IlBSS A. The post-collisioo
directioo and energy in the laboratory system is detennined
assuming isotrcpic scattering in the center of IlBSS system.
double precisioo fltrn
data twopi/6.2831B54/
C03TII = 2. *fltrn () -1.; PHI = fltrn () *twopi
WL = (A*CX:STH+1.) /SCJ{r (A**2+2. *A*C03TII+1.) W in L coordinates
SINTH = SQRT(1.-wL**2)
UL = SINTH*CX:S(PHI); VL = SINTH*SIN(PHI) U & V in L coords
E = E*(A*A+2.*A*C03TII+l.)/(A+l.)**2 Post-collisioo energy
if (abs(u).lt.O.9) then detennine which transforrnatioo to use
SR = SQRT(l.-U*U) x-axis transforrnatioo (eqn 4.43)
Ox = SR*UL + U*WL
Vx = -U*V*UL/SR + W*VL/SR + V*WL
Wx = --w*U*UL/SR - V*VL/SR + W*WL
else
sr = sqrt(l-V*v) y-axis transforrnatioo (eqn 4.44)
ux = w*UL/sr - u*v'*VL/sr + u*WL
vx = VL*sr + v*WL
wx = -u*UL/sr - v*w*VL/sr + w*WL
endif
vee = sqrt (ux*ux+vx*VX+wx*wx) norrnalizatioo to correct for roonding
u = ux/vee; v = vx/vee; w = wx/vee normalized lab directioo cosines
RE'IURN; END

The calculation follows the source neutrons until they down scatter below
the indium resonance (about 1.4 eV) or, in a calculation that uses a finite
geometry, they escape from the system. When they reach the cutoff energy
their radius is determined and the square of the radius is scored. A standard
variance estimate is made. To obtain a valid estimate for the age, the system
radius should be set large enough that the number of particles escaping from
the geometry is essentially zero. To verify that only a negligible number of
neutrons escape before reaching the cutoff energy, the number of neutrons
leaking from the system is scored. The age is then determined by eqn 4.52.
110 Chapter 4

Table 4.10. Subroutines for Cross Sections for Example 4.3


subroutine HYIR:XDI (xs, e, hdens)
calculate mac:rosccpic cross secticn for H,
H atan density hdens * 10**24
e a5surreci to be energy in eV
dirrensicn xspoint (11) , epoint (11)
data epoint/ .01, .1,1.,1000.,10000.,50000., &
l.e5,I.e6,5.e6,I.e7,3.e7/
data xspoint/68.,26.,20.,20.,19.,15.,7.,4.,1.5,.9,.3/
do 3 i = 2,11
ie = i
i f (e.lt.epoint (ie)) go to 4 i f epoint (ie-I) <energy<epoint (ie)
3 continue
xs = hdens*xspoint (ie) Eilergy .GE. 3.E?
return
4 slope = (xspoint(ie)-xspoint(ie-l))/&
alog (epoint (ie) /epoint (ie-I) )
xs = slope*alog(e/epoint(ie-l) ) +xspoint (ie-I) extrapolate be~ ie-I and ie
xs = xs*hdens
return
end

subroutine oxygen (xs, e, odens)


calculate rracrosa::pic cross secticn for 0,
o density odens * 10**24 at/cc
e a5surreci to be energy in eV
dirrension xspoint (84) , epoint (84)
data epoint/.Ol,.I,I.e4,3.e5,3.5e5,4.4e5,5.2e5,6.e5,&
8.5e5,I.e6,1.2e6, 1.31e6, 1.4e6, 1. 64e6, 1.65e6,&
1. 66e6, 1. 67e6, 1.68e6, 1.6ge6,&
1.8e6, 1.82e6, 1.83e6, 1.ge6, 2.e6, 2.25e6, 2.35e6,&
2.4e6, 2.5e6, 2.ge6, 3.1e6,&
3.2e6,3.21e6,3.4e6, 3.41e6, 3.42e6, 3.78e6, 3.7ge6, 3.8e6,&
4.e6, 4.1e6, 4.4e6, 4.45e6, 4.5e6, 4.51e6,&
4.52e6, 4.6e6, 4.7e6, 4.81e6, 5.e6, 5.15e6, 5.2e6,&
5.35e6, 5.36e6, 5.37e6, 5.4e6, 5. 65e6, 5. 66e6, 5.67e6,&
5.98e6, 5.9ge6,&
6.05e6, 6.06e6, 6.3e6, 6.4e6, 6.5e6, 6.8e6, 6.85e6,&
6.86e6, 6.88e6, 7.e6, 7.2e6, 7.4e6, 7.5e6, 7.8e6,&
8.05e6, 8.3e6, 8.6e6, 8.7e6, 9.e6, 9.1e6, 9.3e6,&
II.e6, 12.e6, 18.e6/
data xspoint/3.7,3.7,3.7,3.5,3.8,16.,4.,3.1,2.7,8.,&
2.7,7.,2.5,1.9,9.,1.9,1.9,5.,1.8,1.6,5.,2.,3.,1.5,&
1., .09, .7,1.1,1.1,1.4,5.,3.,3.,5.5,3.,3.,5.6,3. ,2.,1.1,2.1, &
1.4,2.,3.,1.3,2., .9,2., .9,3.95,1.4,1.2,2.1, .8,1.05,1.2,2.6,1. 7, &
1.4, .8,1.6,1., .8,1.7, .6,1.1,1.1,1.5, .85, .85,1.9,1.4,1.1,&
1.5,.8,1.4,1.1,1.5,1.1,1.35,1.08,1.4,1.2,1.6/
do 3 i = 2,84
ie = i
i f (e.lt.epoint(ie) ) go to 4 i f epoint(ie-1)<energy<epoint(ie)
3 continue
xs = a:J.ens*xspoint(ie) Eilergy .GE. 1.8E?
return
4 slope = (xspoint (ie) -xspoint (ie-1) ) / &
alog(epoint (ie) /epoint(ie-1))
xs = slope*alog(e/epoint(ie-l))+xspoint(ie-1) extrapolate be~ ie-1 and ie
xs = xs*odens
return
end
4. Energy-Dependent Neutron Transport 111

lE+2 , . . . . - - - - - - - - - - - - - - - ,
Hydrogen

i
'Oil
lE+l

ilE+O r-----Oxy-sen-----....J

~
o
i lE-l
{!.

lE-2 '---'-~-~---.-""'"--~-"'""'----'--"""----'

1~1~1~1~1M1M1~1~1~1Ml~

Energy (eV)

Figure 4.4. Total Cross Sections for Hydrogen and Oxygen

The result of tracking 106 source neutrons in a 300-cm-radius sphere of


water gives an estimated age to indium resonance of 27.9 cm2 with a
standard deviation of 0.045 cm2• The correct value for the age of neutrons at
1.4 eV from a fission source in water is about 30.4 cm2• The difference
between the calculated and the correct values is caused by the approximate
nature of the cross sections used and other assumptions. As usual the error
estimate that is quoted does not include the systematic error incurred by
these assumptions.
It is possible to continue tracking the neutrons to energies less than 1.4
eV using the current model. However, as the neutron energies approaches
that of the thermal motion of the particles in the scattering material the
stationary target model used here becomes increasingly inaccurate. The
effect of thermal motion ofthe scattering target on the post-collision neutron
energy will be discussed in Chapter 9.

Exercises

1. Repeat the calculation of Example 3.1 assuming isotropic scatter in the


center of mass system using A = 1, but neglect energy changes. Compare
your result with that obtained assuming isotropic scatter in the L system.

2. Estimate the age of neutrons at the Cd cutoff from a fission source in Be


(A = 9). For the total microscopic cross section of Be use cr = 6 barns for E
< 50 keY and use 14.782 - 1.868710gIO (E) for E > 50 keY where E is in eV.
The density of Be is 1.85 gms per cm3 • Assume c = 1.
a. Assume isotropic elastic scatter in the center of mass system.
112 Chapter 4

b. Include inelastic scattering assuming the target nuclei have an internal


excitation energy level of 100 ke V, and that the probability of inelastic
scatter above this energy is 0.5. Assume inelastic scattering is isotropic
in the laboratory system and that the energy loss experienced by the
neutron in inelastic scattering events is the excitation energy; i.e., Er = Eo
_10 5 eV.

3. Consider the slowing down of fast neutrons in a nonabsorbing material


that can undergo both elastic and inelastic scatter. Assume the elastic
scattering is isotropic in the center of mass system, and the inelastic
scattering is isotropic in the laboratory system. Further assume the material
has a single internal excitation energy level of E = 200 keY, and assume the
inelastic scatter probability is 0.75 for neutrons of energy E > E. Assuming
A = 12, determine the mean number of collisions required to reduce the
energy of a neutron from 1 Me V to the Cd cutoff in this material. Assume
the energy loss during inelastic scattering is the excitation energy.

1 S. Glasstone and M. C. Edlund, The Elements ofNuclear Reactor Theory, D. Van Nostrand,
Princeton, NJ, 1952, pp. 143-45. Regarding the linear average of the number of collisions
required to reduce the energy of a neutron to a certain value, see the footnote on p. 145 of
this reference.
2 Ibid., p. 142.
3 Por a discussion ofFenni age theory see Ibid., pp. 172-89; M. M. R. Williams, The Slowing
Down and Thermalization ofNeutrons, John Wiley & Sons, New York, 1966, pp. 358 ff.
4 C. J. Everett and E. D. Cashwell, "A Third Monte Carlo Sampler," LA-9721-MS, Los
Alamos National laboratory, Los Alamos, NM, 1983, p. 129.
S Victoria McLane, Charles L. Dunford, and Philip F. Rose, Neutron Cross Sections, Vol. 2,
Neutron Cross Section Curves, Academic Press, New York, 1988, pp. 1-3,47-49.
Chapter 5

A Probabilistic Framework Code

5.1 Introduction to PFC

As we have seen in the previous chapters, one may develop single-


purpose computer programs to solve specific problems using Monte Carlo
methods. These programs can be efficient in terms of the computer time
needed to solve the problem, and for relatively simple problems custom
software development may be acceptable. However, writing a new
computer program for every Monte Carlo problem tends to be time
consuming and tedious. There are many features in Monte Carlo solutions
to radiation transport problems that lend themselves to standardization. By
exploiting such standardization a procedure can be developed and debugged
once and then reused as required. Furthermore, it is possible that a single-
purpose code may not incorporate some useful variance reduction technique
that is available in a production code. Therefore general-purpose Monte
Carlo transport codes, that make use of standardization to provide users with
a framework within which diverse problems can be solved, dominate the use
of the technique.
It is useful for pedagogic reasons to develop the framework for a
generalized Monte Carlo transport code. Such a framework will serve to
illustrate features of typical production Monte Carlo codes and assist in the
efficient use of such codes. In addition, the framework code will serve as a
tool to minimize the amount of custom programming required to
demonstrate techniques of interest. Specifically, it will provide the basis for
solving problems in subsequent chapters of this book. The code we will
develop will be called the Probabilistic Framework Code (PFC).
Because PFC will be used repeatedly in the chapters that follow, we will
provide here a brief description of the features of the code. Details will be
113
114 Chapter 5

developed or expanded, as required, in subsequent example problems. PFC


follows the basic structure for solving problems using Monte Carlo that was
outlined in Section 3.5. To recapitulate, this structure is as follows:
I. Problem Defmition
- Define the problem geometry
- Define the source
2. Random Walk
- Select a source particle
- Determine a collision point
- Determine the type of interaction
- Determine the result of the interaction
- Complete the history
3. Compute the Response
- Calculate the detector response being modeled by the calculation
This structure applies directly to the PFC main program, which is shown in
Table 5.1. This main program calls subroutines to perform each of the
processes in the structure. The functions performed by these subroutines are
given in Table 5.2. The routines described in this chapter will be referred to
as the "library" versions.
Table 5.1. Library Version ofPFC Main Program
! Main Program for a Prooabilistic Frarrework Code 1
INI'El1:R*2 ihr, imin, isec, ihth 2
OPEN(UNIT=16,FILE='lptl') 3
CALL GEX:MIN reads gearetry descriptioo fran gean. txt 4
CALL XSEl:TS reads cross sectioo info fran xsects. txt 5
CALL rnror reads nll!ber of particles to process 6
CALL Statcne initializes statistics arrays 7
CALL GE:ITIM(ihr,imin,isec,ihth) gets starting tine 8
WRITE(*,15)ihr,imin,isec writes starting tine 00 default device 9
WRITE (16, 15)ihr,imin,isec ! writes starting tine 00 printer 10
15 Fm1A.T( lX, 'STARl' TIME: " I2.2, ':', I2.2, ':', I2.2) 11
CALL WALK subrootine to perform randan walks 12
CALL GE:ITIM(ihr,imin,isec,ihth) ! gets ending tine 13
WRITE(*, 16)ihr, imin,isec ! writes ending tine 00 default device 14
WRITE (16, 16)ihr,imin,isec ! writes ending tine 00 printer 15
16 Fm1A.T( lX, 'END TIME: ',I2.2, ':' ,I2.2,':',I2.2) 16
CALL StatEnd calculates and prints results 17
CALL am:ur ! rootine for other desired ootput 18
SlOP; END 19

To avoid having to modify arguments of subroutine calls, all data


relevant to the geometry specification, tracking of particles, and scoring of
events in PFC have been placed in common blocks. These common blocks,
and the variables they contain, are shown in Table 5.3. Some of the
variables listed will be discussed in subsequent chapters. By placing most
of the variables required for a calculation in common blocks we can have
5. A Probabilistic Framework Code 115

Table 5.2. Hierarchy of Subroutines in PFC


Problan Definition
Geanin -+ Read 'gean. txt' for gearetIy descriptioo, prepare
arrays for tracking
-+
Xsects Read 'xsects.txt' for = s sectioo data
Irplt -+ Read nurber of start particles, other inpJt
Statooe -+ Initialize arrays for scoring
Gettim -+ Read prcblan start tirce
F.andan Walk
walk -+ EKeo..\te na:in tracking loc:ps
Particle IDCp -+ Track eadl soorce particle
StaUp -+ Initialize scoring arrays for particle
Source -+ Get soorce particle pararreters
IS<XX.lt -+ Cbtain isotrcpic unit vector
Collisioo IDCp -+ EKeo..\te rollisioo
1 Dist -+ Pick flight path in mfp
1 Track IDCp -+ Find rollisioo point
1 1 Hit -+ Find distance to boondary,
1 1 call 5Pl, £W, and lAmp as required
"I - 1 MKsec -+ Find = s sectioo for =rent zooe
1 1 Bdl:x -+ Update distance to boondary
1 COl -+ Detennine post-collisioo pararreters
-Statelp -+ Ad::! particle srores to tallies
Carpute Response
Gettim -+ Get prcblan end tirce
Statend -+ calculate and print results
Qltplt -+ Print ack:litiooal ootplt

Table 5.3. Definition of Common Blocks in PFC


catrra'l 'cg' GearetIy data
spxx, SIilCY, SIiJ,cz, SIiJ.r - Centerand radius of SPH bcdies (d:iJrensiooed 20)
q:oonin, rpxmax, etc. - Coordinates of faces of RPP bcdies (d:iJrensiooed 20)
bdin, bdoot - Distance to entry and exit points of each bcdy aloog
=rent particle flight path (d:iJrensiooed 40)
nSIiJ" ru::w - Nunber of SPHs and RPPs
nbdy, nzooes, nbz - Nunber of bcdies, zooes, bcdies per zooe
nnext - Next zooe, ordered by likellhOJd, 00 leaving =rent zooe
bdtest, bdhit - bcdies that have been tested, results (lcgical variables)
catrra'l 'in' Irplt quantities
npart - Nunber of start particles
nbatch - NuTi:Jer of batches
catrra'l 'track' Variables used in finding collision point
dnfp - Current flight path in mfp
dtr - Total distance already traveled aloog flight path
xsec - Total cross sectioo for =rent material
dcur - Distance traveled before entering =rent zone
catrra'l 'part' Particle pararreters
x, y, z - Current particle locatioo
u, V, W - Directioo cosines of particle track
xo, yo, zo - Last rollisioo pt, start location for =rent flight path
00, vo, ~ - Directioo cosines of previous particle track
wate - Current particle ~ight
age - Tine of previous rollisioo
energ - Particle energy
nz=,newzn - CUrrent and new zooe nurrber
ngroup - Particle energy group for rrultigroup cross sectioos
catrra'l 'stat' Tally arrays
bscore, cscore - Tally arrays for boondary crossings and rollisioos
bsunsq, csunsq - Tally arrays for squares of scores, used for variances
l:part:, q:art - Tally arrays for particle scores
catrra'l 'gean' Cross sectioo data
sigt - Total cross sectioos (dirrensiooed 20)
c - Ncn-absorptioo prcbabilities (d:iJrensiooed 20)
116 Chapter 5

ready access to them in the various subroutines without modifying the calls
to the subroutines. As additional capabilities are added to PFC the lists of
variables in the common blocks can be expanded.

5.2 Problem Definition in PFC


For present purposes we consider a problem to be defined by specifying
the geometry within which the particles are to be tracked, the cross sections
of the materials that constitute this geometry, and the source of the particles
to be tracked. The cross sections must include sufficient detail to
accommodate both the range of particle energies of relevance to the problem
and the various types of reactions that are of importance. In addition, the
appropriate cross sections must be assigned to the regions of the geometry to
which they apply. This usually means that the geometry must be divided
into zones, to each of which the appropriate cross sections are assigned.
In PFC the specification of zones is handled by subroutine ' Geomin' and
its subordinate routines. The cross section input and, if required, the
conversion of the cross sections from microscopic to macroscopic form are
accomplished in subroutine 'Xsects' and its subordinate routines. Where
appropriate, this includes definitions of chemical mixtures or compounds vis
a vis single elements. These processes are known as "mixing" the cross
sections. Finally, the source definition is handled by subroutine 'Input' and
its subordinate routines.

5.2.1 Problem Geometry and Tracking

The Monte Carlo method is often invoked because the complexity of a


problem geometry does not allow straightforward use of other methods of
solution. The description of such a problem geometry is thus an important
part of a production Monte Carlo transport code. The description must
include the sizes, shapes, and locations of the physical objects involved, as
well as the materials that make up the various objects. Finally, the program
must be capable of tracking particles through the resulting geometrical
configuration. When the geometry of a problem under consideration is
complex, it is likely that the steps involved in tracking the particles through
the geometry will be the most time-consuming element of the entire Monte
Carlo process. Thus the efficiency of the geometry tracking is an important
consideration.
In the examples given in the preceding chapters the geometry routines
were written specifically for the problem being solved. As a general rule,
such specialized tracking routines, written for a specific problem geometry,
provide the fastest possible geometric tracking. However, as problem
5. A Probabilistic Framework Code 117

geometries become complicated it becomes increasingly difficult and time


consuming to write specialized routines to perform the tracking. Therefore,
the use of standardized routines that provide the user with a relatively
simple way to describe a problem geometry is usually preferable to writing
specialized geometry routines.
There are two common methods available in production Monte Carlo
transport codes for describing problem geometries. The first, which
involves the use of analytic geometry surfaces to define regions of space,
was used in the original Monte Carlo codes developed at Los Alamos and is
still widely used. The second method, which involves the use of solid
geometric shapes to define regions in space, was developed at MAGI and is
referred to as the combinatorial geometry method.) While both methods
provide an effective means for defining problem geometries, under certain
conditions there are valid reasons for preferring one over the other. The
Monte Carlo practitioner will usually become familiar with both techniques.
In order to simplify the definition of problem geometries in the
subsequent examples in this book, and to allow emphasis to be placed on the
techniques used rather than on the geometry definition in these examples,
PFC will incorporate the combinatorial geometry technique for describing a
problem geometry. To expand on the above short description of the
combinatorial geometry technique, a problem geometry is constructed from
a library of basic geometrical bodies that may include spheres,
parallelepipeds, cylinders, cones, wedges, ellipsoids, and other solid shapes.
The parameters by which each body is defined allow the user to place,
orient, and size the body as required for a particular application. Zones can
be described in terms of combinations of the basic bodies. A material is
then defined for each of the zones. It is assumed that the properties of the
material are the same throughout a zone.
The bodies are combined using logical operators such as ".AND." (in set
theory, "(1"), ".NOT." (the negative operator, "-"), and " .OR." (the "u"
operator). The " .AND." operator is used to define the intersection between
two bodies, the ".NOT." operator is used to describe the space that is outside
of a given body, and the ".OR." operator is used to define the union of two
bodies. The bodies are numbered to facilitate their identification when
using the logical operators.
For example, let body 1 be a sphere with center at (-0.5, 0.0, 0.0) and
unit radius. Let body 2 be a sphere with center at (0.5, 0.0, 0.0) and also
unit radius. These bodies are shown in Figures 5.1 and 5.2. The region
defined by the operation " .NOT. 1" consists of all points that are not in body
1. This is illustrated in Figure 5.3 . The region defined by the operation " 1
.OR. 2", shown in Figure 5.4, consists of all points that are either in body 1,
or in body 2, or in both; i.e., the ".OR." operator is not an exclusive "or."
Finally, the region defined by "1 .AND. 2" consists of all points that are in
118 Chapter 5

body 1 and are also in body 2. This is shown in Figure 5.5. Combinations
of logical operators are also allowed. For example, "(.Nor.l).AND.2"
consists of all points that are in body 2 but are not in body 1. This region is
illustrated in Figure 5.6.

Figure 5.1. Description of


Figure 5.2. Description of
Body 1
Body 2

Figure 5.3. Zone defined by Figure 5.4. Zone defined by


" .NOT.I" "I.OR.2"

Figure 5.5. Zone defined by Figure 5.6. Zone defined by


"1 .AND. 2" "( .NOT.I ).AND.2"

The combinatorial package that has been implemented in PFC is a


greatly simplified version of the packages used in production codes. This
package allows the use of only two body types - spheres of arbitrary size
and location, and rectangular parallelepipeds whose faces are perpendicular
to the coordinate axes - but it nevertheless provides a useful and intuitive
model for more complex programs. For the purpose of the program, a
sphere (SPH) is defined by specifying the Cartesian coordinates of its center
plus its radius, and a rectangular parallelepiped (RPP) is defined by
specifying the minimum and maximum values of its faces along each
coordinate axis.
5. A Probabilistic Framework Code 119

The PFC combinatorial geometry package is further simplified by


allowing the use of only the ".AND." and ".NOT." logical operators. This
does not impose any real limitations on describing problem geometries,
however, and it only detracts slightly from the convenience of defining
combinatorial geometries using the full complement of logical operators.
Any zone that can be described by using an ".OR." operator can be described
as two separate zones without using this operator. For example, "l.oR.2"
can be described as a combination of "1" and "2.AND.(.NOT.l)". Further, a
particle will not get "lost," as described below, should these two zones
overlap. Instead, the code will use the first zone found during the tracking.
If the same material is specified for each of these zones it does not matter
which zone is selected. Combinatorial geometry packages that allow use of
the ".OR." operator often construct an internal description of the geometry
that is divided into zones that can be described without the ".OR." operator.
To illustrate how the allowed bodies are used with ".AND." and ".NOT."
to define zones, consider the geometry shown in Figure 5.7. The geometry
is made up of three concentric spheres centered at the origin with radii of
1.0, 1.5, and 2.0 cm, respectively. These three spheres will be designated as
bodies 1,2, and 3. Let zone 1 = "I", zone 2 = "2.AND.(.NOT. I)" or "2 -I",
zone 3 = "3.AND.(.NOT. 2)" or "3 -2", and zone 4 = ".NOT.3" or "-3". In this
description all bodies in a zone are assumed to be combined with the
".AND." operator, and a negative number represents the ".NOT." operator.
Zone 2, for example, could be described as "-1 2" or "-1 +2" or "+2 -I".
The order of the body number in the zone is not significant. The blank
space between entries is significant so that the Fortran program reading the
geometry input can determine that two bodies are being described. The
blank space could be replaced with a comma. In this geometry description,
if a particle enters zone 4 it will be considered to have escaped from the
system.

1.0 em

~-+--+t~ 2.0 em

Figure 5.7. Three Concentric Spheres

The general format for entering the geometry description using the
combinatorial package in PFC is shown in Table 5.4. In the PFC geometry
120 Chapter 5

package the last zone defined must surround the entire problem geometry.
This zone is assumed to consist of a total, or "black" absorber, and particles
that enter this final zone are treated as having escaped from the geometry. If
there is a path for particles to leave the geometry without entering the last
defined zone, tracking will usually fail with a resulting "Lost in Space"
message. The description for the geometry of Figure 5.7 is shown in Table
5.5.

Table 5.4. Input Fonnat for PFC Geometry Description


-Number ofRPPs
-xmin, xmax, ymin, ymax, zmin, zmax
(repeat above line for each RPP)
-Number of spheres
-xcenter, ycenter, zcenter, radius
(repeat above line for each SPH)
-Number of Zones
-number of bodies in first zone
-description of zone using these bodies
(repeat above two lines for each zone)

5 Geometry DescnptlOn or Igure 57


Table 5..
Contents of tile geom.txt Explanation of content
0 -Number ofRPPs
3 -Number of spheres
0.00.00.0 1.0 -xcenter, ycenter, zcenter, radius (sphere I)
0.00.00.0 1.5 -xcenter, ycenter, zcenter, radius (sphere 2)
0.00.00.02.0 -xcenter, ycenter, zcenter, radius (sphere 3)
4 -Number of Zones
I -number of bodies in first zone
I -description of zone using these bodies
2 -number of bodies in second zone
2 -I -description of zone using these bodies
2 -number of bodies in third zone
3 -2 -description of zone using these bodies
I -number of bodies in fourth zone
-3 -description of zone using these bodies

Subroutine "Geomin," shown in Table 5.6, is used to read and process


the geometry description. The geometry input is read from a file called
'geom.txt' in which the user must place the geometry definition data listed
in Table 5.4. The coding on lines 44-52 provides the initialization for arrays
used by the code to "learn" the optimum tracking process. By trial and error
these arrays identify the most likely zones that a particle will enter upon
leaving a given zone. The most likely zones are then checked first during
the tracking process.
5. A Probabilistic Framework Code 121

Table 5.6. Library Version of Subroutine 'Geomin'


SUBIU1l'INE GeanIn 1
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 2
rpyrnin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 3
ICGlCAL I:xitest (40), Ixlhit (40) 4
<XM1:N/cg/sphcx, SJi'lcy, sphcz, sphr, rpxmin, rpxmax, rpyrnin, rpymax, rpzmin, rpzmax, & 5
bdin,bdout,nSJi'l,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),l:xitest,lxlhit 6
0PEN(tmit=10,file='gean.txt') ! gean.txt has gearetric description 7
READ(10, *)nrpp ! nuri:Jer of RPPs 8
IX) 10 i=1,nrpp ! read description for each RPP 9
READ(10,*)rpxmin(i),rpxmax(i),rpyrnin(i),rpymax(i),rpzmin(i),rpzmax(i) 10
10 CXNI'INUE 11
READ (10, *)nSJi'l ! nurrber of spheres 12
IX) 20 i=1,nSJi'l ! read description for each sIilere 13
READ (10, *)SJi'lcx(i) ,sIilcy(i), sphcz (i) , sphr (i) 14
20 CXNI'INUE 15
ntx.!y=nsp1tnq:p ! total nurrber of bodies 16
READ(10,*)nzones ! read nurrber of zones 17
IX) 30 i=1,nzones
READ(10,*)nbz(i,1), (nbz(i,j+1),j=1,nbz(i,1» !
30 CXNI'INUE
*
! read description for each zone
of bodies, body numbers
18
19
20
WRITE (16, *) 'nqp= ',nrpp 21
IX) 40 i=1,nrpp 22
WRITE(16,*)'xmin and xrnax for rpp ',i 23
WRITE(16,*)rpxmin(i),rpxmax(i) 24
WRITE (16, *) 'yrnin and ymax for rpp ',i 25
WRITE(16,*)rpyrnin(i),rpymax(i) 26
WRITE (16, *) 'zmin and zmax for rpp ',i 27
WRITE(16,*)rpzmin(i),rpzmax(i) 28
40 CXNI'INUE 29
WRITE(16,*)'the nurber of SJileres' 30
WRITE (16, *)nSJi'l 31
IX) 42 i=1,nSJi'l 32
WRITE(16,*) 'x,y,z coordinates for center of SJi'lere ',i 33
WRITE(16,*)sphcx(i),sIilcy(i),sphcz(i) 34
WRITE(16,*) 'radius for SJi1ere ',i 35
WRITE (16, *) sphr(i) 36
42 CXNI'INUE 37
WRITE(16,*)'the number of zones' 38
WRITE(16,*)nzones 39
IX) 43 i=1,nzones 40
WRITE (16, *) 'the definiticn, in terms of bodies, of zone',i 41
WRITE(16,*) (nbz(i,j+l),j=l,nbz(i,I» 42
43 CXNI'INUE 43
IX) 50 i=l,nzones ! prepare arrays to cptiroize tracking 44
IX) 50 j=l,nbdy 45
1=0 46
IX) 50 k=1,nzcnes 47
IF(k.EQ.i)CYCLE 48
1=1+1 49
nnext(i,j,l,I)=k possible next zone for =rent zone i, body j 50
nnext(i,j,1,2)=O number of tirres next zone has been zone k 51
50 CXNI'INUE 52
53
END 54

The geometry calculations in PFC are performed in double precision in


order to minimize potential problems in the analytic geometry solutions
caused by numerical round-off errors. Even with this precaution, however,
no digital geometry tracking routine is completely foolproof because it is not
possible to eliminate all conceivable numerical errors in the tracking
122 Chapter 5

process. An error may occur, for example, if the user places two bodies in
contact with one another by assigning them the same coordinate value. The
results of the calculation of entry and exit points for the two bodies may
round differently and an artificial gap may appear between the bodies. If
this gap is not defined to be in a zone, the code will not be able to follow a
particle that is passing between the bodies. In such a case the particle is
lost.
Tracking problems may also occur when a particle passes through the
corner of a body. In this case round-off errors in the computed distances to
the entry and exit points of the body may make it appear that the particle has
passed through the body before it has entered the body. The coding may
determine that the particle has left the current zone but may not be able to
find the particle in a subsequent zone. Again the particle is lost.
In general, particles should not be started on a geometric boundary
because in such a case the geometry package cannot identify the zone the
particle is in. This is unlikely to occur when using distributed sources, but
may occur when using discrete point sources. For example, if a point source
is placed on the interface between two slabs, an ambiguity similar to the
problem of tracking a particle through an artificial gap between bodies can
occur. The problem can usually be solved without loss of accuracy by
placing the source point a short distance into one of the zones.
One useful "trick" to reduce tracking problems is to define bodies such
that they overlap slightly, and to subtract those that are not in a given zone.
This eliminates any possible gaps between bodies caused by round-off
errors. It is also possible to define a large body that encloses the entire
problem and create a "catch-all" zone by subtracting the bodies that
constitute the real zones from this large body. If the material in this outer
body is defined as a vacuum there should be no change in the problem
results. Particles that otherwise would be lost will then merely pass through
a bit of vacuum before reaching the next zone. Despite these precautions,
however, it is rare for a particle to get lost unless there is an error in the
geometry description.

5.2.2 Additional Input and Array Initialization

Subroutine 'Xsects' is used by the main program to read the cross


section information needed for the calculation. This information is assumed
to reside in the file 'xsects.txt.' There is no fixed input form for these cross
section data since, depending upon the problem being solved, both the
amount of data read and the read statements in 'Xsects' may have to be
changed. For example, the cross section arrays may be dimensioned by the
number of data points in the cross section tables, the number of zones or
elements in the problem, and the type (absorption, scatter, etc.) of particle
5. A Probabilistic Framework Code 123

interactions of interest. The library version of 'Xsects' is shown in Table


5.7. This version of the routine reads the minimum information needed to
execute a calculation from file 'xsects.txt;' viz., the non-absorption
probabilities and total cross sections as a function of zone. The cross
sections are assumed to be constant within each zone. The values are read
in free form, one zone per line.
Table 5.7. Library Version of Subroutine 'Xsects'
SUBFaJI'INE XSECI'S 1
REAL (8) sigt(20),c(20) ! 2
CXl«N/GEX:M/sigt,c! sigt is total cross secticn, c is ncn-absorpticn prcb 3
REAL (8) ~(20), SJXlcy(20) , sphcz (20) ,sp-u:(20), rpxm:i.n(20), rpxrrax(20), &! 4
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 5
lffilCAL txitest(40), bdhit(40) 6
CXl«N/cg/~, SJXlcy, SIi'lcz, sp-u:, rpxm:i.n, rpxrrax, rpymin, rpymax, rpzmin, rpzmax, & 7
bdin,bdout,nSIi'l,nrpp,ntxly,nzcnes,nbz(40,41),nnext(40,40,40,2),txitest,bdhit 8
0PEN(UNIT=12,FIIE='xsects.txt') ! '!he cross secticns are in xsects.txt 9
'!he ootside zcne is a vaa.n.m. particles reaching it have escaped. 10
00 50 i=l,nzcnes-l 11
READ(12,*)c(i),sigt(i) 12
WRITE (16, *) 'ncn-abs and cross secticns for zcne ',i 13
WRITE(16,*)c(i),sigt(i) 14
50 CXNrINUE 15
REIURN 16
END 17

Subroutine 'Input' is used to define the source. The library subroutine,


shown in Table 5.8, reads the number of source particles to be tracked in the
random walk process and contains the steps for reading and setting the
random number seed. The library input routine has placeholder language for
setting the number of "batches" to be run. The use of batches will be
illustrated in Chapter 8.
Table 5.B. Library Version of Subroutine 'Input'
SUBIU1I'INE INEUI' 1
CXl«N/IN/npart,nbatch 2
WRITE(*,12) 3
12 FCFM>.T (' Enter the nurd:ler of particles. ' ) 4
READ(*,*)npart 5
WRITE (16, *) 'Nurrber of particles = ',npart 6
WRITE(*,13) 7
13 FCFM>.T (' Enter the randcrn nurd:ler seed, an integer. ') 8
READ(*,*)iseed 9
WRITE (16, *)' Starting randcrn nurrber seed is ',iseed 10
CALL mdin(iseed) 11
nbatch=1 needs to be changed if batches are to be used 12
REIURN ! 13
END 14

Two subroutines are used to initialize tally arrays and to prepare for the
random walk. Entry point 'Statone' in subroutine 'Stats' initializes arrays
used for storing event scores and the squares of these scores. The latter are
used to estimate the standard deviation associated with the various estimated
quantities. Subroutine 'Stats' is shown in Table 5.9. The coding at entry
point 'Statone' is similar to that used in prior examples, such as that shown
124 Chapter 5

in Table 2.9, labeled "Initialize variables." The library version of 'Stats'


provides for the tally of two results. The user can add additional capabilities
as required.

Table 5.9. Library Version of Subroutine 'Stats'


SUBroJI'INE Stats 1
REAL (8) bscore (10) ,bsumsq(10), cscore (10) , csumsq(10) ,tpart (10) ,cpart (10) 2
c:cM1:N/STAT/bscore,bsumsq, cscore, csumsq, tpart, cpart 3
c:cM1:N/IN/npart, nbatdl 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 5
c:cM1:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tmp,tmpl,tmp2,var,stdev ! 7
ENI'RY StatCbe ! entry point to initialize arrays for carplete prcb1em 8
bscore=O. OctO; bsumsq=O. OctO; cscore=O. OctO; csumsq=O. OctO ! 9
REI'URN 10
ENTRY Statlp ! entry point to initialize arrays for a particle 11
tpart=O. OctO; cpart=O. OctO 12
REI'URN 13
ENTRY StatEIp ! entry point to store scores for a particle 14
bscore(1)=bscore(I)+bpart(I) store score 15
bsumsq(I)=bsumsq(I)+bpart(I)**2 store square for variance calculation 16
cscore (1) =cscore (1) +qJart (1) ! store score 17
csumsq(I)=csumsq(I)+qJart(I)**2 ! store square for variance calculation 18
REIURN ! 19
ENTRY StatEnd ! entry point to calculate and print results 20
trrp=DFl.CAT (npart) 21
var=bsumsq(I)/tmp-(bscore(I)/tmp) **2 variance of bscore distribution 22
stdev=cs:;ro' (var) standard deviation of bscore distr23
WRITE (16, *)bscore (1)/tmp, stdev/cs:;ro'(tmp) result and std dey of result 24
var--csumsq(I)/tmp-(cscore (1)/tmp) **2 variance of cscore distribution 25
stdev=cs:;ro' (var) standard deviation of cscore distr26
WRITE (16, *)cscore (1)/tmp,stdev/cs:;ro'(tmp) result and std dey of result 27
REIURN 28
29

The second preparatory subroutine is the standard Fortran subroutine


'Gettim.' This subroutine is used to obtain the starting and ending times for
the random walk process. Because Monte Carlo calculations often require
significant execution time in order to achieve the statistical accuracy
required by the user, and because the user may wish to compare the
efficiencies of alternative variance reduction schemes, it is useful to keep
track of the time required for problem execution. In addition, knowing the
run time required for processing a small number of particles during a test
run allows the user to estimate the time that will be needed to process the
large number of particles required to obtain the desired accuracy for the
final Monte Carlo result.

5.3 The Random Walk in PFC

The heart of PFC is the random walk. This walk is executed by


subroutines that perform the functions that have been discussed in the
examples of Chapters 1- 4. In PFC, by tying the process steps in the random
5. A Probabilistic Framework Code 125

walk to specific subroutines it is possible to identify and isolate coding that


may have to be modified to accommodate extensions in capability, or to
incorporate additional options in future calculations.
The random walk of a particle in PFC is managed by subroutine 'Walk,'
the library version of which is shown in Table 5.10. The random walk is
performed for 'npart' start particles. This is accomplished by a "do" loop
('Loop_Over_Particles') that loops between lines 7 and 23 in subroutine
'Walk.' At the beginning of the loop, entry point 'Statlp' in subroutine
'Stats' is called to initialize arrays used for tallies during each particle's life.

Table 5.10. Library Version of Subroutine 'Walk'


SUBroJI'INE WALK 1
CCM1:N/IN/npart, nbatrn 2
REAL (8) ctnfp,dtr,xsec,dcur 3
CCM1:N/TRACK/ctnfp, dtr, xsec, dcur 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ! 5
CCM1:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
lJ:x:p Over Particles: CO i=l,npart ! locp over nU!lber of particles 7
- CALL Statlp initialize statistics for earn particle 8
CALL SCUR::E get source pararreters for particle 9
lJ:x:p for Collisions: CO to find collision sites 10
CALL- DIST get distance of travel in mfp 11
lJ:x:p_Track: CO track particle to collision point 12
CALL HIT get distance to boundary of current zone 13
CALL MXSEC get total cross section for current zone 14
IF((dtr-dcur)*xsec.GE.dmfp) EXIT Loop Track ! collision before boundary 15
CALL BDRX ! process boundary crossing 16
IF(nzcur.EQ. -1) EXIT lJ:x:p for Collisions ! particle killed e.g., by escaping 17
END CO lJ:x:p Track - - ! 18
CALL COL - ! to process collision 19
IF(nzcur .EQ.-1) EXIT lJ:x:p for Collisions ! particle killed by collision 20
END CO lJ:x:p for Collisions - - 21
CALL Stau:r.P process statistics when particle killed 22
END CO lJ:x:p_Over_Particles ! 23
REI'URN 24
END 25

Subroutine 'Source,' shown in Table 5.11, is called to set the starting


parameters (location, direction, energy, age, and weight, as appropriate for
the specific problem) for the particle to be tracked. The library subroutine
'Source' starts all particles isotropically at the origin. Particle weighting
will be discussed in Chapter 6.
The direction cosines for an isotropic unit vector are obtained in
subroutine 'Source' by calling subroutine 'Isoout.' This latter subroutine,
shown in Table 5.12, uses the coding discussed in Example 3.1, eqn 3.29, to
obtain the required direction cosines. The same coding can be used for
isotropic scattering in the laboratory coordinates and thus, as will be
discussed below, 'Isoout' can be called from subroutine 'Col' to obtain post-
collision parameters when such a scattering model is used. This version of
'Isoout' is similar to that of Table 3.2.
126 Chapter 5

Table 5.11 . Library Version of Subroutine 'Source'


St.JBroJl'INE scmcE 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 2
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
pi=2.OdO*IlAlXS(0 .0d0) ! keep for rrore CCIlplicated source that needs pi 4
x=O.OdO; y=O .OdO; z=O.OdO! starts at origin 5
nzcur=1 assurres source is in zone one 6
CALL rsccur direction chosen isotrcpical1y 7
wate=l.OdO particle starts with a weight of one 8
RE:IURN 9
~ 10

Table 5.12. Library Version of Subroutine 'lsoout'


SUBFaJI'INE rsccur 1
REAL (8) fltrn,r,stheta,phi,pi 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
r=FLTRN () ! 5
pi=2.OdO*IlAlXS(0.0d0) 6
u=-l. OdO + 2. OdO*r 7
stheta=~(l.OdO-u**2) 8
r=FLTRN() 9
phi=2.OdO*pi*r 10
v=stheta*OOIN(phi) 11
w=stheta*CC'Q) (phi) 12
RE:IURN 13
~ 14

The tracking of particles from collision to collision is accomplished in


the 'LoopJor_Collisions,' which is contained in the coding of lines 10
through 21 in the library 'Walk' subroutine. This loop is used to obtain a
particle flight path, to track the path through the problem geometry, and to
determine the location of the next collision.
The first subroutine called in the collision loop in 'Walk' is 'Dist,' which
is shown in Table 5.13. This subroutine determines the number of mean
free paths the particle will travel before the next collision. Portions of the
Fortran used in 'Dist' are identical to that used to obtain particle flight paths
in previous example problems. The subroutine also initializes data needed
for the tracking process. When a particle encounters a zone boundary before
reaching its next collision point, a repetitive sampling procedure could be
used to find a new flight path, as was illustrated in Example 3.4. However,
as in Example 3.5, PFC uses only one sampling of the exponential
distribution per flight path. The resulting flight path, specified in mean free
paths, is converted to units of length according to the cross section
specifications for the zones traversed by the path.
Particle tracking through the problem geometry takes place in the
'Loop_Track,' which extends from line 12 to line 18 in the library version
of subroutine ' Walk.' The first subroutine called in the track loop is 'Hit.'
This subroutine is shown in Table 5.14. 'Hit' determines the physical
distance a particle must travel along its current flight direction before
5. A Probabilistic Framework Code 127

exiting the current zone; i.e., before it "hits" a boundary. Given the results
of calculations indicating whether or not individual bodies are "hit" by the
particle track, and given the descriptions of the zones in terms of their
constituent bodies, the routine determines whether a track intersects a given
zone and, if so, the distance to the entry and exit points of that zone along
the particle flight path.

Table 5.13. Library Version of Subroutine 'Dist'


SUBfOJI'INE orsr 1
RFAL(8) FLTm, r 2
RFAL(8) dmfp,dtr,xsec,dcur 3
c:c:Mm/TIW:K/dmfp, dtr, xsec, dcur 4
RFAL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
c:c:Mm/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
RFAL(8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& ! 7
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 8
U:X;!CAL bdtest (40), bdhit (40) 9
c:c:Mm/cg/sphcx, s~cy, ~z, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, & ! 10
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit i l l
r=FLTm () ! pick a randcm nurrber 12
dlifp=-DU:X;(r) distance traveled in rrean free paths 13
xo=x; yo=y; zo=z store "starting" position for track 14
dcur=O.ODO initialize distance currently traveled 15
IX) 50 i=1,nbdy 16
bdtest(i)=.F.ALSE. beginning a new track, no bcxiies yet tested 17
50 CXNI'INUE 18
19
20

The track must intersect all of the positive bodies that constitute a zone -
i.e., those for which a point must be inside the bodies to be in the zone - in
order for the particle to enter the zone. The distance the particle must travel
before entering the zone cannot be less than the distance to enter the first
such body, while the distance to leave the zone cannot be more than the
distance to leave the last such body. Points must be outside all of the
negative bodies of a zone in order to be in the zone. If the track does not
intersect a negative body of a zone the calculation of entry and exit points
need consider only the positive bodies. However, if the track does intersect
a negative body, then the particle leaves the zone when it enters that body.
The logic of determining the bodies through which the particle track will
pass, and of calculating the distances to entry and exit of each of those
bodies, was used in Example 3.5. In PFC the calculation of the intersection
of the flight path with spheres is performed in subroutine 'Sph.' This
subroutine is shown in Table 5.15. The only difference between 'Sph' and
the program shown in Table 3.12 is the coordinate translation required in
order to include spheres whose centers are not at the origin. The geometric
logic underlying the calcul~tion was discussed in Section 3.7. The
subroutine for calculating the distance to entry and exit points for RPPs,
128 Chapter 5

Table 5.14. Library Version of Subroutine 'Hit'


SUBmJI'INE HIT 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 2
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) dnfp,dtr,xsec,dcur ! dcur is the distance already traveled 4
OOMMON/TRACK/dmfp,dtr,xsec,dcur 5
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 6
rpymin(20) , rpyrrex (20) , rpzmin(20), rpzmax(20) , bdin (40) ,bdout(40) 7
LOGICAL bdtest(40), bdhit(40) 8
OOMMON/cg/sphcx, sphcy, sphcz, sphr, rpxm:in, rpxrrax, rpymin, rpyrrex, rpzmin, rpzmax, & 9
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit 10
REAL (8) dlarge, c:lsrrall ! 11
dlarge=1. ODt37; c:lsrrall=1. 0D-I0 12
dtr=dlarge ! dtr will be distance to leave current zone 13
ro 50 i=l,nbz (nzcur, 1) ! check each body in current zone, nzcur 14
nbs=nbz (nzcur,i+l); nb=abs (nbs) 15
IF(.NOI'.bdtest(nb))THEN ! see i f body has already been tested 16
bdtest(nb)=.TRUE. ! body not previously tested, so test 17
IF(nb.LE.nrpp)THEN; CAIJ., RPP(nb) ! the body is either a RPP 18
ELSE CAIJ., SPH(nb) ! or the body is a sphere 19
ENDIF 20
ENDIF 21
IF(bdhit(nb))THEN ! i f the particle passes thru the body, get dist 22
IF(nbs.LT.O .AND. bdin(nb) .Gl'.dcur .AND. bdin(nb) . LT.dtr) THEN 23
dtr=bdin(nb); nbout=nb! for negative body, leave zone when enter body24
ELSE IF(nbs.GI'.O .AND. bdout(nb) .GI'.dcur .AND.bdout(nb) .LT.dtr)THEN! 25
dtr=bdout (nb); nbout=nb! for positive body, leave zone when leave body26
ENDIF 27
ENDIF 28
50 CCNI'INUE 29
dtr=dtr+c:lsrrall !lOve point a snall arrount to get off exact boundary 30
l£lcp Zones: ro i=l,nzones-1 ! 31
- newzn=nnext (nzcur,nbout,i, 1) ! search zones in rrost prcbable order 32
Wcp Bodies: ro j=l,nbz(newzn,1) 33
- nbs=nbz(newzn,j+1); nb=abs(nbs) 34
IF(.NOI'.bdtest(nb))THEN; bdtest(nb)=.TRUE. 35
IF(nb.IE.nrpp)THEN; CAIJ., RPP(nb) 36
ElSE ; CAIJ., SPH (nb) 37
ENDIF 38
ENDIF 39
IF(.NOI'.bdhit(nb))THEN 40
IF(nbs.LT.O)CYCLE Wcp_Bodies 41
CYCLE Wcp Zones 42
~ - c
IF(bdin(nb) . LT.dtr .AND. dtr.LT.bdout(nb))THEN 44
IF(nbs.LT.O)CYCLE l£lcp Zones 45
CYCLE - 46
ELSE 47
IF(nbs.GT.O)CYCLE l£lcp Zones 48
CYCLE - 49
ENDIF 50
ENDIF 51
END ro Wcp Bodies 52
nnext (nzCur,nbout,i,2)=nnext(nzcur,nbout,i,2) +1 found newzone, optimize search 53
IF(LGI'.1 .AND. nnext(nzcur,nbout,i,2) .GI'.nnext(nzcur,nbout,i-1,2))THEN ! chng sort54
ntemp9nnext(nzcur,nbout,i,2); nnext(nzcur,nbout,i,2)=nnext(nzcur,nbout,i-l,2) ! 55
nnext(nzcur,nbout,i-1,2)=nterrp; ntemp9nnext(nzcur,nbout,i,1) ! 56
nnext(nzcur,nbout,i,I)=nnext(nzcur,nbout,i-l,I); nnext(nzcur,nbout,i-1,1)=nterrp !57
ENDIF; RE:IURN 58
END ro l£lcp Zones 59
WRITE(16-;-*) 'Lost in space'; CAIJ., [U1p could not find a new zone 60
END 61
5. A Probabilistic Framework Code 129

subroutine 'Rpp,' is shown in Table 5.16. The logic for determining


whether a track intersects the planes that make up an RPP is relatively
simple because in PFC we limit the faces of the RPPs to planes
perpendicular to the coordinate axes.

Table 5.15. Library Version of Subroutine ' Sph'


SUBFaJI'INE SPH(nb) 1
REAL (8) temp1,temp2,xe,ye,ze 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo, uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) sphcx(20),sphcy(20),sphcz(20) ,sphr(20),rpxmin(20),rpxrnax(20),&! 5
rpymin(20),rpymax(20),rpzmiri(20),rpzrnax(20),bdin(40),bdout(40) 6
lffilCAL J:x!test(40), bdhit(40) 7
OOMMON/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpxrnax, rpymin, rpymax, rpzrnin, rpzrnax, & 8
bdin,J:x!out,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),J:x!test,bdhit 9
bdhit(nb)=.FALSE. 10
ns--nb-nrpp ! get the index to the sphere 11
xe=xo-sphcx (ns) ; ye=yo-sphcy (ns) ; ze=zo-sphcz (ns) ! dist to origin of sph 12
tempI=u*xe+v*ye+w*ze ! Sect 3.7 explains calc 13
temp2=templ **2 - (xe**2 + ye**2 + ze**2 - sphr(ns)**2) 14
IF(temp2.LT.0.dO)RETURN 15
temp2=DSQRT(temp2) 16
bdin(nb)=- templ-temp2 17
J:x!out(nb)=-templ+temp2 18
IF(J:x!out(nb) .LE.O.dO)RETURN 19
bdhit(nb)=.TRIJE. 20
RETURN 21
DID 22

Each zone that a particle enters along its flight path is related to the zone
the particle is leaving. As the problem proceeds, the coding in 'Hit' uses the
arrays defined at the end of subroutine 'Geomin ' to identify those zones
most likely to be encountered when leaving a given zone. Then, when
determining the zone to be entered when exiting this zone the subroutine
searches through the zones in the most likely order based on those already
found. This "learning" process will generally reduce the time required for
tracking particles in complex geometries.
Since a mistake may occur in the geometry description, it is possible for
particles to become lost due to this error. When this occurs subroutine ' Hit'
writes the message "Lost in Space" and calls subroutine 'Dump.' The
'Dump' subroutine, shown in Table 5.17, writes the geometry description
along with the last known location and direction of the particle, and then
stops the calculation. The information provided by 'Dump' can be used to
help determine errors in the geometry description.
As mentioned above, even when the user is confident that the geometry
has been correctly defined, particles may occasionally be lost. In this case
the user may choose to replace the 'stop' statement in subroutine ' Dump'
with a 'return' statement, and thereby allow the calculation to proceed even
though some particles have been lost. If the number of particles lost is
130 Chapter 5

negligible compared with the number of start particles one usually assumes
that the systematic bias caused by such lost particles is also negligible.

Table 5.16. Library Version of Subroutine 'Rpp'


SUBroJI'INE RPP(oo) 1
REAL (8) dlarge,dtiny,cb<ntin,dxm3x,dymin,dyrrex 2
REAL (8) dzmin, cIzrtax, tatpl, tatp2 3
PAPJ.\ME:I'ER (dlarge=1.0d37,dtiny=1.0d-37) 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,we,wate,age,energ ! 5
c:x:lM::N/PARI'/x, y, z, u, v, w,xo, yo, zo, uo, vo, we, wate, age,energ,nzcur,newzn,.ngroup 6
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),~(20),rpxrnax(20),&! 7
rpymin(20),rpyrrex(20),rpzrnin(20),rpzmax(20),bdin(40),bdout(40) 8
I.o:;ICAL bdtest(40), bdhit(40) 9
c:x:lM::N/cg/sphcx, sphcy, sphcz, sphr,~, rpxrnax, rpymin, rpyrrex, rpzrnin, rpzmax, & 10
bdin,bdout,nsph,nrpp,nbdy,nzanes,OOz(40,41),nnext(40,40,40,2),bdtest,bdhit 11
bdhit(OO)=.rnLSE. ! 12
if outside and can't get in, retum 13
IF«xo.LT.~(OO) .AND. u*dlarge.LT.~(oo)-xo)& 14
.CR. (xo.GI'.rpxrnax(OO) .AND. u*dlarge.GI'.rpxrnax(OO)-xo»& 15
RETURN 16
IF«yo.LT .rpymin(OO) .AND. V*dlarge.LT .rpymin(OO)-yo) & 17
.CR. (yo.GI'.rpyrrex(OO) .AND. V*dlarge.GI'.rpyrrex(OO)-yo»& 18
RETURN 19
IF«zo.LT. rpzrnin (00) .AND. W*dlarge.LT.rpzrnin(OO)-zo)& 20
.CR. (zo.GI'.rpzmax(OO) .AND. W*d1arge.GI'.rpzmax(OO)-zo»& 21
RETURN 22
if inside x-planes and VD1't hit than 23
IF(xo.GI'.~(OO) .AND.xo.LT. rpxrnax (00) .AND.ABS(u) .LT.dtiny)THEN 24
dxrni.n=-dlarge; dxmax=dlarge 25
ELSE 26
tatp1= (~(oo) -xo) /u; tatp2= (rpxrnax (00) -xo) /u 27
dxmin=CMrN1 (tatp1, tatp2); c:lxm3x=lM\X1 (tatp1, tatp2) 28
ENDIF 29
if inside y-planes and won't hit than 30
IF(yo.GI'.rpymin(OO) .AND.yo.LT.rpyrrex(OO) .AND.ABS(v) .LT.dtiny)THEN 31
dymin=-dlarge; dymax=dlarge 32
ELSE 33
tatp1= (rpymin (00) -yo) Iv; tatp2= (rpyrrex (00) -yo) Iv 34
dymin=CMrN1 (tatp1, tatp2); dynax=lM\Xl (tatp1, tatp2) 35
ENDIF 36
if inside z-planes and won't hit than 37
IF(zo.GI'.rpzrnin(OO) .AND.zo.LT.rpzmax(OO) .AND.ABS(w) .LT.dtiny)THEN 38
dzmi.n=-dlarge; dzmax=dlarge 39
ELSE 40
tatp1= (rpzrnin (00) -zo) /w; tatp2= (rpzmax (00) -zo) /w 41
dzmin=CMrN1 (tatp1, tatp2) ; dzmax=lM\Xl (tatp1, tatp2) 42
ENDIF 43
bdin (00) =lM\Xl (cb<ntin, dymin, dzmin) ; bdout (00) =CMrN1 (dxm3x, dyrrex, cIzrtax) 44
IF(bdout(OO) .LT.O.OdO)RETURN; IF(bdin(OO) .GI'.bdout(OO»RETURN 45
bdhit(OO)=.TRUE. 46
RETURN 47
END 48

Subroutine 'Mxsec' is shown in Table 5.18. This subroutine is called by


'Walk' to obtain the total cross section for the material in the current zone.
The library routine is valid for a monoenergetic calculation only. In general
the determination of the material cross section must take into account the
energy of the particle.
5. A Probabilistic Framework Code 131

Table 5.17. Library Version of Subroutine 'Dump'


SUBIOJI'INE lXM' 1
REAL (a) sphcx(20),sphcy(20),sphcz(20),sphr(20),~(20),~(20),& 2
rpymin(20) ,IpYl!I!IX(20) ,Ipzmin(20) ,Ip:zmax(20) ,bdin(40) ,bdrut(40) 3
LOGICAL bdtest(40) , bdhit(40) 4
CXl>KN/cg/sphcx, sphcy, sphcz, sphr,~,~, Ipymln, IpYl!I!IX, Ipzmin, Ip:zmax, & 5
bdin,bdrut,nsph,nxpp,nbdy,nzones,ribz(40,41) ,nnext(40,40,40,2) ,bdtest,bdhit 6
REAL (8) cinfp,dtr,xsec,dcur ! 7
CXl>KN/TRPCKIcinfp, dtr, xsec, dcur 8
REAL (8) x,y,z,u,v,w,XO,i'O,ZO,uo,vo,W),wate,age,energ ! 9
CXl>KN/PARr/x,y,z,u,v,w,xo,yo,zo,uo,vo,W),wate,age,energ,nzcur,newzn,ngroup 10
'!his subrootine dl.1Ips particle arx:I gearetry info if the particle 11
gets "lost in space" during tracking. '!he infomatien is used to 12
check the descriptien of the prcblem gearetry for "holes." 13
write(16,*) 'start of dump--bdtest,bdhit' 14
write(16,*) (bdtest(i),i=l,nzones); write(6,*) (bdhit(i),i=l,nzones) 15
write(16,*)'bdin'; write(6,*) (bdin(i),i=l,nzones) 16
write(16,*)'bdrut'; write(6,*) (bdrut(i),i=l,nzenes) 17
write (16, *) 'ribz ' 18
do 50 i=l,nzones 19
wriEe(16, *) 'zone' ,i; write (6, *) (ribz(i, j), j=l,nzones+1) 20
50 cx:ntinue 21
write (16, *) 'nnext ' 22
do 60 i=l,nzones 23
do 60 j=l,nbdy 24
write(16,*) (nnext(i,j,k,l),k=l,nzones) 25
60 cx:ntinue 26
write(16,*) 'x,y,z ',x,y,z; write(6,*) 'xo,yo, zo',xo,yo, zo 27
write(16,*)'u,v,w',u,v,w; write(6,*)'nzcur,newzn',nzcur,newzn 28
write(16,*)'cinfp,dtr,dcur',cinfp,dtr,dcur 29
stop 30
an 31

Table 5.18. Library Version of Subroutine 'Mxsec'


SUBIOJI'INE MXSEX: 1
REAL (8) cinfp, dtr, xsec, dcur 2
CXl>KN/TRPCKIcinfp, dtr, xsec, dcur 3
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,W),wate,age,energ ! 4
CXl>KN/PARr/x,y,z,u,v,w,xo,yo,zo,uo,vo,W),wate,age,energ,nzcur,newzn,ngroup 5
REAL (a) sigt(20),c(20) ! 6
CXl>KN/GEX:M/sigt,c ! sigt is total cross sectien, c is nen-absoIptien plXb 7
xsec.-sigt (nzcur) ! 8
REI'URN 9
am 10

Using the flight path from 'Dist,' the physical distance to the boundary
from 'Hit,' and the total cross section from 'Mxsec,' the 'Walk' routine
determines whether the particle will suffer a collision within the current
zone or will escape from the zone. This test is performed on line 15 of
subroutine 'Walk.' If the path continues into the next zone the particle is
"stopped" at the boundary in order to process the boundary crossing.
Subroutine 'Bdrx,' shown in Table 5.19, is called by 'Walk' to process
boundary crossings. Although the library version of 'Bdrx' does not include
any scoring when a boundary crossing occurs, it can be updated to do so.
Examples of using 'Bdrx' for event scoring are shown in Chapter 7.
132 Chapter 5

Table 5.19. Library Version of Subroutine 'Bdrx'


SUBEOJI'INE BOOX 1
REAL (B) delta 2
REAL (B) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 3
rpymin(20), rpyuax(20), rpzmin(20) , rpzrrax (20) ,txlin(40) ,lxIout (40) 4
LOGICAL bdtest(40), bdhit(40) 5
cnM:N/cg/sphcx, sphcy, SIilCz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzrrax, & 6
txlin,lxIout,nsph,nrpp,nbdy,nzanes,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit 7
REAL (B) x, y, z, u, v, w, xo, yo, zo, \lO, vo,~, wate, age, energ ! B
cnM:N/PART/x,y,z,u,v,w,xo,yo,zO,\lO,vo,~,wate,age,energ,nzcur,newzn,ngroup 9
REAL (B) cInfp,dtr,xsec,cb..!r ! 10
cnM:N/TRPCKIcInfp, dtr, xsec, cb..!r 11
delta=dtr-cblr ! delta~stance traveled to ream boundary 12
cIcur-dtr ! update current distance traveled 13
cInfp=cinfp-delta*xsec ! subtract current distance in mfp fran cInfp 14
x=x+u*delta; y=y+V*delta; z=z-+w*delta ! update position 15
nza.u:=newzn change identifier of current zone 16
if (nzcur. LT. nzones) RETURN i f not at ooter zane then return 17
nzcw:=-1 ! set nzcw:=-1 i f in ooter zone (for escape) 1B
RETURN ! 19
END 20

If the next collision occurs within the current zone the tracking of the
particle flight path is complete and PFC is ready to process the collision.
Collision events are processed in subroutine 'Col,' shown in Table 5.20. A
collision may result in the particle being killed, the same particle emerging
with a new direction and energy, or secondary particles being produced.

Table 5.20. Library Version of Subroutine 'Col'


SUBEOJI'INE CXlL 1
REAL (B) FLTRN,delta 2
REAL (B) x, y, z, u, v, w, xo, yo, zo, \lO, vo,~, wate, age, energ 3
cnM:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) cInfp,dtr,xsec,cb..!r ! 5
cnM:N/TRACK/cInfp, dtr, xsec, cb..!r 6
REAL (8) sigt(20),c(20); ! diIrensions allow up to 20 different rredia 7
cnM:N/GEX:M/sigt,c; !sigt is total cross section, c is non-absorption prdJ B
delta=ctnfp/xsec ! distance traveled to collision 9
dtr=clcur-+delta ! update total distance traveled 10
x=xo+u*dtr; y=yo+V*dtr; z=zo+w*dtr ! update position 11
wate=wate*c(nzcur) ! reduce wate by non-absorption prcbability 12
IF(wate.LT.0.1dO)'I'HEN if wate SllI3.ll play Russian roolette 13
IF(wate.LT. FLTRN()'I'HEN i f particle killed by RR 14
nzcw:=-1 set nzcw:=-1 to show particle killed 15
RETURN 16
ENDIF 17
wate=l.OdO particle survived RR, increase wate 1B
ENDIF 19
CALL Iscx:ur assurres isotrq>ic scatter in lab system 20
RETURN ! 21
END 22

The procedure used in 'Col' is closely related to the collision subroutines


used in the examples of the preceding chapters. The library version of
subroutine 'Col' assumes isotropic scatter in the laboratory coordinates
either with or without absorption. Provisions are included for changing the
5. A Probabilistic Framework Code 133

particle weight at collisions, and for basic "Russian roulette." These


concepts are discussed in Chapter 6.
If the particle history is terminated by subroutines 'Col' or 'Bdrx,' the
zone number is set to -1. After the return from either 'Bdrx' or 'Col,'
'Walk' checks the zone number to see if the particle has been terminated.
When a particle is terminated, entry point 'Statelp' of subroutine 'Stats'
(Table 5.9) is called to accumulate the appropriate statistical information for
that particle. After all particles are processed, subroutine 'Walk' calls
subroutine 'Gettim' to determine the completion time for the problem.

5.4 Computing the Response

When the random walk for all of the source particles is completed the
main program calls subroutines to calculate and print the results. Entry
point 'Statend' of subroutine 'Stats' (Table 5.9) is used to calculate the
standard deviations in the results stored in the library arrays 'bscore' and
'cscore,' and to print the results. In addition, subroutine 'Output' is
available to calculate and print any additional information desired. The
library version of subroutine 'Output,' shown in Table 5.21, obtains and
prints the ending random number seed. As with all routines in this
framework, the user can modify 'Output' to meet the requirements of any
particular problem.

Table 5.21. Library Version of Subroutine 'Output'


SUBroJI'INE oorror 1
CALL rnc\cut (iseed) 2
WRITE(16,*), Ei1ding ranclannunber seed is ',iseed 3
REI'URN 4
END 5

Example 5.1. Using PFC to solve Example 3.1

Example 3.1 consists of a point isotropic source of monoenergetic


neutrons emitted into a sphere of pure scattering material. The scattering
material has a radius of 10 mfp. The scattering is isotropic in the laboratory
system. In Example 3.1 the average flux was calculated in O.I-mfp-thick
shells around the point source. The results of the Chapter 3 calculation are
shown in Figure 3.3 . We wish to reproduce the results of Example 3.1 using
PFC.
Starting with the library version of PFC, we will modify several routines
to solve this problem. A list of the modified routines and the tables in which
they are given is shown in Table 5.22. A comparable table will be provided
for all subsequent examples in this book. Subroutines not listed are
134 Chapter 5

identical to the library versions. The line numbers shown in the modified
subroutines of this and future examples are unchanged from the library
versions. Unnumbered lines contain changes and line numbers not listed
indicate lines that have been omitted.

Table 5.22. Modified Sub routmes fior Exampte 5 \


Subroutine Location
'Col' Table 5.25
'Stats' Table 5.26

The geometric description for this example using the PFC combinatorial
geometry routines is given in the file 'geom.txt,' shown in Table 5.23. Only
one sphere, centered at the origin, with a radius of 10 units, is needed to
describe the physical shapes. Zone one is defined as the interior of the
sphere. Zone two is defined as everything not in the sphere. Particles
therefore "escape" if they leave the sphere.

Table 5.23. Geometry Description for Example 5.\


o There are no RPPs
1 There is one SPH
O.OdO O. OdO O. OdO 10. OdO Origin and radius ofSPH
2 Number of zones
1 Zone one has one body
1 Body "\" is the body
1 Zone two has one body
-1 Body"-\" is the body

The cross section information for this calculation is given in the file
'xsects.txt,' shown in Table 5.24. Since only the first zone contains
scattering material and the size of the sphere is 10 mfp, the total cross
section is set to 1.0. The material is a pure scatterer and therefore the non-
absorption probability at each scattering event is also 1.0.

Table 5.24.

The average flux in O.l-mfp-thick shells will be calculated by scoring the


location of each collision in an array defined for the purpose. Subroutine
'Col' has been modified to accomplish this scoring, as shown in Table 5.25.
Common 'stat' has been added and the dimension of the arrays 'cscore' and
'csumsq' have been changed to permit the use of 100 radial bins. The array
'cpart' is used for accumulating scores for individual particles. The spatial
bin for scoring a collision, calculated after line 11 of the modified
subroutine 'Col,' is based on the distance from the center of the sphere to
5. A Probabilistic Framework Code 135

the collision point. It assures that each bin in the array ' cscore' corresponds
to 0.1 mfp. Once the correct bin has been found the weight of the particle,
'wate,' at the collision is added to the tally in this bin.

Table 5.25. Subroutine 'Col' for Example 5.1


SUBFOJl'INE (X)L 1
REAL (8) FI.:rm, delta 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) dnfp, dtr, xsec, cbJr ! 5
OOMMON/'ml\CK/dnfp, dtr, xsec, cbJr 6
REAL (8) sigt(20),c(20); ! d.inensioos ail<M up to 20 different Ired.ia 7
OOMMON/GEX:M/sigt,c; !sigt is total cross sectioo, c is ncn-absorptioo prcb 8
REAL (8) bscore (10) , bstInsq (10) ,cscore (100) , c:sunsq (100) , I::part (10) , qxIrt (100)
OOMMON/SI'AT Ibscore, bstInsq, cscore, c:sunsq, I::part, qxIrt
delta=dnfp/xsec ! distance traveled to collisioo 9
c:lt:r-d:::ur-tta ! update total distance traveled 10
x=xo+u*dtr; y=yo+V*dtr; =o+w*dtr ! update positioo 11
r=DSQRT(x*x+y*y+z*z)
i=INT(10.0d0*r)+1 in::Iex to zooe in Iftlich collisioo oocurs
qxIrt(i)=qxIrt(i)+wate ! score wate of particle colliding in zooe
wate=wate*c(nzcur) ! redI..Ire wate by ncn-absorptioo prcbability 12
IF(wate . LT. 0 . 1dO)'llIEN if wate snail play Russian roolette 13
IF(wate. LT.FLTm() )'llIEN if particle killed by RR 14
nzcur=-1 set nzcw:=-l to s11cM particle killed 15
RE:l'Um 16
ENDIF 17
wate=1.0d0 particle StUVived RR, increase wate 18
ENDIF 19
CALL ISCXl.1I' assures isotrcpic scatter in lab system 20
RE:l'Um ! 21
END 22

Because we have modified the dimensions of the arrays 'cscore' and


'csumsq' in subroutine 'Col' we must change subroutine 'Stats' to be
consistent. The modified subroutine 'Stats' is shown in Table 5.26. These
modifications include matching the dimensions of the arrays in common
'stat' to those used in subroutine 'Col.' In addition, the subroutine has been
changed to accumulate statistics only in the 'cscore' and 'csumsq' arrays,
and to take into account the new dimensions of these arrays. Finally. the
volumes of the spherical bins are calculated. By dividing the total weight of
the scores in each bin by the volume of the bil! one can obtain correctly
normalized flux estimates. Subroutine 'Stats' prints the results of the
calculation to the standard printer, which is defined in the main program
(Table 5.1) as 'Iptl,' but the results could easily be stored in a text file or
displayed on the computer screen.
The exact procedure for using the PFC subroutines for solving a problem
will depend on the specific Fortran language package being used. However,
the basic procedure is as follows. The library subroutines for PFC are
compiled and placed into a user library. The main program, which has not
been modified in this example and is therefore identical to that shown in
Table 5.1, is then compiled along with all modified subroutines. Finally, the
l36 Chapter 5

object file produced is linked with the PFC library to supply the final coding
for solving the problem. As expected, the results obtained by running this
modified version of PFC are the same as those of Example 3.1, with only
statistical variations because of different random number sequences.

Table 5.26. Subroutine 'Stats' for Example 5.1


SUBroJI'INE Stats 1
RFAL (8) bscore (10) , bsumsq (10) , cscore (100) , csumsq (100) , tpart (10) , qxrrt (100)
CCMniI/STAT/bscore, bs\.IIBq, cscore, csunsq, tpart, qxrrt ! 3
CCMniI/IN/npart, nbatch 4
RFAL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
CCMniI/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
RFAL(8) trrp,trrp1,tmp2,var,stdev,pi,vol
ENI'RY StatCile ! entry point to initialize arrays for ccnplete proolan 8
cscore=O. OdO; csumsq=O. OdO
RE:ruRN 10
ENl'RY StaUp entry point to initialize arrays for a particle 11
qxrrt;(). OdO
RE:ruRN 13
ENl'RY StatEIp entry point to store scores for a particle 14
ro i=1,100
cscore(i)=cscore(i)+cpart(i) store score
csumsq (i) =CSlllBq(i) +cpart (i) **2 ! store square for variance calculatioo
END ro
RE:ruRN 19
ENl'RY StatEnd entry point to calculate and print results 20
pi=2.OdO*DAOOS(0.0d0) ! to ootain a double precision Pi
t:IlIrDFillI.T (npart) 21
ro i=1,100
var=csumsq(i)/t:np-(cscore(i)/trrp) **2 ! variance of cscore distrib.ltioo
stclev=~ (var) ! standard deviation of cscore distr
trrp2=DFillI.T(i)/10.OdO
vol=4.OdO*pi*(trrp2**3-(trrp2-0.1dO)**3)/3.0d0 ! volumes to normalize scores
WRITE(16,10)cscore(i)/trrp,stdev/~(trrp),&
cscore(i)/trrp/vol,stdev/~(trrp)/vol
END ro
10 FORMAT(lx,4Fl4.8)
RE:ruRN 28
END 29

Although much about PFC may appear new and different upon first
glance, most of the coding is closely related to the custom routines that were
developed to solve the examples in Chapters 1 - 4. In those examples we
developed specialized routines to track particles, to perform isotropic
scattering, to transform scattering angles from C to L coordinates, and to
perform other functions. PFC allows us to place these and other processes
that we will develop for use in Monte Carlo transport into a formalized
structure. None of the flexibility exhibited by the custom routines has been
lost since any or all of the coding in the PFC library routines can be changed
as needed. The routines are intended to be easy to understand, and the user
should be able to modify or extend the coding as required for specific
problems. We will expand the applicability of PFC to realistic transport
5. A Probabilistic Framework Code 137

problems, and incorporate additional features representative of production


Monte Carlo codes, in the following chapters.

Exercises

1. Repeat Example 5.1 using a sphere with radius 15 mfp. Compare the
Monte Carlo results to the diffusion theory solution (eqn 3.34.)

2. Repeat Example 5.1 using a uniformly distributed source throughout the


volume ofthe sphere, instead of a point source.

3. Repeat Exercise 1 of Chapter 4 using PFC.

4. Consider Example 3.5.


a. Repeat the example using PFC. [Hint: Use an RPP with large x and y
dimensions to approximate an infinite slab.]
b. Convert the flight path determination in subroutine 'Dist' to the option
of obtaining a new flight path whenever a particle track encounters a
new zone. Repeat the example using this option in PFC.

1 W. Guber, et aI., "A Geometric Description Technique Suitable for Computer Analysis of
Both the Nuclear and Conventional Vulnerability of Armored Military Vehicles," MAGI-
6701, Mathematical Applications Group, Inc., White Plains, NY, 1967.
Chapter 6

Variance Reduction Techniques

6.1 Introduction

In the examples presented thus far the sampling has been unbiased; i.e.,
the points at which the independent variable was evaluated were selected
from the distribution function that directly describes the sampling problem.
Although nature always plays unbiased Monte Carlo, the practitioner cannot
always do so. Calculations must produce an answer in a reasonable time
with a reasonable expenditure of effort. This may not be possible without
the use of some mathematical technique for reducing the variance.
Fortunately there are methods available that can assist the user in this
regard. Variance reduction, properly applied, can improve the results of a
Monte Carlo calculation without requiring an increase in the amount of
computational resources applied to the problem; i.e., variance reduction
methods can increase the efficiency of the calculation.
Any practical Monte Carlo result will have a non-zero variance
associated with it. As explained in Chapter 2, this variance can almost
always be reduced by increasing the number of samples taken from the
distribution being analyzed. However, the rate of reduction in the variance
obtained by this method, being generally proportional to the square root of
the number of samples, is slow. To reduce the variance in a sampled
quantity one usually makes use of a technique such as stratification, or of
importance sampling. The latter is sometimes referred to as "biasing."
Stratification involves the definition and use of sub-regions in the domains
of certain variables in the problem but does not change the distribution from
which samples are selected. Importance sampling, on the other hand,
139
140 Chapter 6

changes the distributions from which the samples are selected. The key
issue in making such changes is to leave the mean value of the result
unchanged while reducing the variance of the sample.
The theoretical basis for variance reduction using biasing was provided
in Section 2.5. There jt was shown that one can select from a modified
distribution function V'("'I ",fthe form given by eqn 2.92,

,( ) _ V(x)f(x)
(6.1)
V x - g(x)

As was shown in Chapter 2, using this equation to produce the modified


distribution V'(x) will guarantee the same answer as the original distribution
functionV{x), and careful selection of g(x) can result in a reduction in the
variance of the result for the same input of resources. In this chapter we will
examine various methods for defining g(x). We will also look at other
variance reduction techniques, and determine the resulting gain in
calculational efficiency for a few simple examples.
In order to quantify the relative merits of the different methods of
variance reduction to be examined in this chapter, whether used separately
or in combination, we need to establish a consistent basis for determining
the efficiency of each calculation. To accomplish this we will adopt the
definition of efficiency proposed by Hammersley and Handscomb; viz., the
efficiency e will be defined as "inversely proportional to the product of the
sampling variance and the amount of labor expended in obtaining this
estimate") or

1
e=-- (6.2)
Ta 2

Here T is the run time of a calculation and a 2 is the variance of the result.
Obviously this expression cannot be used to compare the results obtained
from different problems, or even from different estimated quantities in the
same problem. However, it provides a useful means for quantifying the
effect of applying alternative variance reduction techniques to a particular
result.

6.2 Source Biasing

For problems in which the source particles are distributed over space,
energy, angle, or time, some source particles may be more likely to
contribute to a particular result than others. In such problems it is often
6. Variance Reduction Techniques 141

useful to sample from a biased source distribution in which the probability


of selecting a source particle from a point in phase space of high importance
- one which makes a relatively large contribution to the result - is greater
than that of selecting a particle from a location of low importance. Further,
it is often possible to add stratification to a source distribution as a means of
achieving additional variance reduction. That is, variance reduction
methods can be combined to increase the efficiency of a calculation. The
Monte Carlo practitioner must seek to identify and apply those methods that
offer the best opportunities for improving the efficiency of the particular
problem under consideration. The following example illustrates the
combination of source biasing and stratification.

Example 6.1. Leakage of particles from a slab

Consider an isotropic source of particles emitted uniformly throughout a


homogeneous slab of scattering and absorbing material. We assume the
particles are monoenergetic. We wish to calculate the probability that a
particle will leak from the slab. In order to address a case in which the
probability of a particle escaping from the slab varies strongly with source
location, we will consider a slab that is ten mfp thick and that has a non-
absorption probability of 0.5. Thus particles born at the edges of the slab
will be much more likely to escape than those born in the middle of the slab.
Stratification and biasing of the source distribution should be useful for
improving the efficiency of this calculation. For simplicity we will assume
the scattering is isotropic in the laboratory coordinate system.
We will begin by solving the problem using analog Monte Carlo.
Starting with the library version of the PFC code, as described in Chapter 5,
we will modify several routines in order to solve the current problem. A list
of the modified routines and the tables in which they are given is shown in
Table 6.1. Subroutines not listed are identical to the library versions. To
execute the calculation the user must link the modified routines to the PFC
library as described at the end of Example 5.1.

Table 6.1. Modified Subroutines for Example 6 I with Unbiased Source, No Stratification
Subroutine Location
'Source' Table 6.2
'Bdrx' Table 6.3
'Col' Table 6.4
'Stats' Table 6.5

The modified subroutine 'Source,' shown in Table 6.2, selects an


isotropic source particle that is located at a random point within a slab that
142 Chapter 6

is one dimensional unit (nominally 1 cm) thick in the Z direction.


Subroutine 'Bdrx,' modified to score particles that exit the slab, is shown in
Table 6.3. All particles start in the slab, which we will define as zone one,
and whenever a boundary crossing occurs (and thus 'Bdrx' is called) the
particle will either have leaked from the negative-Z (or left) side of the slab,
or it will have leaked from the positive-Z (or right) side. In these two cases
the weight of the particle is scored in the first or second element of the
subscripted array 'bpart,' respectively.

Table 6.2. Subroutine 'Source' for Example 6.1 with Unbiased Source, No Stratification
SUBIOJI'INE saJR:E ! 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) FL'mN
z=FL'mN () pick uniformly across slab
x=O.OdO; y=O.OdO starts particle aloog z-axis
nzcur-=l assures source is in zooe me 6
CALL ISCXlJI' directioo chosen isotrcpica11y 7
wate=1.OdO particle starts with a weight of me 8
REIURN 9
aID 10

Table 6.3. Subroutine 'Bdrx' for Example 6.1 with Unbiased Source, No Stratification
SUBIaJI'INE BOO)( ! 1
REAL (8) delta 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 8
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
REAL (8) cInfp, dtr, xsec, <leur ! 10
OOMMON/TAACK/cInfp, dtr, xsec, <leur 11
REAL (8) bscore(10) , bsunsq (10) , cscore (10) ,cs\.l1\Sq(10) ,1::part(1O) , cpart: (10)
OOMMON/STIIT/bs=re,bsunsq,cscore,csunsq,I::part,cpart:
delta=dtr-dcur ! delta--distance traveled to read! boondary 12
cbJr=dtr ! up:late current distance traveled 13
ctnfp=dnfp-delta*xsec ! subtract current distance in mfp fran cInfp 14
z=z+w*delta update positioo, z-directioo ooly
IF(z.LE.O.OdO)THEN
l::part(l)=wate leaks left
ELSE
1::part(2)=wate leaks right
aIDIF
nzcur-=-l set nzcur=-l (for escape)
REIURN 19
aID 20

The modified subroutine 'Col' is shown in Table 6.4. Because we are


interested only in the Z coordinate of the particle we can track the particle in
one dimension, as was done in Example 3.3. Therefore this subroutine
has been changed to account for tracking only in the Z direction. In
addition, at each collision site a random number is compared with the non-
absorption probability in order to choose whether the particle will scatter or
will be absorbed in the collision. Finally, the modified subroutine 'Stats' is
6. Variance Reduction Techniques 143

shown in Table 6.5. This subroutine accumulates statistics for the two cases
being scored in this problem.

Table 6.4. Subroutine 'Col' for Example 6.1, with Unbiased Source, No Stratification
SUBFa1I'INE CXlL 1
RFAL(8) FLTRN,delta 2
RFAL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
RFAL(8) cInfp,dtr,xsec,dcur ! 5
OOMMON!TRACKIcInfp,dtr,xsec,dcur 6
RFAL (8) sigt (20) , c (20) ; ! dirrensioos allCM up to 20 different rredia 7
OOMMON/GE01/sigt,c; !sigt is total cross secticn, c is ncn-absorpticn proo 8
delta=ctnfp/xsec ! distance traveled to collisicn 9
d~elta up:late total distance traveled 10
x=xo; y=yo; z=zo+w*dtr up:late positicn, z-directicn cnly
IF(fltm().Gl' .c(nzcur»THEN See if particle is killed in collisicn
nzcur=-1 set nzcur=-1 i f killed
REI'URN
ENDIF
CAI.J., IscaJr asS\.lteS isotrcpic scatter in lab system 20
REI'URN ! 21
END 22

Table 6.5. Subroutine 'Stats' for Example 6.1 with Unbiased Source, No Stratification
SUBroJI'INE Stats 1
RFAL(8) bscore(10) , bsumsq (10) , cscore (10) ,csumsq(10) ,!:part (10) ,cpart(10) 2
OOMMON/S'OO'Ibscore, bstJI\Sq, cscore, CStJI\Sq,!:part, cpart 3
OOMMON/IN/npart, nbatch 4
RFAL(8) x,y,z, u, v, w,xo, yo, zo,uo, vo,wo,wate, age, energ 5
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
RFAL(8) tmp,tmpl,tmp2,var,stdev ! 7
ENI'RY Statcne ! entry point to initialize arrays for a:nplete prcblem 8
bscore=O.OdO; bsl.IllSCf"O.OdO; cscore=O.OdO; csumscrO.OdO ! 9
REI'URN 10
ENI'RY StatIp ! entry point to initialize arrays for a particle 11
I:part=O.OdO; cpart=O.OdO ! 12
REI'URN 13
ENI'RY StatEl.p ! entry point to store scores for a particle 14
bscore (1)=bscore (1) +bpart (1) store score 15
bsumsq(l) =bsumsq (1) +bpart (I) **2 ! store square for variance calculaticn 16
bscore(2)=bscore(2)+bpart(2) ! store score
bsumsq (2) =bsumsq(2) +bpart (2) **2 ! store square for variance calculation
REI'URN ! 19
ENI'RY StatEnd. ! entry point to calculate and print results 20
~DF'lG\T (npart) 21
~q(I)/tmp-(bscore(I)/tmp)**2 variance of left distr
stdev=~ (var) standard deviaticn of left distr
WRITE(16,*)bscore(I)/tmp,stdev/~(tmp) result and std dev of result 24
var=bsumsq(2)/tmp-(bscore(2)/tmp) **2 variance of right distr
stdev=~(var) standard deviaticn of right distr
WRITE(16,*)bscore(2)/tmp,stdev/~(tmp) result and std dev of result
REI'URN 28
29

The geometry description for this problem is shown in Table 6.6. The
geometry consists of a single RPP that is one dimensional unit thick in the Z
direction. This unit dimension was chosen to match the sampling used for
the spatial source distribution in the modified subroutine 'Source;' i.e., the Z
coordinate of a start particle is selected for 0 < z < 1, and thus the Z limits of
144 Chapter 6

the RPP used to define zone 1 are [0,1]. Because we consider only the Z
coordinate of the particle flight path, the dimension of the RPP in the x-y
plane should be irrelevant. However, in order to make use of our standard
geometry input and tracking routines, these lateral dimensions must be large
enough to prevent particles from escaping from the "sides" of the slab. For
convenience we assume all particle free flights start on the Z axis but we
include all three direction components in computing the collision point.
From the Appendix we know that the smallest number that can be
obtained with the random number generator we are using is [2 31 - 1]-1 ::::: 4.7
x 10-10 • By eqn 2.14, this number corresponds to a flight path of
approximately 21.5 mfp. This is the greatest distance a particle can travel in
a single flight in our calculation. Thus, since in subroutine 'Col' after each
flight path the particle is returned to the Z axis, if the lateral dimensions of
the slab are set greater than 21.5 mfp the particles cannot escape along the X
and Y axes and the slab is effectively infinite in these directions. We have
chosen to define the maximum (x,y) extent of the slab to be 50 units of
distance, which for ~t ~ 21 .5/50 ensures that no particles escape out the
sides of the slab. The input for the cross section data has been used to
define the thickness of the slab in mfp by setting ~ = 10, which means a unit
(1 cm) thickness corresponds to ten mfp.

Table 6.6. Geometry Description for Example 6.1


1 ~e~P
-50.0 50.0 -50.0 50.0 0.0 1.00 Coordinates for ~P
o No spheres
2 Two zones
~e body in first zone
First zone is body "1"
~e body in second zone
-1 Second zone is body "-1 "

Executing the code described in Tables 6.2 - 6.5, with the geometry of
Table 6.6, c = 0.5, and ~ = 10, provides separate estimates of the probability
of source particles leaking from the left and right faces of the slab. The sum
of these quantities constitutes the desired result. Because of symmetry, the
two partial results should be equal, and by comparing them we can get some
indication of the accuracy of the calculation. The results obtained from
running 107 source particles with this analog version ofPFC, which required
102 sec of execution time, are 0.04258 and 0.04266 for the left and right
leakage probabilities, respectively. The standard deviations estimated for
these results are 6.38 x 10-5 and 6.39 x 10-5, and thus by eqn 6.2 the
efficiency of this analog calculation is about 2.4 x 106 • The right and left
leakage estimates agree to within just over one standard deviation.
However, by using only a single zone in the slab we have no data on the
6. Variance Reduction Techniques 145

spatial dependence of collisions and particle tracks within the slab. Thus we
have forgone information on the sampling of phase space within the slab in
favor of a simple geometry. The separate scores for the left and right
leakage compensate somewhat for this shortcoming, but in a real problem
we might prefer to add some spatial resolution to help evaluate the
thoroughness with which we have sampled the important regions of the slab.
To begin the application of variance reduction to this problem we will
first consider the use of stratification based on source location and direction.
The list of the modified subroutines to be used in this stratified calculation
is given in Table 6.7. We have arbitrarily selected ten equal-width spatial
and ten equal-cosine-width angle bins in which to score the results. As
before, we will proceed by selecting a source particle location randomly
over the width of the slab. However, this time we will score the result ofthe
particle leakage based on the bin in which it was born. Thus we will
produce a matrix of 200 scores - one hundred estimates of the left leakage,
one for each source bin, and the same number for the right leakage.

Table 6. 7. Modified Subroutines for Example 6 1 with Source Stratification


Subroutine Location
' Col' Table 6.4
' Source' Table 6.8
'Bdrx' Table 6.9
'Stats' Table 6.10

The modified subroutine 'Source' is shown in Table 6.8. When a source


particle is produced in this subroutine it is assigned an index (n,m) =
(iocation,angle) depending on its start parameters. The number of start
particles selected in bin (n,m) is tallied in the array ' nsamp.' Particle
leakage is scored in subroutine 'Bdrx,' shown in Table 6.9. When a particle
leaks from the slab its weight and the square of its weight are scored in
the tally arrays ' bscore' and 'bsumsq,' or 'cscore' and 'csumsq,' on the
basis of the source bin (n,m). The number of scores in ' bscore' and 'cscore'
is recorded in 'nsampb' and 'nsampc,' respectively, so that the contribution
to the result from each bin can be normalized.
The standard deviations of the estimates for each of the scoring bins are
calculated in subroutine 'Stats,' shown in Table 6.10. 'Stats' creates an
output file that lists the leakage and variance for each source bin. The sum
of the left and right leakage results over the n x m bins gives the total left
and right leakage per source particle ('totalsb' for left leaking and 'totalsc'
for right leaking particles.) The sum of these left and right leakage results is
the total leakage per source particle. The variances of the left and right
leakages are the sums of the variances of the separate contributions ('tvar 1'
for left and 'tvar2' for right leakage, respectively). Because we plan to
146 Chapter 6

make use of the total leakage by spatial bin later, we have included in
subroutine 'Stats' a calculation of the sum of the leakages over the angles.
These results are stored in the arrays 'zstratb' and 'zstratc' for the left and
right leakage, respectively. The variances in these totals, 'zstratb2' and
'zstratc2,' are calculated and written to the output file.

Table 6.8. Subroutine 'Source' for Example 6.1 with Source Stratification
SUBRCUI'INE sana 1
REAL(8} x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 2
COMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL(8} FLTRN
REAL(8} bscore(10, 10) ,bs\.IlIsq(10, 10) ,cscore(10, 10} , csumsq (10, 10}, &
bpart(10},cpart(10}
COMMON/STAT Ibscore, bsumsq, cscore, csumsq, bpart, cpart, &
nsamp(10,10},nsampb(10,10},nsaropc(10,10}
COMMON/EXAMPLE/n,rn
nzcur=l source is in zooe ooe
z=FLTRN(} pick unifoIInly across slab
x=O.OdO; y=O . OdO starts particle aloog z-axis
CALL ISCXJJr directioo chosen isotrcpically 7
wate=1.OdO particle starts with a weight of ate 8
rn=INT(5.OdO*(w+1.0d0»+1 index for scoring by angle
IF (rn.GI' . 10}rn=10
n=INT(10 . OdO*z}+1 index for scoring by locatioo
IF(n.GI'.10}n=10
nsanp(n,rn}=nsarrp(n,rn}+1 nl.llber of particles in each bin
REl'URN 9
Em 10

Table 6.9. Subroutine 'Bdrx' for Example 6.1 with Source Stratification
SUBroJI'INE 8m{ 1
REAL(8} delta, score
REAL (8) x, y, z, u, v, w, xo, yo, zo, uo, vo, wo, wate, age, energ ! 8
COMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
REAL(8} ctnfp,dtr,xsec,cX:ur ! 10
COMMON/TEW::K/ctnfp, dtr, xsec, cX:ur ! 11
REAL(8} bscore(lO, 10} ,bs1.Insq(lO,10} ,cscore(10,10} , csumsq (10, 10}, &
bpart(10),~(10}
COMMON/STAT/bscore, bsUl5q, cscore, csUl5q, bpart, cpart, &
nsanp(10,10},nsampb(10,10},nsaropc(10,10)
COMMON/EXAMPLE/n,rn
delta=dtr-dcur delta~stance traveled to reach boondary 12
cb.lr=dtr update current distance traveled 13
~lta*xsec subtract current distance in rnfp fran ctnfp 14
z=z+W*delta update positioo in z-directioo
score=wate/100 . OdO since bin should contribute 1/100 of source
IF(z.LE.O.OdO}THEN
nsampb(n,rn)=nsampb(n,rn)+1 leaks left
bscore (n, rn) =bscore (n,rn) +score store score
bsumsq (n,rn) =bsumsq(n,rn} +score**2 store square for variance calculatioo
ElSE
nsanpc(n,rn}=nsarrpc(n,rn)+1 leaks right
cscore (n,rn}=csoore (n,rn}+score store score
csurnsq(n,rn}=csumsq(n,rn}+score**2 store square for variance calcu1atioo
EmIF
nzcur=-l set nzcur=-l if in outer zate (for escape) 18
REl'URN ! 19
END 20
6. Variance Reduction Techniques 147

Table 6. 10. Subroutine 'Stats' for Example 6.1 with Source Stratification
SUBFOJTINE Stats 1
RE1IL(8) tnp, tnpl, t:np2, var, stdev, totalsb, totalsc, tvarl, tvar2
RE1IL(8) bscore (10,10) ,bsl.l!'req(lO,lO) , cso:>re (10, 10) ,csumsq(lO, 10), &
bpart(lO),cpart(lO),zstratb(lO),zstratb2(lO),zstratc(lO),zstratc2(lO)
CXlMN/SI'AT/bso:>re,bsunsq, cso:>re, csl.ll'5q, bpart, cpart, &
nsamp(lO,lO),nsampb(lO,lO),nsampc(lO,lO)
ENI'RY Statcne ! entry point to initialize arrays for carplete prd:>lan 8
bscore=O.OdO; bsunsq=O.OdO; cso:>re=O.OdO; csunsq=O.OdO 9
nsanp=O; nsarq::b=O; nsanpc=O
zstratiFO. OdO; zstratb2=O. OdO; zstrat~. OdO; zstratc2=O. OdO
REI'UPN 10
ENI'RY StatIp entry point to initialize arrays for a particle 11
REI'UPN 13
ENl'RY StatEIf> entry point to store scx>res for a particle 14
REI'UPN 19
ENl'RY StatEnd. entry point to calculate and print results 20
totalsb=O.OdO; totals~.OdO; tvarl=O.OdO; tvar2=O.OdO
ro 200 i=I,lO
ro 200 j=I,10
var=O.OdO
k=nsarrp (i, j) ; tllp=DElllP.'I' (k)
IF(k.GE.l)THEN !Scores for left results follC1N *****
var=bsl.l!'req(i,j)/tmp-(bso:>re(i,j)/tnp) **2 Variance by bin
totalsb=totalsb+bso:>re (i, j) /tnp overall currulative scx>re
zstratb(i)=zstratb(i)+bso:>re(i,j)/tnp CUrulative scx>re in stratun i
bso:>re(i,j)=bscore(i,j)/tnp Score by bin
tvar1=tvarl+var/tnp Variance of overall a.mulative scx>re
zstratb2(i)=zstratb2(i)+var/tnp Variance of stratun i scx>re
bsl.ll'5q(i,j)=var/tnp Store variance of bin scx>re
var=O.OdO !Scores for right results follC1N *****
var=csumsq(i,j)/tmp-(cso:>re(i,j)/tnp) **2 ! Variance by bin
totalso=totalsc+cso:>re (i, j ) /tnp overall a.mulative scx>re
zstratc(i)=zstratc(i)+cso:>re(i,j)/tnp Ctm.llative so:>re in stratun i
cso:>re(i,j)=cso:>re(i,j)/tnp Score by bin
tvar2=tvar2+var/tnp Variance of overall C\.IlUlative so:>re
zstratc2(i)=zstratc2(i)+var/tnp Variance of stratun i scx>re
csl.ll'5q (i, j )=var /tnp Store variance of bin scx>re
ENDIF
200 <XNI'INUE
stdev=DSQRT(tvar1) standard deviaticn of distr
WRITE(16,*)totalsb,stdev result and std dev of result
stdev=DSQRT (tvar2) standard deviaticn of distr
WRITE(16,*)totalsc,stdev result and std dev of result
0PEN(UNIT=18,file='output.txt')
ro 300 i=I,10
ro 300 j=I,10
WRITE(18,*)nsamp(i,j),cso:>re(i,j),csl.l!'req(i,j),nsampc(i,j)
300 CCNrINUE
WRITE(18,*) (zstratb(i),zstratb2(i),DSQRT(zstratb2(i»,&
zstratc(i),zstratc2(i),DSQRT(zstratc2(i»,i=1,10)
REI'UPN 28
END 29

The results for 'zstratc' and the associated variances from a calculation
using this stratified example with 107 start particles are shown in Table 6.11.
As expected, the major contribution to the variance in the right leakage
estimate is from scores for particles starting in the three rightmost spatial
bins; i.e., from strata numbers 8, 9, and 10. It would appear from these
results that selecting more start particles from the spatial bins near the right
148 Chapter 6

surface than from the bins near the left or center of the slab would reduce
the variance in the right leakage and improve the efficiency of the
calculation. By symmetry, a similar statement could be made about the
leakage through the left surface. Therefore, because the total leakage is the
sum of the left and right leakages, one should be able to improve the
accuracy of the sum by starting particles preferentially near the surfaces of
the slab.

Table 6.11. Selected Output Data for Example 6.1 with Source Stratification
Spatial Stratum Leak Right Probability Leak Right Variance
1 2.9936E-6 2.9869E-13
2 9.6002E-6 9.S982E-13
3 2.1176E-S 2.I144E-12
4 S.6987E-S S.6998E-12
5 1.470 1E-4 1.4654E-1I
6 4.0062E-4 3.9720E-1I
7 1.0710E-3 1.0449E-10
8 3.0157E-3 2.8344E-1O
9 8.7468E-3 7.3295E-10
10 2.9IS6E-2 1.5494E-9

To test this assertion we will repeat the stratified calculation using a


biased spatial distribution of the source; i.e., we will define a modified
distribution function for selecting the location of source particles that
approximates the spatial dependence of the variance attributed to the various
spatial bins as shown in Table 6.11. We will make this biasing symmetric
about the center of the slab in order to improve both the left and right
leakage. Our biasing will be done in the following rather arbitrary fashion:
we will select start particles in the outermost bins (left and right) with a
relative probability of four. From the next inner bins we will select source
particles with a relative probability of three; and for the third inner bins we
will use a relative probability of two. Source particles will be selected
uniformly from the four centermost bins with a relative probability of one.
The relative weighting of the ten source zones, using the above biasing
scheme, is thus "4,3,2, I, 1, 1, 1,2,3,4."
A listing of the modified subroutines used for this calculation is shown
in Table 6.12. A modified subroutine 'Source' that selects start particles
using this biasing scheme is given in Table 6.13. This routine uses spatial
biasing only. One may anticipate that additional improvements in efficiency
would be possible if angular source biasing were included along with spatial
biasing. In subroutine 'Source' the location of a source particle within a
given spatial bin will be selected uniformly over the bin. In subroutine
'Stats' we divide the mean obtained for each stratum by the number of start
6. Variance Reduction Techniques 149

particles selected for that stratum and hence do not need to modify the
weight of the start particles in order to playa fair game.

Table 6.12. Modified Subroutines for Example 6 I with Source Biasing and Stratification
Subroutine Location
'Col' Table 6.4
'Bdrx' Table 6.9
'Stats' Table 6.10
'Source' Table 6.13

Table 6.13. Subroutine 'Source' for Example 6.1 with Source Biasing and Stratification
SUBroJI'INE SCXJR::E 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
CCMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) FLTRN,r
REAL (8) bscore(10, 10) , bsunsq (10, 10) , cscore (10, 10) ,csumsq(10, 10), &
bpart(10),cpart(10)
CCMMON/~T/bscore,bsunsq,cscore,csumsq,bpart,cpart,&
nsamp(10,10),nsampb(10,10),nsampc(10,10)
CCMMON~/n,m
DIMENSICN ibias (3, 22)
~~ ibias/0,0,4,0,0,4,0,0,4,0,0,4,&
1,4,3,1,4,3,1,4,3,2,7,2,2,7,2,3,9,1,4,10,1,5,11,1,6,12,1,&
7,13,2,7,13,2,8,15,3,8,15,3,8,15,3,&
9,18,4,9,18,4,9,18,4,9,18,4/
nzcur=1 ! origin is in zooe ooe
r=FLTRN () *22. OdO
i=INr(r)+l
z=((r-D~T(ibias(2,i»)/D~(ibias(3,i»+D~T(ibias(1,i»)/10.OdO
x=O.OdO; y=O.OdO ! starts particle along z-axis
CALL lso:ur direction chosen isotrcpically 7
wate=l.OdO particle starts with a weight of one 8
IIFINr(5.0d0*(w+1.0d0»+1 index for scoring by ang1e
IF(rn.GI' .10)1IF1O
n=INr(10 .OdO*z)+1 index for scoring by location
IF(n.GI'.10)n=10
nsamp (n, rn) =nsamp (n, rn) +1 nuTi:Jer of particles in each bin
REl'URN 9
END 10

The left and right leakage results obtained from the three different
methods of solution of this example problem - analog, unbiased stratified,
and spatially biased stratified - are shown in Table 6.14. The efficiencies
for the three calculations, based on eqn 6.2, are shown in the last column of
the table. In each case 107 start particles were used. Unbiased source
stratification is found to increase the efficiency of the leakage calculation by
about 46% compared with the analog calculation. However, more
importantly this stratified source calculation provides the additional benefit
of generating data that can be used as the basis for selecting reasonable
spatial source-biasing parameters, as incorporated in the third calculation.
Using a simple spatial biasing scheme in combination with stratification
increases the efficiency of the calculation by an additional 54% compared
with the analog baseline. Thus we see that the use of both stratification and
150 Chapter 6

source spatial biasing doubles the efficiency of the calculation compared


with the analog approach. The stratification and source biasing used in this
example was not optimized in any sense and further improvement in
efficiency should be possible by refining the parameters used.

Table 614 Resu Its fior Exam Ie 6 I


Problem Run time Fraction leaking left Fraction leaking Efficiency
(s) right
Analog 102 0.04258 ± 6.38E-5 0.04266 ± 6.39E-5 2.4E+6
Stratified 104 0.04265 ± 5.24E-5 0.04263 ± 5.23E-5 3.5E+6
Biased 100 0.04259 ± 4.54E-5 0.04266 ± 4.55E-5 4.8E+6

One general measure ofthe importance of a particle is its distance from a


detector. Usually the closer a particle is to a detector the more important it
is to that detector. In the above example source particles born near the outer
surfaces of the slab were "close" to the leakage detectors, and were
therefore more important than those born near the center of the slab.
Biasing the source particle selection such that particles were preferentially
selected from the important outer regions of the slab was found to reduce the
variance in the result. "Close" in this context is a relative term. In addition
to physical proximity, the direction the particle is traveling and the energy of
the particle may be factors in determining its importance.

6.3 Survival Biasing

In Monte Carlo transport, substantial calculational effort may have been


invested in bringing a particle close to a detector. It is reasonable to assume
that we would not like to see the particle disappear (by absorption or other
means) until it has been used to sample the region around the detector. On
the other hand, if a particle diffuses into a region far from a detector it is
reasonable to assume we do not want to waste very much effort tracking it.
In the latter situation we might like to "kill" the particle; however, to avoid
introducing systematic errors in our result we do not want to disturb the
particle balance in doing so. Survival biasing, Russian roulette, and splitting
are enabling techniques that allow us to implement the preceding objectives
by controlling the weights of particles as they are tracked. These techniques
allow us to modify the tracking process and thereby emphasize the portions
of phase space that are of importance to the result being sought.
Each time a free neutron interacts with a nucleus, or the components
therein, there is a non-zero probability that the neutron will be absorbed. In
analog Monte Carlo this interaction is treated directly and, if the result of
the interaction is determined to be an absorption, the particle track is
6. Variance Reduction Techniques 151

tenninated. Thus in an analog calculation a particle that has been tracked


for many collisions, and may have reached a location near a detector, could
suddenly be tenninated and lost to the calculation.
To avoid the problem of killing particles by absorption, while still
playing a fair game, a technique called survival biasing may be used. In this
technique particles are never killed by absorption. Instead, to ensure a fair
game, the weight of the particle leaving the collision is set equal to the
weight entering the collision multiplied by the non-absorption probability.
That is,

Weight after collision = Weight before collision *(1- ~:J (6.3)

where La is the absorption, and Lt the total, cross section. With survival
biasing particles get lighter in weight as they experience collisions in
materials for which the non-absorption probability is less than one. When
multiply-collided particles can contribute significantly to the desired answer
this technique can decrease the variance of the solution. The disadvantage
of survival biasing, when used in isolation, is that significant computation
time can be expended tracking particles that have very small weights and
therefore make small contributions to the result. This is shown in the
following example.

Example 6.2. Particles passing through a slab

Let us reconsider the problem of a parallel beam of neutrons nonnally


incident on a homogeneous slab. For simplicity, we assume the thickness of
the slab is unity, that scattering is isotropic in the laboratory coordinate
system, and that the particles are monoenergetic. The total cross section and
the non-absorption probability for the neutrons will be treated as variables.
We wish to calculate the probability of a particle being transmitted through
or reflected from the slab. We will solve the problem two ways: using
analog Monte Carlo, in which particles are tenninated when absorption
occurs, and using survival biasing. We will then compare the results to see
the effect of the survival biasing on the efficiency of the calculation. The
subroutines modified for the analog calculation are listed in Table 6.15,
while those for the case with survival biasing are shown in Table 6.16. The
geometry description for the slab in this example is the same as that for
Example 6.1, shown in Table 6.6. The desired result is the fraction of the
particles reflected (that leak to the left) and the fraction of the particles
transmitted through the slab (that leak to the right.)
152 Chapter 6

I 6.2, Anal 0 g Case


Table 6.15. Modified Subrouf IDes fior Example
Subroutine Location
'Bdrx' Table 6.3
'Col' Table 6.4
' Stats' Table 6.5
'Source' Table 6.17

Table 6. 16. Modified Subroutines for Example 6.2, Survival Biasing


Subroutine Location
'Bdrx' Table 6.3
'Stats' Table 6.5
'Source' Table 6.17
'Col' Table 6.18

The 'Source' subroutine, shown in Table 6.17, has been modified to


provide a source that is normally incident on the slab; i.e., positioned at the
origin and traveling in the positive-Z direction. The 'Bdrx.,' 'Col,' and
'Stat' subroutines for the analog case are the same as those used in the
analog calculation of Example 6.1. A version of subroutine 'Col,' modified
to implement survival biasing, is shown in Table 6.18. This is the only
routine that needs to be changed to switch between the analog solution
and the survival biasing solution for this example. As in Example 6.1 the
cross section data input is used to set the non-absorption probability and to
define the total cross section. The latter is used to set the desired slab
thickness in mfp.

Table 6.17. Subroutine ' Source' for Example 6.2


SUB!O.lTINE SCl.lICE 1
RE1\L (8) X, y, z, u, V, w, xo, yo, zo, \lO, vo, w::>, wate, age, energ 2
OOMMON/PARr/x,y,z,u,v,w,xo,'jO,zo,uo,vo,w::>,wate,age,energ,nzcur,newzn,ngroup 3
x=O . Od.O; y=O.Od.O; z=() . Od.0! starts at origin 5
nzcur=1 assures scurce is in ZClle CIle 6
u=O . Od.O; v=O .Od.O; \oFl.Od.O ! start all p3rticles in +z directioo
wate=l.Od.O particle starts with a weight of CIle 8
REl'llR'l 9
END 10

Without survival biasing a particle track can be terminated by


transmission, reflection, or absorption, while with survival biasing a track
can be terminated only by transmission or reflection. We would anticipate,
therefore, that on a per-start-particle basis the calculation with survival
biasing will take longer than that without. Thus in order for survival biasing
to increase the efficiency of the calculation, the variance reduction must be
sufficient to counter the effects of increased run time. With biasing we
should be able to reduce the number of start particles and obtain an answer
with the same or smaller variance than that obtained from a baseline,
unbiased calculation.
6. Variance Reduction Techniques 153

Table 6.18. Subroutine 'Col' for Example 6.2, Survival Biasing


SUffiOJI'INE COL 1
REAL (8) FLTRN,delta 2
REAL (8) x, y, z, u, v,w,xo,yo, zo, 110, vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,l1O,vo,wo,wate,age,energ,nzcur,newzn,ngIOUp 4
REAL (8) ctnfp,dtr,xsec,dcur ! 5
OOMMON/TPJ\CK/ctnfp,dtr,xsec,dcur 6
REAL (8) sigt(20),c(20); ! clinensioos allCM up to 20 different rredia 7
OOMMON/GEX:M/sigt,c; !sigt is total cross sectioo, c is noo-absorptioo prd:> 8
delta=anfp/xsec ! distance traveled to collisioo 9
dtr=dcur+delta ! upjate total distance traveled 10
x=xo; y=yo; z=zo+w*dtr upjate positioo, z--<lirectioo ooly
wate=wate*c (nzcur) ! reduce wate by noo-absorptioo prOOability 12
CALL ISCXlJT assurres isotrcpic scatter in lab system 20
FEIUP.N ! 21
END 22

Table 6.19 shows the probability of neutron transmission through and


reflection from slabs of 1- and 10-mfp thickness with a non-absorption
probability of 0.5, calculated with and without survival biasing. The
efficiencies of the calculations are shown in columns five and seven of the
table. As expected, for the same number of start particles ::. ~ variances in
the results with survival biasing are smaller than those without. However,
when the run time is taken into account, only in the case of the reflection of
neutrons from the l-mfp slab is the efficiency increased by using survival
biasing. The efficiency of the transmission result for the I-mfp slab is
almost unchanged by the use of survival biasing, but the efficiencies of both
the reflection and transmission results are significantly decreased by using
survival biasing with the 10-mfp slab.
This result is easy to understand. With survival biasing, particles are
followed until they leak from the slab. Many more collisions are computed
in the 10-mfp case than in the I-mfp case, and time is spent tracking
particles with very small weights. As a result the efficiency of the
calculation is decreased. Although this example is not necessarily
representative of the range of problems to which Monte Carlo techniques
can be applied, survival biasing used by itself appears to offer little towards
improving the efficiency of Monte Carlo transport calculations. To reduce
the inefficiency incurred by tracking light particles with survival biasing a
mechanism is needed to kill such particles. A technique for killing these
particles, while still playing a fair game, is described in the next section.

r.able 6. 19 ResuIts f;or Example . or tart artlC es


Thickness Biasing Time Reflected E Transmitted E
Imfp None Ss 0.0991± .00030 2.2+6 0.44S± .OOOSO 8.I+S
1 mfp Survival lis 0.0993± .00018 2.9+6 0.44S± .0004S 4.5+S
10mfp None 8s 0.1147± .00032 1.2+6 l.l9-4± l.l-S l.l+9
10mfp Survival lIO s O.lISl± .00018 2.8+S 1.29-4± 8.1-6 1.4+8
154 Chapter 6

6.4 Russian Roulette

Since the score contributed by a particle is always proportional to its


weight, if weights are allowed to decrease without limit then computational
effort will be expended tracking particles that contribute negligibly to the
desired result. Such computational effort would obviously be better spent
on tracking particles that have a chance of contributing significantly to the
result. However, having applied survival biasing, and knowing that light-
weight particles will be generated in the random walks, one cannot merely
define a weight below which particles will be killed. This would not be a
fair game and could introduce significant errors into the results. Therefore
we are faced with the need to develop a means of killing light-weight
particles while maintaining fair-game conditions. The solution to this
problem is called Russian roulette.
To kill light particles yet maintain a fair game one must conserve the
total weight of the particles that are tracked. This can be done by assigning
the weight carried by the particles that are killed to that of the surviving
particles. One need not do this deterministically, such as by adding the
specific weight lost by the death of one particle to that of a surviving
particle. Rather, one can produce the desired result statistically by using kill
and survival probabilities. Use of such probabilities provides considerable
flexibility to the Monte Carlo practitioner and eliminates the need for
maintaining a record of the weights of killed and surviving particles to use
in subsequent Russian roulette games.
In its simplest form, Russian roulette can be played by comparing the
current particle weight, w, to some desired lower weight limit WL. Ifw < WL
the particle can be killed with some fixed probability PIc. To determine
whether such a particle is killed one can test a random number; against this
probability and if; < PIc the particle is killed. If the particle is not killed it
can be assigned a new weight w' = w/PIc and the random walk can continue.
If the new weight is still below WL the process can be repeated. This simple
scheme would guarantee that light particles will not continue to be tracked,
but it does not allow the weight of the surviving particles to be controlled.
In a more sophisticated application of Russian roulette, the weight of the
surviving particles can be fixed. Let us define this survival weight as wA.
To implement this method, the weight of each particle upon entering a zone,
or upon experiencing a collision, is compared with the lower weight limit.
If w ~ WL the tracking continues with no change. If w < WL the particle is
subjected to Russian roulette and will be killed with the probability

(6.4)
6. Variance Reduction Techniques 155

If the particle survives Russian roulette it is assigned the weight wA. Since
the probability of the particle surviving is equal to w/wA, and the game is
played only if w < WL, the ratio WUWA controls the probability with which a
particle survives the game. If this ratio is small - i.e., if WL « WA - few
particles subjected to Russian roulette will survive. This may be undesirable
since many light-weight particles that have been tracked to some point in
phase space, perhaps laboriously, could be killed indiscriminately and rarely
replaced with a heavy particle. Therefore it is customary to set wA within an
order of magnitude of WL.
The real utility of Russian roulette is that the values of WL and wA can
vary throughout the geometry in any manner the user desires. Thus average
particle weights can differ in different parts of the problem geometry and the
floor below which particle weights cannot continue to decrease can vary
with location, energy, direction, or any other problem variables. This is
often desirable because as particles move from the source to the detector it
is usually better to use several, gradual changes in weight to smooth out the
scores rather than to use one large change.

Example 6.3. Russian roulette in the slab problem of Example 6.2

In Example 6.2 we used survival biasing in calculating the probability


that normally incident particles would be transmitted through or be reflected
from a slab. Let us now start with the Fortran routines used in that example
and add Russian roulette to see whether the efficiency can be improved. We
will assume the same geometry description, where the thickness of the slab
is one unit, and use the cross section to obtain the desired slab thickness in
mfp. The non-absorption probability is an input variable, the particles are
monoenergetic, and scattering is assumed isotropic in the laboratory system.
The probability of a particle reaching a distance z into the slab without
suffering a collision is given by eqn 3.4. If our start weight is unity, we can
use this uncollided flux as a guide to setting Russian roulette weights. For
example, we can set the Russian roulette weight WL equal to the uncollided
flux value as a function of the distance from the source face of the slab (WL
= e'Lf). For the Russian roulette survival weight we will use WA = 4WL.
These values for wA and WL would seem to be reasonable in view of the
discussions above. That is, they should provide a significant reduction in
the number of light-weight particles tracked (a kill probability of at least
0.75 for particles with weights at or below wd and yet allow the surviving
particles to undergo several collisions before again becoming subject to
Russian roulette.
A calculation that applies a simple, uniform Russian roulette scheme,
with WA set to 1.0 and WL set to 0.1 regardless of the location of the particle
156 Chapter 6

in the slab, will be performed for comparison. A list of the subroutines


modified to perform this calculation is shown in Table 6.20. The version of
subroutine 'Col' used for the simple Russian roulette calculation is shown in
Table 6.21. The difference from the library version is that only the z-
direction location is updated at each collision.

Table 6.20. Modified Subroutines for Example 6 3 with Simple Russian Roulette
Subroutine Location
'Bdrx' Table 6.3
'Stats' Table 6.5
'Source' Table 6.17
'Col' Table 6.21

Table 6.21 . Subroutine 'Col' for Example 6.3 .with Simple Russian Roulette
SllBIU1l'INE <XlL 1
REAL (8) FLTRN,delta 2
REAL (8) x,y, z,u, V,W,'XD, yo, zo,uo,vo,~,wate,age,energ ! 3
~/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) ctnfp, dtr, xsec, dcur ! 5
~/TAACK/ctnfp, dtr, xsec, dcur 6
REAL (8) sigt(20),c(20); ! dinensioos allCM up to 20 different nedia 7
~/GEX:M/sigt,c; !sigt is total cross sectioo, c is noo-absorptioo prd:> 8
delta=dnfp/xsec ! distance traveled to collisioo 9
dtr=<k::ur-tdelta ! update total distance traveled 10
x=xo; y=yo; z=zo+w*dtr update positioo, z-directioo ooly
wate=wate*c(nzcur) reduce wate by non-absorptioo prd:>ability 12
IF(wate.LT.O . IdO)THEN i f wate small play Russian roolette 13
IF(wate.LT.FLTRN()THEN i f particle killed by RR 14
nzcur-=-1 set nzcur-=-1 to shCM particle killed 15
REIURN 16
ENDIF 17
wate=1.OdO particle survived RR, increase wate 18
ENDIF 19
CALL rsa:ur assurres isotrcpic scatter in lab systan 20
REIURN ! 21
END 22

The list of the subroutines modified to employ spatially dependent


Russian roulette parameters is shown in Table 6.22. The modified version
of 'Col' that provides for this capability is shown in Table 6.23. This
routine defines WL as a function of distance into the slab based on eqn 3.4;
i.e., since we will use Lt= 10, WL is set to e-10z • Alternative sets of parameters
in which WL is set to e-2.30258z ::::: lO-z, or to e-z , are indicated.
The results obtained from running 107 start particles incident on a 10-
mfp-thick slab with c = 0.5 are given in Table 6.24. In this table we include
the results from the analog method of Example 6.2 and show the results of
calculations using the four different Russian roulette schemes described
above. The latter four calculations use survival biasing (otherwise Russian
roulette would make no sense) but now we are not concerned about tracking
extremely light-weight particles. Particle tracks are either terminated when
6. Variance Reduction Techniques 157

the particle weight falls below the specified Russian-roulette value, or the
weight of the particle is increased to the survival value. Either way we
impose a lower limit on the particle weights and reduce the average length
of the particle random walks. By allowing lower weights near the detector
than far from the detector we kill light-weight particles that are produced far
from the detector but track such particles when they are produced near the
detector.

Table 6.22. Modified Subroutines for Example 6.3 Using Spatially Dependent Russian
Roulette
Subroutine Location
'Bdrx' Table 6.3
'Stats' Table 6.5
'Source' Table 6.17
'Col' Table 6.23

Table 6.23. Subroutine 'Col' for Example 6.3 Using Spatially Dependent Russian Roulette
SUBroJI'INE COL 1
REA.L(8} FLTRN,delta,WA,WL
REA.L(8} x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REA.L(8} dnfp,dtr,xsec,dcur ! 5
OOMMON/TAACKIdnfp,dtr,xsec,dcur 6
REA.L(8} sigt(20},c(20}; ! d:irrensioos a1l~ up to 20 different rredia 7
OOMMON/GEn1/sigt,c; !sigt is total cross section, c is non-absorption proo 8
delta=dnfp/xsec ! distance traveled to collision 9
dtr=dcur+delta ! Ilfdate total distance traveled 10
x=xo; y=yo; z=zo+w*dtr Ilfdate position, z-ill.rection only
wate=wate*c(nzcur} ! reduce wate by non-absorption prcbability 12
WA=4.OdO*DEXP(-z*10.0} Use -z*2.302585, -z, or -z*10.0
WlA'IA/ 4. OdO
IF (wate.LT.WL) THEN if wate small play Russian roulette
IF(wate/WA.LT.fltm(}}THEN i f particle killed by RR
nzcur=-1 set nzcur=-1 to sh~ particle killed
REl'URN
ENDIF
wate=WA particle survived RR, increase wate
ENDIF
CALL ISCXUI' assurres isotrcpic scatter in lab system 20
REl'URN ! 21
END 22

Tab/e 624 Resu Its r.or ExampJe


I 63 Wit. h 107 Start P artlC fi SIa b, c=05
. Ies, 10-mrp_ .
Biasing Time Reflected E Transmitted E
Analog 75 0.1l5l± 1.0-4 1.3+6 1.35-4±3.7-6 9.8+8
Simple RR 155 0.1152± 6.0-5 1.8+6 1.30-4± 2.9-6 7.9+8
RR, e-z 65 0.1l50± 1.9-4 4.2+5 1.26-4± 3.9-6 1.0+9
RR,IO- z 71 0.1l50± 1.9-4 4.1+5 1.27-4± 3.1-6 1.5+9
RR, e- JOz 138 0.1l5l± 1.6-4 2.7+5 1.28-4± 2.6-6 1.1+9

It is apparent that, for this simple problem, it is difficult to improve the


efficiency of the calculation relative to analog Monte Carlo by using only
survival biasing and Russian roulette. The simple Russian roulette
158 Chapter 6

technique provides some improvement in the efficiency of the reflected


results, while Russian roulette using e-I;.z, where here Lt = 10, may provide
some improvement in the transmitted results. 8 The e-2.30258z Russian
roulette case provides the best transmitted result, with about a 50%
improvement over the analog case. With Russian roulette and survival
biasing we find that the calculation is slowed and that the efficiency is
reduced compared with the analog case unless "good" parameters are used.
In fact, unless care is taken in the selection of parameters, calculations that
include survival biasing and Russian roulette can be significantly less
efficient than analog calculations.

The use of survival biasing in combination with at least "simple"


Russian roulette is often the "norm" for Monte Carlo transport calculations.
However, we have seen that these schemes may not be particularly useful,
whether employed separately or together. On the other hand, as we shall
see, they provide essential support to other variance reduction techniques
that can provide significant improvements in efficiency.
In most problems it is not practical to use analytic functions to determine
the Russian roulette parameters, as was done in the last part of the preceding
example. Instead the problem is usually broken into importance regions and
the Russian roulette parameters are fixed within each region. An
importance region typically consists of one or more zones in the problem
geometry. As with the evaluation of phase-space sampling, tallies of
collisions and track length in these regions can provide the basis for
determining the appropriate Russian roulette parameters for the region, as
well as verifying the thoroughness with which these regions of phase space
have been sampled. In general, it is useful to have the importance regions
defined by geometrical features that are necessary for the tracking process.
However, in some cases it may be necessary to add zones to provide
adequate definition of importance regions. In these cases the additional time
needed to track through the geometry is a negative factor that must be
overcome by the value of adding such zones to the calculation.
To ensure the elimination of all light-weight particles in an importance
region it is possible to play Russian roulette each time a particle enters the
region as well as after each collision in the region. However, it is usually
adequate to play the game only after collisions. Generally one may argue

8 The run times shown here provide only a rough indication of the changes in efficiency
resulting from the variance reduction techniques. Other factors, such as the optimization of
the executable program by the compiler, can result in changes in the run time and it is
difficult to achieve precise quantification of the changes produced by a particular technique.
Therefore, small changes in the run time may not reflect actual changes in efficiency.
6. Variance Reduction Techniques 159

that the path from the boundary to the first collision point does not
contribute much to the variance of the result. Furthermore, for thin regions,
playing the game only after collisions will eliminate the expenditure of
computer resources playing Russian roulette on particles that have a high
probability of passing through the region without suffering a collision.

6.5 Splitting

If there is a wide disparity in the particle weights in any region of the


problem, one will probably find a wide disparity in the scores contributed by
these particles. On the other hand, if all the particles in a region have
roughly the same weight, the scores from these particles are likely to be
about equal. Since approximately equal scores produce low variance,
roughly equal-weight particle populations should produce results with a
lower variance than populations with widely varying weights.
It is possible for a heavy particle to enter a region in which the average
particle weight is small. This could happen, for example, if a particle has a
particularly long flight path, or if the particle gains weight from another
variance reduction game (such as that discussed in the next section of this
chapter). This heavy particle may contribute inordinately to the scores from
the particles tracked in this region, with a resulting increase in the variance.
Therefore it may become important to ensure that the contribution from
unusually heavy particles is sampled thoroughly over the phase space. This
can be done by splitting heavy particles.
We have seen that Russian roulette, by selectively killing light particles
and producing surviving particles of increased weight, is one way to keep
the weights of particles in an importance region above some desired
minimum value. In an analogous manner, splitting can keep the weights of
the particles below some maximum value. Again, to playa fair game, the
sum of the weights assigned to the split particles must, on the average, equal
that of the parent particle. In practice, Russian roulette is frequently used
without splitting, but when Russian roulette and splitting are used in
combination one can define a weight "window" for each importance region
such that the weights of all particles in the region are restricted to values
within this window. That is, for each importance region we can define a
lower weight limit, WL, and an upper weight limit, WH, between which the
weights of all particles in the region must lie.
In a manner analogous to that used in Russian roulette, splitting can be
performed by comparing the particle weight to the desired upper weight
limit. If the initial particle weight w is greater than WH the particle can be
split into a fixed number of particles, say two, and the weight of each of the
split particles reduced by that factor. If the new particles' weights still
160 Chapter 6

exceed the upper weight limit, they may be split again, until the new weight
w' < WHo Alternatively the particle may simply be split into [[W/WH]] + 1
particles (where [[ ]] refers to the integer part of the quantity in brackets)
and the incoming weight shared among the split particles. Each of the new,
light-weight particles can then be tracked in tum.
Let us assume we wish the weight of split particles to be the same as the
Russian roulette survival weight. If w > WH the particle is split into as many
particles of weight WA as possible. For example, n particles of weight WA
will be created if nwA ~ WH < (n+ l)wA. If the remaining weight Wr = WH -
nwA is greater than zero but less than WL, one can play Russian roulette on
this "particle." If WL < Wr < wA, one may simply assign the particle the
weight Wp That is, one can split off particles of weight wA from the parent
particle until the remaining weight is less than WHo The last particle is then
given the residual weight. Alternatively, one can kill the particle with the
probability PIc, with the weight w in eqn 6.4 set to wr, and assign the weight
w A to the surviving particles. All of these options constitute a fair game and
the choice of which method to use is up to the user.
If splitting occurs at a boundary crossing, the new, split particles are
given phase space properties (energy, location, direction of travel) that are
identical to the parent particle. If particles are split at collision points one
may assume the splitting occurs either before or after the collision. Thus the
split particles can emerge from the collision traveling in either the same or
different directions. Choosing whether the splitting should occur before or
after the collision depends on the problem and the result that is being
sampled. Usually the direction in which the particle leaves the collision
point is important in determining its contribution to the answer of interest
and it is better to select from different scattering directions rather than
assigning the same direction to all of the split particles.
We introduce a new feature into the practical problem of executing
random walks when we include particle splitting. Up to now we have
initiated particle random walks only by selecting particles from a source
distribution. With splitting we have a set of particles that are "new" to the
calculation, and that we must treat essentially as start particles, but that are
not produced by selection from the source distribution. When we are ready
to track these split particles we must have a way to obtain their location,
energy, direction, and other relevant data. One way to do this is to save, or
"bank," them and retrieve their phase-space coordinates when needed. To
do this we will introduce the concept of a particle bank, in which untracked
particles are stored while other calculations are made. The banked particles
will be selected and tracked in some appropriate order, and the calculation
will be complete only when all start particles and banked particles have been
tracked.
6. Variance Reduction Techniques 161

Particle banks are useful for purposes other than storing split particles. If
we wish, we can generate all of our start particles at one time, store them in
the bank, and recall them from the bank as needed. Split particles and
secondary particles that arise in the particle walks can be added to the bank
as they are produced, and can be tracked later. Particles can be placed in the
bank at any time and for any reason, and removed from the bank for
subsequent tracking as desired. Thus it is not necessary to complete a track
before starting another particle. For example, neutrons might be tracked
until they produce a fission event. Each fission event can be considered to
produce a new generation of neutrons, and the phase-space coordinates of
all such fission neutrons can be banked until the tracks of all neutrons in the
previous generation have been terminated. A new calculation can then
proceed with the tracking of the new generation of neutrons. We will see
examples of this in Chapter 8.
The particle bank must include all of the phase space information
associated with each particle. As we have seen, this consists of at least six
variables or, for convenience in programming, seven variables - u, v, w, x,
y, Z, and E. Later we will add the time variable t to this list. It is often
desirable to include additional information to the bank, such as whether the
particle is part of the initial source or is a split or secondary particle, the
material or zone in which the particle is located, other geometry information
relevant to the particle and, last but not least, the particle weight. When
results are calculated per start particle it is necessary to have sufficient
information in the bank to ensure that the scores from split particles are
tallied together with the parent particle.
If we wish to track many particles we can see that, if we use the particle
bank to store all start particle information at the same time, plus allow for
split and secondary particles, the size of the bank can quickly become a
limiting factor in the calculation. One way to restrict the size of particle
banks is to divide the problem into groups, or "batches" of particles, and to
use the particle bank to store data for only one batch at a time. As we will
see later, instead of treating individual particles as the basis for variance
estimates it is possible to use such batches as the basis for statistical
analysis. Batches can also be useful in certain types of eigenvalue
calculations.
The option for banking split particles that will be used here is to store the
parent particle phase-space coordinates and weight in the bank. When the
code is ready to retrieve a particle from the bank it will retrieve this particle
and compare its weight with WHo If the weight is greater than WH an amount
wA will be subtracted from the weight of the banked particle and assigned,
along with the appropriate phase space parameters, to the next particle to be
tracked. The weight of the banked particle will then be reduced by the
amount wA. When the weight of the banked particle falls below wA the final
162 Chapter 6

split particle will be assigned this residual weight. Using this technique a
single bank location can be used to store each particle that is to be split.
The weight window of each region can be defined as narrow as desired;
however, importance sampling suffers from diminishing returns. The
implementation of variance reduction methods requires user effort to define
the parameters, and computer resources to execute the procedures. The
reduction in variance produced by such measures must therefore be balanced
against this expenditure of resources. At some point the return in reduced
variance per unit of resources devoted to importance sampling will begin to
decline and the user normally will decide that enough is enough. Generally,
at that point one will simply run the calculation long enough to obtain the
answer to the desired accuracy.

Example 6.4. Slab problem with splitting and Russian roulette

Returning to the problem of Examples 6.2 and 6.3, we now wish to


include splitting in our calculation. All other parameters will remain the
same as in Example 6.3. As stated above, we will test particles after each
collision and will split heavy particles into [[ w/wA]] new particles with
weight wA until the residual weight is less than wA. The last particle will be
given the residual weight. We will test for splitting only at collision sites.
Because the post-collision direction is significant in determining which
particles leak from the slab, the split particles will be given different post-
collision directions.
In selecting the upper weight limit, or split weights WH, for a given
region in the problem geometry, the user should consider the importance of
the region, the expected maximum weight of particles entering each region,
the survival weight wAin the region, and the size of the particle bank
required. The Russian roulette parameters to be used in this example are
those from the best case in Example 6.3. That is,

WA = e -2.302585z ~ 10-z (6.5)


w
WL =---..1!.. (6.6)
4
We will use the splitting parameters

(6.7)

The latter values ensure the splitting of particles that penetrate most of the
slab while suffering only a few collisions, and provide increased sampling
of the space close to z = I . Since we will bank all of the parent particle
6. Variance Reduction Techniques 163

weight into one bank location, and split off particles with the desired weight
as required, only a few bank positions should be needed.
A listing of the modified subroutines for this example is given in Table
6.25. Subroutine 'Walk' (Table 6.26) includes a test following each particle
random walk to determine whether split particles have been added to the
bank. If so, these particles are processed before the next source particle is
chosen. The coding added between lines 21 and 22 determines whether split
particles need to be processed. In this case the entry point 'Bankout' ofthe
new subroutine 'Bankin' is called to retrieve a split particle. The coding
between lines 6 and 7 provides the data needed to manage the particle bank
and to initialize some variables. Finally, the coding between lines 9 and 10
resets the number of split particles to zero at the beginning of each source
particle track.
Table 6.25. Modified Subro utmes tlor ExampIe
I 64
Subroutine Location
'Source' Table 6.17
'Walk' Table 6.26
'Bdrx' Table 6.27
'Col' Table 6.28
'Bankin' Table 6.29
'Stats' Table 6.30

Subroutine 'Bdrx' is shown in Table 6.27. This routine accumulates the


results for the split particles along with those of the source particles (since
the processing of the statistics occurs in line 22 of subroutine 'Walk.') The
weights of any split particles that escape from the slab are thus added to the
leakage score for the parent particle. The total number of particles used to
average the score in the final result will then still be equal to the number of
source particles
The modified subroutine 'Col' is shown in Table 6.28. Because splitting
occurs at collision sites the weights of all particles entering collisions are
compared with both the Russian roulette and splitting weights. If a particle
is to be split, subroutine 'Bankin' is called to determine the weight that will
continue as the "original" particle and to bank the remainder. Subroutine
'Bankin' is shown in Table 6.29. This subroutine has an entry point called
'Bankout' that is used to retrieve particles from the bank. In this example
the direction of the split particle is chosen isotropically in the laboratory
coordinate system and it is not necessary to store any direction information
in the bank. However, the subroutine stores the incoming direction of the
parent particle so that the option of scattering in the center-of-mass system
could be added easily. The weight of the split particle is determined based
on the stored wA and WH values for the collision point, and the direction
cosines are generated using' Isoout.'
164 Chapter 6

Table 6.26. Subroutine 'Walk' for Example 6.4


SUBR:XJI'INE WALl< 1
CXMm/IN/npart, nbatch 2
RrnL (8) ctnfp, dtr, xsec, d::ur 3
CXMmtmACK/ctnfp, dtr, xsec, d::ur 4
RrnL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 5
CXMm/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
RrnL(8) bank (2000, 9) , wtin, wtoot
CXMm/BllNK/bank,ibank(2000),wtin,wtoot,nsplit,nsptotal,rmax
RrnL(8) oolwt, rrin, rroot
CXMm/<XltWl'/co1wt, rrin, rroot
nsptotal=O; rnax=Q; wtin=O. OdO; wtoot=O. OdO; co1wt=O. OdO
rrin=O. OctO; rroot=O. OctO
I.()(:~,-,)ver_Particles: ro i=l,npart locp over mnber of particles 7
CALL Statlp initialize statistics for each particle 8
CALL saJK:E get soorce pararreters for particle 9
nsplit=O
100 CXNTINUE
WqJ for cOllisioos: ro to find oollisicn sites 10
CArL- DIST get dist:arlre of travel in mfp 11
WqJ_Track: ro track particle to collisicn point 12
CALL HIT get distance to boundary of current zcne 13
CALL MXSEC get total cross secticn for current zcne 14
IF( (dtr-ocur) *xsec.GE:.ctnfp) EXIT WqJ_Track ! collisicn before boundary 15
CALL BOO){ ! process boundary crossing 16
IF (nzcur.EQ.-1) EXIT WqJ for Collisioos ! particle killed e.g., by escaping 17
END ro WqJ Track - - ! 18
CALL CXlL - ! call col to process oollisicn 19
IF(nzcur.EQ.-1) EXIT WqJ for Collisioos particle killed by oollisicn 20
END ro I.ocp for Collisioos - - ! 21
IF(nspUt.m.o)THEN
CALL BI\NKCUl'
ooro 100
ENDIF
CALL StatElfl process statistics when particle killed 22
END ro WqJ Over Particles ! 23
RE:ruRN - 24
END 25

Table 6.27. Subroutine 'Bdrx' for Example 6.4


SUBR:XJI'INE BOO){ 1
RrnL(8) delta 2
RrnL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 8
CXMm/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
RrnL(8) ctnfp,dtr,xsec,d::ur ! 10
CXMmtmACK/ctnfp, dtr, xsec, d::ur 11
RrnL(8) bsoore(10) , bstmSq (10) ,cscore(10) ,csunsq(10) ,1:p3.rt(10) ,qmt(10)
CXMm/STAT/bso::>re,bsunsq,cscore,csunsq,l:p3.rt,qmt
delta=dtr-ocur ! delta-distance traveled to reach boundary 12
ck::ur=dtr ! update current dist:arlre traveled 13
cJnfp=ctn4rdelta*xsec ! subtract current dist:arlre in mfp fran ctnfp 14
z=z+w*delta update positicn, z-directicn cnly
IF(z.LE.O.OdO)THEN
l:p3.rt(l)=l:.part(l)-+wate aCClIll1late left leaks per start particle
ELSE
1:p3.rt(2)=l:.part(2)-+wate aCCLmllate right leaks per start particle
ENDIF
nzcur=-l set nzcur=-l (for escape)
RElURIl 19
END 20
6. Variance Reduction Techniques 165

Table 6.28. Subroutine 'Col' for Example 6.4


SUBFU1I'INE COL 1
REAL (8 ) FLTRN,delta,WA,WL,WH
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) dnfp, dtr, xsec, dcur ! 5
OOMMON/'I'RI\I:l</dnfp, dtr, xsec, dcur 6
REAL (8) sigt (20) ,c (20) ; ! dirrensioos allCM up to 20 different rredia 7
OOMMON/GEnol/sigt,c; !sigt is total cross sectioo, c is non-absorptioo prcb 8
REAL (8) colwt, rrin, rrout
OOMMON/c:orm/colwt, rrin, rroot
delta=dnfp/xsec ! distance traveled to collision 9
dtr=dcur+delta ! update total distance traveled 10
x=xo; y=yo; z=zo+w*dtr ! update positioo, z-directioo ooly
colwt=colwt-twate* (1. OdO-c(nzcur) )! total weight absorbed in collisioos
wate=wate*c(nzcur) ! reduce wate by non-absorptioo prcbability 12
WA?4 . OdO*DEXP(-z*2.302585); WLrWA/4.OdO; ~*2 . OdO
IF(wate .LT .WL)THEN i f wate SIlBll play Russian roulette
rrin=rrin+wate total weight entering RR
IF(wate/WA.LT . fltm(»THEN i f particle killed by RR
nzcur=-l set nzcur=-l to shcM particle killed
REIURN
ENDIF
wate=WA particle survived RR, increase wate
rrout=rrout+wate total weight exiting RR
ENDIF
CALL ISCXlJl' assurres isotrcpic scatter in lab syst€!l\ 20
IF(wate .GI'.WH)CALL BANKIN(WH,WA) i f wate high then split
REIURN 21
END 22

If we had chosen to implement splitting on boundary crossings the


original particle direction would have been assigned to each split particle. If
particles were split on both collisions and boundary crossings one could
store a parameter indicating the type of split particle stored and use the
original particle direction, or assign a new direction, as required. Since in
this problem the particles are being tracked only in the Z direction,
the Z-coordinate value is the only location parameter that needs to be stored.
This will obviously not be true in general.
Subroutine 'Stats' is shown in Table 6.30. In addition to calculating the
statistics associated with the answers of interest, this routine calculates a
few statistics on the weight of particles surviving or killed by Russian
roulette. It also calculates the number of particles split and the maximum
number of particles in the bank. If the problem involved a complicated
geometry it would be useful to have these statistics for regions of interest.
They could be used to refine the Russian roulette and splitting parameters
and provide further information about the adequacy with which important
regions of phase space have been sampled.
The results obtained from this code for reflection from and transmission
through a 10-mfp slab with c = 0.5 are shown in Table 6.31. For
comparison the analog and the survival biasing plus e-2.302585z Russian
roulette results from Table 6.24 are repeated. We see that splitting as used
here has almost no effect on the efficiency of the calculation since the
166 Chapter 6

current results are almost identical to those obtained previously. The effect
is small because splitting is a rare event in this calculation. Although 55.5%
of the total weight of all start particles is involved in Russian roulette, only
0.0023% of the weight is involved in splitting. The present results therefore
do not provide much information about the effect of splitting on the
efficiency of a Monte Carlo calculation. However, splitting can be
important when used with biasing schemes that can cause particle weights to
increase significantly in regions of interest.

Table 6.29. Subroutine 'Bankin' for Example 6.4


SUBroJI'INE BANKIN (WH, WA)
REP.L(8) WH,WA
REP.L(8) x, y, z, u, v, w,xo, yo, zo, uo, vo, YKl, wate, age, energ
CXlt1JN/PART/x,y,z,u,v,w,xo,yo,zo,UO,vo,YKl,wate,age,energ,nzcur,newzn,ngroup
REP.L (8) bank (2000,9) , wtin, wtout
CXlt1JN/BANK/bank, ibank (2000) , wtin, wtout, nsplit, nsptotal, nmax
IF(nsplit .LT. 2000)THEN
nsplit=nsplit+1 ! ack:! to bank i f not full
EISE
REruRN
ENDIF
IF (nsplit . GI' .nmax) nmax=nsplit
nsptotal=nsptotal+1
wtin=Ntin+wate-WA
bank(nsplit,l)=x; bank(nsplit,2)=y; bank(nsplit,3)=z ! bank position
bank(nsplit,4)=uo; bank(nsplit,5)=vo; bank(nsplit,6)=YK> ! bank direction
bank(nsplit,7)=wate-WA; bank(nsplit,8)=WH; bank(nsplit,9)=WA! bank weights
wate=WA ! set weight of rareining particle
ibank (nsplit) =nzcur
REIURN
ENI'RY BI\NKCUI' entry to fetch particle
x=O.OdO; y=O.OdO; z=bank(nsplit,3) get position
nzcur=ibank (nsplit)
IF(bank(nsplit,7).LT.bank(nsplit,8»THEN see i f remaining weight<WH
wate=bank(nsplit,7) if50 retrieve all weight
nsplit=nsplit-1 particle weight no longer in bank
EISE
wate=bank(nsplit,9) retrieve WA of banked weight
bank (nsplit,7) =bank (nsplit,7)-bank(nsplit,9) ! reduce banked weight
ENDIF
CALL Isa::xJl'
wtout=wtout+wate
REIURN
END

Table 6.30. Subroutine 'Stats' for Example 6.4


SUBIOJI'INE Stats 1
REP.L(8) bscore(lO) , bsumsq (10) ,cscore(lO) ,cstlll5q(lO) ,!::part (10) , q;ert (10) 2
CXlt1JN/S'mT/bscore, bs\IllSq, cscore, C5\IlI5q,!::part, q;ert 3
CXlt1JN/IN/npart, nbatch 4
REP.L(8) x,y,z,u,v,w,xo,yo,zo,UO,vo,YKl,wate,age,energ 5
CXlt1JN/PART/x, y, z, u, v,w,xo,.yo, zo, uo, VO,YKl, wate,age,energ,nzcur,newzn,ngroup 6
REP.L(8) tmp,tmp1,tmp2,var,stdev ! 7
REP.L(8) bank (2000, 9) , wtin, wtout
CXlt1JN/BANK/bank, ibank (2000) , wtin, wtout, nsplit, nsptotal, nmax
REP.L(8) colwt,rrin,rrout
CXlt1JN/QC[WT/colwt,rrin,rrout
ENI'RY StatChe entry point to initialize arrays for catplete prcblan 8
6. Variance Reduction Techniques 167

Table 6.30. con't ...


bscx:lre=O. OdO; bsl.ll\Sq=O. OdO; =re=O. OdO; CSl.II\Sq=O. OdO 9
REIURN 10
ENI'RY Statip ! entry point to initialize arrays for a particle 11
t.part=O. OdO; cpart=(). OdO 12
REIURN 13
ENI'RY StatELp ! entry point to store scores for a particle 14
bsCXlre(I)=bsCXlre(I)-ttpart(I) store score 15
bsl.ll\Sq (1) =bsl.ll\Sq (1) -ttpart (1) **2 store square for variance calculatioo 16
bscore (2)=bscore (2)-ttpart (2) ! store score
bstmsq(2)=bsl.ll\Sq(2)-ttpart(2) **2 ! store square for variance calculatioo
REIURN ! 19
ENI'RY StatEild. ! entry point to calculate and print results 20
tnIrDFLa\.T (npart) 21
var=bsum'3q(l) /trrp- (bscx:lre (1) /trrp) **2 variance of left distr
stdev-=~ (var) standard deviatioo of left distr
WRITE(16,*)bscore(I)/trrp,stdev/~(trrp) result and std dev of result 24
var=bsl.ll\Sq (2) /trrp- (bscore (2) /trrp) **2 variance of right distr
stdev=~ (var) standard deviaticn of right distr
WRITE (16, *)bScore(2) /trrp,stdev~(trrp) result and std dev of result
WRITE(16,*)nrnax,nsptotal,wtin,wtout
trrpl=colwtibscore (1) +bscore (2)
t:np2==tIrp1-rrout+rrin
write (16, *) colwt, rrin, rrout,trrpl,trrp2
REIURN 28
END 29

able 6.31. Results for Example 6.4 with 107 Start Particles, lO-mfp Slab, c=O.5
Run time Reflected I> Transmitted I>
Analog 75 0.115l±1.0-4 1.3+6 1.35-4± 3.7-6 9.85+8
RR,IO-z 71 O.ll50± 1.9-4 4.1+5 1.27-4± 3.1-6 1.48+9
RR + Split 70 0.1l50± 1.9-4 4.1+5 1.26-4± 3.1-6 1.53+9

Splitting and Russian roulette are fair-game biasing techniques.


Therefore there is no "wrong" way to use them. Systematic bias cannot be
introduced into the answer using these techniques regardless of the
parameters chosen. However, it is possible to change the efficiency of a
calculation for the worse by arbitrary introduction of the techniques and
poor selection of parameters. Although the split and Russian roulette
weights can be set independently, in order to balance computing resources
between particle tracking and importance sampling, the weight window
should account for both games. It is usually best to allow for at least several
collisions between games of Russian roulette on the same particle.
The best choice for WH and WL will depend on the size of an importance
region. A large region may have widely varying particle weights in analog
Monte Carlo. Forcing a narrow window on such a region might be counter
productive; i.e., the calculation might spend more time splitting and killing
particles than it does tracking them. Therefore one might seek to keep
importance regions small, so that the particle weight varies only by a small
factor, say two or three, across the region. This is roughly the same as
requiring the importance regions to be about one mfp thick. Unfortunately,
in deep penetration problems the policy of using regions with dimensions
168 Chapter 6

corresponding to about one mfp may require a large number of regions, and
the problem efficiency may be decreased by imposing excessive boundary
crossings and importance sampling calculations. Some form of compromise
is usually required.

6.6 Exponential Transform


In a deep-penetration transport problem - one in which the source
location and the detector location are separated by many mean free paths -
the probability of a source particle reaching the detector is small.
Nevertheless, as always, an accurate answer will require a thorough
sampling of the phase space near the detector. For such problems there is a
fair-game method of biasing particle flow toward the area of interest and
thus increasing the fraction of computer resources devoted to the sampling
of this important region of phase space. This method preferentially samples
flight paths greater than one mfp when a particle is moving toward the
detector, and preferentially samples paths shorter than one mfp when a
particle is moving away from the detector. This technique is called
exponential transform, or path stretching.
In an unbiased calculation, the flight path of a particle is selected from
the distribution p(l1), given by

(6.8)

Such a sampling results in a path length x given by eqn 2.14,

(6.9)

Here ~ is a random number evenly distributed between zero and one. Let us
define an artificial interaction probability p* such that

(6.10)

where

1:; = 1:, -g(r,E,O) (6.11 )

That is, we artificially modify the total cross section by an amount g, where
g can be positive or negative and can depend on location, energy, and
6. Variance Reduction Techniques 169

direction as long as we maintain Lt· > 0 at locations where Lt> O. We use


the modified cross section to select a new flight path from

• -ln~
x =-- (6.12)
L·t

If g is greater than zero the average of the modified flight paths x* will
be longer than the average of the unmodified flight paths x, and the paths
will have been "stretched." Alternatively, if g is less than zero the average
of the modified flight paths will be shorter than the average of the
unmodified flight paths, and the paths will have been shortened. To
maintain a fair game, the particle weight w must be adjusted to compensate
for the biased selection of shorter or longer than average flight paths. Since
by eqn 2.92 we require

pw= p·w· (6.13)

the particle weight after biasing must be

(6.14)

Thus if g is greater than zero we will have w* < w for large x and w* > w
for small x. A fair game is maintained because the probability of a given
weight going a given distance is the same in the biased as in the unbiased
case. As positive g approaches Lt the magnitude of weight change resulting
from this biasing will increase without bound, which is why it is necessary
to restrict g < Lt.
Because Lt varies with both particle energy and the material through
which the particle is traveling, it is usually inconvenient to require the user
to specify g as an input parameter. Instead one generally defines a
normalized exponential transform parameter p,

(6.15)

such that p varies over the range [-1,1] as g varies between [-LbLtl. The user
may then define the exponential transform by the parameter p and does not
need to know Lt. Since p < 1, we can define a quantity B by
170 Chapter 6

B=_I_=!t (6.16)
I-p E;

Then

(6.17)

and

x· =Bx (6.18)

Substituting eqn 6.17 into eqn 6.14 we obtain

(6.19)

It is common to definep as a function of the problem parameters, as


indicated by the definition of g in eqn 6.11 . For example, if the direction of
travel of a particle following a collision is 0 and the unit vector from the
collision point to a detector is 0', one may define

(6.20)

where Po< 1. Thus, on the average, particles traveling towards the detector
will have their flight paths stretched and those traveling away from the
detector will have their flight paths shrunk. The maximum value of the
stretching parameter will be Po, and this value will be obtained only when
the flight path is pointed either directly towards (p = Po) or directly away
from (p = -Po) the detector. No modification is made to the flight paths of
those particles traveling at right angles to the direction between the collision
point and the detector.

Example 6.5. Transmission through a slab with exponential transfonn

Let us again address the problem of particles penetrating a thick slab, but
this time let us add exponential transfonn to our arsenal of variance
reduction techniques. As before we will assume the particles are
monoenergetic and undergo isotropic scatter in the laboratory coordinates.
We will assume a unit slab thickness and use the cross section to set the
thickness in mfp. We will leave the Russian roulette and splitting
6. Variance Reduction Techniques 171

parameters set for the most part as in Example 6.4, and add directional-
dependent exponential transform using a modified form of eqn 6.20. That
is, since we seek only to determine the transmission through the slab and not
the radial position of the particles inside the slab, we will set the stretching
parameter P = wpo, where w is the Z- direction cosine for the post-collision
particle track. The maximum value of the transform variable Po will be
constant throughout the slab.
A listing of the modified subroutines used for this example is given in
Table 6.32. The modification of the flight path for exponential transform
based on eqn 6.12 is performed in subroutine 'Dist.' This is shown in Table
6.33. The value of p (the variable 'rho') is set in this subroutine. The
particle weight is then modified using eqn 6.19. A modified version of
subroutine 'Col' is shown in Table 6.34 This subroutine is the same as that
used in Example 6.4 except the Russian roulette parameters have been
changed to values appropriate to the p values used in the problem. In the
example calculations, the weight that would emerge from a first collision at
a given point is chosen as the wA value at that point. Since all source
particles start in the positive-Z direction, they have the maximum
exponential transform path stretching parameter Po applied. The weight
emerging from the first collision is the entering weight times the non-
absorption probability. Therefore, using eqn 6.19, WA is given by

WA- c e-I,poz
--- (6.21)
1- Po

Table 6.32. Subro utmes


' r.or Exam pie
I 65 Usmgan
. Exponential Transfonn
Subroutine Location
'Source' Table 6.17
'Walk' Table 6.26
'Bdrx' Table 6.27
'Bankin' Table 6.29
'Stats' Table 6.30
'Dist' Table 6.33
'Col ' Table 6.34

The results of running the above code, for a 10-mfp slab using a non-
absorption probability of 0.5 and 106 start particles, are shown in Table 6.35.
In this table the reflected and transmitted fractions are given for values of Po
from 0.5 to 0.99. As might be expected, we see that using an exponential
transform to stretch the particle flight paths towards the downstream, or
172 Chapter 6

Table 6.33. Subroutine 'Dist' for Example 6.5


SUBKm'INE DIST 1
RrnL(8) FLTRN,r,b,rho
RrnL (8) cinfp, dtr, xsec, 0Cur 3
CXlMN/TRACK/cinfp,dtr,xsec,OCur 4
RrnL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
CXlMN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
RrnL(8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpKrnaX(20),&! 7
rpymin(20), rpyrrax (20), rp:zmin(20) , rpzrrax(20) ,1:xlin(40) ,lxb.It (40) 8
l£X;ICAL I:xitest (40), b:!hit (40) 9
CXlMN/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpKrnaX, rpymin, rpymax, rp:zmin, rpzrrax, & 10
1:xlin,lxb.It,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,b:!hit 11
CXlMN/rho/rho
rho=O.9dO
b=1. OdO/ (1. OdO--w*rho)
r=FLTRN () ! pick a randan nl.llber 12
dnfIr>-b*DIffi(r) ! transfomed distance in nean free paths
wate=wate*b*rEXP(-Gnfp* (1. OdO-1.OdO/b) ) ! Eqn 6.19
xo=x; yo=y; zo=z store "starting" position for track 14
~.llDO initialize distance currently traveled 15
CO 50 i=l,nbdy ! 16
I:xitest(i)=.F1IISE. beginning a new track, no bodies yet tested 17
50 CXNI'INUE 18
RElURN 19
END 20

Table 6.34. Subroutine 'Col' for Example 6.5


SUBKm'INE OJL 1
RrnL(8) FLTRN,delta,WA,WL,WH,rhO
RrnL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
CXlMN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
RrnL(8) cinfp,dtr,xsec,dcur ! 5
CXlMN/TRACK/cinfp, dtr, xsec, dcur 6
RrnL(8) sigt(20),c(20); ! dilrensions allCM up to 20 different Iredia 7
CXlMN/GEl:M/sigt,c; !sigt is total cross section, c is nan-absorption prcb 8
REAL (8) colwt, rrin, rrout
CXlMN/COLWr/colwt,rrin,rrout
CXlMN/rho/rho
delta=dnfp/xsec ! distance traveled to collision 9
dtr=dcur-t{lelta ! update total distance traveled 10
=0; y=yo; z=zo+w*dtr update position, z-ill.rection only
colwt=colwt-twate* (1. OdO-c (nzcur) )! total weight absorbed in collisions
wate=wate*c(nzcur) ! reduce wate by nan-absorption prOOability 12
~rEXP(-z*rho*10.0)*c(nzcur)/(1.0d0-rho) ! Eqn 6.21
WL=WA/ 4. OdO
WH=WA*2. OdO
IF(wate.LT.WL)THEN if wate srnall play Russian roulette
rrin=rrin-twate total weight entering RR
IF (wate/WA.LT . fltm 0 )THEN if particle killed by RR
nzcur=-l set nzcm:=-1 to shCM particle killed
RElURN
ENDIF
wate=WA particle survived RR, increase wate
rrout=rrout-twate total weight exiting RR
ENDIF
CALL Iscx::ur assures isotrcpic scatter in lab system 20
IF (wate. GI' •WH) qu.L BANKIN (WH, WA) if wate high then split
RElURN 21
END 22
6. Variance Reduction Techniques 173

right, face of the slab reduces the efficiency of the reflection calculation.
However, the use of path stretching in this case is intended only to improve
the efficiency with which the transmission probability is calculated. From
the table it is apparent that this result has been achieved for all values of
Po shown here, with a maximum gain in efficiency of roughly a factor of 200
compared with the best result from Example 6.4 (1.53+9). The results show
that the efficiency reaches a maximum near Po = 0.9, although even the
extreme value of 0.99 gives a greater efficiency than the nominal value
usually recommended for path stretching of Po = 0.5. For this simple
example of a thick slab in one dimension the use of the exponential
transform clearly has much greater value than the survival biasing, Russian
roulette, and particle splitting used previously.

r.able 6.35. Results for Example 6.5 for 106 Start Particles, 10-mfp Slab, c=O.5
Po Run Reflected e Transmitted e
time
0.5 25 s 0.1155± .000318 4.0+5 1.282-4± 9.45-7 4.5+10
0.8 25 s 0.1143± .000586 1.2+5 1.281-4± 3.86-7 2.7+11
0.9 21 s 0.1143± .000888 6.0+4 1.276-4± 3.87-7 3.2+11
0.99 7 s 0.1140± 0.00279 1.8+4 1.288-4± 1.26-6 9.0+10

The biasing techniques discussed here represent only a small sampling of


the biasing that can be done in Monte Carlo transport. Many biasing
techniques have been incorporated into production Monte Carlo particle
transport codes. Each technique uses the same principles as those discussed
above. The reader is referred to the operational manuals of the production
codes, to technical reports on the specific techniques, and to the technical
literature. 2

Exercises

1. Use the angular-dependent results in Example 6.1 to devise a scheme for


biasing the source angular distribution.
a. Implement your source angular biasing and repeat the calculation
while assuming a uniform spatial source distribution. What effect did
this biasing have on the efficiency of your calculation?
b. Combine your angular biasing with the spatial biasing used in the
example and repeat the calculation employing both types of biasing
simultaneously. What effect did the addition of angular biasing have on
the efficiency of the calculation?
174 Chapter 6

2. Repeat the calculations of Example 6.5, without splitting, as well as with


several different splitting parameters. Detennine the efficiency of splitting
when used in combination with exponential transfonn for this calculation.

3. Consider a cube of neutron absorbing material, 1 cm thick in each


dimension, located at the center of a sphere of homogeneous scattering
material of radius r. Assume the absorbing material has a zero cross section
above an energy Eo and a cross section of 1 cm- I below that energy. Assume
the material absorbs all neutrons with an energy below Eo that experience
collisions in the material; i.e., assume the material is a threshold absorber
with a cutoff energy of Eo, and that c = 0 below the cutoff energy. Assume
that the sphere of scattering material is composed of a homogeneous
material of atomic weight A, and that neutrons of energy Es are nonnally
incident unifonnly over the exterior surface of the sphere. Further assume
that the neutrons undergo isotropic scatter in the center of mass with the
atoms of this material, and that all target atoms are at rest prior to such
collisions. Assume that the non-absorption probability is c and the total
cross section for the scattering material is Lt cm- I .
a. Using analog Monte Carlo, for r = 10, Lt = 1 cm-\ c = 0.9, Es = 1 MeV,
and Eo = 1 keV, detennine the probability of an incident neutron being
absorbed in the neutron absorbing material.
b. Implement exponential transfonn and repeat the calculation of part a.
How did the efficiency change? What stretching parameter provides the
greatest efficiency?
c. Include survival biasing, Russian roulette, and splitting along with the
exponential transfonn. How did these measures affect your choice of
stretching parameter and the efficiency ofthe calculation?

I J. M. Hammersley and D. C. Handscomb, Monte Carlo Methods, Chapman and Hall,


London, 1964, p. 22.
2 See, for example, I. Lux and L. Koblinger, Monte Carlo Particle Transport Methods:
Neutron and Photon Calculations, CRC Press, Boca Raton, FL, 1991, especially Chapter 7;
S. Dupree and R. Lighthill, "Sandia National Laboratories CDC7600 Version of MORSE-
SGC," SAND80-1337, Sandia National Laboratories, Albuquerque, NM, 1982; and J. F.
Briesmeister, ed., "MCNpTM - A General Monte Carlo N-Particle Transport Code," LA-
13709-M, Los Alamos National Laboratory, Los Alamos, NM, 2000.
Chapter 7
Monte Carlo Detectors

7.1 Introduction

In analog Monte Carlo transport, the physical processes involved in the


transport of particles are modeled and, on the basis of these models,
particles are tracked through the problem geometry. Tracking particles
through a geometry based on a specified source is analogous to performing
an experiment involving the same source and geometry. In an experiment it
is necessary that the experimenter have in mind a quantity to measure, and
to make provisions to place a detector with the appropriate sensitivity and
response characteristics in a location that will provide the desired answer.
In the same way the Monte Carlo practitioner must determine what
quantities to sample and, in analogy with experiment, place detectors of
appropriate size and energy response in a location that will provide the
desired result.
In early Monte Carlo transport codes no detector scoring was performed
during the random walk. Instead, particle random walks were calculated and
information about the events encountered in the walks, such as collisions
and boundary crossings, was stored on tape. The random walk data were
then post-processed to record scores in various detectors. Because the
computers of the era were slow and limited in memory compared with
modern machines, in many cases the random walk was the product of a
considerable amount of effort and expense. To make maximum use of this
investment the file of event data was often used repeatedly to score different
detectors without the user having to re-calculate the random walk.
Today detector scoring is generally done simultaneously with the random
walk calculation. This requires the random walk to be repeated, or a new
random walk to be performed, for every change in the detector
175
176 Chapter 7

configuration. However, the speed and convenience of modern computers is


such that little penalty is incurred thereby for most problems. In this book
we will score detectors simultaneously with the execution of the random
walk, but the scoring could also be done from an independent record of the
events in such a random walk.

7.2 The Next-Event Estimator

In particle transport one frequently finds estimates of the flux at a point


to be of value. Such estimates can provide a means for mapping the flux
within the problem geometry, for estimating importance values, and for
checking the normalization and results obtained from other types of
detectors. Point detectors are non-physical but can easily be modeled
mathematically. That is, a point detector must use some mathematical
artifice for estimating its response because the probability of a particle track
passing through a preset point in the geometry is zero.3
The next-event estimator is possibly the most commonly used detector in
Monte Carlo transport. When used with appropriate precautions, which can
be significant and will be discussed below, this simple estimator can be
reasonably reliable and accurate in the limit of a large number of tracks. It
is also relatively fast in execution. Multiple point detectors can easily be
used to map flux contours, to help provide insight into the problem being
solved, and to increase confidence in the results.
Recall from eqn 3.24 that the flux at a point can be expressed as a
relatively simple integral. This integral is the sum of the probabilities of
source particles and post-collision particles traveling from their original
location, r', to the detector point, r, without suffering an intervening
collision. That is, for the steady-state case,

'I'(r,n,E) =
""
Je-Il [ S(r',n,E) + JJEs(r';n',E' ~ n,E)'I'(r',n',E')dn'dE'r (7 1) S •
o

where r' = r - sn and

s
J3 = JEt(r - s'n,E)ds' (7.2)
o

a With finite-length words in a digital computer the probability is not actually zero, but it is
quite small.
7. Monte Carlo Detectors 177

r
A flux estimate can be obtained at the point by evaluating eqn 7.1 for each
source event and each collision event encountered in the particle tracking.
The integral transport equation can be written in terms of a transfer
kernel as

\jI(P) = J\jI(P')l:, (P')K(P' ~ P)dP' + S(P) (7.3)

where \jI is the angular flux and P is a point in phase space. In this
formulation K is a transfer kernel that is equal to the probability that a
particle suffering a collision at P' leaves the collision and arrives at P. S(P)
is the uncollided angular flux at P that arrives from externally applied
sources.
In the first term on the right side of eqn 7.3 we have \jI(P')l:,(P') =
density of particles entering collisions in dP', where the element of phase
space dP' = d3r'dE'dO'. The kernel K can be separated into two terms,

Probability of } {probability of traveling from}


K(P' ~ p) = { scattering from • r to r with:mt experiencing
0' to 0 and E'to E an intermediate collision

Here 0 is a unit vector in the direction from r' to r . Given that a particle is
not absorbed at a collision, define the probability of scattering from 0' to 0
per steradian, and E' to E, as p(O'.O,E'~E). Then, if the non-absorption
probability for the collision at P' is Pna, the first term in K can be written

p(O'.O,E' ~ E)Pna
(7.4)
Ir-r'1 2

For monoenergetic, isotropic scattering in the laboratory coordinate system,

1
p(O'.O,E'~E)= 41t (7.5)

That is, the value of p given by eqn 7.5 is the probability of scattering from
0' to 0 per steradian, which is constant for isotropic scatter in the
laboratory system. The second factor in the expression for K is the familiar
attenuation factor e-P, where f3 is given byeqn 7.2 for s = Ir - r'l.
Applying these definitions to eqn 7.3, and omitting the fixed-source term
S(P), we obtain the collided flux estimate at the point r,
178 Chapter 7

'l'c(r,E,O) = ffJ'l'(r',E',O')1: t (r',E') x

Pna(r',E')p(O'. ~,E' ~ E) e '~dO'dE'd3r' (7.6)

Ir-r'l
where the integrals are over the volume of the problem space, all relevant
energies, and all incoming directions 0' at the collision point r'. To obtain
the collided flux for the next-event estimator in a Monte Carlo transport
calculation we will evaluate the integrand of eqn 7.6 at each collision point.
The solution to eqn 7.3 will then consist of the uncollided flux term S(P)
and the collided flux estimate from eqn 7.6.
For example, assume we have designated a point detector at the location
Pd = (Xd,Yd,~), and our particle random walk has resulted in a collision at Pc
= (x,y,z). This geometry is shown in Figure 7.1. We wish to determine the
probability of the post-collision particle leaving the collision point in the
direction of the detector and traveling from the collision point to the
detector without suffering an intervening collision. This estimate can be
viewed as an anticipatory, or expectation, score. Such an expectation is
valid whether or not the particle in fact scatters toward the detector and
whether or not its next flight path is long enough to reach the detector. We
can obtain an expectation score at the detector point and need never have a
particle actually strike the detector. The mean of the expectation scores will
be equal to the response of the detector to all source particles that have
undergone collisions during the particle random walk.
To score the monoenergetic, post-collision particle flux in a next-event
estimator with isotropic scatter in the laboratory system, and for a single
material with constant cross section, we can assemble the terms in eqn 7.6 to
obtain

(7.7)

Here w is the weight of the particle entering the collision. The non-
absorption probability Pna is the ratio of the scatter to the total cross section,
1:s/1:t • The quantity r is the distance between the collision point and the
detector point,

(7.8)
7. Monte Carlo Detectors 179

z Outgoing
Particle
(u,v,w)

n'
Incoming
Particle
/---------~-------y

x
Figure 7.1. Next-Event Estimator Geometry

Eqn 7.7 is the simplest form for the collided contribution to the next-
event flux estimator. It does not apply for anisotropic scattering in the
laboratory system or for situations in which the path from r' to r passes
through different materials. In addition, energy-dependent problems require
correlating the scattering angle with the post-collision energy. In all of these
cases the correct form for the scattering probability p and the optical path
length J3 must be used.

Example 7.1. Next-event flux estimates in an isotropic scattering material

In Examples 3.1 and 5.1 we determined the flux as a function of distance


from an isotropic point source of monoenergetic particles emitted into a
uniform medium with isotropic scattering in the laboratory coordinates. The
geometry used in that example was a sphere of 10-mfp radius with the
source at the center. The flux calculated as a function of radius was shown
in Figure 3.3. We would now like to reproduce this result by using next-
event point detectors to score the flux as a function of radius. We will again
assume a unit macroscopic cross section.
Our strategy will be to place the point detectors at various distances from
the source. By symmetry we can place a detector intended to score the flux
at a given radius at any point on the surface of a sphere of that radius. Thus
for convenience we will place all of the detectors on the positive Z axis.
The detectors will be placed at integral distances in mfp from one to nine,
and additional detectors will be located at z = 0.1 and 9.9 mfp. Unlike the
calculation in Example 3.1, we cannot choose the start direction to be along
the positive Z axis in this calculation because we are no longer averaging the
180 Chapter 7

flux over a spherical shell. The flux detennined for the point detectors
arrayed along the Z axis would obviously be greater for a parallel beam
source directed along that axis than for an isotropic source at the origin.
Therefore we will start the source particles in random directions and score
the flux estimate following each collision according to eqn 7.7. This will
provide the collided portion ofthe total flux estimate for each detector.
To obtain the uncollided flux estimate we must estimate separately the
uncollided score in each detector for each source particle. We could do this
by applying eqn 7.7 to every start particle with w set equal to the start
weight and Pna = 1. However, for a nonnalized, point, isotropic,
monoenergetic source the uncollided flux at a point can be calculated
analytically,

(7.9)

where r is in units of mfp. Using this expression for the uncollided flux, the
total flux estimate will be the sum of the analytic uncollided score and the
Monte Carlo estimate of the collided score. Because the uncollided result is
exact, the variance in the total flux estimate will be equal to the variance in
the collided score. For most complex sources a c1osed-fonn expression for
the uncollided contribution at a point does not exist and this contribution
must be estimated by Monte Carlo methods. In such cases the uncollided
flux estimates will also carry a non-zero variance and the variance in the
sum of the uncollided and collided contributions must include the variances
from both contributions.
The coding we will use for this example is similar to that of Example 5.1
and the problem geometry is the same as that given in Table 5.23. The cross
section infonnation is given in Table 5.24. The list of the modified
subroutines to be used in this calculation is given in Table 7.1. The logical
place to score the collided flux estimates for our point detectors is in
subroutine 'Col' immediately following each collision. A revised
subroutine that perfonns this calculation is shown in Table 7.2. The score
of eqn 7.7 is stored in the variable 'tally' and the tallies are summed for each
detector in the array 'cpart.' In this example, subroutine 'Stats' is used to
compute the estimate of the response for the collided portion of the flux.
The total score for each detector is then obtained by adding the uncollided
contribution. The modified subroutine 'Stats' is shown in Table 7.3.

Table 7.1. Modified Subroutmes fior Example


I 7I
Subroutine Location
'Col' Table 7.2
'Stats' Table 7.3
7. Monte Carlo Detectors 181

The results obtained for 103, 104, 105 and 4 x 105 start particles are shown
in Table 7.4. The standard deviations associated with these results, which
are also presented in the table, indicate that the collided flux estimates
should be of reasonable accuracy. However, it can be seen from the table
that these standard deviations do not decrease by the reciprocal of the square
root of the number of particles tracked as they would if the random variables
were normally distributed. Furthermore, the variation of the flux values
among the results is often large compared with the estimated standard
deviations. These peculiarities are inherent in the next-event estimator for
cases where collisions can occur in the vicinity ofthe detector.

Table 7.2. Subroutine 'Col' for Example 7.1


SUBKUI'INE COL 1
REAL(8} FL'I'RN,delta,pi,dist2, tally
REAL(8} x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
COMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL(8} chIfp,dtr,xsec,dcur ! 5
COMMON/TRACK/chIfp,dtr,xsec,dcur 6
REAL(8} sigt(20},c(20}; ! d:iIrensioos allow up to 20 different Iredia 7
COMMON/GEX:M/sigt,c; !sigt is total cross section, c is noo-absorptioo prcb 8
REAL(8} bscore (10) , bsumsq(10) ,cscore(l1} ,cstmsq(l1} ,tpart(10} ,cpart(l1} , zdet(11)
COMMON/STAT/bscore, bsumsq, cscore, CStmsq, tpart, cpart, zdet
pi=2.OdO*I:ll\£X'6(0.0d0} ! to dJtain a double precisioo pi
delta=chlfp/xsec ! distance traveled to collisioo 9
dtr=dcur-tdelta ! update total distance traveled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! update positioo 11
wate=wate*c(nzcur} ! reduce wate by noo-absorption prd:Jability 12
ro i=1,11
dist2=x**2+y**2+ (z-zdet (i» **2 ! square of dist to detector
tally=wate*EXP(-~(dist2»/(4.*pi*dist2) ! score to detector
cpart(i}=cpart(i}+tally
END ro
IF(wate.LT.O.1dO}THEN if wate small play Russian roulette l3
IF (wate. LT . FL'I'RN () ) THEN if particle killed by RR 14
nzcur=-1 set nzcur=-1 to show particle killed 15
REI'URN 16
ENDIF 17
wate=l.OdO particle survived RR, increase wate 18
ENDIF 19
CALL Iso::m assurres isotrcpic scatter in lab system 20
REI'URN ! 21
END 22

A plot of flux versus radius for the four sets of results presented in Table
7.4 is shown in Figure 7.2. Since the same starting seed was used in each
calculation, the results obtained when using a given number of start particles
subsume those obtained using a smaller number of start particles, and thus
the figure shows the effect of increasing the number of particles tracked. It
is clear that the results do not move smoothly towards a stable answer for
every detector as the number of start particles is increased. The flux at
detector ten (r = 9 mfp) is high for 103 start particles but then appears stable
for larger numbers of start particles. The results for detectors eight and nine
(r = 7 and 8 mfp), on the other hand, start low and increase continually with
182 Chapter 7

the number of start particles. In every case the magnitudes of these


increases cover many standard deviations of the individual results cited. If
the error estimates were accurate this would constitute a most unusual trend.
Finally, the result for detector eight with 4 x 10 5 particles appears high and
the variance is much worse than that obtained for 105 start particles.

Table 7.3. Subroutine 'Stats' for Example 7.1


SUBIDJI'INE Stats 1
REAL (8) bscore(10) ,bsumsq(10) , cscore (11) ,csumsq(l1) ,~(10) , cpart (11) , zdet (11)
OOMMCN/~T/bscore,bsumsq,cscore,csumsq,~,cpart,zdet
OOMMCN/IN/npart,nbatch 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
OOMMCN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tmp,var,stdev,pi
ENTRY Statcne ! entry point to initialize arrays for crnplete prcblen 8
pi=2.OdO*DACOS(0.0d0) to obtain a double precision pi
zdet (1) =0. 1dO; zdet (11) =9. 9d0 detector z-locations
ro i=1,9
zdet (HI) =DFI.a\.T (i) renaining detector locations
END ro
bscore=O.OdO; bsumsq=O.OdO; cscore=O.OdO; csumsq=O . OdO 9
REIURN 10
ENTRY StaUp ! entry point to initialize arrays for a particle 11
~=O. OdD; cpart=O. OdD 12
REIURN 13
ENTRY StatEI.p ! entry point to store scores for a particle 14
ro 80 i=l,l1
cscore(i)=cscore(i)+cpart(i) store score
csumsq (i) =csumsq (i) +cpart (i) **2 ! store square for variance calculation
80 CXNrINUE
REIURN 19
ENTRY StatEnd ! entry point to calculate and print results 20
tmp=DFI.a\.T (npart) 21
ro 90 i=l,l1
var=csumsq(i)/tmp-(cscore(i)/tmp) **2 ! variance
stdev=DSCJ<T (var) ! standard deviation
WRITE(16,10)i,cscore(i)/trrp+DEXP(-zdet(i))/(4.OdO*pi*zdet(i)**2),&
cscore (i) /tmp, stdev/DSCJ<T (tmp) ! acki unco11ided flux to first colurm
90 CXNrINUE
10 FORMAT(lx,i5,3D14.5)
REIURN 28
END 29

Table 74
.. Resu Its fIor Example I 7I
Det. Radius 10J Particles 104 Particles 105 Particles 4x10 5 Particles
I 0.1 9.047± .184 9.290±.084 9. I 85±.029 9.214±.028
2 1.0 0.285±.041 0.25l±.012 0.245±.0091 0.252l±.0 15
3 2.0 0.092±.0123 0.092±.0041 0.099±.0026 0.099±.0020
4 3.0 0.0494±.0070 0.0708±.0 119 0.0587±.0018 0.0593±.0016
5 4.0 0.0406±.0153 0.0350±.0023 0.037l±.0009 0.0383±.0016
6 5.0 0.0 I 82±.0025 0.0307±.0056 0.0240±.0007 0.0245±.0004
7 6.0 0.0143±.0027 0.0172±.0017 0.01 77±.0008 0.017l±.0004
8 7.0 0.0073±.0014 0.0086±.0006 0.011O±.0005 0.0149±.0039
9 8.0 0.0046±.0009 0.0045±.0004 0.0065±.0002 0.OO7l±.0002
10 9.0 0.0108±.0055 0.0042±.0008 0.0043±.0003 0.0040±.0002
II 9.9 0.00135±.0004 0.0035±.0023 0.0016±.0002 0.0016±9.9-5
7. Monte Carlo Detectors 183

When the present results are compared with prior estimates of the fluxes
at the detectors, such as those in Figure 3.3, it is clear that they are mostly
reasonable. However, in most cases the point detector flux estimates are
low by more than would be expected from the estimated standard deviations.
Thus the standard deviation appears to be consistently underestimated. As
will be discussed below, one should be skeptical of results obtained using a
next-event estimator unless it can be shown that the problem phase space
has been adequately sampled, and the estimate of the standard deviation for
scores in such detectors should not be trusted.
1.E+1_------------.....,

Start Particles
+1()3
1.E+O -10"
• I (}I
.4 x 105
~
li: 1.E-1

1.E-2

o 2 3 4 5 6 8 9 10
Radius

Figure 7.2. Results for Example 7.1

Although, as we have seen in the above example, next-event estimators


can give wrong answers with small variances, the estimator is a convenient
and potentially accurate tool for estimating the flux in a transport
calculation. However, the ability to provide a score without requiring
particles to travel to the vicinity of the detector, combined with an
underestimate of the variance, can induce false confidence in the result. In
order to ensure an accurate answer the user must verify that a proper
sampling of phase space has been obtained. When the detector is located in
a scattering medium the collisions that are most important to the final score
are those nearest the detector. That is, Ir - r'l can become arbitrarily small
and scores based on the integrand of eqn 7.6 can become arbitrarily large.
Because of this it is reasonable to question whether the estimator converges
to the true flux value.
If we assume spherical symmetry about the detector point, the
differential volume in terms of the path-length coordinate s will be given by
41ts2ds or, for s = Ir - r'l,
184 Chapter 7

(7.10)

Thus the integrand in eqn 7.6 will be proportional to

(7.11 )

That is, no matter how close to the detector point a collision occurs, the
value of the integrand in eqn 7.6 will remain finite. Hence the next-event
estimate of the flux, which is based on this equation, will converge.
The most important region of phase space for scoring the collided
contributions to the flux estimate in a next-event estimator is the region
close to the detector. In practice then, unless the detector is in a void, the
estimator requires that collisions close to the detector point be included in
the score in order to produce a correct answer. The result produced by a
next-event estimator usually converges to the correct solution from below
because in most calculations collisions close to the detector occur rarely
and, until they occur, the mean contribution to the flux at the detector is low.
To estimate the variance in the result from a Monte Carlo detector we
tally the square of each score along with the score itself. For the next-event
estimator this means we sample the square of the integrand of eqn 7.6.
From eqns 7.6 and 7.11 the differential volume, plus the l/r2 term in the
integrand for the (</12) estimator thus becomes

[ 1 2]2d3r'=41tlr_r'12[ 12]2dlr_r'l (7.12)


Ir - r'l Ir- r'l

which diverges as r ~ r'. That is, because of the contributions from


collisions that occur close to the detector point, the variance estimate for the
next-event flux estimator does not converge. This result is called the
infinite variance catastrophe.
The central limit theorem states that, in the limit of a large number of
scores, the results of a series of measurements tends to a normal distribution
with a variance (12 that is proportional to lin, where n is the number of
measurements taken. This result is contingent upon two assumptions: first
that the scores are independent and have the same mean value (that is, the
same quantity is being estimated in each measurement), and second that
both the mean and the variance are finite. The second assumption is not true
for the next-event estimator since the variance is unbounded. This means
7. Monte Carlo Detectors 185

that the scores do not fall on a nonnal curve, and thus that the estimated
variance of the detector scores is not proportional to lin.
The variance in the score for a next-event estimator does not necessarily
improve as more particles are tracked. As a result, instead of a low variance
estimate providing confidence in the result, such a variance could be a
warning sign to the user. A next-event estimator result with a small variance
estimate probably includes few or no contributions from nearby collisions
and thus the flux estimate is probably low. This explains the peculiar trends
exhibited by the results for detectors eight and nine in Example 7.1.
The problem of the infinite variance catastrophe in the next-event
estimator has been studied in detail. A number of methods have been found
for modifying the estimator to produce an acceptable result with a bounded
variance. One such modification is to assume the flux is constant in some
spherical region about the detector and to treat all collisions inside the
sphere identically by defining an average score within the sphere.) This
technique works reasonably well in many circumstances. Another
procedure2 is to score e·r.r/4nro2 for each collision inside the bounding
sphere. The value of the constant ro can be calculated based on the
approximate flux shape expected inside the bounding sphere. Finally, one
may compute the adjoint flux (see Chapter 9) on a surface surrounding the
detector point. In this case, when a particle encounters the surface a score
equal to the product of the fo.ward and adjoint fluxes on the spherical
surface is tallied. Collisions inside the surface are not scored.
Even when the next-event estimator is modified in order to eliminate
unbounded contributions to the variance, it still often underestimates both
the flux and the variance because of the difficulty of obtaining an adequate
sampling of collisions in the vicinity of the detector. One of the advantages
of using a bounding surface modification to the estimator is that such a
modification provides an easy method of keeping track of the number of
collisions that occur close to the detector. If the number of collisions inside
the bounding surface is not consistent with that expected from the flux
estimate obtained for the detector then the phase space near the detector has
probably not been adequately sampled.

7.3 Volumetric Flux Detectors

In Section 3.3 it was shown that the scalar flux is related to the reaction
rate per unit volume, R, by

(7.13)
186 Chapter 7

where L is a macroscopic reaction cross section. Example 3.1 made use of


the fact that the Monte Carlo random walk provides a means of scoring
collision events within a defined region of space, and from such scores we
can estimate R directly. It therefore follows that, knowing Lt within a region
of volume V, we can estimate the flux from the fact that

(7.14)

where C is the number of collisions per unit time and energy in the volume
V. The volume of space within which we wish to estimate the average flux
4> does not have to be defined by our geometry; i.e., it need not coincide with
a spatial zone in the problem. However, it is frequently convenient to make
a volume detector coincident with such a geometric zone. Obviously
particle tracks must intersect the detector volume, and collisions must occur
in the volume, in order to obtain an estimate of the flux from eqn 7.14. A
detector that uses this equation to estimate the flux in a region is called a
collision-density flux estimator.
An alternative volumetric flux estimator can be obtained from the
definition of particle flux, which is the product of the particle density times
the particle speed (eqn 3.6). The flux is thus equal to the sum of the
distances traveled by all the neutrons that pass through a unit volume of
space per unit time, energy, and direction. Because of this definition, the
particle flux is sometimes referred to as the track length.3 By definition,
therefore, the flux in a volumetric detector is equal to the sum of the lengths
of the particle tracks in the detector that lie within the requisite limits of
time, energy, and angle, divided by the widths of the time, energy, and angle
intervals selected for scoring, and divided by the volume of the detector.
An estimator that scores all particle tracks within a specified volume is
thus a total, or scalar, flux estimator. Such an estimator requires particle
tracks to intersect the detector volume in order to obtain a score, but does
not require collisions to occur within the detector volume. In effect, the
estimator provides information about the flux continuously along the
particle flight paths instead of at collision points. Because collisions are not
required to produce the estimate, a track-length flux estimator can be used in
voids as well as in material regions.

Example 7.2. Collision-density and track-length flux estimates

Let us again consider the problem of Example 7.1 . We wish to estimate


the flux at several radii using both collision-density and track-length
7. Monte Carlo Detectors 187

estimators. For our volume detectors we will define regions O.1-mfp thick
about each unit radius interval, plus a O.I-mfp-thick region at the outer edge
of the geometry. These are mathematical regions only and involve no
change in material or zone specifications. We will score the total track
length of all particles passing through these regions as well as the number of
collisions in each region.
The PFC geometry input file for this calculation, 'geom.txt,' is shown in
Table 7.5. The first nine detectors are defined by spheres numbered 1
through 18, which have radii 0.05 mfp on either side of the integer distances

Table 75 . f fIor Example


. . Geometry Descnpnon 1 72
0 '!here are no RPPs
20 '!here are 20 SFheres
O.OdO O.OdO O. OdO 0 . 9SdO center coordinates am radius-SFhl
O. OdO O. OdO O. OdO 1. OSdO center coordinates am radius-SFh2
O.OdO O. OdO O. OdO 1 . 9SdO center coordinates am radius-spu
O.OdO O.OdO O. OdO 2.0SdO center coordinates am radius-SFh4
O. OdO O. OdO O.OdO 2.9SdO center coordinates am radius-SFhS
O.OdO O. OdO O.OdO 3 . 0SdO center coordinates am radius-SFh6
O. OdO O. OdO O. OdO 3 . 9SdO center coordinates am radius-SFh7
O. OdO O. OdO O.OdO 4 . 0SdO center coordinates am radius-SFh8
O.OdO O. OdO O. OdO 4.9SdO center coordinates am radius-SIil9
O. OdO O.OdO O.OdO S . OSdO center coordinates am radius-SFhlO
O. OdO O. OdO O.OdO S.9SdO center coordinates am radius-SFhl1
O. OdO O.OdO O.OdO 6 . 0SdO center coordinates am radius-SFhl2
O.OdO O. OdO O. OdO 6.9SdO center coordinates am radius-SFhl3
O.OdO O.OdO O.OdO 7 . 0SdO center coordinates am radius-SFhl4
O.OdO O.OdO O. OdO 7 . 9SdO center coordinates am radius-SFhlS
O.OdO O. OdO O. OdO 8.0SdO center coordinates am radius-SFhl6
O.OdO O.OdO O. OdO 8 . 9SdO center coordinates am radius-SFhl7
O. OdO O. OdO O. OdO 9 . 0SdO center coordinates am radius-SFhl8
O.OdO O. OdO O. OdO 9. 90dO center coordinates am radius-SFhl9
O.OdO O.OdO O.OdO 10.0dO center coordinates am radius-SFh20
21 '!here are 21 zooes
2 2 -1 Zooe 1 has boA::> bodies, 2 am -1
2 4 -3 ZOOe 2 has boA::> bodies, 4 am -3
2 6 -S Zooe 3 has boA::> bodies, 6 am -S
2 8 -7 Zooe 4 has boA::> bodies, 8 am -7
2 10 -9 Zooe S has boA::> bodies, 10 am -9
2 12 -11 ZOOe 6 has boA::> bodies, 12 am -11
2 14 -13 Zooe 7 has boA::> bodies, 14 am -13
2 16 -IS Zooe 8 has boA::> bodies, 16 am -IS
2 18 -17 Zooe 9 has boA::> bodies, 18 am -17
2 20 -19 ZOOe 10 has boA::> bodies, 20 am -19
1 1 Zooe 11 has me body, 1
2 3 -2 ZOOe 12 has boA::> bodies, 3 am - 2
2 S -4 Zooe 13 has boA::> bodies, S am -4
2 7 -6 Zooe 14 has boA::> bodies, 7 am -6
2 9 -8 Zooe I S has boA::> bodies, 9, am -8
2 11 -10 Zooe 16 has boA::> bodies, 11 am -10
2 13 -12 Zooe 17 has boA::> bodies, 13 am -12
2 IS -14 Zooe 18 has boA::> bodies, IS am -14
2 17 -16 Zooe 19 has boA::> bodies, 17 am -16
2 19 -18 Zooe 20 has boA::> bodies, 19 am -18
1 - 20 ZOOe 21 has me body, -20
188 Chapter 7

1 through 9 mfp from the source. The tenth detector is defined by sphere
19, which has an inner radius 0.1 mfp less than the outer diameter of the
problem geometry, and an outer boundary coincident with that of the
problem geometry. The first ten of the 21 zones in the problem are detector
zones. The total cross section and non-absorption probability are set to 1.0
for all zones.
The list of the modified subroutines to be used in this calculation is given
in Table 7.6. Subroutine 'Source' is shown in Table 7.7. Although the
library source routine from Chapter 5 starts particles isotropically at the
origin, as is desired in this problem, the library subroutine assumes the
origin is in zone 1. For this problem the origin is in zone 11 and 'Source'
has been modified accordingly. The reason for using zones 1 through 10 for
the detectors is to simplify the scoring of collisions and tracks in the
detector zones. Subroutine 'Bdrx' has been modified to score tracks inside
the detector zones. This subroutine, shown in Table 7.8, calculates the track
length 'delta' needed to leave the current zone. If the current zone, 'nzcur,'
is a detector zone, then the track length times the weight of the particle is
scored in the array' bpart.'
Table 7.6. Modified Subroutmes fior ExampJe
I 72
Subroutine Location
'Source' Table 7.7
'Bdrx' Table 7.8
'Col' Table 7.9
'Stats' Table 7.10

Table 7. 7. Subroutine 'Source' for Example 7.2


SUBKUl'INE SCUOCE 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
CCMO'I/PARI'/x, y, z, u, v, w,xo,yo, zo, uo, VO,wo, wate, age, energ, nz=,newzn, ngroup 3
pi=2.OdO*DACCS(0.0d0) ! keep for nore exnplicated source that needs pi 4
lFO.OdO; y=O.OdO; z=O.OdO! starts at origin 5
nz==l1 ! p.1ts origin in zone 11
CALL IscaJl' direction chasen isotrcpicaliy 7
wate=1.OdO particle starts with a weight of one 8
REI'URN 9
~ 10

Subroutine 'Col,' shown in Table 7.9, scores collisions that occur in the
detectors, as well as that portion of the track length in the detector that lies
between the previous event and the collision point. The track length in the
zone from the previous event (which could be a collision or a boundary
crossing) is contained in the variable 'delta.' If the collision occurs in a
detector, two SCOres are made: the track length times the weight of the
particle, and the weight of the particle undergoing a collision. These are
scored in the arrays 'bpart' and 'cpart,' respectively. The modified
7. Monte Carlo Detectors 189

subroutine 'Stats' is shown in Table 7.10. Because the detectors are


volumetric, the flux results are normalized by the volumes ofthe detectors.

Table 7.B. Subroutine 'Bdrx' for Example 7.2


SUBroJI'INE B[I« 1
REAL (8) delta 2
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 3
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 4
LOGICAL bdtest(40), bdhit(40) 5
CXM1:N/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, & 6
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit 7
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 8
CXM1:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
REAL (8) cinfp,dtr,xsec,dcur ! 10
CXM1:N/TAACK/cinfp, dtr, xsec, dcur 11
REAL (8) bscore(10) , bsumsq (10) ,cscore(10) , csumsq (10) ,1:part(10) , cpart (10)
CXM1:N/STAT/bscore,bsumsq,cscore,csl.lllSq,l:part,cpart
delta=dtr-dcur ! de1ta-distance traveled to reach boundary 12
clcur=titr ! update current distance traveled 13
~lta*xsec ! subtract current distance in mfp fran cinfp 14
x=x+u*delta; y=y+v*delta; z=ztW*delta ! update position 15
IF(nzcur.IE.10)I:part(nzcur)=I::part(nzcur)-k:Ielta*wate! score track length
nzcur=newzn change identifier of current zone 16
if(nzcur.LT.nzones)RETURN if not at outer zone then return 17
nzcur=-l ! set nzcur=-l if in outer zone (for escape) 18
RETURN ! 19
aID 20

Table 7.9. Subroutine 'Col' for Example 7.2


SUB!OJI'INE OOL 1
REAL (8) FLTRN,delta 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
CXM1:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) cinfp,dtr,xsec,dcur ! 5
CXM1:N/TRACK/cInfp, dtr, xsec, dcur 6
REAL (8) sigt (20) , c (20) ; ! clirrensions allCM up to 20 different rredia 7
CXM1:N/GEX:M/sigt,c; !sigt is total cross section, c is non-absorption prcb 8
REAL (8) bscore(10) , bsumsq (10) ,cscore(10) ,csumsq(10) ,1:part(10) ,cpart(10)
CXM1:N/STAT/bscore,bsumsq,cscore,csumsq,l:part,cpart
delta=dnfp/xsec ! distance traveled to collision 9
dtr=dcur+delta ! update total distance traveled 10
x=xo+u*dtr; y=yo+v*dtr; z=zotW*dtr ! update position 11
IF (nzcur.IE. 10) THEN
l:part(nzcur)=I::part(nzcur)+delta*wate ! score track length in zone
cpart (nzcur) =cpart (nzcur) +wate ! score collision wate
aID IF
wate=wate*c(nzcur) reduce wate by non-absorption prOOability 12
IF (wate. LT. O. 1dO) THEN if wate small play Russian roulette 13
IF(wate.LT.FLTRN(»THEN if particle killed by RR 14
nzcur=-l set nzcur=-l to ShCM particle killed 15
RETURN 16
aIDIF 17
wate=1.OdO particle survived RR, increase wate 18
aIDIF 19
CALL Iscx:u:r assurres isotrcpic scatter in lab system 20
RETURN ! 21
aID 22
190 Chapter 7

The results of a calculation using 10 5 start particles are shown in Table


7.11. As can be seen from the table, the track-length and collision-density
flux estimates provide essentially identical results. The variance of the
track-length flux estimate is slightly smaller than that of the collision-
density flux for this calculation. Unlike the next-event point detector
results, the volumetric detector results are normally distributed and they will
show a reduction in variance that is inversely proportional to the number of
start particles.

Table 7.10. Subroutine 'Stats' for Example 7.2


SUBEUJI'INE Stats 1
REAL (8) bscore(lO) , bstmlSq (10) ,cscore(10) ,cstmlSq(10),tpart (10) ,cpart(lO) 2
CXlM:N/STAT/bscore, bS\.lllSq, cscore, CS\.lllSq, tpart, cpart 3
CXlM:N/IN/npart,nbatch 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 5
CXlM:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tnp,var,stdev,pi,vol(10)
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxrnin(20),rpxmax(20),&
rpymin(20),rpyrnax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40)
LCGlCAL bdtest (40), bdhit (40)
CXlM:N/cg/sphcx, sphcy, sphcz, sphr, rpxrnin, rpxmax, rpymin, rpynax, rpzmin, rpzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
ENI'RY StatChe ! entry point to initialize arrays for exnplete prcblan 8
pi=2.OdO*DACC6(0.0d0) ! to cbtain a double precisioo Pi
bscore=O.OdO; bsurrsq=O.OdO; cscore=O.OdO; cs\.lllSq=O.OdO 9
REIURN 10
ENI'RY Statip ! entry point to initialize arrays for a particle 11
l::part=O.OdO; cpart=O.OdO ! 12
REIURN 13
ENI'RY StatEIp ! entry point to store scores for a particle 14
CO 70 i=1,10
bscore (i)=bscore (i) +I:part (i) ad:i particle score to total
bstmlSq(i) =bsurrsq (i) +I:part (i) **2 sum for variance calculatioo
70 <XNl'INUE
CO 80 i=1,10
cscore (i) =cscore (i) +cpart (i) acki particle score to total
cstmlSq (i) =cstmlSq (i) +cpart (i) **2 sum for variance calculation
80 <XNl'INUE
REIURN 19
ENI'RY StatEild ! entry point to calculate and print results 20
tnp=DFLCAT (npart) 21
CO 90 i=1,10
var=bsurrsq(i)/trnp-(bscore(i)/tnp) **2 variance
!
stdev=~(var) standard deviation
!
vol(i)=4 . 0d0*Pi*(sphr(2*i)**3-(sphr(2*i)-.1dO)**3)/3.0d0 ! vols to nonn scores
WRITE(16,*)i,bscore(i)/tnp/vol(i),stdev/~(tnp)/vol(i)
90 CXNl'INUE
CO 100 i=1,10
var=cstmlSq(i) /trnp- (cscore (i) /tnp) **2 ! variance
stdev=~ (var) ! standard deviatioo
WRITE(16,*)i,cscore(i)/tnp/vol(i),stdev/~(tnp)/vol(i)
100 <XNl'INUE
REIURN 28
END 29
7. Monte Carlo Detectors 191

Table 7.11 . Resu ts 0 fE xample .


I 72
Detector Radius Track Len~h Flux Collision Density Flux
0.95- \.05 0.240007±O.00089 0.239082±0.00 170
\.95-2.05 0.09934±0.OOO37 0.09967±0.00059
2.95-3.05 0.05766±0.OO021 0.05766±0.OOO31
3.95-4.05 0.03725±0.00013 0.03732±0.OOOI9
4.95-5.05 0.02528±0.000091 0.0254 !±O.OOO 13
5.95-6.05 0.0 I 744±O.000063 0.01 742±O.000089
6.95-7.05 0.01 I 77±0.000043 0.01170±0.OOO062
7.95-8.05 0.00756±0.000028 0.00755±0.000042
8.95-9.05 0.00422±O.0000 16 0.00422±0.000027
9.90-10.0 0.00 I 48±0.000004 0.00 I 48±0.0000 13

Collision-density and track-length flux estimators perform similar


functions and in many cases may be used interchangeably. The relative
efficiency of the these estimators is geometry specific. If the geometry
description for tracking is the same as that for the detectors, then the track-
length estimator is usually more efficient than the collision-density
estimator. This is the case in the preceding example. However, in this
example it would be possible to simplify the geometry description if the
track-length estimators were not used. In such a case only one sphere would
be needed to describe the geometry, and the algorithm in subroutine 'Col'
for determining whether or nota collision took place in a detector zone
could be based on the radius of the collision point. As a result, the overall
execution speed would be increased, which might improve the efficiency of
the calculation such that the collision-density estimator would provide
results more accurate than those provided by the track-length estimator in
the same run time.
Volumetric flux estimators, combined with a tally of the number of
particle tracks and collision events contributing to the flux estimates, offer a
simple means for quantifying the sampling of phase space achieved in a
Monte Carlo transport calculation. The number of tracks and collisions that
are produced in selected regions of a geometry, including energy and angle
data where required, can provide valuable diagnostic information about the
thoroughness with which the region has been sampled. Some production
Monte Carlo codes tally this information automatically and present it in
summary tables. Where this information is not available automatically, or is
not considered adequate for analyzing a problem under consideration, the
user may wish to add tallies as required.
192 Chapter 7

7.4 Surface-Crossing Flux Estimator

Consider a particle traveling in direction 0 that crosses a surface at an


angle e with respect to the local normal to the surface, D. Assume the
surface has a small but non-zero thickness t. Then, as shown in Figure 7.3,
the track length L of the particle in the layer is

t
L=- (7.15)
I~I
where

~ =cose =O-n (7.16)

Because the absolute value of the cosine is used in eqn 7.15 it does not
matter whether 0 is the inner or outer normal.

t
Surface I

r
,..-----1'------, L

Figure 7.3. Surface-Crossing Geometry

Assuming the total cross section in the medium from which the particle
is exiting (the current zone) is Lb the probability of the particle having a
collision in the track length L is

(7.17)

Thus we can estimate the flux in the region of thickness t on the surface of
interest by the collision-density flux estimator, where the reaction rate R is
given by

R = wP(L)= w(1-e .EIL) (7.18)

and w is the weight of the particle being scored. Using eqn 7.14 we find the
flux can be estimated by
7. Monte Carlo Detectors 193

(7.19)

The volume of our postulated scoring region is

V=At (7.20)

where A is the area of the boundary concerned. Thus

(7.21)

With eqn 7.15 this becomes

(7.22)

Taking the limit as t ~ 0, and applying L'Hospital's rule, gives

(7.23)

This is the estimator used for scoring the flux on a surface. Because the
surface selected for scoring frequently forms a boundary within the problem
geometry, such a detector is sometimes called a boundary-crossing detector.
It is useful to consider an alternate derivation of eqn 7.23. Recall that
the scalar flux cI> is the integral of the angular flux; i.e., from eqn 3.8

11 211

cI>= J'I'(Q)dQ= J J'I'(9,<p)sin9d<pd9 (7.24)


411 0 0

where <p is the azimuthal angle and 9 is the polar angle as shown in Figure
3.1. Changing variables using J.l = cos 9 and defining 'V(J.l) by

2lt
'V(J.l) = J 'I'(J.l, <p )d<p (7.25)
o

gives
194 Chapter 7

f\jI(Jl )dJl
1

q, = (7.26)
-I

Defining Y(Jl) as the number of neutrons per unit area crossing the x-y
plane in the positive Z direction as a function of Jl, then

(7.27)

Similarly defining r(Jl) for neutrons crossing the x-y plane in the negative Z
direction gives

(7.28)

Using eqns 7.27 and 7.28 in eqn 7.26 gives

(7.29)

These integrals may be solved using Monte Carlo by selecting from r(Jl)
and J+(Jl), which is done by observing boundary crossings during the random
walk process, and then scoring W/IJlI. Because we must normalize the result
by the area of the boundary, eqn 7.29 is equivalent to eqn 7.23. Although
we derived eqn 7.29 by assuming a surface parallel to the x-y plane, it is
valid for any surface.
The flux estimator of eqn 7.23 or eqn 7.29 is not bounded. That is, the
score is unbounded when the particle trajectory becomes tangent to the
detector surface. As we saw for the next-event estimator, unbounded scores
lead to erroneous variance estimates. We therefore may legitimately ask
whether we must tolerate unreliable variance estimates for the surface-
crossing estimator.
As was discussed in Section 7.2, accounting for collisions close to a
next-event estimator is essential for obtaining a correct flux estimate from
the detector. Because one cannot exclude contributions from nearby
collisions, special treatment is required in order to produce a valid variance
estimate in such a detector. However, unlike the next-event estimator, the
contribution to the total flux on a surface, of particles traveling tangent (or
nearly tangent) to the surface, is generally small compared with the
contribution of particles incident from the remainder of the 41t solid angle. b

b An exception would be a parallel beam incident onto a material at a grazing angle.


7. Monte Carlo Detectors 195

In particular, for convex surfaces on the exterior of a problem geometry to


which vacuum boundary conditions are applied, the flux tangent to the
surface will be zero.
Even for an interior surface, if the flux is reasonably isotropic the error
introduced by neglecting particles having 1J.l1 < e, where e is some small
number, will be approximately the surface area of the disk defined by this
range of cosines divided by the total solid angle, or 2e/41t. Therefore it
would seem that we could define a practical value for e, and exclude
particles with 1J.l1 < e from our surface-crossing flux estimate, without
introducing a significant systematic bias in the result.
We can confirm this conclusion, and determine the effect the exclusion
of particles traveling nearly tangent to a surface will have on the variance
estimate of our detector, by using a simple approximation. Let us expand
the angular flux \jI at the surface in terms of J.l,

(7.30)

and keep only the isotropic and first order anisotropic terms

(7.31)

Since the probability of surface-crossing events is related to r(J.l) and Y(J.l)


or, by eqns 7.27 and 7.28, apart from a constant to 1J.l1\jJ(J.l), the variance in
this estimator will be

(7.32)

Substituting eqn 7.31 into 7.32, considering only the half space J.l> 0, and
neglecting particles having J.l < e, gives

(7.33)

This result is clearly finite for any e > O. As e ~ 0 the log term dominates;
i.e., for small e the variance is logarithmically divergent,
196 Chapter 7

1
if ~aln­ (7.34)
e

where a is some constant.


On the other hand, again using eqn 7.31 and neglecting particles having
J.I. < e, the scalar flux over the positive-J.I. half space is given by

cjI(e) = 21t J\jIdJ.l.


£
~ 21t[a o (1- e) + i (1- e 2 )] (7.35)

As expected, this result approaches the correct value as e ~ O. That is, the
excluded region of the integral, 0 :::;; J.I. < e, would have contributed an amount

(7.36)

to the flux. The magnitude of the error introduced by neglecting this


contribution is first order in e. This means that scores in surface-crossing
detectors from particles striking the surface at grazing angles produce higher
order effects in the variance than they do in the flux estimate.
We conclude that, to first order, the variance estimate obtained using a
surface-crossing detector that ignores grazing particles over the cosine
interval [0, e] will behave as In(lIe) while the estimate for the flux will
approach cjI x (1 - e). If we exclude a small band of grazing angles from the
detector score we may still expect to obtain a flux estimate of acceptable
accuracy as well as a reasonable variance estimate. In a manner somewhat
analogous to the use of average scores for collisions inside a small spherical
region about a next-event estimator, one may choose to improve this
approximate surface-crossing flux result by estimating the score that would
have been contributed by the excluded component of grazing angles using
non-stochastic means. For example, one may use some mean value of 1I1J.1.1
in scoring every particle crossing the surface with IJ.l.I < e. One way to
estimate such a mean value is to assume the angular flux is approximated by
eqn 7.31 over the interval 0 :::;; IJ.l.I :::;; e. That is, we wish to select randomly
over J.I. E (-e, e) using this equation. To do this we wish to model an angular
flux per unit solid angle that contains only isotropic and first order
anisotropic terms. In terms of the probability of a boundary crossing event
this can be done by defining g(J.I.) = IJ.l.I\jI(J.I.)=IJ.l.I(ao + alJ.l.). This gives
7. Monte Carlo Detectors 197

J J- J
& 0 &

gdJ.l = J.l(a o + alJ.l)dJ.l + J.l(a o + alJ.l)dJ.l = £2 ao (7.37)


-& -& 0

The expected value of 1I1J.l1 is given by

(7.38)

-&

Thus when a particle strikes a surface detector at grazing incidence, with -£


< J.l < £, one can score 1J.l1 = £/2; i.e.,

(7.39)

instead of eqn 7.23. With this correction the error in the flux estimate is no
longer proportional to 1 - £, but is reduced to the extent that 2/£ is a good
estimate of the mean value of 1I1J.l1 for 1J.l1 < £. The assumption that the flux
over -£ < J.l < £ can be modeled with one anisotropic term is generally good
for small £. The non-stochastic estimate 2/£ for the flux contribution over
this interval usually eliminates systematic bias in a surface-crossing
estimator while still providing reasonable variance estimates. It remains to
choose a value for £ that will keep the variance within reasonable limits
while retaining 2/£ as a good estimate for 1I1J.l1 when I!J.I < £. The value e =
0.01 has proved to be reasonable and in practice, for such a small £, it does
not matter very much whether the 2/£ correction is made.

Example 7.3. Surface-crossing flux estimates

As an example of the use of surface-crossing flux estimators, and as a


test of the approximation for grazing incident scores given by eqn 7.39, let
us consider again the problem of Examples 3.1, 7.1, and 7.2. For
comparison with the previous results we will place surface detectors at unit
mfp intervals from the source, plus one at 0.1 mfp and one at 9.9 mfp.
These locations will allow comparisons with the results of our previous
examples. The geometric description for using PFC to solve this problem is
given in Table 7.12. The cross sections and non-absorption probabilities are
198 Chapter 7

both equal to one for all zones in the problem, as was the case in Example
7.2.
In order to score a boundary crossing by means of eqn 7.23 we must
determine the point of intersection of the particle track and the detector
surface, as well as the angle between the flight path and the normal to
detector surface at this point of intersection. Since we are using concentric
spherical surfaces as our detectors, the normal to the detector surface at the
point at which the particle track intersects the surface will always be in the
radial direction. For a particle undergoing a collision at the point p, and
departing the collision in direction n, the coordinates Pi = (x,y,z) of the
intersection of the particle track with a spherical surface of radius r = rd
centered at the origin are given by eqn 3.44, where s is determined by eqn
3.49 with ro2 = rio This geometry is shown in Figure 7.4.

Table 7.12. Geome!!y Description for Example 7.3


o There are no RPPs
12 There are 12 spheres
O.OdO O.OdO O.OdO O. IOdO Center coordinates and radius-sph I
O.OdO O.OdO O.OdO 1.00dO Center coordinates and radius-sph2
O.OdO O.OdO O.OdO 2.0dO Center coordinates and radius-sph3
O.OdO O.OdO O.OdO 3.0dO Center coordinates and radius-sph4
O.OdO O.OdO O.OdO 4.0dO Center coordinates and radius-sph5
O.OdO O.OdO O.OdO 5.0dO Center coordinates and radius-sph6
O.OdO O.OdO O.OdO 6.0dO Center coordinates and radius-sph7
O.OdO O.OdO O.OdO 7.0dO Center coordinates and radius-sph8
O.OdO O.OdO O.OdO 8.0dO Center coordinates and radius-sph9
O.OdO O.OdO O.OdO 9.0dO Center coordinates and radius-sphlO
O.OdO O.OdO O.OdO 9.90dO Center coordinates and radius-sphil
O.OdO O.OdO O.OdO IO.OdO Center coordinates and radius-sphI2
13 There are 13 zones.
1 1 Zone I has one body, I
2 2 -I Zone 2 has two bodies, 2 and -I
2 3 -2 Zone 3 has two bodies, 3 and -2
2 4 -3 Zone 4 has two bodies, 4 and -3
2 5 -4 Zone 5 has two bodies, 5 and -4
2 6 -5 Zone 6 has two bodies, 6 and -5
2 7 -6 Zone 7 has two bodies, 7 and -6
2 8 -7 Zone 8 has two bodies, 8 and -7
2 9 -8 Zone 9 has two bodies, 9 and -8
2 10 -9 Zone 10 has two bodies, 10 and -9
2 II -10 Zone II has two bodies, II and-IO
2 12 -II Zone 12 has two bodies, 12 and -II
I -12 Zone 13 has one body, -12
7. Monte Carlo Detectors 199

z
n

r===-----+--+---y

Figure 7.4. Particle Track Intersection with Spherical Surface Detector

To have an intersection, at least one value of s from eqn 3.49 must be


positive and real. At the point Pi the cosine of the angle between the particle
track and the surface outer normal will be the dot product of the particle
direction and this normal, J..l = n e n. The normal to the spherical surface
will be n = (xlrd,y/rd;zird). From these relations we can determine the cosine
J..l, with which we can complete the score of eqn 7.23. The list of the
modified subroutines to be used in this calculation is given in Table 7.13.

Table 7.13. Modified SubroutInes t;or Example


I 73
Subroutine Location
'Bdrx' Table 7.14
'Stats' Table 7.15

Subroutine 'Bdrx.,' given in Table 7.14 is called each time a boundary is


crossed. It calculates nen and stores the result in the variable 'ctheta.' The
routine then checks to see which boundary the particle has crossed. The
boundary crossed depends on the sign of 'ctheta.' If the particle is directed
outward, the cosine is positive and the particle path crosses the outside
boundary of the current zone. If the cosine is negative, the particle is
traveling inward and its path crosses the inner boundary of the zone.
Finally, the weight crossing the appropriate boundary is scored using eqn
7.23, but without the normalization for the area of the boundary. For
grazing incidence eqn 7.39 is used and for 1J..li < 0.01 all scores are treated as
if 1J..li = 0.005. The statistics for the results are calculated by subroutine
'Stats.' This subroutine, shown in Table 7.15, normalizes the results for
each detector using the area ofthe boundary associated with the detector.
200 Chapter 7

Table 7.14. Subroutine 'Bdrx' for Example 7.3


SUBfOJl'INE BmX 1
REAL (8) delta, tllp,ctheta
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 3
rpjmin(20), rpynax(20), rpzmin(20) , rpZll'aX(20) ,1:xlin(40) ,lxblt (40) 4
LOGICAL bdtest(40) , bdhit(40) 5
aM{N/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpxmax, rpjmin, rpyrrax, rpzmin, rpZll'aX, & 6
l:xlin,lxblt,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit 7
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 8
aM{N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
REAL (8) cinfp, dtr, xsec, ck:ur ! 10
aM{N/TRACK/cinfp, dtr, xsec, ck:ur 11
REAL (8) bscore(12) ,bsumsq(12) ,CSCX)re(10) ,csurnsq(lO) ,qrut(12) , cp3rt (10)
aM{N/STAT/bscore,bsumsq,cscore,cstmSq,qrut,cp3rt
delta=dtr-d::ur ! de1ta--mstance traveled to reach boundary 12
cb.u:=dtr ! update current distance traveled 13
<infp=dnfp-delta*xsec ! subtract current distance in mfp fran cinfp 14
x=x+u*delta: y=y+V*de1ta: z=z+W*delta ! update position 15
tmp=sqrt(x*x+y*y+z*z) radius of sphere at intersection
ctheta= (x*u+y*v+z*w) /tllp ! cosine of angle with sphere noma!
i =nzcur ! boundary index if going oot
if(ctheta.LT.0.OdO)i=i-1 ! boundary index if going in
IF(ABS(ctheta) .LT.0.01dO)ctheta=O.005d0 ! correction for SIlBllangles
qrut(i)=I:part(i)+wate/ABS(ctheta) ! score boundary crossang
nzcur=newzn change identifier of current zone 16
if(nzcur.LT.nzanes)RE:I'URN if not at ooter zane then return 17
nzcur=-l set nzcur=-l if in ooter zone (for escape) 18
RE:I'URN I 19
END I 20

Table 7. J5. Subroutine 'Stats' for Example 7.3


SUBIOJI'INE Stats 1
REAL (8) bscore(12) , bsunsq (12) , CSCX)re (10) ,cstmSq(10) ,qrut(12) ,cp3rt(10)
aM{N/STAT/bscore,bs1.ll5q,CSCX)re,csurnsq,qrut,cp3rt 3
aM{N/IN/npart, nbatch 4
REAL (8) X, y, z, u, V, w, xo, yo, zo, 00, vo, wo, wate, age, energ 5
aM{N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tllp,var,stdev,pi,area
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&
rpjmin(20),rpynax(20),rpzmin(20),rpZll'aX(20),1:xlin(40),lxblt(40)
LOGICAL bdtest(40), bdhit(40)
aM{N/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpxmax, rpjmin, rpyrrax, rpzmin, rpZll'aX, &
l:xlin,lxblt,nsph,nrpp,nbdy,nzanes,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
ENlRY Stat01e ! entry point to initialize arrays for a:np1ete prd::>lan 8
bscore=O.OdO: bsl.m3<FO.OdO: CSCX)re=O.OdO: csunsq=O.OdO ! 9
RE:I'URN 10
ENlRY Statlp ! entry point to initialize arrays for a particle 11
q:rut=O. OdO: cp3rt=O. OdO ! 12
REIURN 13
ENlRY StatEIp ! entry point to store scores for a particle 14
[X) 70 i=l,12
bscore(i)=bsoore(i)+bpart(i): bs1.ll5q(i)=bs1.ll5q(i)+bpart(i)**2 ! score particle
70 CXNI'INUE
REruRN 19
ENlRY StatEh:i ! entry point to calculate and print results 20
tmp=DFU:lAT (npart) 21
pi=2.OdO*DACOS(0.0d0)
[X) 90 i=l,12
var=bslm;q(i) /tllp- (bscore (i) /tllp) **2 estinate of variance
stdev=~(var) estinate of staOOard dev.
area=4 •OdO*pi *sphr (i) **2 area of boundary
~(16,*)i,bscore(i)/tllp/area,stdev/~(tllp)/area
90 CXNI'INUE
REIURN 28
END 29
7. Monte Carlo Detectors 201

The results obtained by running PFC with the indicated modifications for
105 source particles are shown in Table 7.16. The flux estimates from
Examples 7.1 and 7.2 are shown for comparison. The surface-crossing flux
estimates shown in Table 7.16 are in excellent agreement with the track-
length fluxes. The apparent discrepancy between the detectors at 9.9 and
10.0 mfp is caused by the fact that the track-length flux is the average flux
within the volume from r = 9.9 to r = 10.0 while the surface-crossing flux is
calculated at these two radii. The next-event estimator has reasonable
results, except for the detectors at 0.1 and 8.0 mfp. For these two cases the
estimated flux is lower than the more-reliable surface-crossing estimate. At
both of these radii the estimated standard deviation is also lower for the
next-event estimator than for the surface-crossing estimator. This is typical
of the next-event estimator in which a poor estimate of the answer is often
associated with a small standard deviation.

Table 7./6 Resu1ts f;or Example 1 73


. Wit. hC ompansons to 7.1 an d 7.H or 10 Particles
Detector Ex. 7.1 Ex. 7.2 Ex. 7.3 Surface-
Radius Next-Event Track Length Crossing
0.1 9.ISS±.029 9.26S±.042
l.0 0.24S±.0091 0.240007±.000S9 0.2406±.00IS
2.0 0.099±.0026 0.09934±.00037 0.099S±.000S3
3.0 0.OSS7±.00IS 0.OS766±.00021 0.OS7S±.00027
4.0 0.0371±.0009 0.0372S±.00013 0.037l±.000IS
S.O 0.0240±.0007 0.02S2S±.91-4 0.02SS±.OOOI2
6.0 0.0 177±.000S 0.0 1744±.63-4 0.0174±.S2-4
7.0 0.0 II O±.OOOS 0.01 177±.43-4 0.01lS±.5S-4
S.O 0.006S±.0002 0.007S6±.2S-4 0.007S9±.3S-4
9.0 0.0043±.0003 0.00422±.16-4 0.00422±.22-4
9.9 0.0016±.0002 0.0014S±.4-S* 0.00164±.93-S
10.0 0.0014S±.4-S* 0.00130±.39-S
* These results represent the average flux from 9.9 to 10.0 mfp.

7.5 Expectation Surface-Crossing Flux Estimator


The standard surface-crossing flux estimator, like the track-length and
collision-density detectors, suffers from the fact that no score is made unless
a particle crosses the surface being scored. It would seem to be desirable,
under some circumstances, to have a method of improving the frequency of
scores in boundary-crossing detectors. There is such a method available,
called the expectation surface-crossing estimator, or extrapolated boundary-
crossing detector. 4 The surface used for the expectation surface-crossing
detector may be, but need not be, all or portions of the surfaces used to
define the problem geometry. An expectation surface-crossing estimator
202 Chapter 7

can also use an imaginary surface that is completely independent of the


surfaces used in defining the problem geometry.
The Monte Carlo random walk provides a sample set of source points,
collision points, and particle flight paths in the geometry being sampled.
Any method by which we can relate these events to the probability of
scoring a quantity of interest can be used as a means of estimating that
quantity. Thus, given a source particle or a collision, and the weight,
energy, and direction of travel of the particle leaving that source point or
collision, we know that the probability of the particle traveling a distance r
without suffering an intervening collision, p(r), is given by e-13 , where /3 is
the optical path of eqn 7.2; i.e.,

-fl:,(E,s)ds
p(r) = eO (7.40)

If we place a detector at a distance r along the path of the particle as it


leaves the event, we know the particle has the probability given by eqn 7.40
of reaching the detector. Assume the detector is a surface-crossing detector,
with normal n at the point at which the extended particle trajectory crosses
the detector. This geometry is shown in Figure 7.5. We can estimate the
flux on the detector surface contributed by this particle by using the product
of eqns 7.40 and 7.23

W -f l:, (E,s)ds
cp=--e o (7.41)
AI~I

By applying eqn 7.41 to every source particle and to every post-collision


particle whose track intersects a detector surface, we can get an estimate of
the flux on the surface without requiring the particles to cross the surface.
Clearly we increase the probability of getting scores by this method
compared with the method in which only particles actually crossing the
detector surface are scored. If a particle crosses the detector surface we
necessarily get a score in the expectation detector since the trajectory had to
be aiming at the detector in order for the particle to cross the surface, but we
also get a score even if the particle does not reach the detector without
suffering a collision.
With this expectation detector we do not score particles when they
actually cross the surface of the detector, we score only trajectories that
extrapolate to the surface. We are using the flux leaving source points and
collisions as our estimator, not the event of a surface crossing. If we used
the latter as well as the former we would score some trajectories twice. The
7. Monte Carlo Detectors 203

detector surface need not be flat. If the surface is curved it is possible for a
trajectory to pass through it at more than one point. In this case the scores at
all ofthe crossing points are included in the flux estimate.

Paths ___
Collision Point
_--t---nt-~
E,n
n

Figure 7.5. Geometry for Expectation Surface-Crossing Detector

The expectation surface-crossing estimator suffers from the problem of


grazing-angle crossings just as the standard boundary-crossing estimator
does. We can avoid this problem by scoring eqn 7.41 only for l!-ll > E and
scoring

2w -Il:,(E,S)dS
<j)=-e 0 (7.42)
E

for l!-ll < E.


The expectation surface-crossing estimator can produce results even
when particles are not tracked to the vicinity of the detector. Thus this
estimator shares one of the weaknesses of the next-event, flux-at-a-point
estimator. Scores in such a detector do not provide confirmation that a
thorough sampling of the phase space near the detector has been achieved.
As always it is necessary to ensure that particles are tracked into the
important regions of the problem in order to be confident that the answer is
correct.

Example 7.4. Expectation surface-crossing flux estimates

Let us return one more time to the problem considered in the previous
examples of this chapter. As in Example 7.3 we will place boundary
crossing detectors at 0.1 mfp and 9.9 mfp as well as at integral multiples of
one mfp, for a total of twelve detectors. This time, however, we will score
the detectors using the expectation surface-crossing estimator.
The geometric description for using PFC to solve this example is .shown
in Table 7.17. For this application we have defined only two zones although
204 Chapter 7

we have included twelve spheres in the geometry definition. The latter will
provide the detector surfaces for the expectation surface-crossing estimators.
The list of the modified subroutines to be used in this calculation is given in
Table 7.18.

Table 7.17. Geometry Description for Example 7.4


o There are no RPPs
12 There are 12 spheres
O.OdO O.OdO O.OdO O.ldO Center coordinates and radius-sph 1
O.OdO O.OdO O.OdO l.OdO Center coordinates and radius-sph2
O.OdO O.OdO O.OdO 2.0dO Center coordinates and radius-sph3
O.OdO O.OdO O.OdO 3.0dO Center coordinates and radius-sph4
O.OdO O.OdO O.OdO 4.0dO Center coordinates and radius-sph5
O.OdO O.OdO O.OdO 5.0dO Center coordinates and radius-sph6
O.OdO· O.OdO O.OdO 6.0dO Center coordinates and radius-sph7
O.OdO O.OdO O.OdO 7.0dO Center coordinates and radius-sph8
O.OdO O.OdO O.OdO 8.0dO Center coordinates and radius-sph9
O.OdO O.OdO O.OdO 9.0dO Center coordinates and radius-sphl0
O.OdO O.OdO O.OdO 9.90dO Center coordinates and radius-sphll
O.OdO O.OdO O.OdO IO.OdO Center coordinates and radius-sphl2
2 There are 2 zones.
I 12 Zone I has one body, 12
I -12 Zone 2 has one body, -12

Table 7. lB. Modified Sub routmes D


or Example
I 74
Subroutine Location
'Stats' Table 7.15
' Dist' Table 7.19

It is convenient to use 'Dist' to perform the expectation surface-crossing


estimation since this subroutine is called at the beginning of every tracking
operation. If 'Col' had been used, the estimate would have been made only
for the post-collision trajectories. In such a case it would have been
necessary to add the uncollided contribution to each detector. The modified
subroutine 'Dist' is shown in Table 7.19. This subroutine uses 'Sph' to
determine whether a track intersects the surface of the spheres that define
the detectors. If the track passes through a sphere, then a score is added to
the array 'bpart' using eqn 7.41 or 7.42. If the particle originates outside the
sphere, then it is also necessary to score the point at which the track leaves
the sphere; i.e., two scores must be made. The coding necessary for this
scoring is contained in the do loop of statement 100. Obviously, a track can
intercept more than one detector.
The results of a calculation using 105 start particles are shown in Table
7.20. The results from Example 7.3 are shown for comparison. For most of
the detectors considered here the expectation surface-crossing estimators
show a slight reduction in the uncertainty compared with the previous
7. Monte Carlo Detectors 205

results, for the same number of start particles. However, the present
calculation required 93 seconds of execution time versus 37 seconds for the
calculation in Example 7.3. Increasing the run time of the surface-crossing
estimator to match that of the current calculation should decrease the
standard deviations obtained by a factor of 1.59. Thus the expectation
surface-crossing estimator is less efficient than the surface-crossing
estimator for all of the detectors in this example.

Table 7.19. Subroutine 'Dist' for Example 7.4


SUBIOJl'INE DIST 1
REAL (8) FLTRN,r,xi,yi,zi,ctheta
REAL (8) cinfp,dtr,xsec,ck::ur 3
cx::Mn'I/TRACK/cinfp, dtr, xsec, ck::ur 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
cx::Mn'I/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&! 7
rpymin(20),rpyrnax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 8
LOGICAL bdtest(40), bdhit(40) 9
cx::Mn'I/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpxmax, rpymin, rpyrnax, rpzmin, rpzmax, & 10
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit 11
REAL (8) bscore(12) ,bs1.l1lSq(12) ,cscore(10) ,csumsq(10),!:part (12) ,cpart(10)
cx::Mn'I/smTlbscore, bs1.l1lSq, cscore, csumsq,!:part, cpart
REAL (8) sigt (20) , c (20) ! cl:i!rensions allCM up to 20 different rredia
cx::Mn'I/GEX:M/sigt,c !sigt is total cross sectioo, c is non-absorptioo prcb
r=FLTRN () ! pick a randan nl.llber 12
dnfp=-DLOG(r) distance traveled in nean free paths 13
xo=x; yo=y; zo=z store "starting" positioo for track 14
ck::ur=O.ODO initialize distance currently traveled 15
DO 50 i=l,nbdy ! 16
bdtest(i)=.~E. ~g a new track, no bodies yet tested 17
50 <XNI'INUE ! 18
DO 100 i=1,12 locp over twelve detectors
bdtest (i) =.TRIJE.
CALL SPH(i) use sph to see i f track hits surface, etc.
IF(bdhit(i»'rnEN i f track intersects sphere
xi=x+b::lout (i) *u; yi=y+b::lout (I) *v; zi=z+b::lout (i) *w! exit intersect point
ctheta=(xi*u+yi*v+zi*w)/sphr(I) ! cosine of angle with noonal
IF(DABS(ctheta).LT.0.01dO)ctheta=O.00SdO ! correctioo for small angles
!:part(i)=bpart(i)+wate*EXP(-sigt(nzcur)*bdout(i»/DABS(ctheta) ! score
IF(bdin(i) .GI'.O.OdO)'rnEN ! see i f track intersects entering
xi=x+bdin(i)*u; yi=y+bdin(I) *v; zi=z+bdin(i)*w ! entering intersect point
ctheta=(xi*u+yi*v+zi*w)/sphr(i) ! cosine of angle with noonal
IF (DABS (ctheta) .LT. 0 . 01dO)ctheta=O.00SdO ! correctioo for small angles
!:part (i) =bpart (i) +wate*EXP (-sigt (nzcur) *bdin (i) ) /DABS (ctheta) ! score
ENDIF
ENDIF
100 <XNI'INUE
RETURN 19
END 20
206 Chapter 7

Table 7.20 Resu1ts tlor Example1 74 U'smg 105 partlC


• 1es

Detector Ex 7.3 Surface- Ex 7.4 Expectation


Radius Crossing Surface-Crossing
O.l 9.268±.042 9.277±.039
1.0 0.2406±.0015 0.2407±.0013
2.0 0.0998±.00053 0.100l±.00047
3.0 0.0575±.00027 0.0576±.00024
4.0 0.037l±.00018 0.0372±.00015
5.0 0.0255±.00012 0.0255±.00011
6.0 0.0174±.82-4 0.0174±.71-4
7.0 0.0118±.55-4 0.01 17±.47-4
8.0 0.00759±.38-4 0.00757±.33-4
9.0 0.00422±.22-4 0.00423±.21-4
9.9 0.00164±.93-5 0.00165±.1O-4
10.0 0.00130±.39-5 0.00129±.49-5

7.6 Time-Dependent Detectors

To this point the presentation of particle transport by Monte Carlo, and


the example problems treated, have been steady state; i.e., there has been no
consideration of the time dependence of external sources or the time
required for movement of particles through the problem geometries. Many
practical problems include time dependence, and in such problems it is
necessary to consider the time parameter in order to obtain the desired
result. Time dependence can enter a problem in a number of ways,
including delayed particle emission from capture and fission, temperature
fluctuations from changes in reactor power levels, and reactor fuel burn up.
We will not consider changes of this type, however; rather, for present
purposes, we will consider only the time dependence produced by the time
variation of the source and the time of travel of the particles through the
geometry.
The key to including time dependence in a Monte Carlo particle
transport calculation is to assign a start time to a particle track and use the
speed of the particle to establish a chronology of events during the life of the
particle. With such a chronology one can correlate all events of interest in
the detector scoring and thereby obtain the time dependence of the results.
No special provisions are necessary to accommodate time dependence in
Monte Carlo, such as are required for including time dependence in
deterministic solutions to the transport equation. Using the tools described
in the previous chapters one can easily begin including the time variable.
The non-relativistic expression for the kinetic energy of a particle of rest
mass m) is E = m) v2/2, where v is the speed of the particle. The relativistic
kinetic energy of such a particle is Er = (m-m)c 2, where m = m/-V(1-(v/ci),
and c is the speed of light. A neutron has a rest mass of m) ~ 1.686 x 10-24 g;
7. Monte Carlo Detectors 207

therefore, the error in the neutron velocity incurred by using the non-
relativistic approximation at a neutron energy of 14 MeV will be (E - Er)/Er
R: 0.0103. Since 14.1 MeV (the energy of the neutron emitted in a fusion
reaction between deuterium and tritium) is a reasonable upper limit for
neutron energies of interest in many neutron transport problems, and since
this error of about 1% is normally considered acceptable for transport
analysis, we conclude that we can treat the kinematics of neutron motion
non-relativistically. Therefore the speed of a neutron having energy E will
be assumed to be

v=f! (7.43)

Using the conversion 1.60 x 10- 12 erg/eV, the speed of a neutron in cm/sec
as a function of its energy E in eV is

V R: 1.383 x 106 .JE (7.44)

If a neutron undergoes a collision at time t, leaves the collision with speed v,


and then travels a distance d before its next collision, it will arrive at the
next collision at time t',

t'=t+~R:t+0.723xl0-6 ~ (7.45)
v ...,E
We may neglect the interaction time of the neutron with the scattering
nucleus compared with the time of flight between collision points because
such interactions occur over distances on the order of the nuclear radius,
which is many orders of magnitude smaller than the distance between
nuclei. Thus we can use eqn 7.45, applied cumulatively to each particle free
flight, to assign a time to every collision, boundary crossing, or other event
of interest in the neutron's random walk.
The energy of particles and time-dependence of events in a Monte Carlo
transport problem are normally scored using a discrete mesh. The
boundaries of these discrete meshes can be selected by the user in a manner
best suited to the particular problem under consideration. The width of the
time and energy steps can be varied at will; however, as always, the
statistics will typically be better with wide steps than with narrow steps.

Example 7.5. Time-dependence of the flux from a point isotropic source

Consider a point, isotropic source that emits an instantaneous pulse of


particles at time zero into an absorbing and scattering material. We assume
208 Chapter 7

the particles are monoenergetic and consider scattering that is isotropic in


the laboratory coordinates. For convenience we will assume the material
has a total macroscopic cross section of unity (e.g., 1 cm- I ) and a non-
absorption probability of c. We further assume the particles have a velocity
v in units ofmfp per unit time interval (e.g., cm/sec.) We wish to know the
time-dependent flux of particles within the material as a function of distance
from the source point.
One could use an unbounded geometry to model this problem, but as an
alternative let us consider a large but finite homogeneous space filled with
our defined scattering and absorbing material. Because our volume is
essentially unbounded we will use a combination of time kill and Russian
roulette to terminate the particle tracks. With the time kill, particles will be
followed until they reach a certain maximum age, at which time their tracks
will be terminated. That is, we will select a maximum time for which we
are interested in the results, and say nothing about the flux at times later
than this.
We are interested in both the time history of the flux at various radial
locations, and the radial dependence of the flux at various times. Thus we
will require detectors that are located at several different radii. For these
detectors we will use both the standard and the expectation surface-crossing
detectors described in Sections 7.4 and 7.5.
Standard surface-crossing estimators have been included to provide a
means of ensuring that the phase space has been sampled adequately and to
provide confidence that the expectation surface-crossing estimator results
are valid. We need the time at which a particle crosses a detector surface
and therefore we must determine the travel time of the particle from its
source or collision point to the detector surface, whether the score is based
on an actual or an expectation track. That is, to the collision time we will
add the time of flight from the collision to the detector. We will define time
bins for each detector and we will score each particle crossing the detector
in the time bin corresponding to the calculated time. We will use detectors
at ten different radii from the source point, and estimate the flux from zero
to 30 sec following the source pulse.
The monoenergetic, pulsed source will produce a wave of uncollided
particles that will propagate outward from the source point. No particles
will be present in front of the wave. After the wave front passes a given
location, particles that have experienced one or more collisions will begin to
arrive. This scattered flux will decrease as the particles diffuse and are
absorbed. Knowing the velocity of the particles we can determine when the
wave will arrive at each detector, and we can resolve the time-dependence
of the flux in the vicinity of the wave front by using small time steps
following this arrival time. On the other hand, in order to follow the flux at
late times we would prefer to use relatively large time steps. Because it is
7. Monte Carlo Detectors 209

not necessary to use constant time steps, or even the same time bins for
every detector, we can easily obtain both early- and late-time data at each
detector. Relatively small time intervals have been selected for the time
mesh of the expectation surface-crossing estimators in order to resolve the
particle wave front.
The list of the modified subroutines to be used in this calculation is given
in Table 7.21. A modified version of subroutine 'Source' is shown in Table
7.22. This subroutine uses the standard isotropic point source at the origin
but initializes the 'age' variable in order to track the time of the events in the
particle random walk. The modified subroutine 'Col' is shown in Table
7.23. This routine updates the particle age at each collision site. Particles
that are older than the age cutoff are terminated. The simple version of
Russian roulette used in previous examples is included.

Table 7.21. Modified Sub routmes tIor Example


I 75
Subroutine Location
'Source' Table 7.22
'Col' Table 7.23
'Bdrx' Table 7.24
'Dist' Table 7.25
'Stats' Table 7.26

Table 7.22. Subroutine 'Source' for Example 7.5


SUBlUJTINE SCXJOCE 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
pi=2.OdO*DA(XJ3(0.0d0) ! keep for rrore carplicated soorce that needs pi 4
x=O.OdO; y=O.OdO; z=O.OdO! starts at origin 5
nzcur=1 assurres source is in zone one 6
CALL rscaJI' direction chosen isotrcpica11y 7
wate=1.OdO particle starts with a weight of one 8
age=O. OdO particle starts with an age of 0
REIUPN 9
aID 10

The detectors are scored using the methods of Examples 7.3 and 7.4 with the
addition of the transit time of the particle flight from the source point or
collision site to the detector. The modified subroutine 'Bdrx' is shown in
Table 7.24. This subroutine scores the standard boundary-crossing flux. It
updates the age of the particle to determine the time of each boundary
crossing, and scores the flux estimate in the appropriate time bin. It
terminates the tracks of particles that are older than the age cutoff when they
reach the boundary. Subroutine 'Dist' is shown in Table 7.25. This
subroutine performs the expectation surface-crossing estimation. As is
done for the standard boundary-crossing detector, the code determines the
time of each boundary crossing and scores the flux estimate in the
appropriate time bin. If the extrapolated time exceeds the cutoff the routine
210 Chapter 7

does not produce a score but tracking continues. The modified subroutine
'Stats' is shown in Table 7.26. This subroutine sums the tallies and
performs the variance analysis of the time-dependent detectors.

Table 7.23. Subroutine 'Col' for Example 7.5


SUBFCUI'INE COL 1
REAL (8) FLTRN,de1ta, vel
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) ctnfp, dtr, xsec, dcur ! 5
OOMMON/TRACKIctnfp,dtr,xsec,dcur 6
REAL (8) sigt(20),c(20); ! diIrensicns allaN up to 20 different rredia 7
OOMMON/GEX:M/sigt, c; ! sigt is total cross section, c is non-absorption prd:> 8
ve1=1.OdO ! assmed. velocity for all particles
de1ta=dmfp/xsec ! distance traveled to collision 9
dtr=dc\lr-t{ielta ! update total distance traveled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! update position 11
age=a~lta/vel
IF(age .GE. 30.OdO)TIlEN check to see if exceed age limit
nzcur=-l exceeded age limit, set flag to kill
RE:ruPN
ENDIF
wate=wate*c(nzcur) reduce wate by non-absorption prcbability 12
IF(wate.LT.O.OOldO)TIlEN ! if wate small play Russian roulette
IF(O.ldO.LT.FLTRN(»TIlEN ! if particle killed by RR
nzcur=-1 set nzcur=-l to shcM particle killed 15
RE:ruPN 16
ENDIF 17
wate=wate*10.OdO ! particle survived RR, increase wate
ENDIF ! 19
CALL Isa:m' asSI.lleS isotrcpic scatter in lab system 20
RE:ruPN ! 21
END 22

Table 7.24. Subroutine 'Bdrx' for Example 7.5


SUBroJI'INE BDRX 1
REAL (8) delta, vel, tnp, bage, ctheta
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 3
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 4
lffiICAL tx:ltest (40), Ixlhit (40) 5
OOMMON/cg/sphcx, sphcy, SIilCz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, & 6
bdin,tx:lout,nsph,nrpp,nbdy,nzanes,nbz(40,41),nnext(40,40,40,2),tx:ltest,lxlhit 7
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 8
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
REAL (8) ctnfp,dtr,xsec,dcur ! 10
OOMMON/TRACKIctnfp, dtr, xsec, dcur 11
REAL (8) bscore(10,30) , bsI.Insq (10, 30) ,csoore(10, 10) ,csurreq(10, 10), &
bpart(10,30),cpart(10,10),escore(10,30),esurreq(10,30),epart(10,30)
OOMMON/STAT/bscore,bsurreq,csoore,cs1.ll'5q,bpart,cpart,escore,esurreq,epart
vel=1.OdO ! assured velocity for all particles
delta=dtr-dcur ! delta--&stance traveled to reach boundary 12
dcur=dtr ! update current distance traveled 13
clnfp=ctnfp-delta*xsec ! subtract current distance in mfp fran ctnfp 14
x=x+u*delta; y=y+v*delta; z=z+w*delta ! update position 15
age=age+delta/vel update age of particle
IF(age.GE.30 . OdO)TIlEN check to see if particle has exceeded age limit
nzcur=-1 exceeded age, set flag to kill
RE:ruPN
ENDIF
tnp=DSQRT(x*x+y*y+z*z) ! radius of sphere at intersection
ctheta=(x*u+y*v+z*w)/tnp ! cosine of angle with sphere noma!
i=nzcur ! 00Jndary in:Iex if going rut
7. Monte Carlo Detectors 211

Table 7.24. con't ...


if (ctheta. LT . O. OdO) i~i-1 ! boundary in:Iex if going in
IF(DABS(ctheta).LT.0.01dO)ctheta=O.00SdO ! correction for small angles
bage=age-SFhr(i)+D.OOOOOOl ! t:il1'e after wave front reaches boundary
IF(bage.GE.0.0d0.AND.bage.LT.3.0d0)THEN
j=INr (bage*lO. OdO) +1
tpart(i,j)=tpart(i,j)-koIate/DABS(ctheta) ! score boundary crossing
ENDIF
bage=age
IF(age.LT. 29 . 999999) bage=bage+{). 0000001 put uncollided flux across boundary
j=INr(bage/3.OdO)+1
cpart(i,j)=cpart(i,j)-koIate/DABS(ctheta)
nzcur=newzn ! d1ange identifier of Olrrent zone 16
IF(nzOlr.LT.nzones)REIURN if not at outer zone then return 17
nz==-l ! set nz~ 1 if in outer zone (for escape) 18
REIURN ! 19
END 20

Table 7.25. Subroutine 'Dist' for Example 7.S


SUBRaJI'INE DIS!' 1
REAL (8) FLTRN, r,xi, yi, zi,ctheta, vel
REAL (8) chifp, dtr, xsec, cb.u: 3
cx:M1:N/TAACKIchifp, dtr, xsec, cb.u: 4
REAL (8) X, y, z,u,v,w,xo, yo, zo, 00, vo,w::>,wate,age,energ 5
cx:M1:N/PART/x,y,z,u,v,w,xo,yo,zo,oo,vo,w::>,wate,age,energ,nzOlr,newzn,ngroup 6
REAL (8) sp\1o{(20), ~(20) , spx:z (20) ,SFhr(20) ,rpxmi.n(20) ,rpxm3X(20), &! 7
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 8
u:x;rCAL bdtest (40), bclhit (40) 9
(X}K:N/cg/sp\1o{,~, Sf:hcz, SFhr, rpxmi.n, rpxm3X, rpymin, rpymax, rpzmin, rpzmax, & 10
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bclhit 11
REAL (8) bsoore(10,30) , bsureq (10, 30) ,csoore(10, 10) , csureq (10, 10) , &
tpart(10,30),cpart(10,10),escore(10,30),esureq(10,30),epart(10,30)
(X}K:N/SI'AT/bscore,bsureq,csoore,c:sunsq,tpart,cpart,escore,esunsq,epart
REAL (8) sigt(20),c(20) ! diJrensians allaw up to 20 different nedia
cx:M1:N/WM/sigt,c !sigt is total cross section, c is non-absorpticn prcb
vel=1.OdO assured. velocity for all particles
r=FLTR-l () pick a randan nllllber 12
dnfp=-Dr.cx:;(r) distance traveled in rrean free paths 13
xo=x; ycry; zo=z store "starting" position for track 14
cb.u:=O.OOO initialize distance OlrrenUy traveled 15
IX) 50 i=l, nbdy ! 16
IxItest(i}=.E1U.SE. beginning a new track, no txxlies yet tested 17
50 CXNI'INUE ! 18
IX) 100 i=1,10 loq:> over ten detectors
bdtest(i)=.TRlJE.
CALL SPH(i) use S{:h to see if track hits surface, etc.
IF(bclhit(i»THEN if track intersects S{:here
xi=x+bdout (i) *u; yi=y+bdout (i) *v; zi=z+bdout (i) *w ! exit intersect point
ctheta=(xi*u+yi*v+zi*w)/SFhr(i) ! cosine of angle with noore.l
IF(DABS(ctheta) .LT .0.OldO)ctheta=O.00SdO ! correcticn for small angles
j=INl'(age+l:xiout(i)/vel)+l ! in:Iex for age bin, one secarl intervals
IF(j.LE.30)epart(i,j)=epart(i,j)+&
wate*EXP(-sigt(nzOlr)*bdout(i»/DABS(ctheta) ! score if not too old
IF(bdin(i) .GI'.O.OdO)THEN ! see if track intersects entering
xi=x+bdin(i) *u; yi=y+bdin(i) *v; zi=z+bdin(i) *w ! in intersect point
ctheta=(xi*u+yi*v+zi*w)/SFhr(i) ! cosine of angle with noore.l
IF (DABS (ctheta) .LT.0.01dO)ctheta=O.00SdO ! correcticn for small angles
j=INl'(age+bdin(i)/vel)+l ! in:Iex for age bin, cne seccn:l intervals
IF(j.LE.30)epart(i,j)=epart(i,j)+&
wate*EXP(-sigt(nzOlr)*bdin(i»/DABS(ctheta) ! score if not too old
ENDIF
ENDIF
100 CXNI'INUE
REI'URN 19
END 20
212 Chapter 7

Table 7.26. Subroutine 'Stats' for Example 7.5


SUBIOJI'INE Stats 1
REAL (8) bsoore(10,30),~(10,30),cscore(10,10),csumsq(10,10),&
bpart(10,30),cpart(10,10),esoore(10,30),esumsq(10,30),epart(10,30)
roM:N/S'I7IT/bso::>re,~, cscore, csumsq, bpart, cpart, esoore, esumsq, epart
roM:N/IN/npart, nbatdl 4
REAL (8) x, y, z, u, v, w, xo, yo, zo, 00, vo,~, wate, age, energ 5
roM:N/PART/x,y,z,u,v,w,xo,yo,zo,oo,vo,~,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) trnp,var,stdev,pi,area
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&
rpymin(20), rpym3X(20), rp2lllin(20), rpZIffiX(20) , I:xlin (40) ,b.:Ioot (40)
lOGICAL bdtest(40), bdhit(40)
roM:N/cg/sphcx, sphcy, sr:OCz, sphr, rpxmin, rpxmax, rpymin, rpym3X, rp2lllin, rpZIffiX, &
l:xlin,b.:Ioot,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
ENI'RY Statcne ! entry point to initialize arrays for a:np1ete prcblan 8
bsoore=O.OdO; bsumscrO.OdO; cscore=O.OdO; CSl.l!recrO.OdO ! 9
esoort;l=(). OdO; estrCLSq=O. OdO
RE:IURN 10
ENI'RY Statlp ! entry point to initialize arrays for a particle 11
q,art=O. OdO; cpart=O. OdO; epart=O . OdO
RE:IURN 13
ENI'RY StatElp entry point to store scores for a particle 14
bsoore=b.sroreil:part ! ad:i particle soore to total
bst.mSq=bstInsq+i**2 sum for variance calallatioo
escore=esooref€part ad:i particle soore to total
esunsq=esumsqf€part**2 sum for variance calallatioo
cscore=cscore+q:lart ad:i particle soore to total
~**2 sum for variance calallatioo
RE:IURN 19
ENI'RY StaIDld entry point to calallate and print results 20
OPEN (00'1'=18, FILE=' ootpJt. txt ' )
t:nt:FDruM (npart) 21
pi=2.OdO*DACOS(0.0d0)
deltat=O.ldO
10 Ft:R1AT(lx,I5,', ',15,' , ',ESI5 . 5,' , ',ESI5.5)
EX)90 i=1,10
area=4.0*pi*sphr(i) **2
EX) 90 j=1,30
~(i,j)/tmp-(bsoore(i,j)/trnp)**2 variance
stdev=~(var) standard deviation
WRrTE(18,10)i,j,bsoore(i,j)/trnp/area/deltat,stdev/~(trnp)/area/deltat
90 <XNI'INUE
deltat=3.OdO
WRrTE(18, *)
EX) 100 i=l,l0
area=4.0*pi*sphr(i) **2
EX) 100 j=1,10
var=CSl.l!req(i, j)/tmp-(cscore(i,j)/trnp) **2 variance
stdev=~(var) standard deviatioo
WRrTE(18,10)i,j,cscore(i,j)/trnp/area/deltat,stdev/~(trnp)/area/deltat
100 <XNI'INUE
deltat=1. OctO
WRrTE(18,*)
EX) 110 i=1,10
area=4.0*pi*sphr(i) **2
EX) 110 j=1,30
var=esumsq(i,j)/tmp-(esoore(i,j)/trnp) **2 variance
stdev=~(dabs(var» ! standard deviatioo
WRITE(18,10)i,j,esoore(i,j)/trnp/area/deltat,stdev/~(trnp)/area/deltat
110 <XNI'INUE
RE:IURN 28
ilID 29
7. Monte Carlo Detectors 213

For this example we will employ three separate surface-crossing


estimators at each of the selected radial locations - one expectation and two
standard surface-crossing estimators. We will use thirty equal-width time
steps for each of the expectation surface-crossing estimators to score the
flux over the time interval from zero to 30 seconds ('escore'). One of the
standard boundary-crossing detectors will be used to score the flux in 30
time intervals over the first three seconds following the arrival of the wave
front at the detector ('bscore'). The second standard detector will be used
to provide scores in ten time intervals of three seconds each and thus will
provide a coarse estimate of the flux from zero to 30 seconds ('cscore'). In
all cases the time bins will be defined to include the lower but not the upper
time bound. That is, the first time bin for the expectation detector will
include events in the interval [0,1), the second bin will cover the time
interval [1,2), etc.
The geometry description for this example is shown in Table 7.27. The
outer boundary is set at a radius of 35 mfp. Particles with a speed less than
one mfp/s cannot reach this boundary within the 30 second lifetime of the
problem, therefore, for such speeds, this is equivalent to an unbounded
geometry. A sampling of the results obtained at a radius of 0.5 mfp for the
three detectors considered, based on tracking 106 particles with c = 0.5 and v
= 1, are shown in Tables 7.28-7.30.
To help evaluate the results of this example, let us consider the time-
dependent diffusion equation in spherical geometry

&$ 2D 8$ 18$
D - + - - - L$=-- (7.46)
ar 2 r ar a V at

For the initial condition

$(r,O) = O(r) (7.47)

where 0 is the Dirac delta function, and the normalization condition

(7.48)

we obtain the solution


214 Chapter 7

(7.49)

Table 7.27. Geometry Description for Example 7.5


o NoRPPs
11 Eleven spheres
O.OdO O.OdO O.OdO O.IdO Center and radius, sphere 1
O.OdO O.OdO O.OdO 0.5dO Center and radius, sphere 2
O.OdO O.OdO O.OdO l.OdO Center and radius, sphere 3
O.OdO O.OdO O.OdO I.5dO Center and radius, sphere 4
O.OdO O.OdO O.OdO 2.0dO Center and radius, sphere 5
O.OdO O.OdO O.OdO 2.5dO Center and radius, sphere 6
O.OdO O.OdO O.OdO 3.0dO Center and radius, sphere 7
O.OdO O.OdO O.OdO 3.5dO Center and radius, sphere 8
O.OdO O.OdO O.OdO 4.0dO Center and radius, sphere 9
O.OdO O.OdO O.OdO 5.0dO Center and radius, sphere 10
O.OdO O.OdO O.OdO 35.0dO Center and radius, sphere 11
12 Twelve zones
1 1 Definition of zone 1
2 2 -1 Definition of zone 2
2 3 -2 Definition of zone 3
2 4 -3 Definition of zone 4
2 5 -4 Definition of zone 5
2 6 -5 Definition of zone 6
2 7 -6 Definition of zone 7
2 8 -7 Definition of zone 8
2 9 -8 Definition of zone 9
2 10 -9 Definition of zone 10
2 11 -10 Definition of zone 11
1 -11 Definition of zone 12

For our current problem of a uniform, isotropic material with a total


macroscopic cross section Lt = 1 and isotropic scatter in the laboratory
coordinate system, the diffusion coefficient D is given by

D= 1 = 1 (7.50)
3L {1- i~} 3[1- 0.8(1- c)]
t 5 .L t

Thus for c = 0.5 we obtain D = 0.556. A comparison between the results of


eqn 7.49 and those from Tables 7.28 -7.30 for the flux at r = 0.5 mfp is
shown in Figures 7.6 and 7.7. The diffusion equation has a positive result
for the flux at every radial point for all t > 0, and thus predicts a non-zero
flux before the source pulse passes the detector location. The Monte Carlo
result, on the other hand, shows that the wave arrives at 0.5 sec, as it should.
For a short time after the wave front passes the detector position, the
7. Monte Carlo Detectors 215

diffusion and the Monte Carlo results are in fair agreement. At late times
the diffusion result overestimates the flux.

1.E.l

1 . E~

1.E·l
~
u::
1.E·2

1.E.:! 1--_____>------<>------<>------<_----'_----'
0.0 0.5 1.0 1.5 2.0 2.5 3.0
Time (sec)

Figure 7.6. Comparison Between Monte Carlo and Diffusion Results, r = 0.5 em

1.E+O

1.E-2

1.E-4
)(
::J 1.E-6
u:
1.E-8

1.E-10

1.E-12
0 5 10 15 20 25 30
Time (sec)

Figure 7.7. Comparison Between Late-Time Monte Carlo and Diffusion Results, r = 0.5 em

Table 7.28 S i d Resu ts to 3 sec r.or Example 7.5, r = 0.5


e ecte
Time (sec) Diffusion Eqn Monte Carlo Boundary-
(at midpoint) Crossing Detector
oto 0.1 0.239304
0.1 to 0.2 0.533691
0.2 to 0.3 0.389
0.3 to 0.4 0.276762
0.4 to 0.5 0.203412
0.5 to 0.6 0.154468 2.24E+00 ± 0.0017
0.6 to 0.7 0.120524 1.63E-Ol ± O.OIIE-Ol
0.7 to 0.8 9.6 I E-02 1.l0E-01 ± 0.008E-Ol
0.8 to 0.9 7.80E-02 8.04E-02 ± 0.1OE-02
0.9 to 1.0 6.43E-02 6.08E-02 ± 0.07IE-02
1.4 to 1.5 2.84E-02 2.06E-02 ± 0.037E-02
1.9 to 2.0 1.47E-02 9.03E-03 ± 0.22E-03
2.4 to 2.5 8.28E-03 4.90E-03 ± 0.13E-03
2.9 to 3.0 4.94E-03 2.75E-03 ± 0.098E-03
216 Chapter 7

Table 7.29 Selected Results to 30 sec for Example 7.5, r = 0 5


Time (sec) Diffusion Eqn Monte Carlo
(at midpoint) Expectation Estimator
oto 1.0 0.176595 2.65E-Ol ± 0.0023E-01
1.0 to 2.0 2.65E-02 2.23E-02 ± 0.012E-02
2.0 to 3.0 7.B4E-03 4.7BE-03 ± 0.037E-03
3.0 to 4.0 2.93E-03 I.5BE-03 ± 0.022E-03
4.0 to 5.0 1.24E-03 6.2 I E-04 ± 0.13E-04
5.0 to 6.0 5.59E-04 2.64E-04 ± 0.045E-04
6.0 to 7.0 2.65E-04 1.17E-04 ± 0.024E-04
7.0 to B.O 1.30E-04 5.67E-05 ± 0.17E-05
B.O to 9.0 6.57E-05 2.7IE-05 ± 0.079E-05
9.0 to 10.0 3.3BE-05 1.36E-05 ± 0.047E-05
14.0 to 15.0 1.4BE-06 5.59E-07 ± 0.42E-07
19.0 to 20.0 7.B2E-OB 1.99E-OB ± OAIE-OB
24.0 to 25.0 4.57E-09 5.54E-09 ± 3.60E-09
25.0 to 26.0 2.61E-09 B.33E-IO ± 6.07E-1O
26.0 to 27.0 1.49E-09 6.12E-10 ± 4.23E-1O
27.0 to 2B.0 B.5BE-10 I.B2E-1O ± 1.70E-1O
2B.0 to 29.0 4.93E-10 2.B4E-12 ± 1.62E-12
29.0 to 30.0 2.B4E-10 I.B7E-1O ± 1.39E-1O

Table 7.30 compares the standard boundary-crossing estimates with the


expectation surface-crossing estimator results. Except at very late times,
where the statistics for the boundary-crossing estimator are poor, the results
are in good agreement. The standard boundary-crossing results provide an
indication that the phase space has been sampled reasonably well and
therefore that the results from the expectation estimator can probably be
trusted, at least for times up to about 15 to 20 seconds at r = 0.5. Beyond
this time the large uncertainty in the standard boundary-crossing results
indicates that relatively few particles were scored. This could have been
confirmed by tallying the number of scores in each time bin.

Table 730 Resu ts to 30 sec fior Example


175 . , ree- Secon dI nterva s
. ,r= 05Th
Time (sec) Monte Carlo Monte Carlo Expectation
Boundary. Crossing Estimator1avg. over intervall
oto 3.0 9.74E-02 ± 0.0099E-02 9.74E-02 ± 0.00B7E-02
3.0 to 6.0 B.35E-04 ± 0.IBE-04 B.22E-04 ± 0.OB7E-04
6.0 to 9.0 6.65E-05 ± 0.19E-05 6.70E-05 ± O.l6E-05
9.0 to 12.0 9.05E-06 ± 0.51E-06 BA3E-06 ± 0.22E-06
12.0 to 15.0 1.23E-06 ± O.l3E-06 1.26E-06 ± 0.05E-06
15.0 to IB.O I.B5E-07 ± 0.30E-07 1.7BE-07 ± 0.13E-07
IB.O to 21.0 2.5BE-OB ± 0.63E-OB 2.76E-OB ± 0.34E-OB
21.0 to 24.0 3.95E-09 ± 1.65E-09 1.55E-OB ± 0.74E-OB
24.0 to 27.0 2.B4E-09 ± 1.7BE-09 2.33E-09 ± 1.23E-09
27.0 to 30.0 O.OOE+OO 1.24E-1O ± 0.73E-1O
7. Monte Carlo Detectors 217

Example 7.6. Time dependence in neutron slowing down

Let us consider once again the problem of Example 4.3 involving the
slowing down of neutrons in hydrogenous media. We assume a point source
of fission-spectrum neutrons released as a delta-function pulse at time zero
at the center of a sphere of water. The scattering is assumed isotropic in the
center of mass system and the particle velocity is obtained from eqn 7.44.
The radius of the sphere is set by the user. We wish to score the time
dependence of the neutrons leaking from the sphere.
The list of the modified subroutines to be used in this calculation is given
in Table 7.31. The cross sections for this example are same as those used in
Example 4.3. Subroutine 'Hydrogen,' shown in Table 7.32, has been
changed from that given in Table 4.10 to reflect the fact that the variables
passed are now in double precision, and to add a calculation of the non-
absorption probability to account for absorption in hydrogen. Subroutine
'Oxygen' is shown in Table 7.33. The only difference between this
subroutine and that shown in Table 4.10 is that necessary to account for the
variables passed being double precision. The necessary input information
for calculating the combined effective cross-section is read by subroutine
'Xsects,' which is shown in Table 7.34. This subroutine reads the atomic
number densities, in units of 10-24 atoms/cm3, of hydrogen and oxygen for
water of nominal density, 0.06692 and 0.03346 respectively. These values
are included in the file 'xsects.txt.'
The microscopic cross section data must be "mixed" to define a
macroscopic cross section set that will represent the effective cross sections
for the mixture of elements or isotopes at the correct density. The particle
flight path is determined using the sum of these cross sections as though the
material through which the neutrons are moving were a single isotope. The
cross sections are mixed in subroutine 'Mxsec,' shown in Table 7.35. This
subroutine calls subroutines 'Hydrogen' and 'Oxygen' in order to calculate
the total energy-dependent cross section for water.

Table 7.31. Modified Sub routmes fior Example


I 76
Subroutine Location
'Hydrogen' Table 7.32
'Oxygen' Table 7.33
'Xsects' Table 7.34
'Mxsec' Table 7.35
'Source' Table 7.36
'Bdrx' Table 7.37
'Stats' Table 7.38
'Col' Table 7.39
'Isocol' Table 7.40
218 Chapter 7

Table 7.32. Subroutine 'Hydrogen' for Example 7.6


SUBR:lJI'INE Hi'DRI:X:EN (xs, e, helens, c)
calculate macroscx::pic cross section for H,
H atom density helens * 10**24
e assured to be energy in eV
DIMENSION xspoint(II),epoint(ll)
REAL (8) xs,e,helens,c
~ epoint/.Ol,.I,I.,1000.,10000.,50000.,&
l.e5,I.e6,5.e6,I.e7,3.e7/
DP.TA xspoint/68. ,26.,20.,20.,19.,15.,7.,4.,1.5, .9, .3/
c=1.OdO
IX) 3 i = 2,11
ie = i
if(e.lt.epoint(ie» ooro 4 if epoint(ie-l)<energy<epoint(ie)
3 CCNI'INUE
xs = hdens*xspoint(ie) Energy .GE. 3.E7
REIURN
4 slope = (xspoint(ie)-xspoint(ie-l»/&
AJ.£k, (epoint (ie) /epoint (ie-I) )
xsm= slope*DlOG(e/epoint(ie-l»+xspoint(ie-l) extrapolate between ie-l and ie
xs = xsm*helens
ab=O. 05249/DSQRT (e)
c=1.0-ab/xsm; IF(c.LT.O.OdO)c=O.OdO
REIURN
END

Table 7.33. Subroutine 'Oxygen' for Example 7.6


SUBR:lJI'INE oxygen (xs, e, odens)
calculate macroscx::pic cross section for 0,
o density odens * 10**24 at/cc
e assured to be energy in eV
REAL (8) xs,e,odens
DIMENSION xspoint(84),epoint(84)
~ epoint/.Ol,.I,I.e4,3.e5,3.5e5,4.4e5,5.2e5,6.e5,&
8.5e5,I.e6,1 .2e6, 1.3le6, 1.4e6, 1.64e6, 1.65e6,&
1.66e6, 1. 67e6, 1. 68e6, 1.6ge6,&
1.8e6, 1.82e6, 1.83e6, 1.ge6, 2.e6, 2.25e6, 2.35e6,&
2.4e6, 2.5e6, 2.ge6, 3.1e6,&
3.2e6,3.21e6,3.4e6, 3.41e6, 3.42e6, 3.78e6, 3.7ge6, 3.8e6,&
4.e6, 4.1e6, 4.4e6, 4.45e6, 4.5e6, 4.51e6,&
4.52e6, 4.6e6, 4.7e6, 4.81e6, 5.e6, 5. 15e6, 5.2e6,&
5.35e6, 5.36e6, 5.37e6, 5.4e6, 5. 65e6, 5. 66e6, 5.67e6,&
5.98e6, 5.9ge6,&
6.05e6, 6.06e6, 6.3e6, 6.4e6, 6.5e6, 6.8e6, 6.85e6,&
6.86e6, 6.88e6, 7.e6, 7.2e6, 7.4e6, 7.5e6, 7.8e6,&
8.05e6, 8.3e6, 8.6e6, 8.7e6, 9.e6, 9.1e6, 9.3e6,&
II.e6, 12.e6, 18.e6/
DATA xspoint/3.7,3.7,3.7,3.5,3.8,16.,4.,3.1,2.7,8.,&
2.7,7.,2.5,1.9,9.,1.9,1.9,5.,1.8,1.6,5.,2.,3.,1.5,&
1., .09,.7,1.1,1.1,1.4,5. ,3. ,3. ,5.5,3.,3., 5.6,3.,2.,1.1,2.1, &
1.4,2.,3.,1.3,2.,.9,2.,.9,3.95,1.4,1.2,2.1,.8,1.05,1.2,2.6,1.7,&
1.4, .8,1.6,1., .8,1.7,.6,1.1,1.1,1.5,.85, .85,1.9,1.4,1.1,&
1.5,.8,1.4,1.1,1.5,1.1,1.35,1.08,1.4,1.2,1.6/
IX) 3 i = 2,84
ie = i
IF(e.lt.epoint(ie» ooro 4 if epoint(ie-l)<energy<epoint(ie)
3 CCNI'INUE
xs = odens*xspoint(ie) Energy .GE. 1.8E7
REIURN
4 slope = (xspoint (ie) -xspoint (ie-I) ) /&
AJ.£k,(epoint(ie) /epoint(ie-l»
xs = slope*DlOG(e/epoint(ie-l»+xspoint(ie-l) extrapolate between ie-l and ie
xs = xs*odens
REIURN
END
7. Monte Carlo Detectors 219

Table 7.34. Subroutine 'Xsects' for Example 7.6


1
REAL (8) !tlens, o:lens, e, Hxsec, Q(sec
COM:N/GEX::M/}tlens,o:lens,e,Hxsec,Q(sec ! densities, noo.-abs prOO, cross sectioos
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),& 4
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40) 5
I.£XiIC1IL bdtest(40), bclhit(40) 6
COM:N/cg/sphcx, sphcy, sphcz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, & 7
bdin,bdout,nsph,nrpp,Obdy,nzones,nbz(40,41),nnext(40,40,40,2) , bdtest,bclhit 8
OPEN(UNIT=12,FIIE-'xsects.txt') ! The cross sectioos are in xsects .txt 9
The ootsicle zane is a vaaI\J!l. particles reaching it have escaped. 10
DO 50 i=1,nzones-1 11
READ(12,*)!tlens,o:lens
WRITE (16, *) 'Densities for Hydrogen and ()(ygen in ZCne " i
WRITE (16, *)!tlens, o:lens
50 CCNI'INUE 15
REIURN 16
END 17

Table 7.35. Subroutine 'Mxsec' for Example 7.6


SUBIOJI'INE MXSEX:: 1
REAL (8) <infp, dtr, xsec, d::ur 2
COM:N/TAACK/<infp, dtr, xsec, d::ur 3
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,w:>,wate,age, energ ! 4
COM:N/PARr/x,y,z,u,v, w,xo, yo,zo,uo,vo,w:>,wate,age,energ,nzcur,newzn,ngroup 5
REAL (8) !tlens, o:lens, e, Hxsec, «<sec
COM:N/GEX:M/H::Iens,o:lens,e,Hxsec,Q(sec ! densities, noo.-abs prOO, cross sectioos
call Hydrogen(Hxsec,energ,!tlens,e) ! retums ' e ' for hydrogen
call ()(ygen(Q(sec,energ,o:lens) ! 'e' for oxygen ass1.llli!d 1.0
xsec=Hxsect<)(sec
c=(e*Hxsec-+Q<sec) /xsec ! noo.-absorpticn prOO for mixture
REIURN 9
END 10

Subroutine 'Source' is shown in Table 7.36. This routine has been


modified to initialize both the time, which is stored in the variable 'age,' and
the neutron energy, stored in the variable 'energ.' The energy of a source
particle is selected from a fission spectrum as in Example 4.3.

Table 7.36. Subroutine 'Source' for Example 7.6


SUBI01l'INE SOOR:E 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,w:>,wate,age,energ ! 2
COM:N/PARr/x,y,z,u,v,w,xo,yo,zo,uo,vo,w:>,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) fltrn,xtest,ytest
pi=2 . OdO*0I\tXl3(0.0d0) keep for IrOre cx:nplicated scurce that needs pi 4
x=O.OdO; y=O . OdO; z=O.OdO starts at origin 5
nzcur=1 asSUleS origin is in zane cne 6
CALL Iso::ur directicn chosen isotrcpically 7
wate=1.OdO particle starts with a weight of one 8
age=O.OdO particle starts with an age of 0
65 CCNI'INUE ! use Watt fissicn spectIun
xtest=-DLOG(fltrn(»; ytest=-DLOG(fltrn(» pick a point
IF«ytest-xtest-1.OdO)**2.GI'.4.0d0*xtest)ooro 65 ! if fail test, pick another
energ=2 . OdO*xtest*1 .0d6
REIURN 9
END 10
220 Chapter 7

The modified subroutine 'Bdrx' is shown in Table 7.37. This subroutine


is used to score leaking particles. The age of the particle is updated at every
boundary crossing using eqn 7.44. Particles that leak are scored in energy-
dependent bins. These bins are defined in subroutine 'Stats,' which is
shown in Table 7.38. Subroutine 'Col' has been modified to accommodate
isotropic scatter in the center-of-mass coordinates based on an
apportionment of the total cross section between the elements in the
geometry. The 'Isocol' subroutine has been added to perform the scattering
calculation. These routines are shown in Tables 7.39 and 7.40, respectively.

Table 7.37. Subroutine 'Bdrx' for Example 7.6


Sl.JBro1l'INE BOO){ 1
RrnL(8) delta,ve1
RrnL(8) sphcx(20),sphcy(20),sphcz(20),sphr(20),~(20),rpxmaK(20),& 3
rpyrrrln(20) , rpymax(20) , rpzmin(20) , rpznax(20) ,J:xiin(40) ,bdoot(40) 4
LCGICAL lxItest(40) , lxIhit(40) 5
CXlM:N/cg/SIi1cx, sphcy, sphcz, sphr,~, rpxmaK, rpymin, rpynax, rpzmin, rpznax, & 6
J:xiin,bdoot, nsph,nrpp, nbdy,nzones, nbz (40, 41) ,nnext(40,40,40,2) ,lxItest,lxIhit 7
RrnL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 8
CXlM:N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 9
RrnL (8) cinfp, dtr, xsec, dcur ! 10
CXlM:N/TAACK/cinfp, dtr, xsec, dcur 11
REAL (8) bsoore(19),bsumsq(19),btime(19),dtime(19),bpart(19)
CXlM:N/Sl'AT/bsoore, bsumsq, btime, dtime, bpart
vel=1.38318d6*l::GCJ'T(energ) ! velocity in an per sec for energy in eV
delta=dtr-dcur ! delta-distance traveled to reach boundary 12
dcur=dtr ! UJ;XIate current distance traveled 13
ctnfp=dnfp-delta*xsec ! subtract current distance in mfp fran cinfp 14
x=x+u*delta; y=y+v*delta; z=ztW*delta ! UJ;XIate positicn 15
age=a~lta/ve1 UJ;XIate age of particle
IF(age.GE.1.Od-2)'l'HEN ! check to see i f particle has exceeded age limit
nzcur=-l exceeded age, set flag to kill
REIUFN
ENDIF
nzcur=newzn change identifier of current zcne 16
if (nzcur.LT.nzcnes)REIUFN i f not at outer zcne then return 17
nzcur=-l set nzcur=-l if in outer zcne (for escape) 18
[X) i=l,19
IF (age.LE.btime (i) )'l'HEN i f leakage oa::urs in this time interval
bpart(i)=bpart(i)+wate then score and return
REIUFN
END IF
END [X)
19
END 20

Table 7.38. Subroutine 'Stats' for Example 7.6


SUBEOlI'INE Stats 1
RrnL(8) bsoore(19),bsumsq(19),btime(19),dtime(19),bpart(19)
CXlM:N/STAT/bsoore, bsumsq, btime, dtime, bpart
CXlM:N/IN/np:trt,nbatch 4
RrnL(8) tnp, tnp1, tnp2, var, stdev 7
ENIRY Statcne ! entry point to initialize arrays for cx::rcplete prcblE!ll 8
bsoore=O. OdO; bsumsq=O. OdO
btime(1)=f. Od-8; dtime (1) =btime (1) ! time and delta time for first bank
tnp=JE(p(DLCG(1.d6) /18.OdO) to create 18 rrore log spaced time banks
[X) i=2,19
btime (i)=btime(i-1) *tnp ! IlBX age for particles in this bank
7. Monte Carlo Detectors 221

Table 7.38. con'l...


dtiITe(i)=btime(i)-btime(i-1) ! delta time for particles in this bank
END 00
REruRN 10
ENI'RY StatIp entry point to initialize arrays for a particle 11
1:part=O. OdO
REruRN 13
ENI'RY StatElp ! entry point to store scores for a particle 14
00 70 i=1,19
bscore (i) =bscore (i) ii:part (i) ack:I particle score to total
bsUllSq (i) =bsunsq (i) ii:part (i) **2 sun for variance calculatioo
70 <XNI'INUE
REruRN 19
ENI'RY StatEnd ! entry point to calculate and print results 20
OPEN (UNIT=18, FILE?' outp.lt. txt ' )
tnp=DFl.CM' (npart) 21
00 90 i=1,19
var=bsumsq (i) /trrp- (bscore (i) /trrp) **2 variance
stdev=~(var) standard deviatioo
WRITE(18,10)i,btime(i),bscore(i)/trrp/dtime(i),stdev/~(trrp)/dtiITe(i)
WRITE(16,10)i,btime(i),bscore(i)/trrp/dtiITe(i),stdev/~(trrp)/dtiITe(i)
90 CCNI'INUE
10 FORMAT(i3,lp3e12.3)
REruRN 28
END 29

Table 7.39. Subroutine 'Col' for Example 7.6


SUBmJI'INE CXlL 1
REAL (8) FLTRN,delta,vel,A
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) <infp,dtr,xsec,dcur ! 5
OOMMON/T!W:K/<infp,dtr,xsec,dcur ! 6
REAL (8) Helens, CI:lens, c, Hxsec, OKsec
OOMMON/GEX:M/Helens,CI:lens,c,Hxsec,OKsec ! densities, noo-abs prOO, cross sectioos
REAL (8) bscore(19) , bsUlISq (19) ,btime(19) , dtime (19) ,tp:u:t(19)
OOMMON/SI'ATIbscore, bsunsq, btime, dtiITe, tp:u:t
vel=1.38318d6*~(energ) ! velocity in an per sec for energy in eV
delta=cJnfp/xsec ! distance traveled to collisioo 9
dtr=dcur+delta ! up:Iate total distance traveled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! up:Iate positioo 11
age=age+delta/vel
IF(age.GE:. 1. Od-02) 'l'HEN check to see i f exceed age limit
nzcur=-l exceeded age limit, set flag to kill
REruRN
ENDIF
wate=wate*c reduce wate by noo-absorptioo prcbability
IF(wate.LT.O.OOldO)'l'HEN ! i f wate SIlall play Russian roulette
IF(O.ldO .LT. FLTRN())'l'HEN i f particle killed by RR
nzcur=-1 set nzcur=-1 to ShCM particle killed 15
REruRN 16
ENDIF 17
wate=wate*lO.OdO particle survived RR, increase wate
ENDIF 19
A=16. OdO scattering might be with oxygen
IF(fltm() .LT . Hxsec/xsec) A=1. OdO use randan IlUIber to see i f H scattering
CALL ISCCOL(u,v,w,A,energ) outgoing directioo based 00 atan and energy
IF(energ.LT.0.025d0)energ=O . 025d0
REruRN 21
END 22
222 Chapter 7

Table 7.40. Subroutine 'Isocol' for Example 7.6


SUBFaJI'INE ISCCOL (U, V, W,A, E)

SUbrootine ISCCOL calculates the result of elastic oollisioos


of neutralS with nuclei of mass A. The post-collisioo
directioo am energy in the laboratoI}' system is detemdned
assuning isotrcpic scattering in the center of mass system.
REP.L(B) fltrn, u, v,w,A, E, tw:pi,ccsrn, 00, WL, SINI'H,UL, VL, &
SR, ux, vx, wx, vee
twc:pi=4. 0d0*r:w:x:s (0. OdO) ! <b.Ible precisioo twc:pi
ccsrn = 2.dO*fltrn()-l.OdO; 00 = fltrn()*twcpi
WI.. = (A*ccsrn+l.0d0)/DSQRT(A**2+2.0d0*A*ccsrn+1.0d0) ! Win L cooDdinates
SINI'H = DSQRT(1.0d0-WL**2)
UL = SINI'H*IXXS (00); VL = SINI'H*oorn (00) ! U & V in L coords
E = E*(A*A+2.0d0*A*ccsrn+l.0d0)/(A+l.0d0)**2 Post-collisioo energy
IF (D!\BS(u) .1t.0.9d0) THEN ! deteIIlli.ne 1>tri.d1 transfomatioo to use
SR = DSQRT(l.OdO-u*u) ! x-axis transfomatioo
(]x = SR*UL + U*WL
Vx = -u*V*UL/SR + w*VL/SR + V*WL
Wx = -w*u*UL/SR - v*VL/SR + W*WL
ELSE
sr = DSQRT(l.OdQ-V*V) y-axis transfomatioo
ux = W*UL/sr - u*V*VL/sr + u*WL
vx = VL*sr + V*WL
wx = -u*UL/sr - v*w*VL/sr + W*WL
ENDIF
vee = DSQRT (ux*ux+vx*vx+wx*wx) nomalizatioo to correct for roonding
u = ux/vee; v = vx/vee; W = wx/vee nomalized lab directioo cosines
REl'URN; END

The geometry input for this example is shown in Table 7.41. A system
radius of 30 cm is used. The program scores the leakage in 19 time steps
spaced logarithmically between 10-8 and 10-2 seconds. The calculation used
a constant Russian roulette weight of 0.001 and a survival probability of 0.1
(which increases the weight of particles surviving Russian roulette by a
factor often.)

Table 7.41. GeometryDescription for Example 7.6


o There are no RPPs
1 There is one sphere
O.OdO O.OdO O.OdO 30.0dO Center coordinates and radius-sphl
2 There are 2 zones.
1 I Zone 1 has one body, 1
1 -I Zone 2 has one body, -I

The results of running the code with 105 start particles are shown in
Table 7.42. A plot of the time-dependent leakage, integrated over energy, is
shown in Figure 7.8. Because the source is not monoenergetic in this
example, there is no arrival wave of neutrons. However, very few source
particles were produced with energies above 107 eV. The speed of a
neutron at 107 eV is about 4.37xl09 cm/sec. Therefore the earliest time for
7. Monte Carlo Detectors 223

which a significant number of uncollided neutrons could arrive at the outer


radius of the sphere is t = d/v::::: 6.9xl 0-9 sec.

Table 7.42 Resu1ts {;or Example 1 7.6


Bin Bin upper Total Leakage
bound (sec) (neutlsec)
1 1.000E-08 3.830E+05± 1.95E+04
2 2. I 54E-08 1.190E+06± 3.l9E+04
3 4.642E-08 1.954E+05± 8.84E+04
4 I.OOOE-07 2.556E+04± 2.18E+03
5 2. I 54E-07 6.753E+03± 7.64E+02
6 4.642E-07 3.494E+03± 3.74E+02
7 I.OOOE-06 1.564E+03± 1.70E+02
8 2. I 54E-06 5.344E+02± 6.78E+OI
9 4.642E-06 3.14IE+02± 3.53E+OI
10 I.OOOE-05 1.322E+02± 1.55E+OI
II 2. I 54E-05 7.657E+Ol± 7.90E+OO
12 4.642E-05 6.915E+0l± 4.87E+OO
13 l.OOOE-04 6.082E+0l± 2.83E+OO
14 2.1 54E-04 4.652E+Ol± 1.39E+OO
15 4.642E-04 3.033E+0l± 5.IOE-01
16 l.OOOE-03 9.68lE+OO± 9.33E-02
17 2. 154E-03 4.710E-Ol± 4.lIE-03
18 4.642E-03 4.332E-04± 7.26E-05
19 1.000E-02 O.OOOE+OO

1.E+8

1.E+8

1.E+4

i.
z
1.E+2

1.E+O

1.E-2

1.E-4
1.E-8 1.E-7 1.E-6 1.E-5 1.E-4 1.E-3 1.E-2
Time, sec

Figure 7.B. Time-Dependent Leakage of Neutrons from a Sphere of Water

The points on the curve in Figure 7.8 indicate the total neutron leakage
per unit time for each time step. They are plotted at the upper limit of the
time steps. The first data point indicates that about 4 x 105 nls leaked
between time zero and 10-8 sec. This corresponds to roughly 0.004
probability of a fission spectrum neutron being emitted with an energy
greater than approximately 4.7 MeV, and the neutron subsequently leaking
from the sphere of water without suffering a large-angle scattering event.
224 Chapter 7

The leakage rate increases following the arrival of these leading neutrons
because the fission spectrum produces more neutrons below 4.7 MeV than
above this energy.

The time-dependent examples presented here are for o-function sources


in time and space. Obviously many practical problems involve situations in
which an extended source operates with some variation in time. Such
problems require but a simple extension of the concepts illustrated above. A
distributed, time-dependent source can be modeled in a manner analogous to
a distributed steady-state source by selecting source points based on
appropriate sampling of the source region. The time dependence is added
by assigning start times to the particles selected. Whether the spatial- and
time-dependence of the source is expressed as an analytic function, a
product of time- and spatial-dependent functions, or in tabular form, this
dependence of the source can be sampled by any appropriate method, and
the results used as the start point in time for the random walk calculation.
There are many types of Monte Carlo detectors and our intention has
been to provide a brief description of a few of those most common or most
useful to the Monte Carlo practitioner. The interested reader can find many
more in the literature. In almost all cases more than one type of detector can
be used to score the results of a given problem. The detectors, if properly
designed, should converge to the correct results in the limit of a large
number of particle tracks. Of course, different detector types are not likely
to have the same efficiency and one detector type may be "better" than
another in a given set of circumstances; however, identifying the best
detector type may require more effort than is justified and the choice may
not matter much in practice.

Exercises

1. Repeat Example 7.1, but place small spherical regions around each of the
next-event detector points and tally the number-of collisions within each
such region; i.e., score the number of collisions occurring in the vicinity of
each next-event detector.
a. Using eqn 7.14, is the flux result estimated with the detector consistent
with the number of collisions calculated? Show how the results vary
with the size of the spherical regions.
b. Make the boundaries of your spherical regions into both standard and
expectation surface-crossing detectors. How do these two flux estimates
compare with the next-event estimator results? Has your calculation
provided a thorough sampling of the important regions of phase space for
each of the detectors?
7. Monte Carlo Detectors 225

2. Consider a spherical shell of material (see Figure 7.9.) Assume the radial
thickness of the material is 10% of its inner radius. Assume further that the
spherical shell is contained in a box whose inner surfaces are tangent to the
outside of the shell and whose walls are of the same thickness as the shell.
Consider a monoenergetic problem with isotropic scatter in the laboratory
system for which there is an isotropic point source of neutrons at the center
of the shell. Assume a vacuum exists inside the shell and between the shell
and the box. Determine the flux as a function of position on the exterior
faces ofthe box under the following conditions:
a. The shell and box are composed of a pure absorber with a mean free
path equal to the thickness of the shell.
b. The shell and box are composed of a pure scatterer with a mean free
path equal to the thickness of the shell.
c. The shell is composed of a scattering and absorbing material with a
mean free path equal to the thickness of the shell and a non-absorption
probability of 0.5, and the box is composed of a scattering and absorbing
material with a mean free path equal to half the thickness of the shell and
a non-absorption probability of 0.9.

0.1 r

Figure 7.9. Geometry for Exercise 2

3. Calculate the leakage rate of neutrons passing through a 10-cm-thick slab


of water of nominal density as a function of time. Use the water cross
sections from Example 7.6. Assume a delta-function monoenergetic source
at time zero of 5-MeV neutrons is normally incident on the upstream face of
the slab. Account for neutron slowing down and absorption in the slab but
assume all neutrons remain at thermal energy (0.025eV) when they reach
this energy.
226 Chapter 7

IF. H. Clark, "Variance of Certain Flux Estimators Used in Monte Carlo Calculations," Nucl.
Sci. Eng. 27, 1967, pp. 235-36; L. L. Carter and E. D. Cashwell, Particle Transport
Simulation with the Monte Carlo Method, U. S. Energy Research and Development
Administration, Washington, D. C., 1975, pp. 54-55.
2 S. K. Fraley and T. J Hoffman, "Bounded Flux-at-a-Point Estimators for Multigroup Monte
Carlo Computer Codes," Nucl. Sci. Eng. 70, 1979, pp. 14-19.
J S. Glasstone and M. C. Edlund, The Elements o/Nuclear Reactor Theory, D. Van Nostrand,
Princeton, NJ, 1952, pp. 47-48.
4 J. C. Saccenti and W. A. Woolson, "A Comparison of Air-Over-Ground Transport
Calculations Using Different Cross Sections," Nuclear Cross Sections and Technology,
NBX SP 425, National Bureau of Standards, Washington, DC, 1975, p. 431.
Chapter 8
Nuclear Criticality Calculations with Monte Carlo

8.1 Multiplying Assemblies

In order to address multiplying assemblies we must include fission


events. The time-dependent. homogeneous transport equation (eqn 3.11)
can be expressed in operator notation by

8'1' = L'I' (8.1)


at
where 'I'(r.n.E.t) is the neutron angular density of eqn 3.6 and

L =-vn. V - VL t + v JL·(r;n'.E' ~ n . E)dn'dE' (8.2)

Here L* is the total cross section for neutron transfer from n' .E' to n.E.
including fission events. Eqn 8.1 has solutions of the form

'I' =N(r.n. E)e at (8.3)

where a is an eigenvalue of eqn 8.1. Many such eigenvalues aj may exist.


each of which will have a corresponding eigenfunction. Nj • given by

a J·N J· =LN J· (8.4)

If the spatial dependence of the particle angular density 'I' at a given time
can be expanded in terms of the eigenfunctions Nj • then at late times it is

227
228 Chapter 8

reasonable to expect that the neutron population will have a time


dependence given by the eigenfunction with the largest real part, ao. The
particle density at late times will thus reach a spatial equilibrium given by
the eigenfunction No corresponding to this eigenvalue. This eigenfunction is
sometimes called the fundamental, normal, or equilibrium mode of the
system. That is, transient spatial modes of the particle density will decay
away after some period of time, leaving a spatially invariant shape that can
be rising (ao > 0), constant (ao = 0), or falling (ao < 0) in magnitude
exponentially in time. These three distinct results correspond to
supercritical, critical, and subcritical states of the system, respectively.
In practical terms, the problem of determining the state of criticality of
an assembly of fissile material becomes that of determining the eigenvalue
of eqn 8.4 that has the largest real part.! At late times a o can be estimated
from the time dependence of the neutron population using solutions to eqn
8.1 at times t and t + t,

1 {fN(r,O,E,t+t)drdOdE}
ao ~-ln-"--=--------- (8.5)
t fN(r,O,E, t)drdOdE

However, reactor analysts normally speak of an effective multiplication


factor, k, rather than the exponential factor, a. In this case the mean number
of neutrons emitted per fission event, v, is replaced by vlk and k is varied
until a stable condition is reached; i.e., the number of secondary neutrons
emitted per fission is artificially modified until an effective critical
condition (ao = 0) is reached. This is equivalent to determining the
eigenvalue 11k of the equation

vO-VN k +v1: t N k =
HI v(E')1: (r;O',E' ~ O,E)N k(r,O',E')dO'dE'
x.. f
x (8.6)

+~ fJ~ v(E ')1: (r· 0' E' ~ 0 E)N (r 0' E ')dO'dE'


k 41t f" 'k"

where the subscript f refers to fission and the subscript x refers to all other
interactions that result in neutrons appearing in the phase space. The factor
of 41t in the second integral is used to normalize the spectrum of fission
neutrons.2 The integrals are to be taken over all values of the variables that
can contribute to the eigenfunction density Nk(r,O,E). In this chapter we
will examine ways to determine the eigenvalue 11k, and hence the effective
multiplication factor k, using Monte Carlo methods. This effective
8. Nuclear Criticality Calculations with Monte Carlo 229

multiplication can be obtained without taking into account the time


dependence of the particle density.

8.2 The Generation Method

After the equilibrium spatial mode has been achieved in a multiplying


assembly, the effective neutron multiplication factor k will be equal to the
ratio of the population of neutrons in the assembly in successive
generations. Thus if n generations of fissions are calculated we have

(8.7)

where Ni is the number of source neutrons in generation i, and Mi is the


number of next generation neutrons produced by this source. We will call
this method of determining the neutron multiplication in a fissioning system
the "ratio of generations," or simply the "generation" method. Although the
full population of a generation of neutrons may never actually exist at one
time in a fissioning system, a generation is a well-defined quantity with start
and end points delineated by sequential fission events. A generation of
particles can be tracked easily in a Monte Carlo calculation and this fact has
led to the use of the generation method as the most common means of
estimating criticality with Monte Carlo.
As an alternative to using the population of neutrons in successive
generations to estimate the system multiplication, one may use a modified
generation approach that we will call the ''total subsequent population"
method. In this method a running sum is maintained of the progeny that
result from source neutrons. That is, after the equilibrium spatial mode has
been achieved, we calculate the ratio of the total number of progeny divided
by the total number of start particles. The effective multiplication is then
given by

LMi
k=...:..i=....:.!__
n
(8.8)
LNi
i=!

The estimate of eqn 8.8, if made simultaneously with the estimate based on
the ratio of generations method, produces the same estimate of k as eqn 8.7,
within rounding errors, but provides a separate estimate of the variance of
the result. The estimate of the variance based on the total subsequent
230 Chapter 8

population method is more accurate than that of the ratio of generations


method.
It is apparent that the calculation of successive generations of neutrons in
a mUltiplying system will require an initial guess for the spatial distribution
of the population. It is equally apparent that the closer this initial
distribution is to the equilibrium distribution Nk the sooner the equilibrium
state will be reached. However, the equilibrium distribution may not be
known, or may not be used to define the initial source distribution because
of complexity or for other reasons. In this case some other initial source
distribution must be used from which the normal mode will evolve.
Therefore, when using either the generation method or the total subsequent
population method the Monte Carlo practitioner will usually ignore the first
few generations in a calculation in order to allow the particle distribution to
settle into the equilibrium mode.

Example 8.1. Criticality in a homogeneous sphere by ratio of generations

Up to this point we have applied the Monte Carlo method to radiation


transport problems that may generally be classed as shielding problems. In
these problems we have occasionally quantified the scattering and
absorption of neutrons by defining a non-absorption probability c which we
have tacitly assumed to be less than one. The same concept can be used to
examine a multiplying system; however, in such a case, because more than
one neutron may appear following a collision, c can take on values greater
than one. In this case c is no longer the non-absorption probability but is the
expected number of secondary neutrons that result from each collision.
However, for brevity of notation, c may still be referred to as the non-
absorption probability even when values greater than one are allowed.
Allowing c > I creates the possibility of a critical nuclear assembly in which
the neutron population is self-sustaining.
Let us consider a homogeneous sphere of fissile material surrounded by a
vacuum. We will assume the population of neutrons in the material is
monoenergetic and that the total macroscopic cross section is equal to one.
The neutrons in the system will be assumed to undergo isotropic scatter in
the laboratory coordinates, and on the average each collision will produce c
secondary neutrons. By varying the value of c, we will determine the
expected number of secondary neutrons that must be produced per collision
to achieve a critical configuration; i.e., one in which the loss of neutrons by
escape from the sphere and parasitic absorption is balanced by the average
production of more than one neutron per collision.
To solve this problem we will track sequential generations of neutrons in
the system. That is, we will start neutrons at the sites of fission events
8. Nuclear Criticality Calculations with Monte Carlo 231

produced by neutrons in the previous generation and track them until they
are absorbed (in which case they may produce fission neutrons), or until
they escape from the system. We will include both a generation tally and a
total subsequent population tally. For the former, after all of the source
neutrons in a generation have been tracked we will tally the total number of
next-generation fission neutrons produced in the system by those source
neutrons. We will then track the next generation of neutrons based on these
fissions. The number of neutrons resulting from fissions in the current
generation divided by the number resulting from fissions in the previous
generation will provide an estimate of k. By eqn 8,7, just as with any Monte
Carlo estimator, our answer will be the mean of such estimates of k obtained
from as many generations as we wish to track. For the total subsequent
population estimate we will determine the total number of progeny for each
source neutron tracked. By eqn 8.8 the total number of progeny divided by
the total number of source particles will provide a second estimate of k
(which should be the same as that of eqn 8.7 within rounding errors), and
the associated variance (which will not be the same as that of the first
estimate.)
The technique of including an estimate of the desired answer in a tally
only after tracking many neutrons instead of after each neutron track is
known as the batch method of scoring in Monte Carlo. This method was
discussed briefly in Example 6.4, and any of the previous examples in this
book could have used the batch method. When using batches, an estimate of
the desired result is obtained from the average of the scores of some fixed
number of source neutrons rather than from each neutron separately. For
statistical purposes this average, called the batch average, is treated as a
single estimate of the result, and both this estimate and its square are tallied
in the usual way. The final result of the calculation, and the variance of this
result, are then obtained from eqn 2.39 and either eqn 2.40 or 2.41.
In the present case, a batch is equal to a generation. Obviously there is a
tradeoff between the number of neutrons per batch and the number of
batches. A balance is usually sought to ensure that each batch will provide a
reasonable sampling of the portions of phase space that contribute
significantly to the desired result, and that enough independent estimates of
the random variable will be obtained to provide reasonable statistics in the
final result.
Except when the system is exactly critical, the average number of
neutrons in successive generations in a multiplying system will tend to be
either increasing or decreasing. Thus a problem encountered in using the
generation method to estimate the effective neutron multiplication is that of
ensuring that the population neither dies out nor becomes so large that the
calculation time is excessive. Usually the best option is to maintain a
constant population of source neutrons in successive generations. To do this
232 Chapter 8

we will renonnalize the source in each generation to the same number of


start particles. That is, the spatial fission distribution in generation n will
always be used as the basis of the source in generation n+ 1. If the number
of fission events produced by the neutrons in generation n is less than that
needed to produce the required number of start particles in generation n+ 1, a
sampling technique will be used to select more than one start neutron from
some of the fission events. On the other hand, if the number of fission
events is greater than required, some events will be omitted when selecting
start particle locations.
Since this example problem has been defined using c, the expected
number of neutrons emitted per collision, there is a level of ambiguity
regarding the generation to which the particles that emerge from collisions
should be assigned. For example, if the original neutron is assumed to be
absorbed in the collision, then c secondary, or next-generation, neutrons
emerge from the collision. However, if the original neutron is assumed to
scatter and thus to survive the collision, c-l next-generation neutrons will be
produced in the collision event. In reality a portion of the incoming particle
is likely to be absorbed so that these two cases constitute upper and lower
bounds. We will solve the problem for both of these limiting assumptions.
The effect of the ambiguity in c is illustrated by eqn 8.3, which may be
rewritten 3 in tenns of the multiplication k and the generation time t

'I' =N(r,n,E)e(k-J)'/t (8.9)

Both the multiplication factor and the generation time will depend on the
fraction of incident neutrons absorbed per collision. However, for a critical
system, in which k = 1, the exponent will be zero and the result will not
depend on the number of incident particles that survive the collision. Thus
our two cases of c and c-l neutrons leaving a collision in the next generation
*
should give identical results for 'I' when k = 1, but different results for k 1.
Before valid results can be obtained from the tally to be used in this
example we must ensure that a fundamental mode flux distribution has been
established. Because we base the spatial distribution of the source in a
given generation on the fission distribution that resulted from the neutrons
in the previous generation, we anticipate that we will eventually obtain a
nonnal-mode flux from any initial source distribution. This is certainly true;
however, the rate at which the flux converges to the fundamental mode will
depend on the initial distribution and the specifics of the problem. Our
calculation will converge faster if we choose an initial source distribution
that is similar to the fundamental mode than if we choose one quite different
from the fundamental mode. In addition, the flux in a simple, fast neutron
8. Nuclear Criticality Calculations with Monte Carlo 233

system, such as a fast critical assembly, will converge faster than that in a
complex thermal reactor system.
To examine the convergence of the initial flux guess to the fundamental
mode we will solve this example three times, using three different fission
distributions for the first generation source. The first calculation will use
the simplest possible distribution: an isotropic point source at the center of
the sphere. The second calculation will start with a uniform distribution of
fissions throughout the spherical volume of fissile material. The third
calculation will use the spatial flux distribution for the diffusion theory
buckling of a critical sphere. In this last case the radial dependence of the
fission distribution will be proportional to sin(1trfRc)/r, where Rc is the outer
radius of the system. When k = I, Rc is the critical radius. We anticipate
that an equilibrium spatial distribution of fission events will be established
in a few generations for all three cases.
The PFC geometry input file, 'geom.txt,' used for this problem is shown
in Table 8.1. The total cross section is set to 3.0 to give a sphere of fissile
material with a radius of three mean free paths for the criticality calculation.
The value for c will be varied to determine its effect on k-effective.
Table B.l. Geometry Description for Example 8.1
o There are no RPPs
1 There is 1 sphere
0.0, 0.0, 0.0, 1.00 center coordinates and radius-sphl
2 There are 2 zones
I, 1 Zone 1 has one body, 1
I, -I Zone 2 has one body,-I

The list of the modified PFC subroutines to be used in this calculation is


given in Table 8.2. The principle changes required to execute this criticality
calculation are associated with the implementation of the batch option in
subroutine 'Walk' and its subordinate routines. Because we are going to
treat generations as batches, a batch loop has been added to subroutine
'Walk,' as shown in Table 8.3. Within each batch, or generation, we will
track 'npart' source particles. A total of ' nbatch' batches will be run. We
will exclude the first few generations from our estimate of the multiplication
factor in order to allow the system to converge to fundamental mode. The
number of generations we will skip is defined by the variable 'ntransient.'

Table B.2. Modified Subroutmes tior Example


I 81
Subroutine Location
'Walk' Table 8.3
'Source' Table 8.4
' Col' Table 8.5
'Stats' Table 8.6
'Input' Table 8.7
234 Chapter 8

In this calculation the first-generation source distribution is obtained


from subroutine 'Source.' Changes to subroutine 'Source' are indicated in
Table 8.4. Common blocks have been added to allow use of the problem
geometry for calculating the source distribution. The Fortran required to
implement all three initial source distributions is shown, but with the point
and uniformly distributed sources commented out. The source for each
generation is normalized to the desired number of start particles in 'sourc2,'
an entry point in subroutine 'Source.' Finally, the start location and start
weight of each source particle in a generation are obtained by a call to
'sourc3,' another entry point in 'Source.' To accommodate the use of
fissions in generation i for the source in generation i+ 1 a common block
labeled 'bank' has been added to the program. The variables in this
common block are used to score the location and weight of up to 20,000
fission events for each generation. The total number of fissions stored in the
bank at any point in time, 'nsave,' is also included in the 'bank' common
block. The fixed dimensions of the arrays in this common block must be
greater than or equal to the number of fissions produced per batch in order
to avoid overwriting portions of the data.

Table 8.3. Subroutine 'Walk' for Example 8.1


SUBI01I'INE WAIl( 1
CXlMN/lli/npart,nbatdl 2
REAL (8) cinfp,dtr,xsec,ck:ur 3
CXlMN/TAACK/cinfp, dtr, xsec, ck:ur 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,UQ,vo,wo,wate,age,energ! 5
CXlMN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
ntransient=10
CALL S<lJKE ! get souroe pararreters for initial bank
I.ocp Oller Batcnes: ro j=1,nbatch-tntransient
- IF().EQ.ntransient+1)CALL Statcne ! re-initializes statistics arrays
CALL saJFC2
I.ocp Oller Particles: ro i=1,npart 10cp over n\.lltJer of particles 7
- CAIL StatIp initialize statistics for each particle 8
CALL saJFC3 (i)
I.ocp for Collisioos: ro to find collisien sites 10
00.-orSf get distance of travel in mfp 11
I.ocp Tracie ro track particle to collisien point 12
CALL HIT get distance to boondary of current zene 13
CALL MXSEX:: get total cross sectien for current zene 14
IF( (dtr-ck:ur) *xsec.GE.cinfp) EXIT I.ocp Track ! collisien before boondary 15
CALL BOO)( ! process boondary crossing 16
IF(nzcur.EQ.-1) EXIT I.ocp for Collisioos ! particle killed e.g., by escaping 17
END ro I.ocp Track - - ! 18
CALL <XlL - ! call col to process collisien 19
IF(nzcur.EQ.-1) EXIT I.ocp for Collisioos ! particle killed by collisien 20
END ro I.ocp for Collisioos - - ! 21
CALL StatEl{) process statistics I<t!en particle killed 22
END ro I.ocp Oller Particles ! 23
IF(j.m .ntransient)CALL StatEBatdl process statistics I<t!en particle killed
END ro I.ocp Oller Batcnes
~ - 24
END 25
8. Nuclear Criticality Calculations with Monte Carlo 235

Table 8.4. Subroutine 'Source' for Example 8.1


SUBR::mINE saJFCE 1
REAL (8) FLTRN,r1,r2,tmp
cx:MotN/IN/rpart, nbatch
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age, energ ! 2
cx:MotN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20) , &
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40)
LOGICAL bdtest(40), bdhit(40)
cx:MotN/cg/SIiot, sphcy, sphcz, sphr, rpxmin, rpxmax, rpymi.n, rpymax, rpzmin, rpzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
REAL (8) Xbank(20000,2),ybank(20000,2),Zbank(20000,2),Wbank(20000)
cx:MotN/BANKIXbank, ybank, Zbank, Wbank, nsave
pi=2.OdO*DNXS(0 .0d0) ! keep for rrore catplicated soorce that needs pi 4
00 100 i-1,rpart
Xbank(i,2)=O .OdO; ybank(i,2)-o.OdO
EbllONing foor lines are ally for diffusioo theory soorce
50 r1=F.LTRN(); r2-2.5d0*FLTRN() ! II'aX of 4*r*Sin(pi*r) is aboot 2.32
t:np-4.OdO*r1*OOIN(pi*r1) ! select fron 4pi r sin(pi r) for initial batch
IF(tmp.LT.r2)00I'0 50 ! using rejectioo
Zbank(i,2)-r1*sphr(1)
Zbank(i,2)=sphr(1)*r1**(1.OdO/3.0d0) use for flat soorce
Zbank(i,2)=O .OdO ! use for point souroe
Wbank (i) =1. OdO
100 <XNl'INUE
nsave=npart
REIURN
ENl'RY SCXJIC2
initial=rpart; rpart=O
00 200 i=l,nsave
150 CXNI'INUE
IF(Wbank(i) .GE.1.OdO)THEN
rpart=rpart+1
Xbank(rpart,1)=Xbank(i,2) ; ybank(rpart,1)=ybank(i,2); Zbank(rpart,1)=Zbank(i,2)
Wbank(i)=Wbank(i)-l .OdO
OOI'O 150
ELSE
IF(Wbank(i) .GE.FLTRN())THEN
rpart=rpart+1
Xbank(rpart,I)=Xbank(i,2);ybank(rpart,I)=ybank(i,2);Zbank(rpart,I)=Zbank(i,2)
ENDIF
ENDIF
200 CXNI'INUE
IF(rpart .GI'.initial)rpart=initial ! keeps particle nl.lli:lers fron increasing
nsave=O
IF (rpart.LE.O) THEN
write(*, *)' The nlllber of particles decreased to zero.'
SlOP
ENDIF
IF(rpart.LT.initial)THEN ! keeps particle nl.lli:lers fron decreasing
ntatp=initial-npart
00 i=l,ntatp
rpart=rpart+1
Xbank(rpart,I)=Xbank(i,l);ybank(rpart,I)=ybank(i,I);Zbank(rpart,l)=Zbank(i,l)
rnr:ro
ENDIF
REIURN
ENI'RY SClJIC3 (n)
~(n,l) ; y=ybank(n,I); z=Zbank(n,l)
nzcur=l; wate=l.OdO
CALL ISCOJI' directioo chosen isotrq>ica1ly 7
RErUm 9
END 10
236 Chapter 8

The modified subroutine 'Col' is shown in Table 8.5. The version


shown assumes that the incident neutron is completely absorbed in a fission
event and that all particles leaving a fission are in the next generation. Thus
the track of a neutron in the current generation is terminated by a collision in
the fissile material, and c neutrons are stored in the bank for the next-
generation source. The scoring for the total subsequent population estimate
of k is done in 'Col.' The variable 'cscore' keeps a running tally of every
subsequent-generation neutron produced.
The modified subroutine 'Stats' is shown in Table 8.6. The batch results
for the generation method are stored in this subroutine, at entry point
'statebatch.' The number of fission neutrons in the next generation divided
by the number of start particles in the current generation is stored in array
'bscore.' This quantity is given by the variable 'tmp.' The estimates of the
neutron multiplication from each generation can be printed in order to
examine the convergence of the flux to the fundamental mode. At entry
point 'statend' the mean of the estimates of k for generations 'ntrasient'+ 1
through 'nbatch' + 'ntransient,' and the variance in this mean, are calculated
and printed, along with the results for the total subsequent population
estimate. The modified subroutine 'Input' is shown in Table 8.7. An input
for the number of batches has been added to this routine.

Table 8.5. Subroutine 'Col' for Example 8.1


SUBID1I'INE COL 1
REm. (8) FLTRN,delta 2
REm. (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REI\.L (8) ctnfp, dtr, xsec, dcur ! 5
OOMMON/TRACK/ctnfp,dtr,xsec,dcur 6
REm. (8) sigt(20),c(20); ! dirrensions allaY up to 20 different rredia 7
OOMMON/GErM/sigt,c; !sigt is total =ss section, c is non-absoIption prd:> 8
REm. (8) xbank(20000, 2) ,ybank(20000,2) ,zbank(20000,2) ,Wbank(20000)
OOMMON/BANKixbank, ybank, zbank, Wbank, nsave
REm. (8) bscore, bsumsq, csrore, CSUl\Sq
OOMMON/STAT/bsrore,bsumsq, cscore, csl.lllSq
delta=dnfp/xsec ! distance travelled to collision 9
dtr=dcur+delta ! update total distance travelled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! update position 11
The follaving assures crnplete absoIption in collisions
The non-absoIption prch3bility goes to the next generation
nsave=nsave+1 bank a fission
xbank(nsave,2)=x x-position for fission
ybank(nsave,2)=y y-position for fission
zbank(nsave,2)=z z-position for fission
Wbank(nsave)=c(nzcur) weight of fission particle
csrore=csrore+c (nzcur)
csumsq=csumsq+c (nzeur) **2
nzcw:=-l particle absorbed by collision
FEI'URN 21
END 22
8. Nuclear Criticality Calculations with Monte Carlo 237

Table 8.6. Subroutine 'Stats' for Example 8.1


SUBR:mINEStats 1
REAL (8) bscore, bsl1llSq, csrore, csumsq
COMN/STAT/bscore, bsl1IlSq, cscx>re, csumsq
COMN/IN/qA3.rt, nbatdl 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
COMN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tmp,tmp1,tmp2,var,stdev ! 7
REAL (8) xbank(20000,2),ybank(20000,2),ibank(20000,2),Wbank(20000)
COMN/BANK/xbank, ybank, ibank, Wbank, nsave
ENI'RY StatQ1e ! entry point to initialize arrays for carp1ete prcb1ern 8
bscore=O. OdO; bsumsq=O. OdO; cscx>re=O. OdD; CS\.IlISq"O. OdD
RE:IURN 10
ENI'RY StaUp entry point to initialize arrays for a particle 11
RE:IURN ! 13
ENI'RY StatEIp entry point to store scores for a particle 14
RE:IURN 19
ENI'RY StatEBatch ! entry point to store scores after each batch
tmp1=D~(qA3.rt); tmp2=O.dO
IX) 100 i=l,nsave
tmp2=tmp2~(i)
100 CXNI'INUE
tnp=tmp2/tmp1; bscore=bsa:lre+tmp; bsumsq=bsumsq+tmp**2
WRITE (16, *)tmp ! use to print batch results
RE:IURN
ENI'RY StatEhi ! entry point to calculate and print results 20
t:rrp=D~ (nbatch)
var=bsl1llSq/tnp- (bscore/tmp) **2 variance of bscore distril:uticn
stde~(var) ! standard deviaticn of bscore distr23
WRITE(16,*)bscore/tmp,stdev/DSQRT(tmp) ! result and std dev of result
t:rrp=DFUl\T (nbatch) *D~ (qA3.rt)
var=csl1llSq/tnp- (cscx>re/tmp) **2
stdev=DSQRT(var)
WRITE(16,*)cscore/tmp,stdev/DSQRT(tmp)
RE:IURN 28
END 29

Table 8.7. Subroutine 'Input' for Example 8.1


SUBFOJI'INE INruI' 1
COMN/IN/qA3.rt, nbatch 2
WRITE(*,12) 3
12 FCH1I\T (' Enter the !llIlber of particles. ' ) 4
READ(*,*)qA3.rt 5
WRITE (16, *) 'Nurcber of particles = ',qA3.rt 6
WRITE (*,14)
14 FCH1I\T (' Enter the nurrt:Jer of batches. ' )
READ(*,*)nbatch
WRITE (16, *) 'Nurcber of batches ',nbatch
WRITE(*,13) 7
13 FCH1I\T (' Enter the randan nmber seed, an integer. ') 8
READ(*, *)iseed 9
IF(iseed.LT.1)iseed=1 10
IF(iseed.GE.2147483647)iseed=2147483646 11
WRITE (16, *)' Starting randan !llIlber seed is ',iseed 12
CALL mdin (iseed) 13
RE:IURN 15
END 16

To ensure an accurate result, one must consider the convergence of the


first generation source to the fundamental mode of the system. This can be
done by looking at the individual values of k, as determined by the
238 Chapter 8

generation method, for the early generations. The coding to do this is


included, but is commented out in Table 8.6. Figure 8.1 shows the estimates
of k for the first 15 generations using the three initial source distributions
described above, and for c = 1.217. As is apparent from this figure, a point
source at the center of the sphere produces an overestimate of k in the early
generations because the importance of a neutron in this system is highest at
the center of the sphere. After this initial result, the estimates of k in
subsequent generations from this source decline until they begin to show
random statistical variations about the correct result after about ten
generations.

1.20 r--------------.,
1.15

1.10

.>< 1.05

1.00

0.95

3 5 7 9 11 13 15
Batch

Figure B.1. Values of k from Early Generations

The convergence to fundamental mode of a distributed first-generation


source may be expected to require fewer generations than a point source.
Figure 8.1 shows this to be the case for the particular source distributions
used. Both the uniform "flat flux" and the diffusion-theory distributions
converge significantly faster than the point source, with the diffusion-theory
distribution producing the best early-generation results. The uniform-source
distribution places more neutrons near the outer surface of the sphere than
are present in the fundamental-mode distribution and thus the initial
estimates for the multiplication from this source are below the true value.
Under many circumstances the equilibrium flux distribution will not be a
simple function of the spatial variables in the system and a uniform
distribution may be a reasonable compromise for the first generation source.
Regardless of the initial fission guess, however, it appears that the flux in
this system converges to the fundamental mode within about ten
generations. We will set 'ntransient' to ten for subsequent calculations.
A series of calculations has been made with the modified PFC using
values of c from 1.0 to 1.5. The results are shown in Table 8.8. Each
calculation, except for the results shown in the last row, used 15,000
particles per generation for 60 generations, with the estimate of k beginning
8. Nuclear Criticality Calculations with Monte Carlo 239

with the 11 th generation (i.e., nbatch = 50 and a total of 50 generations was


used in the estimate of k). The last row used nbatch = 5000. The results
vary but slightly with the assumed initial source distribution, and only those
for the diffusion-theory start distribution are presented. The results obtained
using both the ratio of generations and the total subsequent population
methods are shown in Table 8.8. The results are identical, to the accuracy
shown, for every value of c. In all cases but the last the standard deviation
in the result is on the order of 0.06% of the estimated multiplication factor.
The last case is included to demonstrate that the estimate of the standard
deviation obtained from the total subsequent population method is more
accurate than that obtained from the generation method. Using 5000 batches
for the estimate rather than 50 should reduce the uncertainty of the result by
a factor of ten. Some reduction in sigma is evident for both estimates of k,
but the value of 0.00053 at 50 batches from the total subsequent population
method is more accurate than the estimate of 0.00067 from the generation
method, as can be seen when the results obtained for 5000 batches are
multiplied by ten. Since these results are linear in c, we see that the system
becomes critical at c ~ 1.217.

Table B.B Resu Its tIor Example


I 8I
c k (generation) Sigma k (total subsequent Sigma
population)
1.0 0.8223 0.00045 0.8223 0.00044
1.1 0.9027 0.00052 0.9027 0.00049
1.2 0.9858 0.00067 0.9858 0.00053
1.3 1.0682 0.00063 1.0682 0.00057
1.4 1.1501 0.00070 1.1501 0.00062
1.5 1.2327 0.00078 1.2327 0.00066
1.2 0.985247 0.0000536 0.985247 0.0000531

The above calculations assumed the incident particle was completely


absorbed at every collision, and c particles were banked for the next
generation. We know that the critical value for c will not change if we
assume the incident particle survives the collision and c - 1 particles are
produced in the next generation. This latter assumption can easily be
implemented by modifying subroutines 'Col' and 'Stats.' To confirm that
the critical value of c does not depend on whether or not the incident
particle is absorbed, we will repeat the above calculation assuming the
incident particle survives the collision. The list of the modified subroutines
to be used in this calculation is given in Table 8.9. The geometry and cross
section information is the same as before.
Table 8.10 shows the version of 'Col' that assumes the incident
particle survives each collision; i.e., that no absorption occurs and that
240 Chapter 8

particles are tenninated only by leakage from the system. In this case c - 1
particles are emitted from each collision as next-generation particles. The
modified Subroutine 'Stats' is shown in Table 8.11. Because each particle
can have more than one collision, and make more than one contribution to
the score, the method for accumulating statistics has been modified
accordingly.

Table 8.9. Modified Subroutmes t1or Example


I 8 I WI·th No Absorption
Subroutine Location
'Walk' Table 8.3
'Source' Table 8.4
'Input' Table 8.7
'Col' Table 8.10
'Stats' Table 8.11

Table 8.10. Subroutine 'Col' for Example 8.1 with No Absorption


SUBlOJI'INE COL 1
REAL (8) FL'1m,delta 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) dnfp,dtr,xsec,OCur ! 5
OOMMON/TRACK/dnfp, dtr, xsec, 0Cur 6
REAL (8) sigt(20) ,c(20); ! d:iIrensiCllS allow up to 20 different rredia 7
OOMMON/GEX:M/sigt,c; !sigt is total cross secticn, c is ncn-absotpticn prcb 8
REAL (8) xbank(20000,2),ybank(20000,2),zbank(20000,2),Wbank(20000)
OOMMON/BANKIxbank, ybank, zbank, Wbank, nsave
REAL (8) b.so:Jre, bsunsq, cscore, csursq, cpart
OOMMON/S'I7\T/b.so:Jre,bsunsq,cscore,csunsq,cpart
delta=dnfp/xsec ! distance travelled to rollisicn 9
dU=ch.lr+delta ! update total distance travelled 10
x.=xo+u*dtr; y=yow*dtr; z=zotw*dtr ! update positicn 11
'!he following asSl.lll!S c is greater than 1 rut less than 2
'!he excess ncn-absOl:pticn prcbability (over 1) goes to the next generaticn
IF(FL'1m() .LT.c(nzcur)-1.OdO)'1HEN ! if fissicn particle generated
nsave=nsave+1 bank a fissicn
xbank(nsave,2)=x ! x-positicn for fissicn
ybank(nsave,2)=y ! y-positicn for fissicn
zbank(nsave,2)=z ! z-positicn for fissicn
Wbank(nsave)=1.0d0 weight of fissicn particle
ENDIF
cpart=cpartfC (nzcur) -1. OdO
CALL Iscx:uI' assures isotrq>ic scatter in lab system 20
REIURN ! 21
END 22

The results of a series of calculations with no absorption are shown in


Table 8.12. As before, the calculations were perfonned with 50 batches of
15,000 particles (plus ten batches discarded to initialize the distribution)
with the exception of the last two calculations listed. These used 10,000 and
8,000 particles, respectively, in order to stay within array limits. As
expected from eqn 8.6, the value of the non-absorption probability required
for criticality is the same as that obtained in the previous calculation, c ::=::
1.217. However, for the situation where the system is not critical, the
8. Nuclear Criticality Calculations with Monte Carlo 241

calculated values for k are not the same as in the prior calculation. This
occurs because the generation time will change depending on the number of
neutrons leaving a fission event that are assumed to be in the current
generation (see eqn 8.9).

Table 8.11. Subroutine 'Stats' for Example 8.1 with No Absorption


SUBFaJI'INE Stats 1
REAL (8) bscore, bsumsq, cscore, csunsq, cpart
COKN/SI'AT/bscore,bs\.ll1Sq,cscore,csumsq,cpart
COKN/IN/npart, nbatch 4
REAL (8) x,y,z, u,v,w, xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
COKN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tmp,tmp1,tmp2,var,stdev ! 7
REAL (8) xbank(20000,2),ybank(20000,2),zbank(20000,2),¥txulk(20000)
COKN/BANK/xbank, ybank, zbank, ¥txulk, nsave
ENI'RY Stat01e ! entry point to initialize arrays for cxnplete prcblem 8
bscore=O. OdO; bs\.ll1Sq=O. OdD; cscore=O . OdD; csumsq=O . OdD
REl'URN 10
ENI'RY Statlp entry point to initialize arrays for a particle 11
cpart=O . OdD
REl'URN 13
ENIRY StatElp entry point to store scores for a particle 14
cscore=cscoreiCpart
csunsq=cs\.ll1Sqtcpart**2
REl'URN 19
ENI'RY StatEBatch
tmp1=DFWIT(npart); tmp2=O.dO
IX)100 i=l,nsave
tmp2=tmp2#.bank (i)
100 CXNI'INUE
tmp=tmp2/tmp1; bscore=bscore+tmp; bsunsq=bsunsq+tmp**2
REl'URN
, ENI'RY StatEild ! entry point to calculate and print results 20
tnp=DFWIT (nbatch)
var=bst.II1Sq/tnp- (bscore/tmp) **2 variance of bscore distribution
stdev=~ (var) standard deviation of bscore distr23
WRITE(16,*)bscore/tmp,stdev/~(tmp) result and std dev of result
tnp=DFWIT (nbatch) *DFIa\T (npart)
var=C5t.111Sq/tnp- (cscore/tmp) **2
stdev=~(var)
WRITE(16,*)cscore/tmp,stdev/~(tmp)
REl'URN 28
29

The differences between the estimates of k obtained using the generation


and the total subsequent population methods occur because these results are
calculated differently in subroutine 'Col' rather than because of inherent
differences in the methods. For the generation method, 'Col' uses a random
number to decide if a particle is generated with weight one at each collision
point. The total subsequent population method scores the probability of a
fission neutron being generated. This latter method is the more accurate of
the two. However, if in the generation method we choose to bank light-
weight particles (with weight 0.05 for example when c = 1.05) we would be
forced to increase the size of the bank significantly. If this had been done,
both methods would have given the same estimate for k, although the
242 Chapter 8

estimate of the variance would still have been more accurate when based on
the total subsequent population method than when based on the generation
method.

Table 8.1 2. Results or ExampleI 8.1 WIt. h No AbsorptIOn


c k Sigma k (total subsequent Sigma
(generation) population)
1.05 0.2283 0.00076 0.2290 0.00029
1.1 0.4580 0.00096 0.4587 0.00058
1.2 0.9152 0.00150 0.9152 0.00117
1.217 0.9969 0.00134 0.9956 0.00127
1.3 1.3811 0.00225 1.3795 0.00215
1.4 1.8323 0.00447 1.8334 0.00320

The fission distribution in Example 8.1 converged to the fundamental


mode in about ten generations. However some problems, such as those
involving large, thermal reactor cores, may require many more iterations
than this to achieve an equilibrium spatial distribution of fission events. In
such cases it is sometimes appropriate to use an independent, deterministic
result for the fission distribution as the source in the first Monte Carlo
generation. Furthermore, although the choice of the energy and directional
distribution of the neutrons in this initial source is arbitrary, the rate of
convergence to equilibrium is usually maximized by using an isotropic,
fission spectrum source.

8.3 The Matrix Method

It is not necessary to track multiple generations of neutrons in order to


obtain an estimate of the effective neutron multiplication of a fissile
assembly. Instead, one can divide the volume of fissile material into a
number of regions and use Monte Carlo transport methods to calculate the
expected number of fission neutrons that will be produced in a given region
j per neutron born in the previous generation in region i. These expected
values form a matrix aij, each element of which is equal to the number of
next-generation neutrons produced in region j by one neutron born in the
current generation in region i.4 Thus the number of neutrons born in region j
in generation n, Snj, is given by the sum

(8.10)

The neutron multiplication factor is contained in the matrix aij since


8. Nuclear Criticality Calculations with Monte Carlo 243

(8.11)

where

(8.12)

The matrix aij, which is called the fission matrix, can be calculated using a
single generation of neutrons. Once the matrix is known an initial guess for
Soj can be used in eqn 8.10, and that equation applied repeatedly until a
stable value ofk is obtained from eqn 8.11.
Here we have introduced the tenn "region" to designate a portion of the
geometry selected for defining this matrix. All fissile material in the
problem geometry must be in some region, and the regions must not overlap.
Obviously aij *- 0 only when both regions i and j contain fissile materials.
While non-fissile materials may be included in a region, volumes with only
non-fissile materials need not be in a region; i.e., while the regions must
encompass all the fissile material in the geometry, they need not encompass
those portions of the geometry that contain only non-fissile materials.
Although one may define the matrix regions such that they are related to, or
coincident with, the zones used to define the problem geometry, this is not
required. We will assume that the regions used to define the fission matrix
are independent ofthe zones used to define the problem geometry.
Calculation of the fission matrix requires starting a number of neutrons
in each region and detennining the response produced by these neutrons in
all regions, including the source region. If the system fundamental-mode
spatial flux distribution is known, then the source used in the calculation for
each region can be distributed accordingly. In this case the size and number
of the regions should be relatively unimportant and a small number of
regions may provide an acceptable result. However, if the fundamental-
mode flux is unknown, the source distribution used to calculate the elements
of the matrix must be chosen in some approximate manner. A common
choice is to use a unifonn distribution over the source region. In this case,
because the source distribution will not be equal to the nonnal mode
distribution, many regions may be required in order to obtain an accurate
estimate of k. Fortunately the error produced in the matrix elements by an
incorrect initial source distribution tends to be of second order because the
value of the matrix element depends only on the distribution across the
region and not on the distribution over the entire system of fissile material.
In the limit of a large number of regions the sensitivity of the results to the
source distributions used to obtain the fission matrix is small.
244 Chapter 8

A second estimated source distribution enters the calculation of k with


the matrix method when applying eqns 8.10 and 8.11 . In order to obtain the
correct value for k using eqn 8.11 the source distribution Snj must
approximate the fundamental mode flux over the entire fissioning system.
However, the initial guess for this distribution, Soj, as long as it provides a
reasonable sampling for each of the aij elements, is relatively unimportant
since iterating on eqn 8.10 until a stable value of k is obtained is trivial.
Thus the major source of error in the system multiplication obtained by the
matrix method is usually in the matrix elements themselves.
In addition to any systematic errors contained in the elements of the
fission matrix produced by incorrect source distributions, these elements
will also contain statistical errors. In a formal sense one should be able to
propagate the~se statistical errors through the calculation to determine the
uncertainty in k. However, because the interactions between the matrix
elements and the iteration of eqns 8.10 and 8.11 are complex, and because
there are covariance terms that can reduce the uncertainty, it is difficult to
do this. 5 We will estimate the error in k assuming statistical independence
in the estimates for the matrix elements, knowing that the final uncertainty
obtained thereby is an overestimate of the true variance.
Since the effect of systematic errors cannot be quantified in the absence
of knowledge of the true system multiplication, one can only attempt to
minimize them. One way to attempt to minimize systematic errors is to vary
the number of regions in the fissile material until a stable value is obtained
for k. However, it is impossible to know whether the particular division of
the geometry into regions used in the calculation will produce a global
minimum in the error; i.e., the value of k to which the system converges may
differ depending on the particular choices for the regions. A more practical
way to minimize systematic errors may be to obtain a first estimate of aij by
starting the source in each region i uniformly over the region. The source
can then be improved by interpolating on the Snj values obtained from eqn
8.10 to obtain a revised spatial distribution. A new matrix can then be
calculated based on this revised source distribution.
Despite the difficulties inherent in the matrix method, it has several
merits. First, in many problems the matrix technique has been found to
reduce the computation time for criticality calculations compared with that
of the generation method. With modern computers, such improvements in
efficiency are of less concern than in the past, but the method still may be of
value in certain specialized problems such as split-core reactors. Second,
the matrix method provides information on the extent to which fissions have
occurred in the regions of the problem. This provides evidence of the
thoroughness with which these portions of phase space have been sampled,
and can be an important check on the validity of the result.
8. Nuclear Criticality Calculations with Monte Carlo 245

Example 8.2. k for a homogeneous sphere using the matrix method


We will repeat the problem of Example 8.1 using the matrix method and
compare the results with those obtained using the generation method. To
define regions corresponding to the elements of the fission matrix we will
divide the fissile material into spherical shells of uniform thickness. The
central region is thus a solid sphere of radius rJn, where ro is the outer
radius of the fissile material (three mfp in this case), and there are n regions.
The second region is a spherical shell with inner radius rJn and outer radius
2rJn, etc. This selection of the regions to be used in our matrix calculation
is arbitrary and is in no way optimum. One may postulate that an improved
choice might be one in which an approximately equal number of fissions
will occur in each region. We will start the source for the fission matrix
elements aij uniformly over each region i and score the number of next-
generation fission neutrons produced by this source in all regions j.
To implement the matrix method we have modified the PFC code to
generate the complete matrix, and to iterate on eqns 8.10 and 8.11, in a
single calculation. The list of the modified subroutines to be used in this
calculation is given in Table 8.13. The geometry description is the same as
that used in Example 8.1, as shown in Table 8.1. The cross-section
information is also the same as Example 8.1. Subroutine 'Walk' is shown in
Table 8.14. This modified subroutine adds a loop over the number of
regions. Subroutine 'Input: shown in Table 8.15, has been modified to
allow user input for the number of regions to be used, as well as the number
of iterations to be used in eqns 8.10 and 8.11.
The modified subroutine 'Source' is shown in Table 8.16. This
subroutine starts particles uniformly over each matrix region. Subroutine
'Col' is shown in Table 8.17. This subroutine assumes the incident neutron
is absorbed in each collision and all secondary neutrons contribute to the
fission matrix for the region in which the collision occurs. The number of
fission neutrons produced in each matrix region is tallied in the array 'aij.'
In order to allow a variance estimate of the result, 'Col' also scores the
square of the number of fission neutrons produced. The squares are stored
in the array 'aijsq.'
Table B.13. Modified Sub routmes t1or Example
I 82.
Subroutine Location
'Walk' Table 8.14
'Input' Table 8.15
'Source' Table 8.16
'Col' Table 8.17
'Stats' Table 8.18
'keff' Table 8.19
246 Chapter 8

Table 8.14. Subroutine 'Walk' for Example 8.2


SUBroJI'INE WAIl( 1
cx:MO'I/IN/npart, nregioos, iter
REAL (8) cInfp,dtr,xsec,dcur 3
cx:MO'I/TRACKIcInfp,dtr,xsec,dcur 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ! 5
cx:MO'I/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
cx:MO'I/EXAMPLEl/nreg
lDq:l_Over_!legioos: ro j=l,nregioos
nreg=j
lDq:l_Over]articles: ro i=l,npart locp over ntmiJer of particles 7
CALL Statlp initialize statistics for each particle 8
CALL saJK:E get source pararreters for particle 9
lDq:l for Collisioos: ro to find collisioo sites 10
CALL-DIS'!' get distance of travel in mfp 11
lDq:l_Track: ro track particle to collisioo point 12
CALL HIT get distance to boundary of current zooe 13
CALL MXSEJ: get total cross sectioo for current zooe 14
IF( (dtr-dcur)*xsec.GE.cInfp) EXIT lDq:l Track ! collisioo before boundary 15
CALL BOOX ! process bolmdary crossing 16
IF (nzcur.El;l.-I) EXIT lDq:l for Collisions ! particle killed e.g., by escaping 17
END ro Locp_Track - - 18
CALL COL ! call col to process collisioo 19
IF(nzcur.El;l.-I) EXIT lDq:l for Collisioos ! particle killed by collision 20
END ro Locp_for_ Collisioos - - ! 21
CALL StatEIp process statistics when particle killed 22
END ro lDq:l Over Particles 23
=: =:
END ro lDq:l Over !legioos
REIURN 24
END 25

Table 8.15. Subroutine 'Input' for Example 8.2


SUBroJI'INE INIUI' 1
cx:MO'I/IN/npart, nregions, iter
WRITE (*,10)
10 E"CH1AT (' Enter the ntmiJer of regioos. (rrax of 20) ')
READ(*, *)nregioos
IF(nregions.LE. 0.OR.nregioos.Gr.20)nregians=20
WRITE (16, *) 'Nurrber of regioos = ',nregioos
WRITE(*,l1)
11 E"CH1AT(' Enter the nurrber of matrix iteratioos. ')
READ(*,*)iter
WRITE (16, *)' Nurrber of matrix iteratioos = ',iter
WRITE(*,12) 3
12 E"CH1AT (' Enter the ntmiJer of particles/regioo. ' )
READ(*,*)npart 5
WRITE (16, *) 'Nurrber of particles/regioo = ',npart
WRITE (*,13) 7
13 E"CH1AT (' Enter the randan ntmiJer seed, aJ} integer. ') 8
READ(*,*)iseed 9
IF (iseed.LT .1) iseeci=l 10
IF(iseed.GE.2147483647)iseed=2147483646 11
WRITE (16, *)' Starting randan nI.llDer seed is ',iseed 12
CALL rndin(iseed) 13
REIURN 15
END 16

The modified subroutine 'Stats' is shown in Table 8.18. The matrix


regions are defined at entry point 'statone,' and the elements aij are
calculated at entry point 'statend.' Variance estimates are also made for the
matrix elements. After the matrix elements have been estimated, 'Stats'
8. Nuclear Criticality Calculations with Monte Carlo 247
calls the new subroutine 'keff.' This subroutine, shown in Table 8.19, has
been added to perform the iteration of eqns 8.10 and 8.11. The routine
assumes an initial, uniform source distribution for Soj and iterates to obtain
k. The number of iterations used in this routine is set by the user. a 'Stats'
then makes an estimate of the variance in k and prints the results.

Table 8.16. Subroutine 'Source' for Example 8.2


SUBIU1I'INE SOJICE 1
RE1\L(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ ! 2
OOMMDN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ,nzcur,newzn,ngroup 3
RE1\L(8) aij(20,20),aijsq(20,20),rreg(21),outrad
OOMMDN/~/aij,aijsq,rreg,outrad
OOMMDN/EXAMPLEI/nreg
RE1\L(8) radius,fltrn
pi=2.OdO*I:lA(Xl) (O.OdO) ! keep for Il'Ore catplicated source that needs pi 4
radius=((rreg(nreg+l)**3-rreg(nreg)**3)*fltrn()+rreg(nreg)**3)**(1:0d0/3.0d0)
CALL rscx:m' ! pick directicn of starting locaticn
x=radius*u; y=radius*v; z=radius*w ! starting locaticn
nzcur=l ! assures particle is in zcne cne
CALL rscx:m' directicn chosen isotrcpically 7
wate=l.OdO ! particle starts with a weight of cne 8
REIURN 9
am 10

Table 8.17. Subroutine 'Col' for Example 8.2


SUBR:m'INE COL 1
RE1\L(8) FLTPN,delta 2
RE1\L(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,~,wate,age,energ ! 3
OOMMDN/PART/x,y,z,u,v,w,xo,yo,zo,uo;vo,~,wate,age,energ,nzcur,newzn,ngroup 4
RE1\L(8) dnfp,dtr,xsec,dcur ! 5
OOMMDN/TRACK/dnfp,dtr,xsec,dcur 6
RE1\L(8) sigt(20),c(20); ! dirrensicns allay up to 20 different ned.ia 7
OOMMDN/GEIM/sigt, c; ! sigt is total cross section, c is non-absorption prdJ B
RE1\L(B) aij(20,20),aijsq(20,20),rreg(21),outrad
OOMMDN/~T/aij,aijsq,rreg,outrad
OOMMDN/IN/npart, nregicns, iter
CXM£.N/EXPMPLE1/nreg
RE1\L(8) radius
delta=ctnfp/xsec ! distance travelled to rollision 9
dtr=dcur+delta ! update total distance travelled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w"dtr ! update position 11
radius=~(x*x+y*y+z*z) ! radius of rollision point
index=INT(radius*~(nregicns)/outrad)+l
aij (nreg,index)=aij (nreg,index) +c(nzcur) ! SOJres all outgoing neutrcns
aij sq (nreg, index) =ai j sq (nreg, index) +c (nzcur) **2
nzcur=-l ! all incani.ng neutrcns are absorl:Jed
REIURN 21
am 22

An example of a fission matrix for the current system, produced by


tracking 5000 start particles in each of five regions, and assuming c = 1.2, is
shown in Table 8.20. From the entries in this table it is clear that this short

a
One could specifY a convergence criterion, such as some maximum fractional change in k
per iteration, and perform the iteration until that criterion is met.
248 Chapter 8

calculation successfully sampled the connections among all regions of the


geometry; i.e., we have no zero entries in the matrix. If these were our final
results we would also examine the uncertainties in the matrix elements to
verify that our sampling was reasonably thorough.

Table 8.18. Subroutine 'Stats' for Example 8.2


SUBIOJI'INE Stats 1
REAL (B) aij(20,20),aijsq(20,20),rreg(21),outrad
OOMMCN/~/aij,aijsq,rreg,outrad
OOMMCN/IN/npart, nregioos, iter
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
OOMMCN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) trop,trop1,trnp2,var,stdev,xkeff
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40)
UX;ICAL bdtest(40), bdhit(40)
OOMMCN/cg/sphcx, sphcy, SIiJ,cz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzanes,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
ENIRY Stat01e ! entry point to initialize arrays for cxnp1ete proo1em 8
rreg(l) =0. OdO; outrad=sphr(l)
ro i=2,nregioos+1 ! calculate outer radius of regioos
rreg (i) =DFI.O\T (i-I) *outrad/DFLd\T (nregioos) ! ooly for case of SJXlere
END ro
aij=O.OdO; aijsq=O.OdO
REIURN 10
ENIRY StaUp entry point to initialize arrays for a particle 11
REIURN ! 13
ENIRY StatEIp entry point to store scores for a particle 14
REIURN 19
ENIRY Stamrl entry point to calculate am print results 20
tnp=DFI.O\T (npart) 21
ro i=l,nregioos
ro j=l,nregioos
var--aijsq(i,j)/tmp-(aij(i,j)/trop)**2
aij (i,j)=aij (i,j)/tmp
aijsq(i,j)=var/trop
END ro
rnD ro
CALL keff(xkeff,var)
WRITE(16,100)xkeff,DSQRT(var)
100 EOM\.T(' k-effective = ',lpe14.5,' +- ',lpe14.5)
RErum 28
END 29

From these preliminary results we can draw several conclusions about


our choice of regions. The coupling between widely spaced regions, such as
regions I and 5, is weak, while that between adjacent regions is strong.
Furthermore the coupling from region I to 5 is stronger than the coupling
from region 5 to 1. This is logical because region 5 is much larger as seen
from region 1 than vice versa. On the other hand, the within-region
coupling is approximately equal for all regions except region 1. That region
has a small volume, and a small number of fissions, compared with the other
regions. All of this is consistent and indicates that the matrix values are
reasonable. For this case of five regions we obtain k ~ 0.967. Comparing
this with the result from Table 8.8 for the same value of c, for which we
8. Nuclear Criticality Calculations with Monte Carlo 249

obtained k ~ 0.986, it appears that these five regions are not sufficient to
obtain a good result using a uniform source to calculate the matrix elements
for this system.

Table 8.19. Subroutine 'keff' for Example 8.2


SUBRCUI'INE keff(xk,xke) ! Iterate I1Btrix for criticality
REAL (B) aij(20,20),aijsq(20,20),rreg(21),outrad
CXM1:N/STAT/ai j, ai jsq, rreg, ootrad
CXM1:N/IN/npart, nregions, iter
REAL (B) s (20) , sprilre (20) , delta (20) , xk, xke
s=1.0; delta=1.0
L::x:p Over Iterations: [X) n=1,iter ! begin iteration
Xk = O.
[X)1 i = 1, nregions
xk = xk + s(i)
1 CXNI'INUE
[X)2 i = l,nregions
s (i) = s (i) /xk nomalize s
2 CXNI'INUE
cala.!late sprine
[X) 3 i = l,nregions
sprine(i) = 0.; delta (i) = O.
[X) 3 j = 1, nregions
delta (i) = delta(i)+aijsq(i,j)*s(j)**2
sprine(i) = sprine(i)+s(j)*aij(i,j)
3 CXNI'INUE
[X)4 i = 1, nregions
s(i) = sprine(i)
4 CXNI'INUE
END [X) L::x:p Over Iterations
xk = 0.; xke = o.
[X) 5 i = 1, nregions
xke = xke+delta(i)
xk = xk + s(i)
5 CXNI'INUE

END

Table 8 20 F"Isslon M'R


atnx esu Iii
ts or a 5R'
- eglOn C ' WIt'h e = 1 2
I IatlOn
a eu
i \j 1 2 3 4 5
1 0.3965 0.4110 0.1824 0.09228 0.05340
2 0.05376 0.5626 0.3137 0.1276 0.06828
3 0.01008 0.1234 0.5713 0.2722 O.OIlOO
4 0.00181 0.02736 0.1391 0.5785 0.2651
5 0.00024 0.00612 0.03324 0.1566 0.5868

Figure 8.2 shows the results for k obtained from running the current
program assuming c = 1.2 and using various numbers of regions. These
results used 106 start particles per region to determine the matrix elements,
and 20 iterations of eqn 8.10 to obtain the estimate of the system
multiplication. The figure shows that the result changes little provided
fifteen or more regions are used, and hence we will use fifteen regions to
determine the effective multiplication of our system as a function of c.
250 Chapter 8

0.98

0.98

".
0.84

0.82

0.88
1 3 5 7 8 11 13 15 17 18
Number of Regions

Figure 8.2. Effect of Number of Regions on k Using Matrix Method

The results of fission matrix criticality calculations for various values of


c, using fifteen regions, 5000 source particles per region, and 20 iterations to
determine k, are shown in Table 8.21. These results are very close to those
of Table 8.8. Again the system is found to be critical at c ~ 1.217. While
the current calculation assumed the incident particle was absorbed at the
fission site, the coding could easily be modified to consider the case where
the incident particle survives the fission event. The matrix method uses very
little computational time and can give accurate results, as in this example.
However, since this method has systematic errors not included in the
variance calculation, it is difficult to estimate the actual variance.

Table 8.21. Results of Matrix Method k as a Function of c


c k cr
1.0 0.8216 0.0032
1.1 0.9037 0.0035
1.2 0.9859 0.0038
1.3 1.0680 0.0042
1.4 1.1502 0.0045
1.5 1.2332 0.0048

8.4 Combination of Generation and Matrix Methods

One possible source of systematic error in the matrix criticality


calculation of Example 8.2 is the use of a flat source distribution for
calculating the matrix elements. We know that the effect of the flat flux
source can be reduced by increasing the number of regions, but this is a
relatively inefficient way to improve the result because the run time of the
calculation will vary approximately linearly with the number of regions. It
might be more efficient to try to improve the result by making the source
distribution in the regions already selected as close as possible to the
fundamental-mode fission distribution.
8. Nuclear Criticality Calculations with Monte Carlo 251

The use of generations, in which the source in each generation is based


on the fission distribution produced in the previous generation, will
eventually produce a fundamental-mode fission distribution for any initial
source guess. If we could define the source in each region of a matrix
calculation on the basis of the fission distribution calculated using the
generation method we should be able to eliminate any systematic error in the
matrix result produced by use of an incorrect source distribution. This
might also allow us to reduce the number of matrix regions without reducing
the accuracy of the result.
It is relatively easy to combine the generation and matrix methods. The
potential value from such a combination is twofold: by using the
fundamental mode fission distribution from the generation method we
eliminate the systematic error introduced by an incorrect source distribution;
and by calculating a fission matrix in a generation calculation we can gain
confidence that all important regions of phase space have been adequately
sampled. That is, by waiting several generations before scoring entries in
the 'aij' array the user can be confident that the source distribution is
essentially that of the fundamental mode of the system; and if the elements
in aij are non-zero, and the uncertainties associated with these elements are
reasonable, the user can have increased confidence that an acceptable
number of fissions has been achieved in each of the regions of the problem.

Example 8.3. Multi-generation matrix calculation

We wish to repeat the calculations of Examples 8.1 and 8.2 by


combining the methods used in those examples into one calculation. We
will do this by maintaining the generation method changes to PFC discussed
in Example 8.1, including the total subsequent population method for
estimating k, and adding the matrix changes of Example 8.2. The latter will
be done such that we will obtain an estimate of the matrix aij from each
generation, which we will call the "matrix-by-generation" method, as well
as the standard matrix estimate for the total population. All calculations will
assume a value of ten for 'ntransient' such that no scores will be made with
either method until ten generations have been tracked.
The list of subroutines to be used in this calculation is shown in Table
8.22. The geometry description and cross section information are the same
as those used in Example 8.1. Subroutine 'Walk,' shown in Table 8.23, is
similar to the version used for Example 8.1. The difference is that the
common block 'in' has been modified to allow additional input parameters
for the matrix calculations.
252 Chapter 8

Table B.22. Modified Subroutmes {;or Example


I 83
.
Subroutine Location
'Walk' Table 8.23
'Input' Table 8.24
'Source' Table 8.25
'Col' Table 8.26
'Stats' Table 8.27
'kef!' Table 8.28

Table B.23. Subroutine 'Walk' for Example 8.3


SUBR:UI'INE WAIl< 1
(XlKN/IN/npart, nbatch, ru:egicns, iter
REAL (8) dnfp,citr,xsec,dcur 3
(XlKNtrAACK/dnfp, dtr, xsec, dcur 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ! 5
(XlKN/~ART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
ntransient=10
CALL SCl.lOCE ! get source pararreters for initial bank
Locp Oller Batches: IX) j=I,nbatch+ntransient
- IF<].EJ;l. ntransient+l)CALL Statcne ! re-initializes statistics arrays
CALL SOOFC2
Locp Oller Particles : IX) i=l,npart locp over nUlber of particles 7
- C7\IL Statlp initialize statistics for each particle 8
CALL saJR:;3 (i)
Locp for COllisicns: IX) to find collisicn sites 10
CALL- DIsr get distana:! of travel in mfp 11
Locp Track: IX) track particle to collisicn point 12
CALL HIT get distana:! to boondary of current zcne 13
CALL MXSEl: get total cross secticn for current zcne 14
IF( (dtr-dcur) *xsec.GE:.dnfp) EXIT Locp Track ! collisicn before boondary 15
CALL BOO){ ! process boondary crossing 16
IF(nzcur.EJ;l.-I) EXIT Locp_for_COllisicns ! particle killed e .g., by escaping 17
END IX) Locp Track ! 18
CALL OOL - ! call col to process collisicn 19
IF(nzcur.EJ;l.-l) ElaT Locp for COllisicns ! particle killed by collisicn 20
END IX) Locp for COllisicns - - ! 21
CALL StatEIP process statistics when particle killed 22
END IX) Locp Oller Particles ! 23
IF(j.Gr.ntransient)CALL StatEBatch process statistics when particle killed
END IX) Locp Oller Batches
~ - 24
END 25

Subroutine 'Input,' shown in Table 8.24, allows for input of both batch
data and the matrix calculation data. The number of regions for this
example has been set to 15 by this subroutine. Subroutine 'Source' is
shown in Table 8.25. This subroutine uses what would be 20 equal-radial-
width regions and collapses them into 15 regions. The five smallest of the
20 regions are put into the first of the 15 regions. The next two are placed in
the second region of the 15, and the remaining regions are unchanged. This
modification was made because the volumes of the inner regions in the set
of 20 are so small that the number of fissions occurring under a
fundamental-mode neutron distribution would be insufficient to obtain good
statistical results without greatly increasing the number of particles tracked
8. Nuclear Criticality Calculations with Monte Carlo 253

per generation. Even so, the bank size for the common 'bank' has been
increased from 20,000 to 200,000. This will allow us to increase the
number of particles tracked per generation versus the number of batches
used.

Table 8.24. Subroutine 'Input' for Example 8.3


SUBIDJI'INE INEUl' 1
o::MOI/IN/npart, nbatch, nregioos, iter
WRITE(*,10)
10 FI:H1P.T(' Enter the nLIlber of regioos. (m:IX of 20) ')
READ(*, *)nregioos
IF(nregioos . LE.0 .OR. nregioos.GT.20)nregians=20
ru:egians=15 ! fix the nlJlber of regioos
WRITE (16, *) ' Nuttler of regioos = ',nregioos
WRITE (*,11)
11 E1:!M\T (' Enter the nurber of natrix iteratioos. ')
READ(*,*)iter
WRITE (16, *)' Nuttler of natrix iteratioos = ',iter
WRITE(*,12) 3
12 E1:!M\T (' Enter the nurrber of particleslbatch. ')
READ(*, *)npart 5
WRITE (16, *) 'NI.Ilber of particleslbatch = ',npart
WRITE(*,14)
14 E1:!M\T(' Enter the nurt:ler of batches.')
READ(*,*)nbatch
WRITE (16, *) 'Nuttler of batches ',nbatch
WRITE(*,13) 7
13 E1:!M\T (' Enter the randan nurber seed, an integer. ') 8
READ(*,*)iseed 9
IF(iseed.LT.l)iseed=1 10
IF(iseed.GE. 2147483647)iseed=2147483646 11
WRITE (16, *)' Starting randan nurrber seed is ',iseed 12
CALL rndin (iseed) 13
RElURN 15
am 16

Subroutine 'Col,' shown in Table 8.26, provides for scoring the matrix
values at each collision. This version of 'Col' assumes that all neutrons
experiencing collisions are absorbed and that all secondary neutrons are in
the next generation. Two matrices are used for scoring the matrix method in
this example. The first matrix, 'aij,' is used to tally scores for all neutrons,
as was done in Example 8.2. The second matrix, ' bij,' is used to tally scores
for neutrons on a batch basis. This will permit a matrix calculation of k for
each batch. Subroutine 'Col' also tallies scores for the generation and the
total subsequent population methods.
Subroutine 'Stats,' shown in Table 8.27, calculates the results for the
four different methods of determining k. Subroutine 'keff,' shown in Table
8.28, is similar to that used in Example 8.2. The primary difference is that
data are passed in the subroutine call rather than in a common block. This
change is made so that the subroutine can be used to process both the 'aij'
and the 'bij' matrix data received from 'Stats.' The common block 'in' is
also modified to account for both batch and matrix input data.
254 Chapter 8

Table 8.25. Subroutine 'Source' for Example 8.3


SUBroJl'INE SCXlOCE 1
REAL (8) FLTRN,rl,r2,trnp,radius
roM:N/IN/npart, nbatch, nregioos, iter
REAL (8) x, y, z, u, v, w,xo, yo, zo, uo, vo,w::>,wate, age,energ 2
roM:N/PART/x,y, z,u,v,w, xo, yo, zo,uo,vo,w::>,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),~(20),rpxmax(20),&
Ipyrnin(20) , Ipytll3X(20) , Ipzmin(20) , Ipzmax(20) ,bdin(40) ,bdout(40)
lffiICAL bdtest(40), bdhit(40)
roM:N/cg/sphcx, sphcy, sphcz, sphr, ~, rpxmax, Ipyrnin, Ipytll3X, Ipzmin, Ipzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
REAL (8) sigt(20),c(20)
roM:N/G&M/sigt,c ! sigt is total cross sectioo, c is noo-absoIptioo prcbability
REAL (8) xbank(200000,2),ybank(200000,2),zbank(200000,2),wbank(200000)
roM:N/BANK/xbank, ybank, zbank, wbank, nsave
REAL (8) bscore,bsunsq,cscore(2) ,cst.ITBq(2) ,aij (20,20) , aijsq(20, 20) , &
bij(20,20),bijsq(20,20),outrad
roM:N/S'mTIbscore, bsunsq, cscore, csursq, aij, aijsq, &
bij,bijsq,outrad,nstart(20),nbstart(20)
roM:N!EXAMPLElInreg, lreg (20)
~ lreg/l,1,1,1,1,2,2,3,4,5,6,7,8,9,10,11,12,13,14,15/
pi=2.OdO*I:WXS(0.0d0) ! keep for rrore a:nplicated source that needs pi 4
IX) 100 i=l,npart
xbank(i,2)=O.OdO; ybank(i,2)=O.OdO
50 r1=FLTRN () ; r2=2. 5dO*FLTRN () max of 4*r*Sin(pi*r) is about 2.32
trrp=4. OdO*r1*C6IN (pi *r1) select using rejectioo
IF(trnp.LT.r2)GOTO 50
zbank(i,2)=r1*sphr(1); wbank(i)=l.OdO
100 CXNl'INUE
nsave=npart ; RElURN
ENl'RY s:xJIC2
initial=npart; npart=O
IX)200 i=l,nsave
150 CXNl'INUE
IF(wbank(i) .GE:. 1.OdO)THEN
npart=npart+1
xbank(npart,1)=xbank(i,2);ybank(npart,1)=ybank(i,2);zbank(npart,1)=zbank(i,2)
wbank(i)=wbank(i)-l.OdO ; GOTO 150
ELSE
IF(wbank(i) .GE:.FLTRN())THEN
npart=npart+1
xbank(npart,1)=xbank(i,2);ybank(npart,1)=ybank(i,2);zbank(npart,1)=zbank(i,2)
ENDIF
ENDIF
200 CXNl'INUE
IF(npart.GI'.initial)npart=initial ! keeps particle nl.mDers fran increasing
nsave=O
IF (npart.I.E.O) THEN
write (*, *)' '!he n1.llber of particles decreased to zero. ' ; STOP
ENDIF
IF (npart. LT . initial) THEN ! keeps particle nl.mDers fran decreasing
ntatp=initial-npart
IX) i=l,ntatp
npart=npart+1
xbank(npart,l)=xbank(i,l);ybank(npart,l)=ybank(i,l);zbank(npart,l)=zbank(i,l)
ENIlXl
ENDIF
RElURN
ENIRY SCXJR::3 (n)
x=xbank(n,l); y=ybank(n,l);z=zbank(n,l)
radius=~(x*x+y*y+z*z) ! radius of source point
nreg=INl' (radius*FI.CM (20) /outrad) +1; nreg=lreg (nreg)
nstart (nreg) =nstart (nreg) +1; nbstart (nreg) =nbstart (nreg) +1
nzcur=l; wate=l .OdO
CALL ISCXlJl' ! directioo chosen isotrq:>ically 7
RElURN ; END
8. Nuclear Criticality Calculations with Monte Carlo 255

Table 8.26. Subroutine 'Col' for Example 8.3


SlJBIOJI'INE CXlL 1
RE!U.(8) EL'lm,delta 2
RE!U.(8) x,y,z,u,v,w,xo,}'O,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/EART/x,y,z,u,v,w,xo,}'O,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
RE!U. (8) d:!Ifp, dtr, xsec, d::ur ! 5
OOMMON/TRACK/d:!Ifp, dtr, xsec, d::ur 6
RE!U.(8) sigt(20),c(20); ! diIrensioos all~ up to 20 different rredia 7
OOMMON/GaM/sigt,c; !sigt is total cross sectioo, c is noo-absoIptioo prd:> 8
RE!U. (8) bscore,bstmsq, csoore (2) , CS1.II5q(2) , aij (20,20) , aijsq(20,20) , &
bij(20,20),bijsq(20,20),outrad
OOMMON/~ /bscore, bsuI5q, csoore, CS1.II5q, aij, aijsq, &
bij,bijsq,outrad,nstart(20),nbstart(20)
OOMMON/IN/q:lart, nbatch, nregioos, iter
OOMMONIE»MPLEl/nreg,lreg (20)
RE!U.(8) radius
RE!U.(8) xbank(200000,2),ybank(200000,2),zbank(200000,2),Wbank(200000)
OOMMON/BANKIxbank, ybank, zbank, Wbank, nsave
delta=ctnfp/xsec ! distana:! travelled to collisioo 9
dtl:=dc:ur-+<lelta ! update total distance travelled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! update positioo 11
radi~(x*x+y*y+z*z) ! radius of collisioo point
index=INr (radius*ru:m (nregioos) /outrad) +1; index=lreg (:imex)
index=INr (radius*ru:m (20) /outrad) +1; index=lreg (:imex)
aij(nreg,:imex)=aij(nreg,:imex)+c(nzcur) ! scores all outgoing neutroos
aijsq (nreg, :imex) =aijsq (nreg, :imex) +c (nzcur) **2
bij (nreg,:imex)=bij (nreg,:imex)+c(nzcur) ! scores all outgoing neutroos
bijsq(nreg,:imex)=bijsq(nreg,:imex)+C(nzcur) **2
nsave=nsave+1 ! bank a fissioo
xbank (nsave, 2) =x x-positioo for fissioo
ybank(nsave,2)=y y-positioo for fissioo
zbank(nsave,2)=z z-positioo for fissioo
Wbank(nsave)=c(nzcur) weight of fissioo particle
csoore (1) =cscore (1) +c (nzcur)
csumsq(I)~(I)+c(nzcur)**2
nzcur=-1 all incani.ng neutroos are absoIbed
REruP.N 21
END 22

The results of two calculations using a value of c = 1.217 are shown in


Table 8.29. The same number of particles are used in both calculations.
The first case shown uses 500 batches of 18,000 particles each (not
including the ten batches needed to reach the fundamental flux distribution;
i.e., 'ntransient' = 10.) The second case uses 50 batches of 180,000
particles each, again with 'ntransient' = 10. The uncertainties for both the
ratio of generations and matrix-by-generation methods are reduced when
more batches are used, even though the number of particles used in the two
calculations is the same. The uncertainty changes only slightly when the
number of batches is changed for both the total subsequent population
results and the standard matrix results. Further, as noted in the previous
section, the standard deviations calculated for the standard matrix results are
overestimated. We expect that the latter should be at least comparable to
those estimated using the matrix-by-generation method.
256 Chapter 8

Table B.27. Subroutine 'Stats' for Example 8.3


SUBFOJI'INE stats 1
BEAL(8) bsoore,bsumsq,csoore(2),csumsq(2),aij(20,20),aijsq(20,20),&
bij(20,20),bijsq(20,20),outrad
o::::MCN/STAT/bsoore, bs1.msq, csoore, csumsq, ai j, aij sq, &
bij,bijsq,outrad,nstart(20),nbstart(20)
o::::MCN/IN/npart, nbatcn, nregioos, iter
BEAL(8) xbank(200000,2),ybank(200000,2),zbank(200000,2),Wbank(200000)
o::::MCN/BANK/xbank, ybank, zbank, Wbank, nsave
BEAL(8) tmp,tmp1,tmp2,var,stdev,xkeff
BEAL(8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&
rpymin(20),rpymax(20),rpzmin(20),rpzmax(20),bdin(40),bdout(40)
LOGICAL bdtest(40), bdhit(40)
o::::MCN/cg/S]:t!cK, sphcy, sphcz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzanes,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
EN.l'RY Statcne ! entry point to initialize arrays for o::nplete prcblan 8
bscore=().OdO; bsunscrO.OdO; csoore=().OdO; csUl5Cf"O.OdO; outrad=sphr(l)
aij=O.OdO; aijsq=O.OdO; nstart=O; bij=O.OdO; bijsq=O.OdO; nbstart=O
REnm 10
EN.l'RY StaUp entry point to initialize arrays for a particle 11
REnm ! 13
EN.l'RY StatEIp entry point to store scores for a particle 14
REnm 19
EN.l'RY StatEBatcn !entry point to store scores after eacn batch
tmp1=D~(npart); tmp2=O.dO
ro 100 i=l,nsave
tmp2=tmp2Mlank (i)
100 CCNI'INUE
tmp=tmp2/tmp1; bsoore=bscore+tmp; bsursq=bsunsq+tmp**2
ro i=l,nregioos
tnp=D~ (nbstart (i) )
ro j=l,nregioos
var=bijsq(i,j)/tmp-(bij(i,j)/tmp)**2
bij (i,j)=bij (i,j)/tmp
bijsq(i,j)=var/tmp
END ro
END ro
CALL keff(bij,bijsq,xkeff,var)
csoore(2)=csoore(2)+xkeff; csumsq(2)~(2)+xkeff**2
bij=O.OdO; bijsq=O.OdO; nbstart=O
REnm
EN1'RY StatEn! ! entry point to calculate and print results 20
tnp=D~ (nbatcn)
var=bstmsq/tmp- (bsoore/tmp) **2; stdev=r:so:u (var)
WRITE (16, *) bsoore/tmp, stdevIr:so:u (tmp)
tnp=~(nbatch) *D~(npart)
~(1) /tmp- (csoore (1) /tmp) **2; stdev--r:scro'(var)
WRITE(16,*)csoore(1)/tmp,stdev/r:so:u(tmp)
~(nbatcn)
var=cstIl5q (2)/tmp- (csoore (2) /tmp) **2; s~ (var)
WRITE (16, *) csoore (2) /tmp, stdevlr:so:u (tmp)
ro i=l,nregioos
tnp=D~(nstart(i) )
ro j=l,nregioos
var--aijsq(i,j)/tmp-(aij(i,j)/tmp)**2
aij (i,j)=aij (i,j)/tmp
aijsq(i,j)=var/tmp
END ro
END ro
CALL keff(aij,aijsq,xkeff,var)
WRITE (16, 200) xkeff, r:so:u(var)
200 Fl:R11IT(' k-eff = " 1pe17 .8,' +- " 1pe17 .8)
WRITE(16,*) (nstart(i),i=l,nregioos)
REnm 28
END 29
8. Nuclear Criticality Calculations with Monte Carlo 257

Table 8.28. Subroutine 'keff for Example 8.3


SUBIOJI'INE keff(aij,aijsq,xk,xke) Iterate matrix for criticality
REAL(S) aij(20,20),aijsq(20,20)
c::oMN/IN/npart, nbatch, nregicns, iter
REAL(S) s(20),sprime(20),delta(20),xk,xke
s=1.0; delta=1.0
Locp Oller Iteraticns: IX) n=l,iter ! begin iteraticn
Xk = o.
IX)1 i = l,nregicns
xk = xk + sCi)
1 CXNI'INUE
IX)2 i = l,nregicns
sCi) = s(i)/xk normalize s
2 CCNI'INUE
calrnlate sprime
IX) 3 i = l,nregicns
sprime(i) = O.
delta (i) = O.
IX) 3 j = 1, nregicns
delta (i) = delta(i)+aijsq(i,j)*s(j)**2
sprime(i) = sprime(i)+s(j)*aij(i,j)
3 CCNI'INUE
IX) 4 i = l,nregicns
sCi) = sprime(i)
4 CXNI'INUE
END IX) Locp Oller Iteraticns
xk = 0.- -
xke = O.
IX) 5 i = l,nregicns
xke = xke+delta(i)
xk = xk + sCi)
5 CXNI'INUE

Table 829
. Resu Its f;or ExampJe
I 83. ,c= 1217
.
500 Batches of 18000 50 Batches of 180000
Neutrons Neutrons
Ratio of Generations 0.999329 ± 0.0001626 0.998928 ± 0.0001649
Total Subsequent Population 0.999329 ± 0.0001555 0.998928 ± 0.0001556
Matrix by Generation 0.999346 ± 0.0001674 0.998867 ± 0.0001725
Standard Matrix 0.999263 ± 0.0004010* 0.998859 ± 0.0004014*
* Results for standard deviation are approximate and are shown here to be high.

It has been shown in the literature that the matrix method can be used to
accelerate the convergence of an initial flux distribution to the fundamental
mode.6 As noted, the iteration that produces a criticality estimate using the
~j matrix also provides an estimate for the source distribution by region.
One can use this estimate of the source distribution, obtained from the first
generation of a matrix-by-generation calculation, as the source for the
second generation. If this process is repeated for several generations,
convergence to the fundamental mode can be achieved faster than using the
generation method alone.
258 Chapter 8

8.5 Criticality Calculations Using Multigroup Cross Sections

In a fissile assembly neutrons are born with a fission energy spectrum,


undergo scattering collisions that typically reduce their energy, and are
eventually either absorbed or leak from the system. A realistic criticality
calculation thus must account for the energy dependence of the neutrons as
well as their movement through the system. The previous examples
considered only monoenergetic particles. While it would be relatively
straightforward to add the simple neutron energy down scatter model of
Chapter 4 to the previous examples, it is also possible to use multigroup
cross sections to account for energy dependence. The latter can provide a
simple and accurate means of using PFC to perform calculations on realistic
systems, specifically including criticality calculations.
Nuclear fission by neutrons is described by the fission cross section, ~f,
which is equal to the probability per unit path length that a neutron will
suffer a fission interaction with the nuclei of the medium through which it is
traveling. Each fission event results in the production of some number of
secondary neutrons, depending on the energy of the incident neutron and the
isotope struck. The fission neutron production rate can be expressed as a
probability density function having an average of v secondary neutrons per
fission. The product V~f, which is equal to the probability of production of
a fission neutron per unit path length, is frequently used instead of the two
factors separately to calculate the fission neutron source in a multiplying
assembly. Monte Carlo random walks can use the fission cross section and
the fission neutron production either separately or combined.
An important set of cross sections designed for calculating multiplication
eigenvalues of fast and intermediate critical assemblies was developed by
Hansen and Roach at Los Alamos. These cross sections, consisting of 6-
and 16-group sets, were first published in 1960. 7 They have been validated
many times against experimental data for fast critical assemblies and
provide accurate results for a wide range of mUltiplying systems. To
demonstrate the use of multigroup cross sections in Monte Carlo criticality
calculations we will make use of the 16-group data from the references
cited. The group energy bounds, neutron velocities and fission spectrum for
these 16 groups are shown in Table 8.30. Note that the groups are in
descending order of energy; i.e., the lower the group number the higher the
energy. The fission spectrum is normalized such that Xg is equal to the
probability of a fission neutron being born in energy group g. The velocities
are spectral-averaged values.
8. Nuclear Criticality Calculations with Monte Carlo 259

Table 8.30. EnerSQ' Bounds flor 16-Groul Hansen-Roaeheross SeetlOns


Group Energy Range Velocity Xi
108 em/sec
I 3 - OC) (MeV) 28.5 0.204
2 1.4-3 19.9 0.344
3 0.9 - 1.4 14.7 0.168
4 0.4 - 0.9 11.0 0.18
5 0.1 - 0.4 6.70 0.09
6 17 - 100 (keV) 2.70 0.014
7 3 - 17 1.14 0
8 0.55 - 3 0.480 0
9 100 - 550 (eV) 0.206 0
10 30 - 100 0.101 0
11 10 - 30 5.66E-2 0
12 3 - 10 3.19E-2 0
13 1- 3 I. 79E-2 0
14 0.4 - 1 1.09E-2 0
15 0.1 - 0.4 6.06E-3 0
16 Thennal 2.18E-3 0

Example 8.4. Critical mass ofthe Godiva assembly

We wish to calculate the critical mass of the Godiva fast critical


assembly. This assembly consists of unmoderated, solid uranium metal
enriched to approximately 93.86% 235U.8 The metal has a density of about
18.80 g/cm 3 • Although the assembly is not precisely spherical, and
corrections for impurities are required in order to obtain the equivalent
geometry for pure uranium, on the basis of Godiva measurements a prompt
critical sphere of the above specified pure uranium has been determined to
have a radius of about 8.705 cm, which corresponds to a critical mass of
51.94 kg.
To calculate the effective neutron multiplication k for a spherical
assembly of uranium at the Godiva density and enrichment we will use the
Hansen-Roach 16-group cross sections for 235U and 238U. These cross
sections are reproduced in Tables 8.31 and 8.32. In the tables the absence of
an entry indicates a zero. The microscopic cross sections are given in the
traditional units of barns, where a bam is equal to 10.24 cm2• The absorption
cross section, or the cross section for a neutron-gamma reaction, is
designated by a n•y• The total cross sections in these data sets have been
260 Chapter 8

Toable 831 I6-Group 23Su Cross S ' 0 ata


ectlOn
i Or °av °tr VOr O '-+i 0° i+I 0 0-+i+2 00-+i+3 OO-+i+4 Oi-+i+5
I 1.21 0.05 4.25 3.557 1.2 0.27 0.37 0.65 0.44 0.06
2 1.22 0.08 4.5 3.196 1.77 0.24 0.67 0.45 0.07
3 1.22 0.11 4.65 3.087 2.3 0.55 0.4 0.07
4 1.2 0.15 5.2 2.988 3.42 0.35 0.08
5 1.43 0.23 7.9 3.518 6.16 0.08
6 2.5 0.65 12.4 6.125 9.2 0.05
7 4.2 1.3 15.1 10.29 9.55 0.05
8 7.9 3.2 21.1 19.36 9.95 0.05
9 18.7 8.5 37.2 45.815 9.95 0.05
10 38 20 68 93.1 9.95 0.05
II 55 35 100 134.75 9.95 0.05
12 44 40 94 107.8 9.95 0.05
13 30 9 49 73 .5 9.95 0.05
14 70 10 90 171.5 9.95 0.05
15 185 39 234 453.25 9.96 0.04
16 516 95 621 1264.2 10

Toable 832 16-Group 238u Cross S ' 0 ata


ectlOn
i Or On.v Otr VOr 0° ....i 0 °-+°+ 00-+i+2 0°-+°+3 Oi-+°+4 0;-+°+5
I 0.616 0.02 4 1.725 1.254 0.33 0.46 0.79 0.53 0.07
2 0.485 0.05 4.4 1.213 1.825 0.35 0.96 0.64 0.09
3 0.044 0.1 4.5 0.108 2.906 0.8 0.55 0.1
4 0 0.14 5.25 0 4.53 0.5 0.08
5 0 0.16 8.2 0 7.96 0.08
6 0 0.45 12 0 11.45 0.1
7 0 0.7 14 0 13.24 0.06
8 0 2 15 0 12.94 0.06
9 0 II 22 0 10.95 0.05
10 0 50 59 0 8.94 0.06
II 0 56 65 0 8.94 0.06
12 0 110 119 0 8.94 0.06
13 0 0.4 9.4 0 8.94 0.06
14 0 0.55 9.55 0 8.94 0.06
15 0 I 10 0 8.95 0.05
16 0 2.44 11.44 0 9

transport corrected and are designated by atr. b Finally, the cross section for
scattering from group i to group j is given by ai-4j. For the uranium
isotopes used in this calculation, within-group scattering is always possible
(ai-4i *- 0) but up scatter is not (ai-4j = 0 for j < i.) All scattering is assumed to
be isotropic in the laboratory coordinate system. Again, the components

b The transport-corrected cross section is equal to the total cross section less the product of
the scatter cross section and the average cosine of the scattering angle for the material and
neutron energy of interest. See G. I. Bell and S. Glasstone, Nuclear Reactor Theory, Van
Nostrand Reinhold, New York, 1970, p 104.
8. Nuclear Criticality Calculations with Monte Carlo 261

must be "mixed" to obtain effective cross sections for the mixture. The
number density of uranium atoms at 18.80 glcm3 and 93.86% 235U is
approximately 0.04815 x 1024 atoms/cm3 •
The program in Table 8.33 was written to process the microscopic cross
sections into a macroscopic set to be used by PFC. This cross-section-
mixing program is not an essential part of the example calculation and the
mixing could have been done by a number of methods, including hand
calculation. It is included here to demonstrate how the cross sections were
prepared for input to the modified version of PFC discussed below.
Specifically the absorption, fission, and scatter cross sections have been cast
into the form of cumulative probability distributions from which PFC will
select an outcome from a neutron collision. The energy down scatter matrix
has likewise been converted into a cumulative probability distribution from
which a post-collision energy can be obtained.
The code in Table 8.33 reads the cross section data from a file called
'cross.txt. ' The contents of the file consist of the group velocities and
fission spectrum given in Table 8.30, followed by the specific cross section
data for 235U and 238U. These latter data are read by group in the order of
group number as listed in Tables 8.31 and 8.32. That is, in the
'loop_over_elements' and 'loop_over_groups' the code sequentially reads
the rows of these tables. Thus the data in these tables must be prepared in
the proper order and placed in the file ' cross.txt. ' After mixing and
summing the data for 235U and 238U the code calculates the cumulative
probability distributions for the fission spectrum, 'gpnu.' It also
calculates the probability of fission, 'pfis,' of absorption without fission,
' pabs,' and of scatter, 'pscat.' The normalized down scatter matrix Li~j is
then converted into a cumulative probability distribution and stored in the
array 'pggscat. ' The total macroscopic cross section for each energy group,
in units of cm- I , is stored in the array 'sigt' for use in determining neutron
flight paths. The processed data are stored in a file called 'mixed.txt' which
will be read by PFC.
The geometry input file ' geom.txt' for Example 8.4 is given in Table
8.34. The radius of sphere 1 will be varied to determine the critical radius
of the system. The list of the modified subroutines to be used to perform the
Godiva criticality calculation is given in Table 8.35. Both the generation
and the total subsequent popUlation methods will be used to determine the
system multiplication. The changes in the subroutines arise primarily from
the use of a multi-group cross section set and the need to account for
processes other than fission that can occur at collisions.
262 Chapter 8

Table 8.33. Program to Mix Cross Sections for Example 8.4


REAL (8) sigt(8,20),c(8,20),pscat(8,20),pabs(8,20),&
pfis(8,20),gpnu(8,20),pggscat(8,20,20),vel(20),chi(20),a,b,d,s
OPEN (UNIT=lO, FII.E='COCSS. TXT'); OPEN (UNIT=12, FII.E='MIXEIl. TXT')
nerggp=16; pggscat=O.OdO
READ (10, *) (vel (i) ,i=l,nerggp); READ (10, *) (chi (i) ,i=l,nerggp)
IDcp Over Elarents: ro llF1,2
I.oCP oier Groops: ro i=l,nerggp
READ (10, *)n,pfis(m,i) ,pabs (m,i) , sigt (m, i) ,gpnu(m,i), &
(pggscat (m, i, j) , j=i, nerggp)
END ro IDcp Over Groups
END ro IDcp c:Ner Elarents
a=O.9386d0; ~.0614dO; d=O.04815d0 mix 93.86% u-235 and 6.14% u-238
ro 200 i=l,nerggp
ro 190 j=l,nerggp
pggscat(1,i,j)=a*d*pggscat(1,i,j)+b*d*pggscat(2,i,j)
190 CXNI'INUE
pfis (l,i)=a*d*Pfis (1, i)+b*d*pfis (2, i)
pabs (1, i)=a*d*pabs (l,i)+b*d*pabs (2,i)
sigt (1, i)=a*d*sigt (1, i) +b*d*sigt (2, i)
gpnu(l, i) =a*d*gpnu (1, i) +b*d*gpnu (2, i)
200 CXNI'INUE
TIle inplt data used for gpnu is nu*sigf, pfis is sigf, need to calc gpnu
ro 250 i=l,nerggp
gpnu(1,i)=gpnu(1,i)/pfis(1,i) gpnu=nu*sigf/sigf
pfis(1,i)=pfis(1,i)/sigt(1,i) get prcb of fissicn
pabs(l,i)=pabs (l,i)/sigt (l,i) get prcb of absorptioo w/o fissicn
pscat(l,i)=l.OdO-pabs (l,i)-pfis (l,i) all other prcb is scatter
s=O.OdO
ro 230 j=l,nerggp
5=s+pggscat(l,i,j) get nomalizaticn factor
230 CXNI'INUE
ro 240 j=l,nerggp
pggscat(1,i,j)9P99scat (1,i,j)/s normalize 50 sum is cne
240 CXNI'INUE
pggscat(1,i,nerggp)=1.OdO
ro 245 j=2,nerggp-1
pggscat(1,i,j)=pggscat(1,i,j-1)+pggscat(1,i,j) need cumrulative prd:>
245 CXNI'INUE
250 CXNI'INUE
s=O.OdO
ro 260 i=l,nerggp
5=stdU.(i) get nomalizaticn factor
260 CXNI'INUE
ro 270 i=l,nerggp
chi(i)=chi(i)/s nomalize 50 S\.Jll is cne
270 CXNI'INUE
chi (nerggp)=l.OdO
ro 280 i=2,nerggp-1
chi (i) =chi (i-1) +chi (i) get ClIlIlLIlative prcb.
280 CXNI'INUE
WRITE (12, *) nerggp ootplt mixed. txt
ro 300 i=l,nerggp
WRITE (12, *)sigt(l,i) ,pscat(l,i),pabs (l,i) ,pfis (l,i) ,9txlU(1,i)
ro 300 j=l,nerggp
WRITE(12,*)pggscat(1,i,j)
300 CXNI'INUE
ro 350 i=l,nerggp
WRITE(12,*)vel(i),chi(i)
350 CXNI'INUE
STOI?; END
8. Nuclear Criticality Calculations with Monte Carlo 263

Table 8.34. Geometry DescriPtion for Example 8.4


o There are no RPPs
I There is I sphere
0.0,0.0,0.0,8.76 center coordinates and radius-sphl
2 There are 2 zones
I, I Zone I has one body, I
I, -I Zone 2 has one body, -I

Table 8.35. Modified SubroutInes fior Example


I 84
Subroutine Location
'Walk' Table 8.3
' Input' Table 8.7
'Stats' Table 8.11
'Source' Table 8.36
'Col' Table 8.37
' Xsects' Table 8.38
'Mxsec' Table 8.39

Subroutines 'Walk' and 'Input' are identical to those used in Example


8.1. Subroutine 'Stats' is identical to that used in Example 8.2. The
modified subroutine 'Source' is shown in Table 8.36. The changes in this
subroutine, compared with the version used in Example 8.1, consist of
storing the cross section data in common 'geom,' and changes to the entry
point 'sourc3.' The latter now selects an initial energy group from the
Hansen-Roach fission spectrum for particles selected from the fission bank.
The modified subroutine 'Col' is shown in Table 8.37. At each collision
site this subroutine determines whether a fission event has occurred by using
the probabilities 'pfis,' 'pabs,' and 'pscat.' If a fission occurs, a fission
event is entered into the bank to be tracked in the next generation; i.e., by
determining fissions on the basis of Lf instead of VLf exactly v fission
neutrons will be produced per "fission" interaction. In this formulation the
incident particle is not killed. Instead it leaves the collision point
isotropically with a weight equal to the incoming particle weight times the
probability of scattering. The post-collision particle is subjected to Russian
roulette and, if it survives, the outgoing energy of the scattered particle is
found based on the group-to-group scattering probabilities. Because this
example is relatively simple, it is not expected that the variance of the result
will be affected to any great extent by the use of survival biasing and
Russian roulette. These techniques could probably be removed without
detriment to the efficiency of the calculation.
264 Chapter 8

Table 8.36. Subroutine 'Source' for Example 8.4


1
REAL (8) FLTRN,r1,r2,tmp
CXMOJ/IN/rq:art, nbatdl
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
CXMOJ/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) sphcK(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&
rpymin(20), rpymax (20) , rpzmin (20) , rpZlll3X(20) ,bdin(40) ,lxIout (40)
r.a:;rC'AL bdtest (40), bdhit (40) .
CXMOJ/cg/sphcK, sphcy, S!ilcz, sphr, rpxmin, rpxmax, rpymin, rpyrrax, rpzmin, rpZlll3X, &
bdin,bdbut,nsph,nrpp,nbdy,nzones,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
REAL (8) xbank(20000,2),ybank(20000,2),zbank(20000,2),Wbank(20000)
CXMOJlBANK/xbank, ybank, zbank, Wbank, nsave
REAL (8) sigt(8,20),c(8,20),pscat(8,20),pabs(8,20),&
pfis(8,20),gpnu(8,20),pggscat(8,20,20),ve1(20),dli(20)
CXMOJ/GECM/sigt,c,pscat,pabs,pfis,gpnu,pggscat,ve1,dli,nerggp
00 100 i=l,rq:art
xbank(i,2)=O.OdO; ybank(i,2)=O.OdO; Wbank(i)=l.OdO
zbank(i, 2) =sphr (1) *FLTRN() ** (1. OdO/3 .0d0) ! use for flat soorce
100 CXNI'INUE
nsave=rq:art
RE:IUm
ENI'RY SOOFC2
initial=npart; rq:art=O
00 200 i=l,nsave
150 CXNI'INUE
IF(Wbank(i) .GE:.l.OdO)THEN
rq:art=npart+1
xbank (rq:art, 1) =xbank (i, 2); ybank (rq:art, 1) =ybank (i, 2); zbank (rq:art, 1) =zbank (i, 2)
Wbank(i)=Wbank(i)-l .OdO
ooro 150
EISE
IF(Wbank(i) .GE:.FLTRN(»THEN
rq:art=npart+1
xbank(rq:art,1)=xbank(i,2);ybank(rq:art,1)=ybank(i,2);zbank(rq:art,1)=zbank(i,2)
ENDIF
ENDIF
200 CCNl'INUE
IF(rq:art .Gl'.initial)rq:art=initial ! keeps particle nU!lbers fran increasing
nsave=O
IF (rq:art .IE.O) THEN
write (* , *)' 1he ntl!ber of particles decreased to zero.'
sroP
ENDIF
IF (rq:art. LT. initial) THEN ! keeps particle ntllbers fran decreasing
ntatp=initial-rq:art
00 i=1,nt6lp
rq:art=npart+1
xbank(rq:art,l)=xbank(i,l);ybank(rq:art,l)=ybank(i,l);zbank(rq:art,l)=zbank(i,l)
ENID)
ENDIF
RE:IUm
ENI'RY saJK:3 (n)
x=xbank(n,l); y=ybank(n,l); z=zbank(n,l)
nzcur=l; wate=l.OdO
r1=FLTRN()
00 300 i=l,nerggp
IF(rl.IE.dli (i»ooro 301
300 CXNI'INUE
301 ngroop=i
CALL IS<Xl1l' direction dlosen isotrcpically 7
RE:IUm 9
10
8. Nuclear Criticality Calculations with Monte Carlo 265

Table 8.37. Subroutine 'Col' for Example 8.4


SUBI01I'INE OOL 1
REAL (8) FLTRN,delta,r
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) ctnfp,dtr,xsec,dcur ! 5
OOMMON/TRACKIctnfp, dtr, xsec, dcur 6
REAL (8) sigt(8,20),c(8,20),pscat(8,20),pabs(8,20),&
pfis(8,20),gpnu(8,20),pggscat(8,20,20),vel(20),chi(20)
OOMMON/GEOM/sigt, c,pscat,pabs,pfis, gpnu, pggscat, vel, chi, nerggp
REAL (8) xbank(20000,2),ybank(20000,2),zbank(20000,2),Wbank(20000)
OOMMON/BANKIxbank, ybank, zbank, Wbank, nsave
REAL (8) bscore, bsumsq, cscore, csumsq, qJart
OOMMON/SI'AT/bscore, bsumsq, cscore, CSlm3q, qJart
delta=ctnfp/xsec ! distance travelled to collisicn 9
c:ltr=<:k:ur-+<lta ! update total distance travelled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! update positicn 11
IF(FLTRN().LE.pfis(nzcur,ngroup»THEN ! if fissicn
nsave=nsave+1 bank a fissicn
xbank(nsave,2)=x ! x-positicn for fissicn
ybank(nsave,2)=y ! y-positicn for fissicn
zbank(nsave,2)=z ! z-positicn for fissicn
Wbank(nsave)=wate*gpnu(nzcur,ngroop) ! weight of fissicn particle
cpart=cpartfwate*gpnu (nzcur, ngroop)
ENDIF
wate=wate*pscat(nzcur,ngroup) reduce wate by ncn-ab50rpticn
IF(wate.LT.0.1dO)THEN russian roulette to kill i f wate is small
IF (wate. LT . FLTRN () ) THEN killed by RR
nzcur=-l; REIURN
ENDIF
wate=l.OdO survived, set weight = 1
ENDIF
find new energy group
r=FLTRN()
CO 100 i=l,nerggp
IF(r.LT.pggscat(nzcur,ngroup,i»GOTO 101
100 CXNI'INUE
101 ngroup=i
CALL ISCOJI' assures i50trc:pic scatter in lab system 20
REIURN ! 21
END 22

Subroutine 'Xsects' is shown in Table 8.38. This subroutine is used to


read the cross sections from the file 'mixed.txt' generated by the program
shown in Table 8.33. The cross sections are stored in the arrays contained
in common 'geom.' Subroutine 'Mxsec' is shown in Table 8.39. This
subroutine is called by subroutine 'Walk' before a flight path is determined
in order to find the total cross section for a particle. The subroutine has
been modified to use the group-dependent value of'sigt' for all neutrons in
group 'ngroup.'
266 Chapter 8

Table 8.38. Subroutine 'Xsects' for Example 8.4


SUBKm'INE XSEcrS 1
REAL (8) sigt(8,20),c(8,20),pscat(8,20),pabs(8,20),&
pfis(8,20),gpnu(8,20),~t(8,20,20),vel(20),chi(20)
OOMMON/GEOM/sigt,c,pscat,pabs,pfis,gpnu,pggscat,vel,chi,nerggp
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpKmin(20),rpKmaX(20),& 4
rpymin(20) ,rpynex(20) ,rp:mlin(20) ,rpZllaX(20) ,txlin(40) ,bdout(40) 5
IffilCAL bdtest(40), bdhit(40) ! 6
OOMMON/ct:}/sphcx, sphcy, sphcz, sphr, rpKmin, rpKmaX, rpymin, rpym3X, rp:mlin, rpZllaX, & 7
txlin,bdout,nsph,nrpp,nbdy,nzanes,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit 8
OPEN(UNIT=12,FILEF'mixed.txt') ! '!he cross sections are in mixed.txt
READ(12,*)nerggp
The outside zane is a vacuum. particles reaching it have escaped. 10
DO 50 i=l,nzones-l
DO 50 j=l,nerggp
READ(12,*)sigt(i,j),pscat(i,j),pabs(i,j),pfis(i,j),gpnu(i,j)
DO 50 1<.=1, nerggp
READ(12,*)pggscat(i,j,k)
50 CXNI'INUE
DO 60 i=l,nerggp
READ(12,*)vel(i),chi(i)
60 CXNI'INUE
RE:IURN 16
am 17

Table 8.39. Subroutine 'Mxsec' for Example 8.4


SUBRaJrINE t«SEI:: 1
REAL (8) anfp,dtr,xsec,dcur 2
OOMMON/l'R1>CKIctnfp, dtr, xsec, dcur 3
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,v.u,wate,age,energ ! 4
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,v.u,wate,age,energ,nzcur,newzn,ngroup 5
REAL (8) sigt(8,20),c(8,20),pscat(8,20),pabs(8,20),&
pfis(8,20),gpnu(8,20),pggscat(8,20,20),vel(20),chi(20)
OOMMON/GEOM/sigt,c,pscat,pabs,pfis,gpnu,~t,vel,chi,nerggp
xsec=sigt (nzcur, ngroup)
RE:IURN 9
am 10

PFC, with the modified subroutines listed in Table 8.35, has been
executed repeatedly using the generation and total subsequent population
methods in order to estimate the effective neutron multiplication of bare,
enriched-uranium, Godiva-like spheres with radii from 8.0 to 9.5 cm. The
results of these criticality calculations are shown in Table 8.40 and Figure
8.3. All of the calculations used uniformly distributed first-generation
sources and 60 batches of 10,000 particles each ('nbatch' was set to 50 and
'ntransient' set to ten.) The results of the two calculations of k are in
excellent agreement for every system radius.
If we perform a linear regression on the results for r versus k in Table
8.40 we obtain as the best fit for the radius r(k) = 10.72 k - 1.96. This fit
predicts that the system will be prompt critical at a radius of 8.758 ± 0.025
cm, or a critical mass of 52.90 ± 0.45 kg. This calculated radius is 0.6 %
greater than the published radius while the calculated critical mass is 1.8 %
above the published value. Alternatively, if we assume k varies linearly
with radius over the range 8.5 to 8.75 cm, we obtain a critical radius of 8.74
8. Nuclear Criticality Calculations with Monte Carlo 267

± 0.02 cm. This corresponds to a critical mass of 52.58 ± 0.44 kg. These
latter values are closer to the published values than the linear regression
results that consider radii from 8.0 to 9.5 cm. Since the neutron
multiplication is not linear in radius, an improvement in the result can be
obtained by examining the region around 8.74 cm in greater detail than has
been done here.
Reference 8 provides two benchmarks for the Godiva assembly. The
calculations given here are ·for the idealized, pure metal benchmark. The
second benchmark reflects the actual Godiva composition. This second case
has a density of 18.74 glcm3, assumes 93.71 weight percent 235U, and has a
critical radius of 8.74 cm. Performing the example calculation on this
second configuration provides results that are also about 0.2% greater in
radius than the benchmark value. One of the reasons for the error in both
cases is that the benchmarks include about 1.02 weight percent 234U, which
is treated as 238U in these example calculations. The reactivity worth of
234U is slightly greater than that of 238U and the present results could be
improved by including 234U in the calculation.

Table 8.40. Effiectlve


. MI' r . Factors f;or GodIva-
u tlpncatlOn I e Assembrles
' rk
Radius (cm) k (generation) k (total subsequent
population)
8.0 0.928 ± 0.0024 0.928 ± 0.0020
8.25 0.952 ± 0.002 1 0.952 ± 0.0020
8.50 0.976 ± 0.0021 0.976 ± 0.0021
8.75 1.001 ± 0.0025 1.001 ± 0.0021
9.0 1.026 ± 0.0019 1.026 ± 0.0021
9.25 1.045 ± 0.0019 1.045 ± 0.0021
9.50 1.067 ± 0.0020 1.067 ± 0.0021

1.08 r---------------,

1.04

~ 1.00

0.96

0.92 ' - - - - - - - - - - ' - -.......- .......- -.....- - '


8 8.25 8.5 8.75 9 9.25 9.5
Radius (em)
Figure 8.3. Effective Neutron Multiplication for Godiva-Like Assemblies
268 Chapter 8

Exercises

I. Find the value of c for which two spheres of homogeneous fissile


material, each 5 mean free paths in diameter and separated by one-fifth their
diameter, would be exactly critical. Assume the neutrons are monoenergetic
and scattering is isotropic in the laboratory system. The spheres are
surrounded by void.

2. Find the critical radius and critical mass of fissile material for a
homogeneous sphere of 235U and water. Assume isotropic scatter in the
center of mass to account for neutron downscatter in the water and use the
Watt fission spectrum for fission neutrons. Assume a uranium density of
1.5 glcm3• Use the Hansen-Roach 16-group cross sections for 235U. Use the
subroutines 'Hydrogen' and 'Oxygen' from Table 4.10 for water. [Hint:
Assume mid-energy of each group for all uranium interactions, continuous
energy in water.]

3. Use the matrix method to calculate the effective neutron multiplication in


a system containing 235U spheres in water. Assume there are nine uranium
spheres, each 3 cm in diameter, placed on a rectangular grid with 5 cm
between the centers of the uranium spheres. The intervening space is filled
with water and the outer boundary of the system is 2 cm outside the
outermost uranium spheres. Assume pure 235U with a density of 18.80 gI
cm3 • Use the Exercise 2 cross section assumptions.

1 See G. I. Bell and S. Glasstone, Nuclear Reactor Theory, Van Nostrand Reinhold Co., New
York, 1970, pp. 37 ff. See also P. K. MacKeown, Stochastic Simulation in PhYSics,
Springer-Verlag, New York, 1997, pp. 320 if.
2 Bell and G1asstone, op..cit., p 9.
3 S. Glasstone and M. C. Edlund, The Elements ofNuclear Reactor Theory, D. Van Nostrand,
Princeton, NJ, 1952, pp. 292-93.
4 For an alternative fonnulation see L. L. Carter and N. 1. McConnick, "Source Convergence

in Monte Carlo Calculations," Nuc Sci Eng 36, 1969, pp. 438-41. See also M. H. Kalos, F.
R. Nakache, and 1. Celnik, "Monte Carlo Methods in Reactor Computations," Chapter 5 in
Computing Methods in Reactor PhysiCS, H. Greenspan, C. N. Kelber, and D. Okrent, eds.,
Gordon and Breach, New York, 1968, pp 420-21.
S Carter and McConnick, op. cit.
6 Ibid.

7 William H. Roach, "Computational Survey of Idealized Fast Breeder Reactors," Nuc Sci
Eng 8, 1960, pp. 621-51. See also Gordon E. Hansen and WilIiam H. Roach, "Six and
Sixteen Group Cross Sections for Fast and Intennediate Critical Assemblies," LAMS-2543,
Los Alamos Scientific Laboratory, Los Alamos, NM, 1961.
8 G. E. Hansen and H. C. Paxton, "Reevaluated Critical Specifications of Some Los Alamos
Fast-Neutron Systems," LA-4208, Los Alamos Scientific Laboratory, Los Alamos, NM,
1969.
Chapter 9
Advanced Applications of Monte Carlo

The range of specialized radiation transport problems that can be


analyzed using Monte Carlo methods is broad and extends well beyond the
rudiments developed in the preceding chapters. The purpose of this chapter
is to give the reader a brief introduction to some advanced radiation
transport applications of Monte Carlo. The literature is full of special
Monte Carlo techniques that allow users to attack sophisticated problems in
radiation analysis as well as other fields of science. and the reader is
referred to such literature for additional discussion of the topics treated in
this chapter and for information on other advanced concepts.

9.1 Correlated Sampling

Perturbation calculations constitute an important element of transport


analysis. The purpose of such calculations is to determine the effect of
small changes in the problem parameters on the solution to the problem.
Thus the sensitivity of a solution to uncertainties in such factors as cross
sections. material composition. geometry. source characteristics. and other
features can be examined and quantified. Such quantification allows the
analyst to identify those portions of a problem that must be specified to a
high degree of accuracy and those portions that may be approximated
without detriment to the solution.
Generally the change in an answer resulting from changes in an
independent variable selected for study are treated as linear over the range
of the perturbation. Therefore. perturbation calculations need to consider
changes in the independent variable that are as small as practicable. As a
result. the change in the answer between the baseline and the perturbed
problems should be small.

269
270 Chapter 9

In deterministic radiation transport methods, perturbation analysis is


relatively straightforward. To determine the sensitivity of the answer to the
uncertainty in a particular cross section of a certain material, say, one might
run several calculations in which the cross section is modified slightly from
the baseline, or most probable, value. The accuracy with which the changes
are determined will depend on, inter alia, the calculational technique used,
the fidelity to which the problem is modeled, and the convergence
requirements placed on the calculation.
When using Monte Carlo techniques to address perturbation problems
the situation is somewhat different from that of deterministic methods. As
with experimental measurements, all Monte Carlo results contain statistical
errors independent of the inaccuracies that result from the usual factors
related to the fidelity to which the problem is modeled. Thus a non-
problem-dependent source of error is always present in such results. An
attempt to compare answers obtained from two independent Monte Carlo
calculations that use nearly identical problem parameters is comparable to
an attempt to compare the results of two nearly identical measurements.
Unless a high degree of accuracy is obtained in the measurements, or in the
calculations, it is not possible to produce meaningful results.
An attempt to distinguish small changes in uncorrelated Monte Carlo
results is similar to that of taking the difference between two large numbers
that are almost equal. This is conceptually simple, but in practice it is
necessary to know both numbers to many significant digits in order to obtain
the right answer. To have any validity at all, two independent Monte Carlo
calculations that are used to analyze a perturbation in a system should have
statistical uncertainties in the individual answers that are significantly
smaller than the difference between the two results. Thus the smaller the
perturbation being examined the worse the situation gets for Monte Carlo.
Assume we are estimating two quantities, II and 12, where 8

(9.1)

(9.2)

Here fl and f2 are probability density functions that reflect the baseline and
perturbed cases, respectively. We evaluate II and 12 in the usual manner,
obtaining estimates 9 1 and 92, respectively. Then we calculate

8 Here we follow the method of E. J. McGrath and D. C. Irving, "Variance Reduction,"


ORNL-RSIC-38. In Techniquesfor Efficient Monte Carlo Simulation, Vol. III, Oak Ridge
National Laboratory, Oak Ridge, IN, 1975.
9. Advanced Applications of Monte Carlo 271

(9.3)

where

(9.4)

If the variance in the quantity estimated in the first, or baseline,


calculation is al 2

(9.5)

and that of the second, or perturbed, calculation is ai

(9.6)

then the variance in the difference between the two estimated quantities is

(9.7)

where the covariance is

(9.8)

If the estimates 9 1 and 9 2 are statistically independent then cov(9J,92 ) =


oand
(9.9)

which is the best we can hope for in estimating II - 12 using statistically


independent Monte Carlo calculations for the baseline and perturbed results.
For such estimates this variance places a stringent limit on the accuracy to
which the change induced by the perturbation can be determined.
Fortunately, the result of eqn 9.9 can be improved by considering a
specialized approach. Instead of attempting to calculate two highly precise
but statistically independent results, one can use correlated calculations to
obtain results that take advantage of the covariance term in eqn 9.7 to reduce
the uncertainty in the estimated difference. When the random variables X
272 Chapter 9

and Yin eqn 9.3 are positively correlated, cov(9.,92 ) > 0 and the variance in
the estimate for ~9 can be much less than that given by eqn 9.9.
Positive correlation between the results obtained in two similar Monte
Carlo calculations can be obtained by correlated sampling; i.e., by ensuring
that every particle random walk that does not involve an interaction in the
perturbed portion of the problem is the same in both of the calculations.
Thus as the effect of the perturbation goes to zero the practitioner is assured
that the two calculations will converge to the same result, independent of the
statistical uncertainty in the individual answers, provided the same number
of particles is tracked in both calculations. That is, although the absolute
uncertainty in the result will remain as determined in the individual
calculations, the relative uncertainty between the two calculations will go to
zero as the calculations become identical. The only difference between the
two calculations will be the changes produced by particle interactions, or
other events, in or involving the perturbed region of the problem. The
statistical uncertainties in the two answers will not apply to the uncertainty
in the difference between the two results.
Under the conditions postulated, it is no longer essential that the
individual uncertainties in the two answers be small, but only that the
uncertainty in the difference between the two results be small. Instead of
concealing the perturbation, the uncertainties in the separate answers
become almost irrelevant. However, in analogy with the phase-space
sampling requirements discussed repeatedly in the previous chapters, a valid
perturbation result still requires a thorough sampling of the phase space of
the perturbed problem parameters. Obviously if particle tracks do not
thoroughly sample the perturbed portion of the problem phase space, the
answer obtained may be wrong.
The key to correlated sampling in Monte Carlo transport is to make sure
that corresponding particle tracks in the baseline and the perturbed
calculations use the same random number string. In this way any particle
that does not encounter the perturbed region of the problem will score the
same in both calculations. By ensuring that both calculations are identical
except for tracks with interactions in the perturbed region, and using the
same number of start particles in each, the results will differ only insofar as
the perturbation influences the answer.
There are several techniques that might be used to ensure identical
random number sequences for particles tracked in correlated calculations.
For example, one could use preset, sequential portions of a random number
string for each start particle, or one could use randomly selected segments of
such a string. In the first method the portion of the random number string
used by sequential start particles would be selected by choosing a fixed
interval in the string between such start particles. That is, the initial random
numbers used for successive particles would be chosen in some
9. Advanced Applications of Monte Carlo 273

deterministic way, such as at fixed intervals. If the user can be assured that
the maximum length of the random number string used for any particle in
either the baseline or the perturbed calculation is less than some integer N,
then each particle can start with the random number that is N steps forward
in the string from that used by the previous particle.
In the second method each start particle is assigned its own start random
number from a list produced separately from the random number generator.
For example, the user might specify an initial random seed. The seed plus
one could be used to initialize the random number string for the first
particle, the seed plus two used to initialize the string for the second particle,
etc. Obviously, the interval between the starting seeds for each particle
could also be chosen as something other than one.
Should the user wish to introduce an additional degree of randomness
into the selection of start random numbers, it is possible to make use of a
second, separate, and independent random number generator in correlated
sampling. One generator would be used in the usual fashion to obtain
random numbers for the particle random walk. The other random number
generator, which generates a sequence of random numbers that is different
from that of the first generator, would be used to obtain the seeds for the
first random number generator from which each correlated particle random
walk is initiated.
The method of starting each particle track with a different start random
number produces sequences for particle tracking that are positioned more or
less randomly along the full period of the first random number generator.
The advantage of this method is that the maximum length of the random
number chain that might be used by any particle need not be estimated. The
disadvantage is that there is always the risk that a portion of the string used
in the random walk of one particle will be repeated in that of another
particle, perhaps more than once. Although this is an unlikely event for
long-period random number generators (long with respect to the length of
the string used in the random walk for any single particle in the correlated
calculations), it will happen · with some (hopefully small) regularity.
However, in particle transport some rare overlap of random number strings
in particle tracking generally does not introduce a discernible bias in the
results.
For correlated sampling it is necessary to know how the generator is
initialized. The function 'fltrn,' for example, is initialized with a single seed
that consists of an integer from one through 2147483646 (see Appendix.)
The first random number, and the subsequent sequence of random numbers,
are uniquely defined by this seed. Other random number generators,
especially those incorporating special techniques in order to produce very
long periods, may require several parameters to be set in order to define a
unique and reproducible string of random numbers. Random number
274 Chapter 9

generators must be examined on a case-by-case basis to determine how they


should be initialized for correlated sampling.

Example 9.1. Generating correlated strings of random numbers

We will illustrate the use of correlated strings of random numbers by


producing a code that contains two different random number generators, the
first of which, generator A, produces a sequence of ten values beginning
from a point set by the second generator, generator B. To ensure that all of
the period of generator A is accessible to the calculation, generator B should
have the same word length as A. In this example a user-input seed will be
used to initialize both random number generators, and this seed will be used
to produce the first string in generator A. Generator B will then produce a
second number which will be used as the seed for the second string in A,
etc.
Tables 9.1 and 9.2 show the Fortran listing of an example code that
repeatedly generates ten random numbers beginning at a user-set location in
the strings of the two generators. That is, ten-word-Iong pieces of the
random number string from generator A are obtained at random start points,
the latter being produced from the sequence generated by B.

Table 9.1. Fortran Code Illustrating Two-Generator Correlated Sampling


! Program to illustrate ~rator correlated sarrpUng
REAL (B) fltDn,rand
INl'EX>ER sfltDn
OI?EN (UNIT=16, FIIE-'lpt1')
WRITE (* , *)' Enter seed for seccn::i randall nl.llber generator '
READ(*,*)iseed ! Cbtain initializatioo seed
CALL srndin(iseed) initialize seccn::i ran generator
icont=1 user pararreter for continuing
CO WHILE (icent.NE.O) centinue until user sets icent=O
CALL rndin(iseed) initialize first ran generator
WRITE(*,*)iseed write iseed to standard outpJ.t clev:ice
WRITE(16,*)iseed print iseed
CO i=1,10 generate ten-woro-randall nl.llber string
rand=fltDn() ran number fram first generator
WRITE(*,' (flO.B) ')rand outpJ.t to standard device
WRITE (16, '(flO.B) ')rand print rand
END CO
WRITE (* , *)' Again? -- O=SroP, l=<XNI'INUE '
READ (* , *) icent see i f user wishes to centinue
iseed=sfltDnO .i.ncrerent iseed using seccn::i ran generator
END CO
CALL srndout (iseed) get errling randall number for seccn::i generator
WRITE (* , *)' Eh:!:ing seed " iseed
WRITE (16, *)' Eh:!:ing seed ',iseed
sroP
END

As discussed in the Appendix, there are a number of alternative, equally


valid selections for the multiplier in the 32-bit, multiplicative congruential
9. Advanced Applications of Monte Carlo 275

random number generator used in the example problems of this book.


Therefore for generator B we can use coding similar to that which we have
used in the function 'fltrn.' We will call this new routine 'sfltrn,' or second
floating-point random number generator. Our changes will consist of using
a different multiplier than that in 'fltrn,' and not normalizing the result. By
not normalizing the result, we will obtain an integer from one to the
maximum seed given above. This integer will serve as the seed for
generator A. The program shown in Table 9.1 uses both the random number
generator 'fltrn,' described in the Appendix, and the second random number
generator ' sfltrn,' shown in Table 9.2. The function 'sfltrn' uses an 'a'
parameter of 39373. The ' q' and Or' values were obtained as described in
the Appendix.
Table 9.3 shows a few results (truncated to four significant digits) from
the code of Table 9.1 using seed = 1. Any sequence of ten values can be
reproduced by entering the seed value shown in the table for that sequence.
Table 9.4 shows a few results for a modified version of the code of Table
9.1. This modified version provides twelve-word-Iong pieces of the random
number sequences resulting from each seed value. The table shows words
generated using seed = 39373, which is the second random number from
generator B and is the starting seed for the second column in Table 9.3. The
first ten numbers in the columns of Table 9.4 are the same as those in Table
9.3 that have the same starting seeds.

Table 9.2. Random Number Generator 'sfltm' for Example 9.1


FtN:TICN sfltm ()
INl'EJ3ER a ,m, q, r, hi, 10, seed, sfltm
PARAMETER (a=39373, m = 2147483647, q = 54542, r = 1481)
PARAMETER (fIn = m)
CXMOI/srandseediseed
DM'A seedlll
hi = seedlq
10 = MOD(seed,q)
seed = a*10 - r*hi
IF (seed.LE. 0 ) seed=seed + m
sf1tm = seed
RE:IURN
END

SUBroJI'INE srndin(iin) srndin sets the =rent ran:lan rnnber seed


CXMOI/srandseediiseed
iseed=iin
RE:IURN
END

SUBroJI'INE sITrloot (ioot) sITrloot returns the =rent ran:lan rnnber seed
CXMOI/srarrlseedliseed
ioot=iseed
RE:l'URN
END
276 Chapter 9

The program in Table 9.1 also gives the ending seed value from
generator B. This allows the user to start a subsequent calculation using this
value as the initial seed, with assurance that the new run will not repeat the
same random number strings used in the previous run. The ending seed for
the last column of results shown in Table 9.3 was 1548773083. As
expected, this is the value used to start the sequence shown in the last
column of Table 9.4. Any string of random numbers that is started with the
seed values shown in the top row of these tables will remain identical for as
long as the string is continued.

Table 9.3. Results of Example 9.1 for Three Ten-Word Strings


Seed I 39373 1550233129
Ran-I 0.783-5 0.3081 0.6969
Ran-2 0.1315 0.0373 0.8949
Ran-3 0.7556 0.4484 0.9155
Ran-4 0.4587 0.4316 0.1280
Ran-5 0.5328 0.6444 0.4822
Ran-6 0.2190 0.0800 0.5447
Ran-7 0.0470 0.2877 0.5968
Ran-8 0.6789 0.9405 0.1985
Ran-9 0.6793 0.9374 0.7385
Ran-I 0 0.9347 0.6634 0.7284

Table 9.4. Results of Example 9.1 for Three Twelve-Word Strings


Seed 39373 1550233129 1548773083
Ran-I 0.3081 0.6969 0.2700
Ran-2 0.0373 0.8949 0.6735
Ran-3 0.4484 0.9155 0.3872
Ran-4 0.4316 0.1280 0.8374
Ran-5 0.6444 0.4822 0.8082
Ran-6 0.0800 0.5447 0.0605
Ran-7 0.2877 0.5968 0.2931
Ran-8 0.9405 0.1985 0.4841
Ran-9 0.9374 0.7385 0.7384
Ran-IO 0.6634 0.7284 0.1045
Ran-II 0.6273 0.5651 0.8909
Ran-12 0.9808 0.7247 0.9284

Example 9.2. Sensitivity of the number of particles passing through a


slab to the thickness of the slab

Let us consider the simple problem of a parallel beam of particles


normally incident on a slab. We assume the particles are monoenergetic and
undergo isotropic scatter in the laboratory coordinates. The material
through which the particles are passing is assumed to have a non-absorption
9. Advanced Applications of Monte Carlo 277

probability c. We want to examine the effect of an uncertainty in the


thickness z of the slab on the number of particles passing through the slab.
For a baseline calculation we will assume a slab ofthickness z = 1 mfp. We
will then perturb the thickness by increasing it to z' = 1.01 mfp and observe
the change in our answer.
The simplest case for this problem is c = 0, or a pure absorbing material.
In this case the probability of a nonnally incident particle passing through
the baseline slab is

(9.10)

while the probability of a particle passing through the perturbed slab is

Pp=e -z' (9.11)

Because we assume a start particle weight of one, the average of the weights
of particles passing through the slab in this case compared to the total
number of start particles is

(9.12)

where Xj = 1 for particles that pass through the slab, and zero otherwise; i.e.,
a binomial distribution. Since the square of the weight is equal to the
weight,

(9.13)

and the standard deviation of (x) is

(9.14)

For c = 0, z = I, and z' = 1.01 this gives the results shown in Table 9.5.

Table 9.5. Perturbation Resu Its fior Purely Absorb·mg SIab


z (x) cr
1.00 0.367879 0.482228
1.01 0.364219 0.481210
278 Chapter 9

The PFC subroutines required to perform the calculation are given in


Table 9.6. Subroutine 'Input,' shown in Table 9.7, has been modified to
allow user input of the starting seed for 'sfltm.' This parameter is passed to
subsequent routines in common 'in.' The modified subroutine 'Walk,'
shown in Table 9.8, sets the seed at the beginning of the random walk
calculation for each of the 'npart' particles. The function 'sfltm' ensures
that the beginning random number for each particle is uniquely specified to
allow for correlated sampling when the problem is run with the perturbed
thickness. For the baseline slab of thickness 1.0 mfp the geometry
description is the same as that given in Table 6.6. For the perturbed slab the
thickness in the Z-direction is set to 1.01.

Table 9.6. Modified Subroutmes f,or Example


I 92
Subroutine Location
'Bdrx' Table 6.3
'Stats' Table 6.5
'Source' Table 6.17
'Col' Table 6.21
'Input' Table 9.7
'Walk' Table 9.8

Table 9.7. Subroutine 'Input' for Example 9.2


SUBroJI'INE :rnror 1
CXlM:N/IN/npart, nbatch, iseed
WRITE(*,12) 3
12 ~T (' Enter the nurrber of particles. ' ) 4
READ(*,*)npart 5
WRITE (16, *) 'Nunber of particles = ',npart 6
WRITE(*,13) 7
l3 ~T (' Enter the randan nurrber seed, an integer. .) 8
READ(*,*)iseed 9
IF(iseed.LT.l)iseed=1 10
IF(iseed.GE.2147483647)iseed=2147483646 11
WRITE (16, *). Starting randan nurrber seed is • ,iseed 12
CALL smdin(iseed)
nbatch=1 needs to be changed i f batches are to be used 14
~ ! 15
am 16

To test these correlated sampling updates to PFC, we have performed


five pairs of calculations using the subroutines listed in Table 9.6 with c = O.
The results of these calculations are shown in Table 9.9. Each calculation
used a different user-specified seed, as indicated in the table, and 106 start
particles. Comparing these results with the exact results of Table 9.5 we see
that the results for seed = 1 are remarkably close to the true values, while the
other cases are within one standard deviation of the exact results.
For normally incident particles on a purely absorbing material, the
change in the number of particles passing through the slab, with respect to
the thickness of the slab, is
9. Advanced Applications of Monte Carlo 279

Table 9.8. Subroutine 'Walk' for Example 9.2


SUBIU1l'INE WAll< 1
cnMN/IN/npart, nbatch, iseed
IN1'EGR sfltm
RE1IL(8) cInfp,dtr,xsec,dcur 3
cnMN/TIW:K/cInfp,dtr,xsec,dcur 4
RE1IL(8) x,y,z,u,v,w,xo,yo,ZO,IlO,vo,wo,wate,age,energ! 5
cnMN/PARr/x,y,z,u,v,w,xo,yo,ZO,IlO,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
I.ocp OJer Particles: ro i=1,npart ! locp over nuIi:ler of particles 7
- CAli RNDIN (iseed)
iseed=sfltm ()
CALL StaUp initialize statistics for each particle 8
CALL SCXlK:E get soorce pararreters for particle 9
I.ocp for Collisicns: ro to find c:ollisioo sites 10
CALL- DIsr get distance of travel in rnfp 11
I.ocp_Track: ro track particle to collisioo point 12
CALL HIT get distance to bamdary of current zooe 13
CALL MXSEX: get total cross sectioo for current zooe 14
IF( (dtr-dcur) *xsec.GE.cInfp) EXIT I.ocp Track ! collisioo before bamdary 15
CALL BOO){ ! Pl:oceSS bamdary crossing 16
IF(nzcur.E}J.-1) EXIT I.ocp for Collisicns ! particle killed e.g., by escaping 17
END ro I.ocp Track - - ! 18
CALL COL - ! call col to process collisioo 19
IF(nzcur.E}J.-1) EXIT I.ocp for Collisicns ! particle killed by collisioo 20
END ro I.ocp_for_Collisicns - - 21
CALL StatEIp process statistics men particle killed 22
END ro I.ocp_OJer_Particles ! 23
RErum 24
END 25

Table 9.9. Results for Example 9.2, c = 0


seed z = 1.00 z' = 1.01
1 0.367875±0.0004822 0.364263±0.0004812
2 0.367600±0.0004822 0.363928±0.0004811
3 0.367899±0.0004822 0.364311±0.0004812
4 0.367610±0.0004822 0.364043±0.0004812
5 0.367731±0.0004822 0.363964±0.0004811

dP d -z -z
-=-e =-e (9.15)
dz dz

where P is the probability of an incident particle passing through the slab.


For z = 1 this gives a value of dP/dz ~ -0.3679. A linear approximation for
this quantity calculated analytically with the values z = 1.0 and z' = 1.01
gives

(9.16)
280 Chapter 9

Therefore, using a linear estimate for dP/dz with the given values of z, we
would expect to underestimate the correct exponential decline of the number
of particles penetrating the slab with increasing slab thickness by a small
amount, even with perfectly correlated Monte Carlo calculations.
Using the results of our correlated calculations for c = 0 and seed = 1,
and assuming a linear approximation for dP/dz at z = 1, we obtain the
estimate

dP 1z_1 ~ (x')-(x) = 0.364263-0.367875 ~ -0.3612 (9.17)


dz - /).z 1.01 - 1.0

Thus we see the Monte Carlo estimate for dP/dz at z = 1, for c = 0 and seed
= 1, is about 2% low compared with the correct value of -0.3679, and about
1.3% low compared with the exact linear approximation. The mean value of
our estimate for dP/dz over the five cases is shown in Table 9.10. This
average is within about 1% of the correct value, and within 0.5% of the
analytical linear approximation result.

Table 9.10. Effect of Perturbation in Example 9.2, c = 0


seed linear approximation for dP/dz
1 -0.3612
2 -0.3672
3 -0.3588
4 -0.3567
5 -0.3767
Average -0.3641

Now let us consider the more realistic problem of c *- O. The results


obtained from running 106 start particles in correlated Monte Carlo
calculations with c = 0.5, z = 1.0, and z' = 1.01 are given in Table 9.11 for
five different seeds. From the results for seed = 1 we estimate

dP I ~ (x,) - (x) = 0.442202 - 0.445960 ~ _ 0.3758 (9.18)


dz z=1 /).z 1.01-1.0

Table 9.11. Results for Example 9.2, c = 0.5


seed z =1.00 z' =1.01
1 0.445960±0.000450 0.442202±0.000450
2 0.445583±0.000450 0.44 1855±0.000450
3 0.446058±0.000450 0.442384±0.000450
4 0.445736±0.000450 0.442105±0.000450
5 0.446067±0.000450 0.442258±O.000449
9. Advanced Applications of Monte Carlo 281

In the present case the most straightforward way to obtain an uncertainty


for dP/dz is to make several independent estimates of the quantity and
perform a statistical analysis on the results. The multiple results shown in
Tables 9.9 and 9.11 can be used to perform such an analysis. The
calculations of dP/dz for the five cases of Table 9.11 are shown in Table
9.12. These results give an average value of -0.3720. An estimate of the
standard deviation of the distribution of dP/dz is

(9.19)

From eqn 2.41, the standard distribution of the estimate of the average of
dP/dz is lower than this by a factor of ll~(n-l) and therefore cr ~ 0.0031.
That is, we estimate the uncertainty of the estimate of the mean at about
0.4%, and to one standard deviation, for c = 0.5,

dP ~(x)
dz I
z;) ~ - ; : ; : = - 0.3720 ± 0.0031 (9.20)

Table 9.12. Results for dP/dz and (dP/dzt from Five Independent Pairs of Correlated Runs
Seed (x), z = 1 (x), z' = 1.01 dP/dz (dP/dz)2
1 0.445960 0.442202 -0.3758 0.14123
2 0.445583 0.441855 -0.3728 0.13898
3 0.446058 0.442384 -0.3674 0.13498
4 0.445736 0.442105 -0.3631 0.13184
5 0.446067 0.442258 -0.3809 0.14508

9.2 Adjoint Monte Carlo

For a number of reasons it is useful to consider solutions to an equation


that is adjoint to the neutron transport equation. First, the solutions to the
adjoint equation can often be used directly to find a desired result in
radiation transport analysis. Second, in many cases the solution to the
adjoint equation is easier to obtain and of broader application than is that of
the forward equation. Third, the solution to the adjoint equation with an
appropriately defined inhomogeneous source can be shown to be equal to
the importance of neutrons within a system. Even approximate knowledge
of the importance of neutrons at certain locations and with certain energies
can provide valuable information for setting parameters in Monte Carlo
variance reduction schemes.
282 Chapter 9

Given two "well-behaved" functions f( 0) and g( 0) of the same variable


0), the inner product of these functions is given by

J
(f,g) = f(O) )g(O) )dO) (9.21)

where the integral is over the range of the variable 0). Let us consider an
operator 0 that acts on the function f and a similar operator 0+ that acts on
the function g. Then if

(9.22)

the operator 0+ is said to be adjoint to O.


The steady-state neutron transport equation can be written in operator
form as

F'¥(r,n, E) + S(r,n, E) = 0 (9.23)

The operator F is given by (see eqn 3.11)

(9.24)

In the absence of a source on the boundary, the usual boundary condition on


the angular flux is '¥(r,n) = 0 for n • Q < 0, where n is the unit outer
normal and r is a point on the outer boundary of the problem geometry.
This condition defines a vacuum outer boundary; i.e., there is no incoming
angular flux at the boundary.
Let us now define an equation similar to eqn 9.23

(9.25)

where

(9.26)

and apply the equivalent vacuum boundary condition o/(r,n) = 0 for n. n


> 0, where n is the unit outer normal and r is on the outer boundary of the
problem geometry. From eqn 9.21 we have
9. Advanced Applications of Monte Carlo 283

('1'+ ,F'I') = HIdVdndE[ {-'I'+n. V'I' - '1'+ L, 'I'} (9.27)

+ Hdn'dE''I'+L s(r;n',E' ~ n,E)'I']


and

('I',F+'I'+) = HfdVdQdE[{'I'Q. V'I'+ - 'I'L, 'I'+} (9.28)

+ Hdn'dE''l'Ls(r;n,E ~ n',E')'I'+]

By interchanging the integration variables n' ,E' and n,E in the last term
of one of these equations it is easy to see that the last terms in the integrands
are equal. The difference between the gradient terms in these integrands is

(9.29)

Because the gradient does not operate on direction we can bring the
directional vector inside the gradient operation; i.e., n.v = V.Q. Applying
this we can combine the two terms in eqn 9.29 and, using the divergence
theorem, see that

(9.30)

where the surface integral is taken over the outer boundary of the problem
geometry. When we apply the vacuum boundary conditions 'I'(r,n) = 0 for
n. n < 0 and Y(r,n) = 0 for n • n > 0, it is clear that the surface integral
is equal to zero. Therefore

(9.31)

and thus F+ is adjoint to F. Eqns 9.25 and 9.26 define the steady-state
adjoint transport equation.
There are only minor differences between the adjoint and forward
formulations of the transport equation. In the adjoint equation the gradient
term is positive rather than negative, and the collision integral is performed
over the "scattered to" variables of the scattering function rather than the
"scattered from" variables. Thus it should be possible to solve the adjoint
equation using the same general approach used to solve the forward
equation. That is, we should be able to perform random walks on adjoint
particles using substantially the same tracking routines we have used for
forward calculations.
284 Chapter 9

To solve the adjoint transport equation using the Monte Carlo random
walk routines we have already developed it is reasonable to consider a
function in which the signs of 0 and 0' are changed.) Such a function
would have a negative divergence term in eqn 9.26 and a boundary
condition of zero for n • 0 < 0 at points on the outer boundary. Thus the
equation for this function would look much like that for the forward flux.
This new equation could be solved using the random walk process defined
for the forward transport equation, but with a modified scattering kernel.
That is, the direction of travel of the adjoint particles, which by convention
we will call adjunctons, is actually opposite to that of the value of 0 used in
the calculation.
One may envision the physical process of adjoint transport as one in
which the adjunctons flow in the reverse direction from that of the
"forward" -flux. In many practical transport problems the location of an
absorption event is the desired result of the calculation. An absorption is the
last act in the life of a particle, and for such problems the adjoint flux would
start with an absorption. For example, let us consider the use of Monte
Carlo techniques for tracking adjunctons in a problem in which the quantity
of interest is the neutron absorptions inside the system. The first task is to
determine the location of an absorption event so that an adjuncton track can
be initiated from that point. Once this adjoint source location is determined,
other factors such as the energy of the neutron that was absorbed and
possibly the time at which the absorption occurred, could be selected and
assigned to the adjuncton. The last step in the adjoint source definition is to
select the direction from which the absorbed neutron could have come.
Given the location of the absorption, and the direction of travel of the
incoming neutron (which is opposite to that of the outgoing adjuncton), the
cross section information for the materials along this path can be
determined. This cross section information is used to select the initial free-
flight path of the adjuncton from among those possible paths that the
neutron could have traveled to reach the point of the absorption. The end of
this path defines the first adjuncton collision point. At each adjuncton
collision point the random walk must determine how an incident neutron,
traveling in the forward direction, could have produced a post-collision
neutron having the properties of the incident adjuncton. A new energy and
direction of travel is selected after each adjuncton collision, based on this
determination.
If the adjuncton has a collision at a point from which it is not possible for
a real source neutron or post-collision neutron to have originated, the track
is terminated. For example, if a collision event occurs in a pure absorber the
adjuncton is captured because no forward neutron could have departed from
that point in space. If an event occurs at a location from which it is possible
9. Advanced Applications of Monte Carlo 285

for a neutron to have departed (e.g., arrived from elsewhere and scattered)
the track continues.
The adjoint tracking is continued until the adjuncton either escapes from
the problem geometry or is captured. If an event location is found at which
a neutron could have been born then there is a match between the adjuncton
(a backward-traveling neutron) and a real source (a forward-traveling
neutron) and the match is scored. This match can occur at a forward source
point within a problem geometry or at the boundary of the geometry. The
match can be angular dependent, energy dependent, and time dependent.
The score that is made will depend on the magnitude of the forward source
and the weight ofthe adjuncton.
The adjoint flux is a direct measure of the importance of forward
neutrons that are, or might be, present at particular points in phase space.
Locations in phase space that are visited frequently by adjunctons would
give high scores if source particles were present, while locations seldom
visited would give low scores.
In general, in order to solve a problem for a response of interest using
adjoint transport, the adjoint source must be related to the response of
interest. We can see the effect of this association for a number of different
cases by multiplying the forward transport eqn 9.23 by \{'+ and the adjoint
eqn 9.25 by \{', and integrating over the phase space variables of energy,
direction, and volume. Differencing the resulting equations and applying
the divergence theorem gives 2

HI'I"I'+ (n. n)dAdndE = HJ(\{'+S - 'PS+ )dVdndE (9.32)

where dA is an element of a surface A that completely encloses the problem


geometry, and n is the unit outer normal on A.
In the case of a vacuum boundary condition, the left side of eqn 9.32 is
zero, as was the case in eqn 9.30. For this case

(9.33)

If S+ is defined as the response per unit flux, then the right side of eqn 9.33
is equal to the total response to the forward flux. Similarly, the S term on
the left side is equal to the total response to the adjoint flux.
In the case where there is not a vacuum boundary condition, defining

'P = 'Pine for n • n < 0, and


(9.34)
'P+ = 'P:Ut for n. n > 0
286 Chapter 9

on the surface, then eqn 9.32 gives

fHln. Ol('l'( -O)'l':Ut (-0) - 'l'inc(O)'l'+ (O»)dAdOdE


ne(kO (9.35)
= Hf('l'+S - 'l'S+ )dVdOdE

For the case S = 0 and S+ = La within the volume defined by the surface A,
the right side of eqn 9.35 is the negative of the reaction rate given by eqn
3.9. Further, if the adjoint flux has a vacuum boundary condition, then 'l'+out
is zero at the boundary and the left side of eqn 9.35 is the negative of the
adjoint leakage times the forward source incident on the surface. For this
case, changing the signs of both sides of eqn 9.35 shows that the probability
of a particle entering the surface and not leaking (the left side) is equal to
the probability that it will be absorbed (the right side).

Example 9.3. Detector response function using adjoint transport

Consider a spherical detector that consists of a neutron absorber


surrounded by a moderating material. We wish to know the response of this
detector to a uniform, parallel beam of neutrons incident on the exterior
surface of the moderator. For simplicity let us assume that the neutrons are
monoenergetic, that the scatter in the moderator is isotropic in the laboratory
coordinate system with no absorption, and that in the absorber Lt = La. The
geometry is shown in Figure 9.1. We will assume that the macroscopic total
cross sections for the absorber and moderator are both unity. Furthermore
we will assume that the radius of the absorber is ra = 1 mfp, and that of the
moderator is rm = 2 mfp.
We can solve this problem easily in the forward mode. The incident
beam of neutrons is uniform so that the number of neutrons per unit area of
the beam is constant. If we assume the particles in the beam are traveling in
the -Z direction, and that the detector is centered on the Z axis, we can
randomly select the (x,y) coordinates of a particle incident on the detector
by selecting uniformly over a disk of radius rro. The probability of a particle
in the beam being at some source radius rs measured from the beam
centerline is
9. Advanced Applications of Monte Carlo 287

(9.36)

where So is the density of particles in the beam. Thus we have rs = rm --J~,


where ~ is a random number between 0 and I. With this result, and a
random azimuthal angle, we can easily find the (x,y) coordinates for a start
particle. If we assume the region exterior to the detector is a void we can
start the beam particles on the surface of the detector. However, since the
bounding surface of a zone is not in the zone, we will move the start location
a small distance into the moderator; i.e., we will choose z = --J(rm2 - x2 - y2_ 0)
where 0« rm. Collisions in the absorber region will be scored as detection
events and particle tracks will be terminated when a score is produced or
when the particle escapes from the detector .

..
.. Parallel
Moderator
.. Beam

.. Source

..
Figure 9. J. Parallel Beam Source Incident on Spherical Detector

The list of modified PFC subroutines required for calculating the number
of absorptions in the detector using the forward transport mode is shown in
Table 9.13. The modified subroutine 'Source' is shown in Table 9.14. This
subroutine starts all particles just inside the +Z surface of the sphere,
traveling in the -Z direction. The source particles are selected evenly from
across the beam using eqn 9.36. Subroutine 'Col,' shown in Table 9.15,
scores all collisions in the absorber. Subroutine 'Stats,' shown in Table
9.16, calculates the statistics for the results and normalizes these results to a
beam with an intensity of one particle/cm2/sec. The geometry description
for this calculation is shown in Table 9.17. The cross section data provide
for a pure absorber in zone one, with a total cross section of unity and a non-
absorption probability of zero. Zone two, the moderator, has a non-
absorption probability c = 1.0 and a total cross section of unity.
The probability of an incident neutron being absorbed, obtained by
tracking 106 particles incident on the spherical detector of Figure 9.1, is
found to be 0.15087 ± 0.00036. If we assume the beam intensity is one
288 Chapter 9

neutron per unit area we have a total of 1trm2 :::: 12.566 incident neutrons, or
1.8959 ± 0.0045 absorptions per unit beam intensity.

I 9.3, F0 rward Solution


Table 9.13. Modified Subroutmes fior ExampJe
Subroutine Location
'Source' Table 9.14
' Col' Table 9.15
'Stats' Table 9.16

Table 9.14. Subroutine 'Source' for Example 9.3, Forward Solution


SUBIUJl'INE SCXJFCE 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
OOMMON/PARr/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
REAL (8) radius,fltrn,pi,phi
pi=2.0cI0*mo::s(0.OdO) ! keep for IIOre carplicated soorce that needs pi 4
radius=2.OdO*~(fltrn()) ! radius of soorce particle
phi=2. OdO*pi*fltrn () ! angle for x,y selection
x=radius*IXXS(phi); y=radius*OOIN(phi)
z=~(4.OdO-x*x-y*y)-1.0d-10 ! starts just inside IIOderator
nzcur=2 IIOderator is Za1e 2
u=O.OdO; v=O.OdO; W"-1.OdO ! start all particles in -z direction
wate=1.OdO ! particle starts with a ~ight of one 8
RE:roRN 9
END 10

Table 9.15. Subroutine 'Col' for Example 9.3, Forward Solution


SUBIUJl'INE aJL 1
REAL (8) FLTRN,delta 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PARr/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) cJnfp,dtr,xsec,dcur ! 5
OOMMON/TAACK/cJnfp,dtr,xsec,dcur 6
REAL (8) sigt(20) ,c(20); ! dimensions allCM up to 20 different media 7
OOMMON/GEX:M/sigt,c; !sigt is total cross section, c is nan-absorption prro 8
REAL (8) bscore (10) , bsunsq (10) , cscore (10) , csunsq (10) , i::p3rt (10) , cpart (10)
OOMMON/STAT/bscore,bsunsq,cscore,cstmSq,i::p3rt,cpart
delta=ctnfp/xsec ! distance traveled to collision 9
dtr=c:b.lr-tOelta ! update total distance traveled 10
x=xo+u*dtr; y=yotv*dtr; z=zo+w*dtr ! update position 11
IF(nzcur .m.1)'IHFN
cpart(1)=cpart(1)+1
nzcur=-1
RE'lUm
ENDIF
CALL ISCXXJT assures isotrcpic scatter in lab system 20
RE'lUm 21
END 22

Table 9.16. Subroutine 'Stats' for Example 9.3, Forward Solution


SUBKmINE Stats 1
REAL (8) bscore(10) , bstrrsq (10) , cscore (10) ,csunsq(lO) ,i::p3rt(10) ,cpart(10) 2
OOMMON/STAT/bscore,bsunsq,cscore,csunsq,i::p3rt,cpart 3
OOMMON/IN/qmt, nbatdl 4
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ 5
OOMMON/PARr/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
REAL (8) tmp,tmp1,tmp2,var,stciev,pi
ENTRY Statcne ! entJ:y point to initialize arrays for carplete prd:>lem 8
bscore=O. OdO; bs1.Il\Sq=O . 0cI0; cscore=O. OdO; CS1.Il\Sq=O . OdO ! 9
RE'lUm 10
9. Advanced Applications of Monte Carlo 289

Table 9.16. con't ...


ENl'RY StaUp ! entry point to initialize arrays for a particle 11
tpart=O. OdO; <part=O. OdO 12
RE:IUm 13
ENl'RY StatErp ! entry point to store srores for a particle 14
CSOJre (1)=cscore (1) tqJart (1) ! store srore 17
csumsq (1) =CSU!l5q(I) tqJart (1) **2 ! store square for variance calculatioo 18
~ ! 19
ENl'RY StatEnd ! entry point to calculate and print results 20
t:rrp=OFI.mT (npart) 21
var=csunsq(I) /tnp- (CSOJre (1) /tnp) **2 ! variance of CSOJre distrili..!tioo 25
stdev-=ISCJU'(var) ! staOOard deviatioo of csrore distr26
WRITE(16,*)CSOJre(I)/tnp/stdev/~(tnp) ! result and std dev of result 27
pi=2.OdO*Il1\Ca3(0.0d0) ! double precisioo pi
tnpl=4. OdO*Pi
WRITE (16, *) tnpl*CSOJre (1) /tnp, tnpl*stdev/ISCJU'(tnp) nomalized results
RE:IUm 28
ilID 29

Table 9.17. Geometry Description for Example 9.3


o NoRPPs
2 Two spheres
O.OdO O.OdO O.OdO l.OdO Center and radius-sph 1
O.OdO O.OdO O.OdO 2.0dO Center and radius-sph 2
3 Three zones
1 One body in first zone
1 First zone is body "1"
2 Two bodies in second zone
2 -1 2nd zone is "2 -I"
1 One body in third zone
-2 3rd zone is "-2"

We now wish to calculate the same result using adjoint transport. We


represent the forward, parallel-beam source as an incident forward flux on
the positive-Z surface ofthe sphere. This flux is equal to

(9.37)

where 0 0 is the beam direction, J(E) is the particle current in the beam, and
8 is the Dirac delta function. The factor of 41t is required to convert the
beam current to an equivalent flux. That is, the neutron current is given in
terms of the angular flux by eqn 3.10. Since angular flux is specified per
steradian, the flux must be 41t times as large as the current in order to have
the correct number of particles streaming in direction 0 0 •
For this problem we can conveniently choose the surface A enclosing the
problem geometry to coincide with the detector outer surface. Since the
forward source is zero inside the detector, by eqn 9.32 we have

(9.38)
290 Chapter 9

The detector response (the adjoint source) is isotropic, and thus the adjoint
flux is symmetric and depends on no and n only through the scalar product
/-l = -no • n. We know that 'P+(/-l) is zero for the outgoing direction, or /-l <
O. Thus only the incoming forward flux contributes to eqn 9.38. For z > 0
we can define this as 'P(r,E,n,) = 'P(E)8(n-no), where Irl ~ rm and 'P(E) =
41tJ(E). Introducing this expressing into eqn 9.38, and using -no.ndA =
21trm2/-ld/-l, where /-l is the cosine of the angle between no and the unit inner
normal, gives

(9.39)

where 'P·(E,/-l) = 'P+(E,-/-l). Here 'P+ is the true adjoint flux and 'P. is the
flux estimated in a Monte Carlo calculation using an appropriate adjoint
source. That is, as discussed earlier, a change in the sign of the direction of
travel of an adjoint particle in a Monte Carlo calculation is required in order
for the Monte Carlo flux to match the true adjoint flux. The modified
adjoint function 'P. has a vacuum boundary condition in the forward flux
sense. The second integral, that over /-l, is equal to the total adjoint leakage
from the detector. Thus to determine the total response of the symmetric
detector using adjoint transport we will obtain the total leakage of
adjunctons from the system using the source S+(r) = La(r) and then multiply
this leakage by 41tJ(E). Because we are assuming the neutrons are
monoenergetic we can ignore the energy dependence of the cross sections.
It may be useful to consider a different interpretation of this adjoint
solution for a symmetric detector. Kalos3 has shown that a forward
calculation that scores the average reaction rate as a function of radius for an
isotropic source incident on the exterior of the detector will produce the
same total response as a parallel beam. For the calculation of the average
flux as a function of radius, an incident parallel beam of K particles/cm2-sec
can be replaced by an isotropic flux of K particles/cm2/sec over the entire
surface of the sphere. Using this result, the present adjoint solution could be
obtained by matching the adjoint leakage to an isotropic forward flux
incident over the entire surface of the detector. Thus the net leakage of
adjunctons through the surface can be equated to the net number of
absorptions in the detector due to a unit isotropic flux source on the surface.
In either case, to determine the response of our detector using adjoint
transport we need merely calculate the total leakage of adjunctons from the
system.
There are several ways to score the particle leakage from a system. The
most straightforward way is to tally the adjunctons as they actually escape.
Another way is to extrapolate every flight path to the exterior surface of the
detector and score an expectation leakage. A third way is to assume the
9. Advanced Applications of Monte Carlo 291

parallel beam is produced by a distant, isotropic point source. By specifying


a void outside the detector, we can designate this forward source as a point
detector for the adjoint calculation. Thus we could use a next-event
estimator, scored at every adjuncton birth and scattering event, to solve this
problem. If the source point is a distance ro » rs from the center of the
detector the forward flux incident on the detector will be SJ41tro2.
Therefore, such a next-event flux estimate would have to be multiplied by
41tro2 to be properly normalized. However, the next-event estimator has a
1/41tro2 term, and the two terms cancel. A next-event estimation of the
adjoint leakage has the advantage that it does not depend upon the symmetry
of the adjoint source or flux.
In this example, we will use both the first method, in which the leakage
is scored, and the third method, in which a next-event estimator is used.
However, in the later case, we will assume ro ~ 00 and thus that the post-
collision expectation track is everywhere parallel to the Z axis. For the
current example the "forward point source" direction is taken as the
direction from which the beam arrives. This is equivalent to locating the
point source a large distance away.
A list of the modified PFC subroutines used to solve the problem using
adjoint transport is given in Table 9.18. Subroutine 'Source,' shown in
Table 9.19, starts adjunctons uniformly within a sphere of radius ra using the
sampling scheme discussed in Example 2.1 . Since a next-event estimator is
used in the second scoring method, the uncollided contribution to this
detector is calculated in this subroutine for each starting particle.

I 9.3, Ad··
Table 9.18. Modified Sub routmes fior Example lJomt Solution
Subroutine Location
' Source' Table 9.19
' Bdrx' Table 9.20
'Col' Table 9.21
'Stats' Table 9.22

The library version of subroutine ' Sph' is used to calculate the distance
'bdout' from the start location of the particle to the surface where the beam
is incident. Since the cross sections for both the absorbing and scattering
media are unity, the attenuation ofthe adjuncton from the source point to the
surface of the detector in the +Z direction is exp(-bdout) and, as indicated
above for scoring to a beam there is no 1/41tfo2 factor.
The modified subroutine 'Bdrx' is shown in Table 9.20. This subroutine
scores adjunctons that leak from the sphere. Subroutine 'Col' is shown in
Table 9.21. This subroutine scores a next-event estimate at each collision in
the moderator region along the expectation track toward the beam.
Collisions in the absorber region result in absorptions and the particle
292 Chapter 9

tracking is tenninated. The statistics are calculated by subroutine 'Stats' as


shown in Table 9.22. The results are nonnalized to account for the total
number of absorptions in the absorber. The calculated results for one
absorption per unit volume in the absorbing material must therefore be
multiplied by the volume of that material.

Table 9.19. Subroutine 'Source' for Example 9.3, Adjoint Solution


SUBIaJI'INE saJR::E 1
RrnL(8) X, y, z, u, V, w, xo, yo, zo, uo, VO,.o, wate, age, energ 2
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,.o,wate,age,energ,nzcur,newzn,ngroup 3
RrnL(8) bsrore(10) ,bstm;q(lO) ,cscore(10) ,CSUl\Sq(10) ,tpart(10) ,q:>art(10)
OOMMON/S'OO'/bsrore, bstm;q, cscore, csunsq,tpart, q:>art
RrnL(8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxm8X(20),&
rpymin(20),rpymax(20),rpzmin(20),rp~(20),bdin(40),bdout(40)
LOGICAL bdtest(40) , bdhit(40)
OOMMON/cg/sphcx, sphcy, ~z, sphr, rpxmin, rpxm8X, rpymin, rpj'lll3X, rpzmin, rp~, &
bdin,bdout,flSIil,ilIW,nbciy,nzrnes,nbz (40,41) ,nnext(40, 40,40,2) ,bdtest,bdhit
RrnL(8) radius,fltm,pi,pu,sinth
pi=2.0d0*1l!I£X)3(0.0d0) ! keep for II'Ore CCIlplicated soorce that needs pi 4
radius=fltm()**(1.OdO/3.0d0) ! radius of soorce particle in absorber
_1.OdQ-2.0d0*fltm()
sinth=~(1.OdQ-w*w)
z=radius*w
pu=2. 0d0*pi*fltm ()
x=radius*[XD3 (pu) *sinth; y=radius*OOIN (pu) *sinth
nzcur=1 ! absorber is in zene ooe
u=O.OdO; v=O.OdO; w=1.0d0! directicn for =llided a:ntrihtticn
xc>=x; yo=y; z= locaticn for 'sp-!' calculaticn
cALL SRl(2) get distance to exit to beam
q:>art (1) =£EXP (-bdout (2» =llided a:ntr.ib.lticn
CALL ISC<lJI' directicn chosen isot~ica11y 7
wate=1.0d0 particle starts with a weight of ooe 8
REIURN 9
END 10

Table 9.20. Subroutine 'Bdrx' for Example 9.3, Adjoint Solution


SUBIaJI'INE BmX 1
RrnL(8) delta 2
RrnL(8) sphcx(20),sphcy(20),~z(20),sphr(20),rpxmin(20),rpxm8X(20),& 3
rpymin(20) ,rpymax(20) ,rpzmin(20) ,rp~(20) ,bdin(40) ,bdout(40) 4
LOGICAL bdtest(40) , bdhit(40) ! 5
OOMMON/cg/sphcx, sphcy, ~z, sphr, rpxmin, rpxm8X, rpymin, rpj'lll3X, rpzmin, rp~, & 6
bdin,bdout,flSIil,ilIW,nbciy,nzrnes,nbz(40,41) ,nnext(40,40, 40,2) ,bdtest,bdhit 7
RrnL (8) x, y, z, u, V, w, xo, yo, zo, uo, VO,.o, wate, age, energ ! 8
OOMMON/PART/x,y, z,u,v,w,xo, yo, zo,uo,vo,.o,wate, age, energ, nzcur, newzn,ngroup 9
RrnL(8) cknfp,dtr,xsec,OCur ! 10
OOMMON/TRACK/cknfp, dtr, xsec, 0Cur. 11
RrnL(8) bsrore(10) ,bsunsq(10) ,cscore(10) ,cs1.Il5q(10) ,tpart(10) ,q:>art(10)
OOMMON/S'I1IT/bsrore,bsunsq,cscore,CSUl\Sq,tpart,q:>art
delta=dtr-d:::ur ! delta-distance traveled to ream booOOary 12
0Cur=dtr ! update current distance traveled 13
dnfp=dnfp-delta*xsec ! subtract current distance in mfp fran cknfp 14
x=x+u*de1ta; y=y-W*de1ta; =-IW*de1ta ! update positicn 15
nzOJr=neWZn change identifier of current zooe 16
if(nzcur.LT.nzrnes)RE:IUm if not at ooter zrne then retum 17
tpart (1)=tpart (1) +1 srore leakage
nza.Jr=-l set nza.Jr=-1 if in ooter zrne (for escape) 18
RE:IUm ! 19
END 20
9. Advanced Applications of Monte Carlo 293

Table 9.21. Subroutine 'Col' for Example 9.3, Adjoint Solution


SUBR:XJI'INE <XlI. 1
REM.(8) FLTRN,delta 2
REM.(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,WJ,wate,age,energ 3
OOMMCN/BART/x,y,z,u,v,w,xo,yo,zo,uo,vo,WJ,wate,age,energ,nzcur,newzn,ngroup 4
REM.(8) cInfp,dtr,xsec,dcur ! 5
OOMMCN/TAACKIcInfp,dtr,xsec,dcur 6
REM.(8) sigt(20),c{20); ! dirrensioos allCM up to 20 different Iredia 7
OOMMCN/GEX:Mlsigt,c; !sigt is total cross sectioo, c is ncn-absorptioo prcb 8
REM.(8) bscore(10) ,bsunsq(10) ,cscore(10) ,csumsq(10) ,!:part (10) ,cpart:{lO)
OOMMCN/S'mT/bscore, bsumsq, cscore, csumsq,!:part, cpart
REM.(8) sphcx(20),sphcy{20),sphcz{20),sphr{20),rpxmin{20),rpxmax{20),&
~(20),rpymax(20),rpzmin{20),rpzmax{20),bdin{40),bdout{40)
LOGICAL bdtest(40), bdhit(40)
OOMMCN/cg/SIilCX:, sphcy, sphcz, sphr, rpxmin, rpxmax, rpymin, rpymax, rpzmin, rpzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzooes,nbz{40,41),nnext{40,40,40,2),bdtest,bdhit
delta=cinfp/xsec ! distance traveled to collisioo 9
dtr=dcur-l{!elta ! update total distance traveled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! update positioo 11
IF {nzcur.EQ. 1) THEN
nzcur=-1
REl'URN
ENDIF
u=O.OdO; v=O.OdO; _1.OdO! direction for next-event estination
xo=x; yo=y; zo=z ! location for SIil
CAIL Sffi(2) ! get distance to exit to beam
cpart: (1)=cpart (I) +OCI{P(-bdout (2) ) ! collided contr:ibJtion
CAIL ISCXJJI' ! assures isotrcpic scatter in lab systan 20
REl'URN ! 21
END 22

Table 9.22. Subroutine 'Stats' for Example 9.3, Adjoint Solution


SUBR:XJI'INESta~ 1
REM.(8) bscore(10) , bsumsq(10) ,cscore(10) ,csunsq(10) ,!:part (10) ,cpart:{lO) 2
OOMMCN/SI'AT/bscore,bsunsq,cscore,csumsq,!:part,cpart: 3
OOMMCN/IN/npart, nbatch 4
REM.(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,WJ,wate,age,energ ! 5
OOMMCN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,WJ,wate,age,energ,nzcur,newzn,ngroup 6
REM.(8) trnp,trnpl,tmp2,var,stdev ! 7
ENl'RY Statcne ! entry point to initialize arrays for carplete prcblan 8
bscore=O.OdO; bsunsq=O.OdO; cscore=O.OdO; csunsq=O.OdO ! 9
REl'URN 10
ENl'RY Statlp ! entry point to initialize arrays for a particle 11
1:part=O. OdO; cpart:=O. OdO ! 12
REl'URN 13
ENl'RY StatElp ! entry point to store scores for a particle 14
bscore (1)=bsoore(l) +bpart (I) store score 15
bsumsq{I)=bsunsq{I)+bpart{I)**2 store square for variance calculation 16
cscore (1)=cscore (1)+cpart (I) store score 17
csunsq{I)=csumsq{I)+cpart{I) **2 store square for variance calculation 18
REl'URN 19
ENl'RY StatEnd entry point to calculate and print results 20
trnp=DFLCro'(npart) 21
pi=2.OdO*I:lAIXS{O.0d0) ! double precision pi
trnpl=4.0d0*pi/3.0d0 ! nomalization for vol of soorce
var=bsunsq{I)/tnp-{bscore{I)/trnp) **2 ! variance of bscore distr:ibJtion 22
stdev=~ (var) ! standard deviation of bscore distr23
WRITE {16, *)bscore{l) /trnp,stdev/~{trnp) ! result and std dev of result 24
WRITE{16,*)trnpl*bscore{I)/trnp,trnpl*stdev/~{trnp) ! nomalized resul~
var=csunsq{I)/tnp-{cscore{I)/trnp) **2 ! variance of cscore distr:ibJtion 25
stdev=~ (var) ! standard deviation of cscore distr26
WRITE{16,*)cscore{I)/trnp,stdev/~{trnp) ! result and std dev of result 27
WRITE{16,*)trnpl*cscore{I)/trnp,trnpl*stdev/~{trnp) nomalized resul~
REl'URN ! 28
END 29
294 Chapter 9

A calculation using this modified PFC with 106 start particles resulted in
1.8956 ± 0.0021 adjunctons leaking from the detector when scored using the
leakage to a surface source, and 1.8987 ± 0.0029 for the next-event
estimation to the beam. These adjoint results are in excellent agreement
with the forward result of 1.8959 ± 0.0045.

Example 9.4. A point-detector response using adjoint transport

Consider the geometry used in Example 9.3, but with the following
modifications. First, the absorber is not a pure absorber, but has a non-
absorption probability of c = 0.8. Second, we wish to measure the flux at
three points inside the absorber region. These points are (0,0,0.5), (0,0,-0.5)
and (0,0.5,0). The first two points are located along the Z axis, at the center
of the beam incident on the positive-Z surface of the sphere, while the third
point is off the beam axis. All are equidistant from the center of the
detector.
A list of the modified PFC subroutines needed to solve this problem
using a forward calculation is shown in Table 9.23. Because we now have
point detectors, we will use three next-event estimators. Subroutine 'Col' is
shown in Table 9.24. In this subroutine, every collision results in a flux
estimate being made for each of the three detectors. The method for doing
this is described in Chapter 7. The calculations again take advantage of the
fact that the total cross section is everywhere unity in this example, and
therefore the attenuation is determined solely by the distance between
points. We should recall that the next-event estimator results will be suspect
and should be used with care. In order to use them with confidence in the
absence of other analysis it would be essential to examine the number of
collisions in the vicinity of each detector and to ensure that the relevant
phase space has been adequately sampled.

I 9.4, F0 rward Solution


Table 9.23. Modified Sub routmes fior Example
Subroutine Location
'Source' Table 9.14
'Col' Table 9.24
'Stats' Table 9.25

Table 9.24. Subroutine ' Col' for Example 9.4, Forward Solution
SUBroJl'INE COL 1
RE1\L(8) FLTRN,delta, tllp,pi
RE1\L(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OCMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
RE1\L(8) cinfp,dtr,xsec,dcur ! 5
OCMMON/TRACK/cinfp, dtr, xsec, dcur 6
RE1\L(8) sigt(20),c(20); ! d:inensioos allow up to 20 different necIia 7
OCMMON/GEIM/sigt,c; !sigt is total cross sectioo, c is noo-absorptioo prcb 8
9. Advanced Applications of Monte Carlo 295

Table 9.24. con't ...


RE1IL(8) bscore(10) , bsUI5q (10) ,cscore(10) ,c:stJreq(10) ,tpart(10) , cpart (10)
CXlKN/STAT/bscore,bsUI5q,cscore,csunsq,tpart,cpart
pi=2.0ci0*I:lI\Cffi(0.0d0) ! cbJble precisicn pi
delt:a=dnfp/xsec ! distance traveled to alllisicn 9
d.tr=OCur+delta ! up:late total distance traveled 10
x=xo+u*dtr; y=yo+v*dtr; z=zo+w*dtr ! up:late positicn 11
wate=wate*c(nzcur) ! reduce wate by ncn-absorpticn prcbability 12
tnp=~(x**2 + y**2 + (z-O.5dO) **2) ! distance to 1st detector
cpart(1)=cpart(1)+wate*DEXP(-tmp)/(4.OdO*pi*tmp**2) ! collided ccntr, 1st det
tnp=~(x**2 + y**2 + (z+O.5dO) **2) ! distance to 2nd detector
cpart(2)=cpart(2)+wate*DEXP(-tmp)/(4.OdO*pi*tmp**2) ! collided ccntr, 2nd det
tnp=~(x**2 + (y-O.5d0)**2 + z**2) ! distance to 3rd detector
cpart(3)=cpart(3)+wate*DEXP(-tmp)/(4.0ci0*pi*tmp**2) ! collided ccntr, 3rddet
IF(wate . LT.O.1dO)THEN if wate small play Russian roulette 13
IF (wate.LT.FLTR-I() ) THEN if particle killed by RR 14
nzcw:=-1 set nzcw:=-1 to shcM particle killed 15
RElURN 16
ENDIF 17
wate=1.OdO particle slllVived RR, increase wate 18
ENDIF 19
CALL ISCXJJI' assures isotrcpic scatter in lab system 20
RElURN ! 21
END 22

Table 9.25. Subroutine 'Stats' for Example 9.4, Forward Solution


~StaG 1
RE1IL(8) bscore(lO) , bsUI5q (10) , cscore (10) ,csunsq(10) ,tpart(10) ,cpart(lO) 2
CXlKN/STAT/bscore,bsUI5q,cscore,csunsq,tpart,cpart 3
CXlKN/IN/npart,nbatdl 4
RE1IL(8) x, y, z, u, v,w,xo, yo, zo, 00, vo, WJ, wate, age,energ ! 5
CXlKN/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,WJ,wate,age,energ,nzcur,newzn,ngroup 6
RE1IL(8) tmp,tmp1,tmp2,var,stdev,pi
ENIRY Stat01e ! entry point to initialize arrays for a:nplete prcblem 8
bscore=O.OdO; bsunscFO.OciO; cscore=O.OdO; cs~.OdO ! 9
RElURN 10
ENIRY StatIp ! entry point to initialize arrays for a particle 11
l:part=O. OdO; cpart=O. OdO ! 12
RElURN 13
ENIRY StatEIp ! entry point to store scores for a particle 14
00 i=1,3
cscore (i) =cscore (i) -tcpart (i) store score
csumsq(i)=c:stJreq(i)-tcpart(i) **2 ! store square for variance calculaticn
END 00
RElURN 19
ENIRY StatEnd entry point to calculate and print results 20
tnp=DFImT (npart) 21
tmp2=1.5d0 distance fran beam to 1st detector
cpart(1)=DEXP(-tmp2) I.II1CX)llided ccntribrticn, 1st detector
tmp2=2.5dO distance fran beam to 2nd detector
cpart(2)=DEXP(-tmp2) I.II1CX)llided ccntributicn, 2nd detector
tmp2=~ (4. OdD-0.25d0) distance fran beam to 3rd detector
cpart (3) =DEXP (-tmp2) uncollided ccntributicn, 3rd detector
pi=2 . OdO*I:lI\Cffi(0.0ci0) cbJble precisicn pi
00 i=1,3
var=c:stJreq(i)/tmp-(cscore(i)/tmp) **2 variance of absorbed distr
stdev=~(var) standard deviaticn of distr
WRrTE(16,*)cscore(i)/tmp,stdev/~(tmp) result and std dev of result
tmp1=4.OdO*pi
WRrTE(16,*)cpart(i)+tmp1*cscore(i)/tmp,tmp1*stdev/~(tmp) noon'ed resulG
END 00
RElURN 28
29
296 Chapter 9

The uncollided contribution for the estimation will be scored in


subroutine 'Stats.' This is done because the uncollided contribution of a
parallel beam to a point detector can be calculated analytically. Subroutine
'Stats' is shown in Table 9.25.
The fluxes estimated for the three point detectors, obtained by running a
forward calculation with 106 start particles, are as follows: detector one,
1.0287 ± 0.0117; detector two, 0.5257 ± 0.0044; detector three, 0.7431 ±
0.0044. While there is nothing obviously wrong with these results we notice
that the estimated uncertainty for the first detector is larger than that for
detectors two and three. Because this relatively large uncertainty may have
been caused by scattering events close to the detector it is possible that the
first result will be found to be more accurate than the other two.
We would now like to perform an adjoint calculation that will estimate
the same three point responses to our incident parallel beam. To accomplish
this we will use the next-event estimator from Example 9.3. In the present
example we no longer have spherical symmetry; i.e.,. the detector (the
adjoint source) is not symmetric and as a result the adjoint flux will not be
symmetric. Therefore the total adjoint leakage estimator cannot be used to
estimate the desired result.
For this example we will use an adjoint Monte Carlo calculation with a
source at the first forward detector point but we will apply three different
scoring schemes to obtain all three adjoint responses with one Monte Carlo
run. The adjoint detector for the first forward detector, located at the point
(0,0,0.5), will be scored using the actual source beam incident on the +Z
surface of the sphere. That is, the first point adjoint detector will be
assumed located on the +Z axis at some point distant from the detector. In
the same calculation the response of the second detector, that at (0,0,-0.5),
will be scored by assuming a second distant point adjoint detector on the -Z
axis. This score is equivalent to a beam incident on the -Z surface of the
detector. That is, the second adjoint point detector will score the response
of a forward detector at (0,0,0.5) to a parallel beam incident along the -Z
axis. By symmetry this is equivalent to the response of a forward detector at
(0,0,-0.5) to a parallel beam incident along the +Z axis. Finally, the adjoint
score for the third forward detector will be modeled by a point adjoint
detector located at a distant point on the +Y axis. This geometry is shown in
Figure 9.2.
The advantage of using three adjoint detectors in this calculation is that
we obtain all three desired results with one calculation instead of making a
separate run for each adjoint source. Obviously, the specific detector
locations for this problem were chosen with the intent of being able to
combine the three response calculations into a single run; nevertheless, in
many cases it is possible to calculate responses for a number of forward
9. Advanced Applications of Monte Carlo 297

detector locations using a single adjoint run by using schemes similar to that
used here.

Adjoint
detector 1
i
Z

Beam from
+Z direction

--
• = Adjoint source point Beam from
• = Adjoint dcteector points +Y direction
Adjoint
detector 3

-
J--+-+--~~ Y

x
11 11 Beam from
-Z direction

Adjoint 'f
detector 2 ,

Figure 9.2. Geometry for Three Adjoint Source and Detector Points

The modified PFC subroutines used to perform the present adjoint


calculation are listed in Table 9.26. Subroutine 'Source' for this problem,
shown in Table 9.27, sets the source location for each adjuncton to be
tracked. As indicated above, in this example we will use a single point
source placed at the location of the first forward detector.

Table 9.26. Modified Sub rouf mes tior Example


I 94 Ad'oint Solution
Subroutine
..
Location
•Source' Table 9.27
'Col' Table 9.28
'Stats' Table 9.29

Subroutine 'Col' is shown in Table 9.28. This routine accounts for the
weight loss that is now possible at each collision in the absorbing material,
and the use of three adjoint point detectors. Subroutine 'Stats' is shown in
Table 9.29. The uncollided contribution to each of the detectors is
calculated in this routine. The results and associated statistics are also
calculated for each detector.
The results of the present adjoint calculation along with those for the
forward calculation are presented in Table 9.30. Based on the differences in
run times for the forward (26 seconds) versus the adjoint (35 seconds)
calculations, a 16% improvement in the standard deviations should be
298 Chapter 9

expected. However, the adjoint results are more accurate than the forward
results by a factor of thirteen for the first detector and a factor of about
seven for the other two detectors. If the estimates of the standard deviation
for the forward calculation are assumed accurate it would take a forward
calculation fifty or more times the run time of the adjoint calculation to
match the standard deviations for the latter.
Table 9.27. Subroutine 'Source' for Example 9.4, Adjoint Solution
SUBlUJI'INE SOOFCE 1
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 2
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 3
pi=2.OdO*DACCS(0.0d0) ! keep for xrore carplicated soorce that needs pi 4
x=O. OdO; y=O. OdO; z=O. SdO
nzcur=1 assunes origin is in zooe one 6
CALL Iscx::ur directioo chosen isotrcpica1ly 7
wate=1.OdO particle starts with a weight of ooe 8
REI'URN 9
END 10

Table 9.28. Subroutine 'Col' for Example 9.4, Adjoint Solution


SUBlUJI'INE <XlI. 1
REAL (8) FLTRN,delta 2
REAL (8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 3
OOMMON/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 4
REAL (8) <infp, dtr, xsec, dcur ! 5
OOMMONtrRI\CK/<infp, dtr, xsec, dcur 6
REAL (8) sigt(20) ,c(20); ! clirrensioos alia. up to 20 different zredia 7
OOMMON/GX:M/sigt,c; !sigt is total cross sectioo, c is noo-absorptioo prcb 8
REAL (8) sphcx(20),sphcy(20),sphcz(20),sphr(20),rpxmin(20),rpxmax(20),&
rpyrnin(20),rpymax(20),rpzrnin(20),rpzmax(20),bdin(40),bdout(40)
l(GlCAL bdtest(40) , bdhit(40)
OOMMON/cg/sphcx, spx:y, sphcz, sphr, rpxmin, rpxmax, rpyrnin, rpymax, rpzrnin, rpzmax, &
bdin,bdout,nsph,nrpp,nbdy,nzooes,nbz(40,41),nnext(40,40,40,2),bdtest,bdhit
RrnL(8) bscore(lO) ,bsunsq(10) ,cs=re(lO) ,csumsq(10) ,q:,art(10) ,cpart(10)
OOMMON/STAT/bscore,bsunsq,cs=re,csumsq,tpart,cpart
delta=dnfp/xsec ! distance traveled to collision 9
dtr=dcur+delta ! update total distance traveled 10
x=xotu*dtr; y=yo+v*dtr; z=zo+w*dtr ! update position 11
wate=wate*c{nzcur) ! reduce wate by noo-absorptioo prcbability 12
u=O.OdO; v=O.OdO; w=1.OdO! directioo for first next-€Vent estinatioo
xo=x; 'f'CFY; zo=z ! update for SI=h
CALL SPH(2) ! get distance to exit to beam
cpart(l)=cpart(I)-+wate*lEXP(-bdout(2)) ! collided cootributioo, 1st detector
u=O.OdO; v=O.OdO; w=-1.OdO! directioo for 2nd next-€Vent estinaticn
CALL SPH(2) ! get distance to exit to beam
cpart (2)=cpart (2)-+wate*lEXP(-bdout (2) ) ! collided cootributicn, 2nd detector
u=O.OdO; v=1.OdO; w=O.OdO! directicn for 3rd next-event estinaticn
CALL SPH(2) ! get distance to exit to beam
cpart(3)=cpart(3)-+wate*lEXP(-tdout(2)) ! collided cootributian, 3rd detector
IF(wate.LT.O.ldO)'rnEN if wate srall play Russian roolette 13
IF (wate.LT .FLTRNO)'rnEN if particle killed by RR 14
nzcur=-1 set nzcur=-1 to shCM particle killed 15
REI'URN 16
ENDIF 17
wate=1.0d0 particle survived RR, increase wate 18
ENDIF 19
CALL Iscx::ur asSI.ll'eS isotrcpic scatter in lab systan 20
REI'URN ! 21
END 22
9. Advanced Applications of Monte Carlo 299

Table 9.29. Subroutine 'Stats' for Example 9.4, Adjoint Solution


SUBro1l'INE Stats 1
RE7IL(8) bscore(10) ,bs=q(lO) , cscore (10) , csumsq (10) ,l::part(10),cpart (10) 2
CCM{N/f5rM/bscore, bs=q, cscore, csumsq, l::part, cpart 3
CCM{N/IN/npart, nbatch 4
RE7IL(8) x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ ! 5
CCM{N/PART/x,y,z,u,v,w,xo,yo,zo,uo,vo,wo,wate,age,energ,nzcur,newzn,ngroup 6
RE7IL(8) tmp,tmp1,tmp2,var,stdev ! 7
ENI'RY StatQ1e ! entry point to initialize arrays for a::nplete prcblem 8
bscore=O.OdO; bsumsq=O.OdO; cscore=O.OdO; csumscrO.OdO 9
RETURN 10
ENI'RY Statlp ! entry point to initialize arrays for a particle 11
l::part=O. OdO; cpart=O . OdO ! 12
RETURN 13
ENI'RY StatEIp ! entry point to store scores for a particle 14
!Xl i=1,3
csoore (i) =cscore (i) +cpart (i) store score
cs=q (i) =cs=q(i) +cpart (i) **2 ! store square for variance calculation
END !Xl
RETURN 19
ENI'RY StatEild entry point to calculate and print results 20
tnp=DFID\T (npart) 21
tmp2=1.5d0
cpart(l)=DEXP(-tmp2) unoollided contribution, 1st detector
tmp2=2.5d0
cpart (2) =DEXP (-tmp2) uncollided contribution, 2nd detector
tmp2=DSQRT(4.OdO-0.25d0)
cpart (3) =DEXP (-tmp2) uncollided contribution, 3rd detector
!Xl i=1,3
var=csunsq (i) /tnp- (cscore (i) /tmp) **2 ! variance of next event distr
stclev=DSQRT(var) ! standard deviation of distr
WRITE (16, *)cscore (i)/tmp, stdev/DSQRT(tmp) ! result and std dev of result
WRITE (16, *)cpart (i) +csoore (i) /tmp,stdev/DSQRT(tmp) +unoollided flux
END !Xl
RETURN 28
END 29

Table 9.30. Resu Its t;or Example


I 94 Usmg 1 . Ies
PartlC
Detector Number Forward Results Adjoint Results
and Location (26 sec) (35 sec)
1 (0,0,0.5) 1.0287 ± 0.012 1.01373 ± 0.00086
2 (0, 0, -0.5) 0.5257 ± 0.0044 0.53154 ± 0.00063
3 (0,0.5,0) 0.7431 ± 0.0044 0.75659 ± 0.00074

The forward result for the first detector is slightly higher than the adjoint
result, and its standard deviation is relatively large. These results are
consistent with a collision having occurred close to that detector. The
forward results for the second and third detectors are below those of the
adjoint calculation, and the standard deviations are smaller than that of the
forward result for the first detector. In fact, the forward result for the third
detector is just over three sigma below the adjoint result. While this is
statistically possible, it would seem more likely to be a result of
undersampling in the vicinity of the forward point detector. All of this is
consistent with the performance of next-event estimators and confirms that
the results shown here for the forward calculation are not definitive. The
300 Chapter 9

forward results could only be validated by use of the techniques discussed in


Chapter 7 for next-event estimators.

Example 9.4 provides a good example of a situation in which the use of


an adjoint solution not only avoids the problems of estimating flux at a
point, but also inherently increases the efficiency of the calculation. In
general, we can expect that about 50% of all particle transport problems
could be solved as well or better in the adjoint mode than in the forward
mode. Both methods of solution should be given consideration when using
Monte Carlo techniques for solving transport problems.
The previous examples considered only monoenergetic neutrons.
However, just as neutrons usually lose energy from interactions in a forward
calculation, adjunctons will usually gain energy from interactions, and
treatment of energy dependence in adjoint calculations is necessary in order
to solve real problems. To include energy dependence in adjoint
calculations it is necessary to transform the scattering kernel in eqn 9.24 to
the form of eqn 9.26. That is, instead of describing the outgoing particle
direction and energy, 0 and E, in terms of the incoming values, 0' and E',
we must describe the incoming values in terms of the outgoing quantities.
To address this problem we may consider the forward scatter kernel K in
eqn 7.3. This kernel is equal to the probability that a particle located at
point P' in phase space and experiencing a collision at the point r, will
emerge from the collision with coordinates P in phase space. That is, in
terms of the direction and energy of the particle,

00 L (r'O' E'~O E)
K(r' 0' E' ~O E) = fdE' fdO' 5 " , (9.40)
'" -00 41t L t (r, E')

In order to select the outgoing coordinates we must normalize the scattering


cross section. This is done by including the total scattering cross section at r
and E' in both the numerator and denominator of the integrand. This total
scattering cross section serves as a normalization factor for the scattering
kernel and to maintain a fair game the post-collision particle weight is
multiplied by the weighting factor c = L/Lt. That is,

L (r' 0' E' ~ 0 E) L (r E')


K(r;O',E' ~ O,E) = fdE' fdO'
00
5 " '5 , (9.41)
-00 41t Ls(r,E') Lt(r,E')

For many problems of interest, the weight factor L/Lt is less than or equal to
one. Even in multiplying systems this factor is relatively small and the
9. Advanced Applications of Monte Carlo 301

particle population, or the particle weights, do not increase drastically at


collisions.
The adjoint to the collision kernel is

0) 1: (r'O E~ 0' E')


K+(r'O E~O' E')= IdE' IdO' 5 " , (9.42)
'" -0) 4n 1: t (r, E')

Again we must normalize this kernel in order to facilitate sampling. We do


this in an analogous manner to the way we normalized the forward
scattering kernel; viz., by integrating the scatter cross section over all
incoming directions and energies. As before, we can then write the
integrand of eqn 9.42 as a product of a normalized scattering kernel and a
weight factor

(9.43)

The quantity in square brackets is the weight factor for adjoint scattering.
After the post-collision direction and energy are chosen from the first term
in the integrand of eqn 9.43, the post-collision adjuncton weight must be
modified by this factor. Unlike the weight factor in the forward collision
kernel of eqn 9.41, in many cases the weight factor in eqn 9.43 is much
greater than unity, even if the upper bound on the energy integral of the
normalization factor is set to some maximum value of interest. Furthermore,
the weight factor varies widely with the adjuncton energy and the type of
nucleus struck. As a result one finds the weight of the adjuncton fluctuating
widely. Because of these fluctuations, in many cases the simple option of
particle splitting is not an effective means of controlling the adjuncton
weights.
The reason for the difficulty in sampling the adjoint collision kernel can
be understood by considering the problem of selecting the type of reaction
that an adjuncton will experience at a collision. The reaction type, as well
as the angle of scattering, is dependent on the incoming particle energy,
which is an unknown quantity. The post-collision forward particle energy
and direction (i.e., the incoming adjuncton energy and direction) may have
been the result of many different reactions from many different incident
particle energies and directions. Selecting an incoming energy requires
302 Chapter 9

normalizing the scattering kernel over all of these possible incoming


energies and directions, and adjusting the weight of the post-collision
adjuncton accordingly. This normalization factor can be large.
Various attempts have been made to overcome the problem inherent in
continuous-energy adjoint Monte Carlo caused by the weighting factor of
eqn 9.43. These have included a number of bias schemes and
transformations of the integro-differential adjoint transport equation.
Although these efforts have met with different degrees of success, no
uniformly applicable solution has been found. On the other hand, the
transformation of the scattering kernel between eqns 9.24 and 9.26 can be
accomplished easily in multigroup format. For this reason many
practitioners prefer to perform adjoint Monte Carlo calculations in
multi group rather than continuous-energy format.

9.3 Neutron Thermalization

In Chapter 4 we considered the slowing down of neutrons by elastic


scattering with light elements. The model developed in that chapter
assumed the scattering targets were stationary and thus the energy of the
neutron was always reduced by the collision. Actually the target nuclei are
in thermal motion and, as the kinetic energy of the diffusing particle
approaches that determined by the temperature of the bulk scattering
material, a neutron will be as likely to gain as to lose energy in an elastic
scattering collision.
If we neglect chemical binding we can employ the free gas kernel to
develop an approximate model of thermal scattering. b In this model the
neutrons are assumed to be moving through a uniform, monatomic gas with
atoms of mass A in equilibrium at absolute temperature T. The probability
per second that a neutron of energy En will collIde with a target nucleus
depends on the macroscopic cross section of the target nucleus and the
relative velocity between the neutron and the target nucleus. The effective
cross section for the elastic scattering reaction for a neutron of energy En
and speed Vn is given by

f
""
Vncr eff (En) = cr s(v rel)v rei Pr(v redEt) Pr(E t )dE t (9.44)
o
where Pr(vreIIEt) designates the probability of Vrel given an energy Et for the
target nucleus, and Pr(Et) is the probability of a target nucleus having an

b The present description of thermal scattering follows that of L. L. Carter and E. D.


Cashwell, Particle Transport Simulation with the Monte Carlo Method, TID-26607, U. S.
Energy Research and Development Administration, Washington, D. c., 1975, pp. 71 ff.
9. Advanced Applications of Monte Carlo 303

energy ofEt. From Figure 9.3, by the law of cosines, a neutron moving with
velocity Vn that encounters a target nucleus with velocity V t will see a
relative scalar velocity of

VreI = [ Vn2 + Vt2 -2V nVtJ.lt ]~ (9.45)

Here J..lt = cos9 = OteOn is the cosine of the angle between the direction of
travel of the target nucleus, 0t> and that ofthe neutron, On.
target

Vr"~t
~~: •••• iln
neutron Vn "~
ilt
Figure 9.3. Interaction Between a Neutron and a Moving Target

For a Maxwellian energy distribution of the target nuclei, the number of


target nuclei with energies in dEt about Et is given by

Pr(E )dE =_2_~Et e -k~' dE (9.46)


t t .[itkT kT t

where k is Boltzmann's constant. Let us use Et = 'l2 AVt2 to change the


variables in eqn 9.46, and define

A )~
13= ( 2kT (9.47)

Then, with the assumption that crlvrel) = constant = cro, and an isotropic
distribution of directions of travel of the target nuclei in the laboratory
coordinate system, we have

(9.48)

Thus the effective scattering cross section of eqn 9.44 can be written as

(9.49)
304 Chapter 9

Perfonning the integration over J..lt gives

(9.50)

This equation can be simplified by substituting x = j3V, and a = j3vn which


gives

(9.51)

or

(9.52)

Here erf is the error function,4

2 x 2

erf(x) = c Je- u du (9.53)


'" 1t 0

With these equations one can sample the thennal motion of the target
atom. The integrand of eqn 9.51 is proportional to the probability of a target
nucleus having velocity x. This probability falls rapidly with increasing x
and, because the total probability of x> 3 is less than 0.00125, values of x
greater than 3 may generally be neglected. This is equivalent to neglecting
target energies greater than 9 kT. This assumption simplifies the sampling
of thennal scattering and, given the approximation of the overall model,
does not greatly impact the accuracy of the results.
The procedure for sampling thennal scattering is based on sampling the
response function for the collision density,

(9.54)

Given an energy En for the neutron entering a scattering event, the effective
cross section for such a collision, <JcM:En), can be calculated using eqn 9.52.
For Monte Carlo tracking purposes it is also necessary to select a specific
target velocity for the nucleus involved in the collision. This velocity, along
with the target mass and the neutron velocity, can then be used to calculate
9. Advanced Applications of Monte Carlo 305

the energy and direction of the outgoing neutron, assuming isotropic


scattering in the center-of-mass coordinates.
The selection of the target velocity is performed by picking an x from a
distribution proportional to the integrand of eqn 9.51 using the rejection
technique discussed in Section 2.2.2. The magnitude ofthe target velocity is
thereby specified since x = ~VI' Next, the angle between the velocity of the
target nucleus and that of the neutron is determined. (Although the
directional distribution of the target nuclei is isotropic in the laboratory
coordinate system, the probability of an interaction between the neutron and
a target nucleus varies depending on the direction of the target nucleus.)
The probability density function for the collision angles that would produce
the effective cross section for the given neutron and target velocities is
determined by selecting from the distribution for the cosine J.lt in eqn 9.49,

(9.55)

where C is the normalization factor needed to produce a probability density


function. The value of J.lt can be selected analytically by sampling from the
inverse of the cumulative distribution of the above probability density
function; i.e.,

(9.56)

where ~ is a random number. The cosine J.lt defines the half angle of a cone
around the direction of travel of the neutron, On = (u,v,w), from which the
target nucleus is approaching. By finding a random azimuthal point on the
cone of this half angle we can fix the direction of flight of the target nucleus,
which we will call (UI ,VI ,WI)'
Since the scattering is assumed isotropic in the center of mass, a new
random direction of flight of the neutron in the center-of-mass coordinates
(uo,vo,wo) is selected, and from this the post-collision neutron energy E' and
direction of flight in the laboratory system (u',v',w') are determined. The
derivation of these quantities requires an extension of the analysis of
Sections 4.1 and 4.2 because in thermal collisions both the neutron and the
target nucleus are assumed to be moving. c

C This derivation follows that ofE. D. Cashwell and C. J. Everett, A Practical Manual on the
Monte Carlo Method/or Random Walk Problems, Pergamon Press, New York, 1959, pp.
56ff.
306 Chapter 9

Let us consider a two-particle interaction between a neutron of mass one


and a target nucleus of mass A. The pre-collision velocity of the center of
mass of the interacting particles in the laboratory system is

v = Vo +AVt (9.57)
em l+A

which, from conservation of momentum, is equal to the velocity of the post-


collision center of mass. In the center-of-mass coordinates the neutron and
the target nucleus approach each other along a straight line at velocities v o'
and V t', where v n' = Vn - Vem and V t' = V t - Vem. The three velocity vectors
Vem, v n', and V t ' are coplanar.
After the isotropic, elastic collision, the relative speeds of the neutron
and target nucleus are unchanged and their velocities are still colinear, but
the pre- and post-collision lines of travel have been rotated through a
random angle 'I'n' about Vem. This is shown in Figure 9.4 where the post-
collision center of mass velocities are designated by the letters Wand W
with the appropriate subscripts. We have Wem = Vem , IWo'l = IVo'l, and IWI'I
= IVt'I. The velocity vectors W em , w o', and Wt' are coplanar, but the pre-
collision (V) and post-collision (W) planes do not coincide.

Figure 9.4. Neutron-Nucleus Interaction in Center-of-Mass Coordinates

Given the arbitrary scattering angle in the center-of-mass coordinates,


'I' n', we can find the scattering angle in the laboratory coordinates using a
vector diagram similar to that of Figure 4.2. This is shown in the present
notation in Figure 9.5. Here w n/ is the post-collision neutron velocity in the
center of mass coordinates and Wn is the post-collision neutron velocity in
the laboratory coordinates. By the law of cosines,
9. Advanced Applications of Monte Carlo 307

(9.58)

and by inspection of Figure 9.5 the scattering angle in the laboratory


coordinates is given by

IWem I+ Iw n' Icos '¥n'


cos '¥n = Iw I n
(9.59)

The diagram of Figure 9.5 also applies to the scattered nucleus as indicated;
however, we are concerned here only with the post-collision neutron
parameters.
The pre-collision neutron speed in the center-of-mass coordinates is

(9.60)

w:t

Figure 9.5. Relation Between Post-Collision Neutron Parameters in C and L Coordinates

The post-collision velocity of the neutron in the center-of-mass coordinate


system will have the same magnitude as the pre-collision velocity in the
center-of-mass coordinate system. Assuming a direction of no = (uo,vo,wo)
for the post-collision velocity in the center-of-mass coordinate system gives

(9.61)
308 Chapter 9

Finally, from Figure 9.5, the post-collision neutron velocity in the laboratory
coordinates will be given by
,
Wo =W o + Wcm (9.62)

Using Wem = Vem, where Vem is given by eqn 9.57, and eqns 9.60 and
9.61 gives

W
o
=Iv '1 0
0 0
+ Vo + AVt
(l+A) (l+A)
=(l+A)
AVrel 0
0
+ Vo + AVt (9.63)
(l+A) (l+A)

This in tum gives

(9.64)

where On is a unit vector in the Vn direction and Ot is a unit vector in the Vt


direction. Finally, using eqn 9.45, 8 is given by

(9.65)

Let us define a vector R by

(9.66)

R is parallel to W O, and, from eqn 9.64, the components of R in the


laboratory system are

(9.67)

(9.68)

(9.69)
9. Advanced Applications of Monte Carlo 309

Then from the definition ofR (eqn 9.66) the energy of the neutron following
the collision is

E' = ER2 (9.70)


(A + 1)2

The post-collision neutron direction in the laboratory coordinates is given by


u' = RulIRI, v' = Rv/IRI, and w' = RwlIRI.

Example 9.5. Neutron spectrum in thermal equilibrium

Consider a monoenergetic source of neutrons emitted into an infinite


volume of uniform, homogeneous, nonabsorbing material of atomic mass A
at temperature T. We wish to calculate the equilibrium energy spectrum of
the neutrons in the material. This spectrum can be obtained in several ways.
For example, we could track a single neutron through many collisions,
scoring the energy of the neutron after each collision or after some number
of collisions. Alternatively we can track many neutrons through a number
of collisions, scoring the final energy of the neutron. In either case we must
be careful to allow the neutron to reach the energy range appropriate to the
temperature of the material.
The number of collisions required to bring the neutron into the correct
energy range will depend on the start energy, the material temperature, and
the atomic mass of the scatterer. We saw in Example 4.1 that a significant
number of elastic collisions is required, on the average, to reduce the energy
of a neutron from a few MeV to thermal, even in a low-Z scatterer. If the
source energy selected for this example is much greater than kT we will
have to discard the first few collisions just as we had to discard the first few
generations of neutrons in a criticality calculation to obtain the fundamental-
mode flux distribution.
For the purpose of this example we will assume the initial neutron
energy is the most probable value for room temperature, T = 293 K, or 0.025
eV. We will follow each source neutron through 24 or more collisions
(depending on the atomic mass of the target nucleus) and score the energy
after the final collision. A Fortran code to perform this calculation is shown
in Tables 9.31 and 9.32. The atomic mass of the scattering material and the
temperature are input parameters. The error function in eqn 9.52 can be
evaluated by table lookup or by Taylor expansion.s The function program in
Table 9.32 uses the latter method.
310 Chapter 9

Table 9.3/. Main Program for Example 9.5


DIMENSICN eg(52) ,nscor(52)
~ bol/8.617342e-5/,pi/3.14159265/
OPEN (UNIT=16, FIlE? 'ootplt. txt')
WRITE(*,*) Start reading inplt
2 WRITE(*,' (lx,a\) ')' Enter mnber of start particles'
READ (* , *) l'I1I\X
IF (l'I1I\X.EQ.O) S'roP
WRITE(*, , (lX,A\) ')' Enter start randan nutber seed '; READ(*, *) ISEED
CALL rn:iin(iseed) ! set initial randan II
WRITE(*,' (lX,A\) ')' enter nass of scatterer '; READ(*,*)a
WRITE(*,' (lX,A\)')' enter tenperature (K) '; READ(*, *)tetp ! End of inplt
nSa:R = 0; ckt=txll*tetp; eg(1)=O.0 ! initialize pararreters
ro i= 2,11; eg(i)=eg(i-1) +0.01; END ro set energy bounds
ro i=12,31; eg(i)=eg(i-l) +0.02; END ro
ro i=32,41; eg(i)=eg(i-l)+O.04; END ro
ro i=42,52; eg(i)=eg(i-l)+O.I; END ro ! last energy bounds
ro l'F1, l'I1I\X locp over l'I1I\X particles
e=0.025; u=O . ; v=O.; w=lo initial energy and direction
nscat=20+4*a # of collisions (scatters)
ro j = l,nscat locp over scatters
CALL Theon(a,e,tetp,u,v,w) 'Theon' perfonns scatter
END ro
Loc:p for index: ro i = 1,52 locp to find energy bin
index=I
if(e.le.eg(i» EXIT Loc:p for index if energy bin is foond
END ro Loc:p for index --
nscor(index) = iiscor (index) +1 score in correct energy bin
END ro End of locp over l'I1I\X particles
delta=eg(2)-eg(I); energ=eg (1) +delta/2.0 pararreters for first energy bin
suml=O.O; sUll2=O. 0 needed to acc.urulate scores
ro 10 i = 2,51 locp over bins, first is etpty
score=FLCm' (nscor (i) ) /delta/FImT (max) noon avg score by width of bin
ac = SQRT(a*energ/bol/tetp)
sigrat = (1.+I./2./ac**2)*erf(ac)+EXP(-ac**2)/ac/l.77245385 lac = alpha
suml=suml+score*delta/sigrat; sum2=sum2+score*delta*energ/sigrat
delta=eg(i+l)-eg(i); energ=eg(i)+delta/2.0
10 CXNI'INUE
WRITE (16, *)' Last bin, should be zero', nscor(52)
WRITE (16, *)' calc Avg Energy Theoretical Avg Energy ,
WRITE(16,*)sum2/suml,2.0*bol*tetp
WRITE (16, *)
WRITE (16, *)' Energy - Theoretical flux - calculated flux - Standard Dev '
delta=eg(2)-eg(1); energ=eg(I)+delta/2.0
ro 20 i=2,51
prcb=FImT (nscor (i) ) /FImT (max)
StDev=SQRT(prob-prob**2)/SQRT(FImT(max» ! binanial distr in eqn 2.29
score=prcb/delta noon by width of bin
StDev=StDev/delta
ac = SQRT(a*energ/bol/tetp)
sigrat = (1.+I./2./ac**2)*erf(ac)+EXP(-ac**2)/ac/l.77245385 lac = alpha
WRITE(16,*)eg(i),energ*EXP(-energ/ckt)/ckt**2,&
score/sigrat/suml,StDev/sigrat/suml
delta=eg(i+l)-eg(i); energ=eg(i)+delta/2.0
20 <XNrINUE
GJT02

The thermal calculation, which follows the preceding theoretical


structure, is performed in subroutine 'Therm.' Although this subroutine
calculates the post-collision neutron direction of travel (variables 'u,' 'v,'
and Ow' in the subroutine), only the post-collision energy is used in this
9. Advanced Applications of Monte Carlo 311

example. The value for x was calculated using rejection over the range 0 <
x < 4. Although in practice 0 < x < 3 is usually sufficient, the broader range
was used in this example in order to improve the agreement with the
theoretical results.

Table 9.32. Subroutine 'Therm' and Function 'Erf for Example 9.5
~ Thenn(a,e,temp,u,v,w)
RFAL(8) fltm
~ bol/8.617342e-5/,pi/3.14159265/ ! bol=Boltzmann canst
alpha = SCJ{['(a*e/temp/bol)
sigrat = (1.+I./2./alpha**2)*erf(alpha)+EXP(-alpha**2)/alpha/I.77245385
I xl = 4.*fltm() ! 'x' of eqn 9.48
x2 = ABS(alpha-xl) **3; x3 = (alpha+xl)**3-x2
x4 = O.45304*xl*x3*EXP(-xl**2)/alpha**2/sigrat
IF(x4-fltm() .It.O.) ro ro I
x7 = xl/alpha ! target velocity
x5=(alpha+xl) **3
rand=fltm()
xmut=(alpha**2+xl**2-(xS+rand*(x2-xS»**(2./3.»/2./alpha/xl ! mu of eqn 9.55
IF(ABS(xmut) .It.1.) ro ro 99
xmut=xmut*O.999995
IF(ABS(xmut) .It.1.) ro ro 99
WRITE(*,*)e,alpha,ac, sigrat,xl,x2,x3,x4,xS,x6,x7,rand,xmut
S'roP I
99 b = SCJ{['(I .-xmut**2)
rand = fltm(); c = COS(2.*pi*rand); d = SIN(2.*pi*rand)
IF(ABS(w).lt.O . 999) ro ro 2
sqrtu = SQRr(I.-u*u); wt = b*(c*u*w-d*v)/sqrtu+xmut*w
vt = b*(c*u*v+d*v)/sqrtu+xmut*v; ut = xmut*u-b*c*sqrtu
ro ro 3
2 sqrtw = SCJ{['(1.-w*w); ut = b*(c*w*u-d*v)/sqrtw+xmut*u
vt = b* (c*W*v+d*u) /sqrtw+xmut*v; wt = xmut*w-b*c*sqrtw
3 wO = 2*fltm()-1. ! get isotrcpic unit vector
sinth = SQRr(1.-wO*wO); Iill = 2. *pi*fltm()
uO = sinth*COS(Iill); vO = sinth*SIN(Iill); yl = (1.+x7*(x7-2.*xmut»
IF(y1.gt.O.) ro ro 98
WRITE(*,*) x7, xmut, yl
S'roP 2
98 yl = SQRT(yl); y3 = u+a*(uO*yl+x7*ut); y4 = v+a*(vO*yl+x7*vt)
y5 = w+a*(wO*yl+x7*wt); y6 = y3**2+y4**2+y5**2
e = e*y6/ (1. +a) **2 ! ootgoing neutroo energy and directioo.
y2 = l./SQRr(y6); u = y3*y2; v = y4*y2; w = y5*y2
RE:ruP.N
END
FUOCI'ICN ERF(X)
IF(x.gt.l.5) ro ro I
erf = x-x**3/3.+x**5/10.-x**7/42.+x**9/216.-x**11/1320.+x**13/9360.
erf = erf*1.12837917
RE:ruP.N
1 erf = 1.-.5/x/x+.75/x**4-1.875/x**6+3.281/x**8-7.383/x**IO
erf = 1.-EXP(-x*x)/x/I.77245385*erf
RE:ruP.N
END

The final energy calculated for each neutron is scored in an energy


structure consisting of 51 groups, some of which are shown in the first
column of Table 9.33. The energy resolution is arbitrary and was selected to
have an appropriate grouping for temperatures as high as T= 1000 K while
312 Chapter 9

still having sufficient energy resolution to allow us to estimate the average


energy of the calculated spectrum.
The results of running the program in Table 9.31 with 106 particles, A =
1 and a temperature of300 K are shown in Table 9.33. For comparison, the
theoretical thermal spectrum is also shown in the table. This theoretical
spectrum is obtained from the energy-dependent, equilibrium neutron flux
for a Maxwellian distribution. This can be found by multiplying eqn 9.46
by the velocity of the neutron, giving

~(E)dE =_E_ e -%T dE (9.71)


(kT)2

where the function is normalized so that the integral over all energies gives a
unit flux.

Table 9.33. Thermal Neutron Flux Spectra for T = 300 K


Energy (eV) Theoretical Value Calculated Value
1.0E-02 6.1657 5.657 ± 0.016
2.0E-02 12.563 12.37 ± 0.029
3.0E-02 14.222 14.233 ± 0.034
4.0E-02 13.524 13.514 ± 0.035
5.0E-02 11.810 11.810 ± 0.034
6.0E-02 9.8042 9.7694 ± 0.032
7.0E-02 7.8699 7.8884 ± 0.029
8.0E-02 6.1677 6.1869 ± 0.027
9.0E-02 4.7478 4.7559 ± 0.024
1.0E-Ol 3.6041 3.5981 ± 0.021
0.120 2.3360 2.3625 ± 0.012
0.140 1.2736 1.3117 ± 0.0091
0.160 0.67797 0.6886 ± 0.0067
0.180 0.35447 0.3609 ± 0.0049
0.200 0.18277 0.1874 ± 0.0035
0.220 9.3194-02 9.643-02 ± 2.5-3
0.240 4.7088-02 5.067-02 ± 1.8-3
0.260 2.3612-02 2.29E-02 ± 1.2-3

If eqn 9.71 is differentiated with respect to E and the result set equal to
zero, it can be seen that the maximum flux occurs at an energy of kT.
Multiplying eqn 9.71 by the energy, and performing the integration to find
the average energy for the flux gives a result of2kT. This calculation of the
average energy will be used to help confirm the accuracy of the current
Monte Carlo results.
The results obtained for neutron spectra in hydrogen for three different
temperatures, again using 106 source particles, are plotted in Figure 9.6.
The uncertainties shown do not measure all sources of error; for example,
they do not include a consideration of whether sufficient collisions have
9. Advanced Applications ofMonte Carlo 313

taken place to reach equilibrium conditions. However, the calculated results


are close to the theoretical values, except for the two lowest energy groups.
Table 9.34 gives the average energy at the three different temperatures based
on the mean Monte Carlo results. The calculated average energy values
match the theoretical values to at least two decimal places. Thus, although
we have not examined the effect of increasing the number of scattering
events before scoring the particle energy, it appears that 24 scattering events
provide a reasonable thennal energy distribution for hydrogen.

15 r------------------------------.

10

w
:g
w
f 5

0 .0 0.1 0.2 0.3 0.4


Energy - eV

Figure 9.6. Calculated Equilibrium Neutron Spectra

Table 9.34. Average Energy of ThermaI Flux Spectra


Temp (K) Theoretical avg energy (eV) Calculated avg energy (eV)
300 5.170E-02 5.1 84E-02
500 8.6 I 7E-02 8. 629E-02
1000 0.1723 0.1725

As stated, when applying the thennal scattering model we would


nonnally use as an upper limit of the integral in eqn 9.50 a target velocity
that corresponds to an energy of 9kT. If we take this energy as a transition
point between the zero-temperature and thennal-scattering models we can
develop an elastic-scattering model that accounts for both slowing down
from high energies and thennal scattering at low energies. We can use the
isotropic, center-of-mass scattering model of Section 4.1 for neutron
energies above 9kT and the model of this section for neutron energies below
9kT. While such a combined model will still be limited by the assumptions
on which it is based - isotropic elastic scattering in the center of mass, with
the free-gas kernel applied at low energies - it mimics the models used in
current continuous-energy production Monte Carlo transport codes.
314 Chapter 9

Exercises

1. Use correlated sampling for the following:


a. Determine the sensitivity of the particle leakage in Example 6.1 to the
total cross section. Assume the value of c does not vary.
b. Using the results from Example 4.3, determine the sensitivity of the
of the age of thermal neutrons in water from a fission source to the total
cross section for neutrons in hydrogen above 1 MeV.

2. Use adjoint transport to determine the probability of a particle passing


through a slab two mean free paths thick as a fun9tion of the angle at which
the particle strikes the slab (see Figure 9.7). Assume isotropic scattering in
the laboratory coordinate system with c = 1. [Hint: place an isotropic
adjoint source on one face of the slab and score leakage through the
opposite face of the slab as a function of angle.] Verify your answer at
several angles using forward calculations.

Slab

Adjoint _
j o Adjoint

I
leakage source

Figure 9.7. Geometry for Exercise 9.2

3. Example 9.5 assumed all source particles were born with an energy of
0.025 eV and their energy was scored after 20 collisions. Consider the
following variations on that calculation.
a. Repeat the example calculation using the technique of tracking a single
neutron through many collisions.
b. Use the technique of following many neutrons and scoring the energy
of each after some fixed number of collisions, but choose several
different start energies. Then, instead of using a fixed start energy, vary
the start energies within a single calculation. Did the results change?
c. Using the same parameter values as those used in the example,
examine the effect of changing the number of collisions a neutron is
allowed to undergo before scoring its energy. Is there an optimum
number of collisions that will minimize the run time of the calculation
while guaranteeing an equilibrium spectrum?
9. Advanced Applications ofMonte Carlo 315

I See George I. Bell and Samuel Glasstone, Nuclear Reactor Theory, Van Nostrand Reinhold,
New York, 1970, Section 2.7, for the effect of the change of variables on the one-speed
transport equation.
2 This manipulation is described in numerous places and the details are not reproduced here.
See ibid., pp. 257-58; James H. Renken, "Use of Solutions to the Adjoint Transport
Equation for the Evaluation of Radiation Shield Designs," Sandia Laboratories,
Albuquerque, NM, Report SC-RR-70-98, January 1970; G. E. Hansen and H. A.
Sandmeier, "Neutron Penetration Factors Obtained by Using Adjoint Transport
Calculations," Nuc Sci Eng 22,1965, pp. 315-320.
3 M. H. Kalos, Appendix G of "ANTE 2, Adjoint Monte Carlo Time-Dependent Neutron
Transport Code in Combinatorial Geometry," Mathematical Applications Group Inc.
(MAGI), White Plains, NY, 1970. See also Hansen and Sandmeier, op. cit.
4 See Bell and Glasstone, op. cit., pp. 604-5.
S Ibid.
Appendix
Random Number Generators

"Anyone who considers arithmetical methods of producing


random digits is, of course, in a state of sin."J

Monte Carlo calculations require access to random numbers. Non-


repeatable sequences, or strings, of truly random numbers can be obtained,
at least in theory, from electronic noise, radioactive decay, and other natural
random events. However, in Monte Carlo it is often desirable to be able to
repeat a calculation exactly and thus it is desirable to use a repeatable
random number sequence. Computers are excellent tools for generating
repeatable strings of this sort, but any computer-generated random number
sequence will necessarily be subject to the limitations of the algorithm used
and to the fact that the computer is a digital machine with a finite word
length. A repeatable string of random numbers generated on a computer is
properly called a pseudorandom number string. Fortunately the
imperfections of good random number generators are frequently minor and
can usually be tolerated by Monte Carlo practitioners.a Consistent with
most of the Monte Carlo literature, a computer-generated pseudorandom
number string will be referred to here as a random number string.
A good random number generator should have several properties,
including the following:

a "It is the almost universal practice to use, as 'random generators,' devices ... which do not
even pretend to have more than a trace of true randomness. ... This would be very
discouraging, were it not for the fact that, when 'random numbers' are used in practice, we
generally require only a few of the properties of randomness, and all others are immaterial."
1. H. Halton, "A Retrospective and Prospective Survey of the Monte Carlo Method," SIAM
Review 12, 1970. pp. 5-6.
317
318 Appendix

• The period should be long (i.e., such a generator should produce many numbers
before repeating its sequence such that no portion of the string is reused in a
calculation),
• The numbers produced should tend to be equidistributed (i.e., a string of several
hundred or more numbers should tend to be uniformly distributed over the
interval of interest),
• The numbers should be uncorrelated (i.e., each number in the sequence should
be statistically independent of, or uncorrelated with, the previous numbers), and
• The algorithm should have rapid accessibility (i.e., the computational time
devoted to obtaining the random numbers should be small).
Interestingly, a high degree of equidistribution is not usually a feature of
true random number strings. Thus a truly random string of numbers may not
be as effective in Monte Carlo as applied to particle transport, where a
thorough sampling of the important regions of phase space is necessary in
order to obtain a correct answer, as a pseudorandom, equidistributed string.
Deliberately equidistributed strings of "random" numbers are called quasi-
random and a special discipline has been developed to address such random
number strings.
One might anticipate that complexity in a random number generator
would be more likely to ensure randomness than simplicity. As a result a
number of complicated, multi-step algorithms have been proposed for
generating random number sequences. However, complication appears to
offer no guarantee of randomness and generally incurs high costs in
computing requirements. Some extremely complicated algorithms that have
been postulated have been found to make extraordinarily bad random
number generators.
Users frequently are tempted to "tinker" with random number generators
in an attempt to improve them. However, unless the tinkerer is quite
knowledgeable in the arcane art of tuning random number generators, this
almost always results in reduced performance and can produce very bad
results. Bad random number generators are easy to come by; good ones are
not.
Random number generation on a digital computer often involves the use
of remainders, or low-order bits, extracted from the results of various
mathematical procedures. In the simplest case each random number Xn is a
function only of the previous random number xn-,:

(A.I)

This simple formulation certainly meets one of the requirements for random
number generators listed above - it allows the user to select a start random
number, XQ, and be assured that the resulting sequence will always be
Random Number Generators 319

reproducible. The problem is to define the function f such that the


application of eqn A.I will produce a sequence that meets minimum
standards of length, equidistribution, noncorrelation, and rapid execution.
The classical and probably still most commonly used random number
generator is the linear congruential generator (sometimes called the mixed
congruential generator). This generator employs a large integer, M, called
the modulus, to generate a sequence of integers Yn, 0 ~ Yn ~ M-I, by the
recursion relation

yn+1 = mod(aYn +c,M) (A.2)

Here a and c are integers and mod(l;,,,) designates the modulo function; i.e.,
the remainder after subtracting from l; the largest integral multiple of" that
is less than or equal to l;. Random numbers Xn in [0,1) are obtained from the
Yn by the normalization .

(A.3)

The starting point for the sequence of eqn A.2 is Yo, which may be set by the
user for each calculation. The quantity Yo is sometimes called the start
random number, or the seed, even though the actual start random number is
yolM.
It is obvious that in the string of numbers produced by eqn A.2 each
number can appear once and only once before the string repeats. Therefore
the period of a linear congruential random number generator - the length of
the sequence generated before the starting number is repeated - is per(xn) ~
M. That is, in the best case of eqn A.2 the Yn will take on all values in the
range [O,M-I], after which the sequence will be repeated. A generator that
meets this best-case requirement is known as a purely periodic random
number generator. For a linear congruential random number generator the
maximum period depends on the computer word length. The largest period
for a 16-bit machine in single precision is 2 16 = 65536. A 32-bit machine in
single precision, or a 16-bit machine in double precision, will extend the
maximum period to 232 ~ 4.29xl09.
Conditions that guarantee per(xn) = M are known. Specifically the linear
congruential sequence of eqn A.2 has the period M if and only if
a) c is relatively prime to M; i.e., c and M have no common prime factors
greater than I,
b) a-I is a multiple of p, for every prime p dividing M, and
c) a-I is a multiple of 4 if M is a multiple of 4.
Selecting coefficients for eqn A.2 that guarantee per(Yn) = M is no guarantee
that the random numbers that result from the algorithm will be "good." For
320 Appendix

example, if we select a = c = 1 and Yo = 0, we obtain the sequence Yo = {O, 1,


2, 3, ... , M-I}. Obviously such a sequence, while having a period of M and
being as random as any other sequence of these integers, is not very useful
for Monte Carlo sampling. Eqn A.2 will be useful as a random number
generator only if some choices for the parameters produce more
"interesting" sequences of numbers.
Eqn A.2 has been studied extensively for moduli that are powers of two;
i.e., for which M = 213 , where f3 is an integer. In this case per(Xo) = M can be
guaranteed if a is defined such that mod(a,4) = 1, and c is odd. For example,
we may consider M = 16 and a = 1. Then for the c values given in Table
A.I we obtain the corresponding Yo values shown in the table. In each case
Yo was chosen to be zero. Changing Yo merely moves the start point of the
sequence and has no effect on the numbers selected. Choosing an even
value for c would reduce the period by a factor of two compared with
choosing c odd.

Table A. J. Pseudorandom Numbers from a Linear Con~ential Generator with M= 16, a= I


c=1 c=5 c= II c= 15
Yo 0 0 0 0
YI I 5 II 15
Y2 2 10 6 14
Y3 3 15 I 13
Y4 4 4 12 12
Ys 5 9 7 II
Y6 6 14 2 to
Y7 7 3 13 9
Ys 8 8 8 8
Y9 9 13 3 7
YlO to 2 14 6
Yll II 7 9 5
YI2 12 12 4 4
YJ3 13 I 15 3
YI4 14 6 10 2
YIS 15 II 5 I
YI6 0 0 0 0

It is apparent that for this example the choice a = 1 is not very "good."
For each of the values of c given in the table the period of the sequence is
indeed equal to M, but the "randomness" of the sequence leaves a great deal
to be desired. A "better" sequence can be obtained for large a. For
example, for a = 9, c = 11, and yo = 0, we obtain the sequence {O, 11, 14,9,
12, 7, 10, 5, 8, 3, 6, 1, 4, 15, 2, l3, O}. This sequence begins to "look"
somewhat better than those in Table A.I. However, as has been pointed out
by many authors, the virtue ofa sequence of "random" numbers, like beauty,
is in the eye ofthe beholder. 2
Random Number GeIJerators 321

A special case of the linear congruential random number generator is that


for which c = O. This special case is called the multiplicative congruential
generator. It was suggested by Lehmer in 1951 3 and has proved to be
remarkably robust. By eliminating the addition of a constant in the
argument of the modulo function the multiplicative model is faster to
execute than the linear model with c -::t: O. The maximum period of the
multiplicative congruential generator is M-l rather than M since if Yn = 0 the
string degenerates to all zeros. This maximum length can be assured if M is
prime, a is a primitive root of M (i.e., a is an integer greater than one and
less than M for which mod(an,M) -::t: I for all integers n, 0 < n < M), and Yo-::t:
O. Alternatively, a sequence of length per(Yn) = 213-2 can be produced by a
linear congruential random number generator if M = 213 , mod(a,8) = 5, and
Yo is odd.
For example, for M = 13 we have the primitive roots 2, 6, 7, and 11. The
other values of a, 0 < a < 13, are not primitive roots of M because in each
case there exists an integer 0 < n < M for which mod(an,M) = 1. Therefore
all sequences of eqn A.2 with M = 13, c = 0, and a = {I, 3, 4, 5, 8, 9, 10, 12}
will have per(Yn) < M-1. Primitive roots come in pairs: a = mod(kb,M) is a
primitive root if and only if a' = mod(kM-I-b,M) is a primitive root. Table
A.2 shows an example of a multiplicative congruential generator with M =
13 and Yo = 1. As before some of the strings in Table A.2 may "look" more
random than others although all are full period and all are equally probable
representations of a set of random integers over the range 1 through 12.

Table A.2. Pseudorandom Numbers from a Multi2licative Conl[!;!ential Generator, M=13


a=2 a=6 a=7 a= 1l
Yo 1 1 1 1
YI 2 6 7 1l
Y2 4 10 10 4
Y3 8 8 5 5
Y4 3 9 9 3
Ys 6 2 11 7
Y6 12 12 12 12
Y7 1l 7 6 2
Ys 9 3 3 9
Y9 5 5 8 8
YIO 10 4 4 10
YII 7 1l 2 6
YI2 1 1 1 1

The linear congruential method has a number of known deficiencies in


addition to the connection between the period and the computer word
length. Various long-range correlations have been found in the sequences of
numbers produced by these generators. One limitation applicable to all
digital-computer-based random number generators, whether linear
322 Appendix

congruential or not, is that the Xn are rational fractions and the range (0,1) is
sampled discretely rather than continuously. A second limitation of the
linear congruential generator is that the sequence of geometric points
defined by the adjacent random numbers Xn produced by such a generator lie
in hyperplanes. For example, in 3-dimensional space eqn A.2 will always
produce sets of points {XI ,X2 ,X3}, {X2 ,X3, '4}, {X3, '4, xs}, etc, that lie on a
finite set of planes in three-dimensional space. This phenomenon is called
the lattice structure of the generator.
For k-dimensional space there are at most Milk such planes on which the
points lie and, depending on the choice of parameters, the points may lie on
many fewer planes than this. The separation between these hyperplanes has
a minimum value depending on the specifics of the generator. Even for
values of M, a, and c that produce full period sequences, eqn A.2 tends to
produce points that lie on widely spaced planes. Studies of the lattice
structure produced by various combinations of linear congruential
parameters have shown that some combinations are significantly better than
others; i.e., that the distance between their lattice planes is close to the
minimum value.
With the help of Fishman, Park and Miller have defined what they refer
to as a "good, minimal standard random number generator" with c = 0. 4 For
a computer word length of 32 bits they recommend a multiplicative
congruential generator with M = 23L} = 2147483647, and a = 75 = 16807.
The lattice structure for this generator does not quite meet the criterion,
recommended by Fishman, that the spacing between the lattice planes be
less than 1.25 times the minimum, but the lattice spacing for this generator
is within about 1.3 times the minimum. Suggested alternatives for a are
39373, 48271, and 69621. L'Ecuyer has tested this "minimal standard
random number generator" and found that it failed six of ten tests for
randomness. b However, the tests were stringent and the fact is that the Park-
Miller random number generator is of good quality.
Implementing a program . for using eqn A.2 that does not exceed the
integer capacity of a 32-bit machine requires avoiding the multiplication a x
Yn. This can be done by performing the modulo process prior to the
multiplication, as in the method of Schrage. 5 In this method we factor Minto

M =qa+r (A.4)

where

b Pierre L'Ecuyer, "Efficient and Portable Combined Random Number Generators," Comm
ACM 31, 1988, pp. 742-774. L'Ecuyer also tested a = 39373 and found it to be a good
choice. The other two choices for a suggested by Park and Miller have not been tested
thoroughly but appear to be as good or better than 39373.
Random Number Generators 323

q = div(M,a) (A.S)

and

r= mod(M,a) (A6)

Here div(S,T) is the largest integer that, when multiplied by T), gives a result
that is less than or equal to S. We note that q ;?: I and I ::;; r ::;; a-I, when a <
M is relatively prime to M.
Let us rewrite eqn A2, with c = 0, as

F(y) = mod (ay,M) (A7)

Since ay = Mdiv(ay,M) + mod(ay,M) this can be written as

F(y) = ay- Mdiv(ay,M) (AS)

Further, since y = qdiv(y,q) + mod(y,q), then

ay = aq div(y,q) + a mod(y,q) (A.9)

Substituting this into eqn AS, and using qa = M - r from eqn AA, gives

F(y) =a mod(y,q) - r div(y,q) + M[div(y,q) - div(ay,M)] (A.lO)

or

F(y) = y(y) + Mo(y) (All)

The functions y and 0 are given by

y(y) = a mod(y,q) - r div(y,q) (A. I2)

and

o(y) =div(y, q) - div( ay, M) (A 13)

It can be shown that for r < q, and for all y in {1, 2, ... , M-I}, that
(1) B(y) is either 0 or 1
(2) both amod(y,q) and rdiv(y,q) are in {O, 1,2, ... ,M-I}
(3) ly(Y)1 :$; M-I
324 Appendix

In this formulation it is not necessary to evaluate o(y) because o(y) = 0 if


and only if 1 ~ y(y) ~ M-l, and o(y) = 1 if and only if -(M-l) ~ y(y) ~ -1. In
the Schrage method the generator first evaluates y(y). If y(y) is greater than
zero then F(y) = y(y); otherwise F(y) = y(y) + M. Thus it is not necessary to
calculate quantities whose absolute value is greater than M.
For the examples described in this book we have chosen to implement
the Park-Miller 32-bit minimal standard random number generator using the
Schrage algorithm. c The Fortran for the resulting routine 'fltm' is shown in
Table A.3. The implementation of the Schrage algorithm is obvious in the
variable names used in the routine, which reflect those of eqns A.4 through
A.l3. Although the routine is in Fortran, and thus the efficiency of its
execution will depend on the compiler and options used to convert it to
machine language, the Fortran has been designed to maximize the
probability of producing an efficient executable. For example, the random
number that is produced is assigned to the function name itself, not to an
argument. This allows the function to be called without arguments, which
reduces the variable addresses required for execution and improves the run
time. The initial seed is used as an argument for the function in some other
versions ofthis random number generator.
The data statement in 'fltrn' in which the variable 'seed' is set to one is
used to provide the default start random number seed Yo = 1 should the user
wish to use a default value. If another seed is desired the user may change
the Fortran or call the subroutine 'mdin,' which is shown in Table A.4. The
latter method is used in the examples in this book. Subroutine 'mdin' sets
the seed in 'fltm' to any value greater than zero and less than M that is
selected by the user.
The next, unused random number in the sequence can be retrieved at any
time by calling the subroutine 'mdout.' The main purpose of this subroutine
is to allow the user to stop a calculation to review interim results and then
resume at the same point. Thus a lengthy calculation can be broken into two
or more parts in a repeatable manner without concern about losing or
duplicating any portion of the random number string. By calling 'mdout'
before terminating a calculation, and when resuming the calculation setting
the seed to the value obtained from 'mdout,' the results obtained will be
identical to those that would have been obtained had the calculation not
been interrupted. Subroutine 'mdout' is shown in Table A.5.
When a calculation is broken into two or more parts, the intermediate
results and the variance estimates for these results must be combined to
obtain the final answer and the associated variance in this answer. This is
usually done by calculating the weighted average of the individual estimates

C The authors wish to thank Lester Petrie of the Oak Ridge National Laboratory for his
assistance in suggesting and implementing this random number generator.
Random Number Generators 325

of the answer. Thus if the calculation is broken into n pieces, the ith piece
of which provides the intermediate mean Vi, with variance Var(Vi), then the
best estimate of the true mean is

(v) = var(v) t Vi (A.14)


n i=1 var(v)

where var(v) is the best estimate of the variance of this mean,

var(v)=[t I ]-1 (A.15)


i=1 var(v i )

Table A.3. Random Number Generator 'fltm'


mcrICN fltm () 1
REm. (8) fltm, fm 2
~ a,m.q, r,hi,lo, seed 3
PARAMEl'ER (a=16807, m = 2147483647, q = 127773, r = 2836) 4
PARAI£l'ER(fm=m) 5
<XHOI/rarxlseed/seed 6
DATA seedll/ 7
hi = seedlq 8
10 = MD(seed,q) 9
seed = a*lo - r*hi 10
IF (seed. IE. 0 ) seed = seed +m 11
fltm = IEE(seed)/fm 12
RE:l'Um 13
END 14

Table A.4. Subroutine for Setting Start Random Number


SUBR:lJl'INE mdin(iin) ! mdin sets the =rent rancbn nurber seed 1
<XHOI/randseed/iseed 2
iseed=iin 3
IF(iin.LT.1) iin=1 4
IF(iin.GT.2147483646)iin=2147483646 5
RE:l'Um 6
END 7

Table A.5. Subroutine for Obtaining Next Random Number


SUBR:lJl'INE m::b.tt (ioot) ! m::b.tt retums the =rent rancbn IUllber seed 1
<XHOI/rarxlseed/iseed 2
ioot=iseed 3
RE:l'Um 4
END 5

The smallest number that can be returned by ' fitm' is Xmin = [231_1]-1 ~
4.66 x. 10-10• Every number returned will be an integral multiple of this
value, and the largest number returned will be l-Xmin. That is, the random
numbers will be selected from a discrete grid determined by the specifics of
the generator and the word length of the computer being used. The values
326 Appendix

of a random variable other than those defined by such discrete grid points
cannot be accessed. Furthermore, every number available to the generator
will be used once and only once during each period of the generator. Thus
'fltrn' is an exclusive generator; i.e., a number once selected is discarded
from the remainder of the numbers from which the next number in the
sequence will be selected. These constraints clearly bias the generator since
a truly random string should be continuous, and the probability of selecting
a particular number should be constant regardless of the values already
selected.
To avoid the risk of encountering long-range correlations in the number
sequences produced by pseudorandom number generators, it is frequently
recommended that only a small part, typically no more than 10%, of the
period of a random number generator be used in a given Monte Carlo
calculation. The period of 'fltm' is approximately 2.1475 x 109• This
period is acceptable for the simple examples presented in this book but is
not adequate for calculations in which many particles are tracked or in
which many random numbers are used per start particle. Thus it should be
considered at best marginal for production use.
Fortunately various algorithms are available that enable one to obtain a
period for a random number generator that is much greater than 213, where J3
is the word length of the computer on which the generator is used. Such
algorithms include the multiple-recursive congruential method, the explicit
inversive congruential technique, and various shift-register methods. An
alternative formulation of the Park-Miller generator that has been combined
with a Marsaglia shift sequence is presented by Numerical Recipes in
Fortran 90: The Art of PARALLEL Scientific Computing. 6 This shift-
register version of the minimum standard generator has a period of about 3.1
x 10 18• The Mersenne Twister, developed by Matsumoto and Nishimura,
has a reported period of 219937_1.7 The interested reader can find information
on other random number generators in the books and articles cited in the
bibliography.

1 John von Neumann, "Various Techniques Used in Connection With Random Digits," Monte
Carlo Method, A. S. Householder, G. E. Forsythe, and H. H. Germond, eds., National
Bureau of Standards Applied Mathematics Series 12, U. S. Government Printing Office,
Washington, D.C., 1951, p. 36.
2 William H. Press, Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling,
Numerical Recipes in C. The Art o/Scientific Computing, Cambridge University Press, New
York, Cambridge, 1988, p. 204.
3 D. H. Lehmer, "Mathematical methods in large-scale computing units," Annu. Comput. Lab.
26, Harvard Univ., 1951, pp. 141-146.
4 Stephen K. Park and Keith W. Miller, "Random Number Generators: Good Ones are Hard
to Find," CommACM31, 1988,pp. 1192-1201.
Random Number Generators 327

S P. Bratley, B. L. Fox, and E. L. Schrage, A Guide to Simulation, Springer-Verlag, New


York, 1983, pp. 180-213. See also P. L'Ecuyer, "Random Number Generation," Chapt. 4 in
Handbook on Simulation, Jerry Banks, ed., John Wiley & Sons, New York. 1998, p. 112-
13.
6 Numerical Recipes in Fortran 90: The Art of PARALLEL Scientific Computing, Chapter B7,
Cambridge University Press, 1986-1996, p. 1142. A web version is available at
http://www.nr.com. Other generators are provided in this reference.
7 M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally Equidistributed
Uniform Pseudorandom Number Generator," ACM Trans on Modeling and Computer
Simulation 8, 1998, pp. 3-30. This generator is available on the web at
http://www.math.keio.ac.jp/-matumoto/emt.html.
Bibliography

The present volume has only touched on the wide range of techniques
and applications amenable to Monte Carlo methods. There are many books
available to explain and elaborate on various aspects of using Monte Carlo
methods to perform radiation transport calculations, and the interested
reader in encouraged to pursue those areas of particular interest or otherwise
appropriate to a specific area of specialty. Technical journals frequently
publish papers that describe various applications of Monte Carlo and report
the latest research and developments in the field. Finally, many technical
reports from laboratories and industry contain items of interest.
Listed below are a few references that the reader might find useful for
considering alternative approaches to a particular topic, for providing
elaboration on areas of interest, or for extending study into additional areas.
The early references, which were mostly published prior to 1980, remain
excellent sources of information on Monte Carlo. However, they tend to be
limited in scope compared with recent publications. Therefore a sampling
of both old and recent books are cited. Finally, state-of-the-art Monte Carlo
transport capability exists in the production codes that are in use by the
community at large. These codes are usually described in users' manuals
that are provided with the software. Only a sampling of such users'
manuals, both old and new, is provided here and the actual list of codes
available is much larger than that shown.
The production codes, and the latest editions of the users' manuals, may
be obtained from the organizations sponsoring the development of the
codes, or from the Radiation Safety Information Computational Center at
the Oak Ridge National Laboratory, Oak Ridge, Tennessee. This Center is
supported by the U. S. Department of Energy and other organizations for the
purpose of compiling and distributing software related to radiation safety,
transport, and shielding. The Center is a convenient source for obtaining all
manner of radiation analysis software and documentation, as well as
practical help in implementing the software on various computers.
329
330 Bibliography

Early Monte Carlo references:

L. L. Carter and E. D. Cashwell, Particle-Transport Simulation with the


Monte Carlo Method, Technical Infonnation Center, Office of Public
Affairs, U.S. Energy Research and Development Adminstration, TID-26607,
Washington, D.C., 1975.
E. D. Cashwell and C. J. Everett, A Practical Manual on the Monte
Carlo Methodfor Random Walk Problems, Pergamon, New York, 1959.
C. J. Everett and E. D. Cashwell, "A Third Monte Carlo Sampler," LA-
9721-MS, Los Alamos National Laboratory, Los Alamos, NM, 1983.
G. Goertzel and M. H. Kalos, "Monte Carlo Methods in Transport
Problems," Progress in Nuclear Energy, Physics and Mathematics Series 1,
Vol. 2, Pergamon, New York, 1958. p.315.
J. M. Hammersley and D. C. Handscomb, Monte Carlo Methods,
Chapman and Hall, London, 1964.
H. Kahn, "Applications of Monte Carlo," AECU-3259, Rand
Corporation, Santa Monica, CA, 1954.
M. H. Kalos, F. R. Nakache, and J. Celnik, "Monte Carlo Methods in
Reactor Computations," Chapter 5 of Computing Methods in Reactor
PhYSics, H. Greenspan, C. N. Kelber, and D. Okrent, eds., Gordon and
Breach, New York, 1968. p. 365.
W. E. Selph and C. W. Garrett, "Monte Carlo Methods for Radiation
Transport," Chapter 5 in Reactor Shielding for Nuclear Engineers, N. M.
Schaeffer, ed., U.S. Atomic Energy Commission Office of Infonnation
Services, TID-25951, 1973. p.207.
Y. A. Shreider, ed., The Monte Carlo Method, Pergamon, New York,
1966.
J. Spanier and E. M. Gelbard, Monte Carlo Principles and Neutron
Transport Problems, Addison-Wesley, Reading, MA, 1969.

A sampling of recent references:

T. W. Anderson, An Introduction to Multivariate Statistical Analysis, J.


Wiley and Sons, New York, 1984.
N. Bouleau and D. Lepingle, eds., Numerical Methods for Stochastic
Processes, J. Wiley and Sons, New York, 1994.
Bibliography 331

G. S. Fishman, Monte Carlo: Concepts, Algorithms, and Applications,


Springer Verlag, New York, 1996.
D. P. Landau and K. Binder, A Guide to Monte Carlo Simulations in
Statistical Physics, Cambridge University Press, New York, 2000.
J. E. Gentle, Random Number Generation and Monte Carlo Methods,
Springer Verlag, New York, 1998.
T. M. Jenkens, W. R. Nelson, and A. Rindi, eds., Monte Carlo Transport
of Electrons and Photons, Plenum, New York, 1988.
M. H. Kalos and P. A. Whitlock, Monte Carlo Methods, Volume I.
"Basics," J. Wiley and Sons, New York, 1986.
D. E. Knuth, The Art of Computer Programming: Seminumerical
Algorithms, 3rd ed., Vol. 2, Chapter 3, "Random Numbers," Addison-
Wesley, Reading, MA, 1997.
P. L'Ecuyer, "Random Number Generators," Handbook on Simulation,
Chapter 4, Jerry Banks, ed., J. Wiley and Sons, New York, 1997. p. 93.
I. Lux and L. Koblinger, Monte Carlo Particle Transport Methods:
Neutron and Photon Calculations, CRC Press, Boca Raton, FL, 1991 .
P. K. MacKeown, Stochastic Simulation in Physics, Springer Verlag,
New York, 1997.
C. P. Robert and G. Casella, Monte Carlo Statistical Methods, Springer
Verlag, New York, 1999.
I. M. Sobol, A. Sobol, and I. M. Sobol, A Primer for the Monte Carlo
Method, CRC Press, Boca Raton, FL, 1994.
D. Vose, Risk Analysis: A Quantitative Guide, J. Wiley and Sons, New
York, 2000.
B. White, Programming Techniques for Software Development, Van
Nostrand Reinhold, New York, 1989.

A selection of manuals for Monte Carlo production codes:

J. F. Briesmeister, ed., "MCNpTM - A General Monte Carlo N-Particle


Transport Code," LA-13709-M, Los Alamos National Laboratory, Los
Alamos, NM, 2000. 1
R. R. Coveyou, J. G. Sullivan, H. P. Carter, D. C. Irving, R. M.
Freestone, Jr., and G. B. K. Kam, "05R, A General-Purpose Monte Carlo
Neutron Transport Code," ORNL-3622, Oak Ridge National Laboratory,
Oak Ridge, TN, 1965.
332 Bibliography

D. E. Cullan, A. L. Edwards, and E. F. Plechaty, "Tart-95: A Coupled


Neutron-Photon Monte Carlo Transport Code," UCRL-MA-121319,
Lawrence Livennore National Laboratory, Livennore, CA, 1995.
S. A. Dupree and R. E. Lighthill, "Sandia National Laboratories
CDC7600 Version of MORSE-SGC," Sandia National Laboratories,
Albuquerque, NM, 1982.
S. K. Fraley, "User's Guide to MORSE-SGC," ORNLlCSD-7, Oak
Ridge National Laboratory, Oak Ridge, TN, 1976.
J. A. Halbleib, "Integrated TIGER Series," SAND95-1561A, Sandia
National Laboratories, Albuquerque, NM, 1995.
L. M. Petrie and N. F. Landers, "KENO V.a: An Improved Monte Carlo
Criticality Program with Supergrouping," NUREG/CR-0200,
ORNLINUREG/CSD-21R6, Oak Ridge National Laboratory, Oak Ridge,
TN,2000. 2
R. E. Prael and D. G. Madland, "The LAHET Code System with
LAHET2.8," LA-UR-00-2140, Los Alamos National Laboratory, Los
Alamos, NM, 2000. 3
E. A. Straker, W. H. Scott, Jr., and N. R. Bym, "The MORSE Code with
Combinatorial Geometry," DNA-2860T, Science Applications, Inc., La
Jolla, CA, 1972.
E. A. Straker, P. N. Stevens, D. C. Irving, and V. R. Cain, "The MORSE
Code - A Multigroup Neutron and Gamma-Ray Monte Carlo Transport
Code," ORNL-4585, Oak Ridge National Laboratory, Oak Ridge, TN, 1970.
J. T. West, T. J. Hoffman, and M. B. Emmett, "MORSE-SGC for the
SCALE System," NUREG/CR-0200, ORNLINUREG/CSD-2N21R6, Oak
Ridge National Laboratory, Oak Ridge, TN, 2000.2
T. Wilcox, "MORSE-L, A Special Version of the MORSE Program
Designed to Solve Neutron, Gamma and Coupled Neutron-Gamma
Penetration Problems," UCID-16680, Lawrence Livennore Laboratory,
Livennore, CA, 1972.

References for Neutron Transport Theory

G. I. Bell and S. Glasstone, Nuclear Reactor Theory, Van Nostrand


Reinhold Co., New York, 1970.
K. M. Case and P. F. Zweifel, Linear Transport Theory, Addison-
Wesley, Reading, PA, 1967.
B. Davison, Neutron Transport Theory, Oxford University Press, New
York, 1957.
Bibliography 333

S. Glasstone and M. C. Edlund, The Elements of Nuclear Reactor


Theory, D. Van Nostrand, Princeton, NJ, 1952.
R. V. Meghreblian and D. K. Holmes, Reactor Analysis, McGraw-Hill,
New York, 1960.
A. V. Weinberg and E. P. Wigner, The Physical Theory of Neutron
Chain Reactors, University of Chicago, Chicago, 1958.
G. M. Wing, Introduction to Transport Theory, J. Wiley & Sons, New
York,1962.

I More infonnation is available at http://www-xdiv.lanl.govIXCI under Projects, MCNP.


2 These codes are part of the Standardized Computer Analyses for Licensing Evalution
(SCALE) package. Additional infonnation is available at http://www.cad.oml.gov/scale/
scale-home.html.
3 More infonnation is available at http://www-xdiv.lanl.govIXCI under Projects, LCS.
Index

absorption, 58,67,78,80, 151 attenuation of a particle bearn, 59


adjoint, 284 average value, 15
accuracy. See variance bank. See particle bank
adjoint barn, 58, 260
absorption, 284 batch method, 123, 162,231
and next-event estimator, 185 biased sampling, 51-55
boundary condition, 283 biasing
collisions, 285 definition, 26
continuous energy, 302 exponential transform, 168-73
efficiency, 301 Russian roulette, 154-59
flux, 285 sampling schemes, 52
Monte Carlo, 282-303 source, 141-50
multi group, 303 splitting, 159
operator, 283 stratified sampling, 43
physical process of, 284 survival,150-54
random walk, 284--85 binomial, 77
scattering kernel, 302 binomial distribution, 277
source, 285 Boltzmann
transport equation, 282-84 integral form of transport equation, 65
adjunctons, adjoint particles, 284 transport equation, 18,62
age, 107 Boltzmann's constant, 304
alpha boundary conditions
eigenfunctions, 227 vacuum, 72
eigenvalues, 227 boundary-crossing detectors. See
analog Monte Carlo, 16 detectors, surface crossing
angular brute force Monte Carlo. See analog
density,60 Buffon, Comte de, 2
fluence,61 C system, 90, 98
flux, 60 capture. See absorption
atomic mass, 89, 303 Cartesian coordinates, 63
335
336 Index

direction cosines, 70, 98 data for oxygen, 108, 218


Cd cutoff energy, 95 effective thermal, 305
center of mass energy dependence, 106-12, 106
coordinates, 90 fission, 228, 259
isotropic scattering in, 89 Hansen and Roach multigroup sets,
transformation of direction to 259
laboratory system, 98-106 Legendre expansion, 106
central limit theorem, 36, 185 macroscopic, 58
central moments, 32 microscopic, 58, 109
collision mixing, 116, 218, 262
location, 69, 80 multigroup, 106
probability, 58 multigroup data for uranium, 261
collision density, 177 sampling continuous energy, 109
collision rate density, 72 scattering, 58
combinatorial geometry, 117-19 total,58
description of package in PFC, 117- transport corrected, 261
19 crude Monte Carlo. See analog
combining independent Monte Carlo cumulative distribution function
results, 325 definition, 24
conditional probability, 47 current, 61, 194
continuous random variable decay constant, 81
expected value, 32 definite integrals, 15
mean value, 32 density function. See pdf
correlated random number sequences, detector
274 adjoint, 287
correlated sampling, 269-81 collision density, 186
covariance,271 expectation surface crossing estimator,
critical equation, 228 203
critical mass, 260 flux at a point, 176
critical radius, 233 next-event estimator, 178
criticality,228 next-event estimator, variance of, 185
calculation benchmarks, 269 relative efficiency of volumetric types,
calculation for Godiva, 262 191
combination of generation and matrix surface crossing, 194
methods, 251 surface crossing, grazing incidence,
flux convergence to fundamental 197
mode, 233,239, 242,258 time dependent, 207-8
generation method, 229-43 track length flux estimator, 186
Godiva, 260-69 detector scoring
initial flux guess, 230 dimensions of, 71
matrix method, 243-50 diffusion theory, 74
matrix method, error estimation, 244 diffusion coefficient, 107
total subsequent population method, hybrid, 74
229 time dependent, 214
using multigroup cross sections, 258- discrete random variable
70 standard deviation, 32
cross section, 58 variance, 32
absorption, 58 distribution function. See pdf
data for hydrogen, 108, 218 divergence theorem, 283
Index 337

effective multiplication factor, 229 equation, 107


efficiency, 140, 191,205 in water, 112
exponential transfonn, 173 Fick's Law, 107
Russian roulette, 158 first collision source, 75
splitting, 166 first moment, 32
stratification, 150 fission spectrum, 259
survival biasing, 153 Watt spectrum, 108
elastic scattering, 89-97 fltrn,325
center of mass, thennal, 89-97 flux. See angular flux or scalar flux
energy loss, 92, 93 flux estimate
in center of mass, 89-93 collision density, 186
energy groups. See multi group expectation surface crossing, 203
equidistribution, 318 flux at a point, 176
equilibrium flux, 228 next-event, 178
erf. See error function next-event estimator, variance of, 185
error surface crossing, 194
Monte Carlo, 10 surface crossing, grazing incidence,
systematic, 14, 130 197
error estimation. See variance time dependent, 207-8
error function, 305 track length, 186
estimate of mean, 35-39 fractional standard deviation, 17,36, 106
random variable, 35 free gas kernel, 303-6
estimate of variance, 35-39 fsd,36
random variable, 35 fundamental mode flux, 228
estimator. See detector gamma rays, self shielding, 76
event Gaussian distribution, 38
selection, 25-32 generation method. See criticality
stochastic, 22 generation time, 232
event file, 67, 176 geometry
event selection. See sampling multi-region, 84
event space. See sample space sphere, 85
event times, 208 Godiva
expectation score fast critical assembly, 260
point detector, 178 Gosset, W. S., 4
surface crossing, 203 Hall, A., 2
expected value, 8, 32 Hammersley, J. M., 140
exponential distribution, 27 Handscomb, D. C., 140
sampling from, 28 Hansen and Roach multi group cross
exponential integral, 75 section sets, 259
exponential transfonn, 168-73 histories. See random walk
extrapolation distance, 74 importance, 141, 150,282
fair game, 151, 168 regions, 158
definition, 26 sampling, 139
Russian roulette, 154 indium resonance, 110
splitting, 160 infinite variance catastrophe, 185
fast critical assemblies, 259 integrals
Godiva, 260 evaluation by Monte Carlo, 15
Fenniage inverse distribution
definition, 107 sampling from, 27
338 Index

isotropic scattering definition, 1


L system, 68 error, 10
outgoing angles, 70 problem definition, 66
isotropic unit vector, 70 multi group cross sections, 106
k eigenvalue, 229 in criticality calculations, 258-70
Kalos, M. H., 291 sampling, 262
Kelvin, Lord, 3 multiplication factor. See effective
kernel multiplication factor
adjoint scattering; 302 multiplicative congruential random
free gas, 303-6 number generator, 321
scattering, 62 neutron
transfer, 177 slowing down, 93
L system, 90, 98 thermal, most probable energy, 93
laboratory system thermalization, 92
coordinates, 90 neutron absorption, 58
isotropic scattering in, 92 neutron cross section. See cross section
law of cosines, 91 neutron density, 60
law of large numbers, 2, 15 neutron detectors. See detectors
Leclerc, Georges Louis, 2 neutron momentum, 59
lethargy, 107 neutron motion
L'Hospital's rule, 193 modeling of, 66-75
logarithmic energy decrement, 94, 107 neutron reaction rate, 61
lost in space neutron speed, 208
PFC error message, 120 neutron wavelength, 59
macroscopic cross section, 61 non-absorption probability, 123, 135, 151
Manhattan Project, 4 and random walk, 67
matrix method. See criticality definition, 58
matrix-by-generation. See criticality Normal distribution, 38
Maxwellian energy distribution, 304 normal mode flux, 228
average energy, 314 nth central moment, 32
most probable energy, 314 optical thickness, 65, 202
mean, 32-35 optimization
estimate of, 35-39 of stratification, 51
mean free path, 59 optimum biasing, 168-73
reselection at boundaries, 81 Park, S. K., 322
mean time to decay, 82 particle bank, 161
mean value, 32 subroutine '8ankin', 164
of a random variable, 14 use in criticality calculations, 234
mean value theorem, 15 particle weights, 55
Mersenne Twister, 326 path length. See mean free path
mfp. See mean free path path stretching. See exponential transform
Miller, K. W., 322 pdf, 24, 34
minimal standard random number modified, 53
generator, 322 perturbation
mixing cross section, 116 linear estimate, 280
modeling of random walk, 66-75 solution using correlated sampling,
moderation. See slowing down 269-81
Monte Carlo PFC, 113-34
analog, 16 "lost in space", 120
Index 339

applicability of, 137 phase space


array initialization, 124 definition, 59
body definition, 118 sampling of. See sampling of phase
combinatorial geometry, 117-19 space
common blocks, 115 variables, 59
cross section definition, 131 Pi
file 'geom.txt', 121 experimental determination of, 2
file 'xsects.txt', 123 Monte Carlo estimation of, 11
geometry errors, 122 primitive roots, 321
geometry logical operators, 119 Probabilistic Framework Code. See PFC
geometry specification, 120 probability density function, 23-25, 34
learning process, 130 modified pdf, 53
'LoopJor_Collisions', 127 probability distribution, 23
'Loop_Over]artic1es', 125 radioactive decay, 81
'Loop_Track', 127 random number
procedures for compiling and evaluation of, 7
assembling, 136 random number generator
standard printer, 136 and computer word length, 319, 326
subroutines, 115 minimal standard, 322
tracking through bodies, 127 multiplicative congruential generator,
tracking through zones, 128 321
zone definition, 117 random number generators
PFC main routine, 114 'fltro', 325
PFC subroutines lattice structure, 322
'Bdrx', 132 linear congruential, 319
'Col',133 long period, 326
'Dist', 127 period,319
'Dump', 131 properties of, 317
function 'fltrn', 325 seed,319
'Geomin', 121 random numbers, 6
'Gettim' (standard Fortran library), 'fltro', 12
125 generators for correlated sampling,
'Hit', 128 274
'Input', 124 random number generators, 6, 12
'Isoout', 126 'rodin', 12
'Mxsec', 132 sequences for correlated sampling,
'Output', 134 272
'rodin', 325 random unit vector, 70
'rodout', 326 random variable, 4,14,21-25
'Rpp',130 definition, 22
'Source', 126 discrete, 22
'Sph', 129 estimate of mean, 35
'Statelp' (entry point), 124 estimate of variance, 35
'Statend' (entry point), 124 evaluation of, 5
'StatJp' (entry point), 124, 133 random walk, 61, 66-75
'Statone' (entry point), 124 adjoint, 284--85
'Stats', 124 subroutine 'Walk', 125
'Walk', 125 reaction rate, 61, 186
'X sects', 123 rejection technique, 12,30-32
340 Index

efficiency of, 31 sampling from, 28


relative error. See fractional standard splitting, 159-68
deviation standard deviation, II, 14
relativistic neutron speeds, 207 continuous random variable, 33
round-off errors, 122 discrete random variable, 32
Russian roulette, 133, 154--59 of estimate of mean, 36
sample space, 4, 22 uncertainty in, 36
sampling, 25-32 stochastic event, 22
biased,52 stochastic process, 4
exponential distribution, 28 stratification, 139
over a disk, 287 stratified sampling, 43-51,149
rejection technique, 30 Student, 4
spherical distribution, 28 survival biasing, 150-54
stratified, 43 systematic error, 14
tabular data, 27 temperature of moderator, 303
sampling of phase space, 204 thermalization
thoroughness of, 41, 245, 251 neutron energy spectrum, 314
sampling with replacement, 37 of neutrons, 303-15
scalar flux, 61 scattering angles, 306
scattering three dimensional tracking, 85
and slowing down, 89 total flux. See scalar flux
cross section, 58 total subsequent population method. See
directional transformation, 98-106 criticality
inelastic, 89 tracking generations of neutrons, 231
isotropic in C system, 89 transformation
isotropic in C system, thermal, 89-97 center of mass direction to laboratory
isotropic in L system, 68, 98 coordinates, 98-106
thermal,303-15 matrix, 103
scattering angle transport equation, 62
center of mass to laboratory adjoint, 282-84
coordinate system, 92 integral formulation, 65
Schrage algorithm, 324 Ulam, Stanley, 4
scoring. See detector unbiased sampling, 51
secondary particle production, 58, 232 uncertainty. See variance
self shielding of gamma rays, 76 uncollided flux, 75, 78, 81, 180
sensitivity analysis. See perturbation vacuum boundary condition, 73
slowing down variance, 7, 32-35
and age theory, 107 and standard deviation, 14
and thermalization, 315 continuous random variable, 33
density, 107 discrete random variable, 32
in carbon, 96 estimate of, 35-39
in hydrogen, 96 next-event flux estimate, 185
neutron, 93 of estimate of mean, 36
time dependent, 218 surface crossing flux estimate, 196
slowing down density, 107 variance reduction, 141-50
source biasing, 141-50 basis for, 140
sphere variance reduction techniques
intersection of flight paths, 85 biased sampling, 51-55
spherical distribution correlated sampling, 269-81
Index 341

exponential transfonn, 168--73 von Neumann series, 66


introduction, 39-55 von Neumann, John, 4
particle weights, 55 water
repeated sampling, 39 Fenni age in, 112
Russian roulette, 154 neutron slowing down in, 107
splitting, 159-68 Watt fission spectrum, 108
stratified sampling, 43-51 weight, 15
weighting, 55 weight window, 160
zero variance estimator, 53 weighting, 55
void, particles streaming in, 84 zero variance, 53

You might also like