Fundamentals of the Monte Carlo method for neutral and charged particle transport Alex F Bielajew The University of Michigan Department of Nuclear Engineering and Radiological Sciences 2927 Cooley Building (North Campus) 2355 Bonisteel Boulevard Ann Arbor, Michigan 48109-2104 U. S. A. Tel: 734 764 6364 Fax: 734 763 4540 email:
[email protected]
c 1998—2001 Alex F Bielajew
c 1998—2001 The University of Michigan
September 17, 2001
2
Contents 1 What is the Monte Carlo method?
1
1.1
Why is Monte Carlo? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
1.2
Some history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
2 Elementary probability theory 2.1
2.2
Continuous random variables
15 . . . . . . . . . . . . . . . . . . . . . . . . . .
15
2.1.1
One-dimensional probability distributions
. . . . . . . . . . . . . . .
15
2.1.2
Two-dimensional probability distributions . . . . . . . . . . . . . . .
17
2.1.3
Cumulative probability distributions . . . . . . . . . . . . . . . . . .
20
Discrete random variables . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
3 Random Number Generation
25
3.1
Linear congruential random number generators . . . . . . . . . . . . . . . . .
26
3.2
Long sequence random number generators . . . . . . . . . . . . . . . . . . .
30
4 Sampling Theory
35
4.1
Invertible cumulative distribution functions (direct method) . . . . . . . . .
36
4.2
Rejection method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40
4.3
Mixed methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.4
Examples of sampling techniques . . . . . . . . . . . . . . . . . . . . . . . .
44
4.4.1
Circularly collimated parallel beam . . . . . . . . . . . . . . . . . . .
44
4.4.2
Point source collimated to a planar circle . . . . . . . . . . . . . . . .
46
4.4.3
Mixed method example . . . . . . . . . . . . . . . . . . . . . . . . . .
47
iii
iv
CONTENTS 4.4.4
Multi-dimensional example . . . . . . . . . . . . . . . . . . . . . . . .
5 Error estimation
49 53
5.1
Direct error estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.2
Batch statistics error estimation . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.3
Combining errors of independent runs . . . . . . . . . . . . . . . . . . . . . .
58
5.4
Error estimation for binary scoring . . . . . . . . . . . . . . . . . . . . . . .
59
5.5
Relationships between Sx2 and s2x , Sx2 and s2x . . . . . . . . . . . . . . . . . .
59
6 Oddities: Random number and precision problems
63
6.1
Random number artefacts . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63
6.2
Accumulation errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
70
7 Ray tracing and rotations
75
7.1
Displacements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
7.2
Rotation of coordinate systems . . . . . . . . . . . . . . . . . . . . . . . . .
76
7.3
Changes of direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
7.4
Putting it all together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
8 Transport in media, interaction models 8.1 Interaction probability in an infinite medium . . . . . . . . . . . . . . . . . . 8.1.1
85 85
Uniform, infinite, homogeneous media . . . . . . . . . . . . . . . . . .
86
8.2
Finite media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
8.3
Regions of different scattering characteristics . . . . . . . . . . . . . . . . . .
87
8.4
Obtaining µ from microscopic cross sections . . . . . . . . . . . . . . . . . .
90
8.5
Compounds and mixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . .
93
8.6
Branching ratios
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
8.7
Other pathlength schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
8.8
Model interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
8.8.1
Isotropic scattering . . . . . . . . . . . . . . . . . . . . . . . . . . . .
95
8.8.2
Semi-isotropic or P1 scattering . . . . . . . . . . . . . . . . . . . . . .
95
CONTENTS
v
8.8.3
Rutherfordian scattering . . . . . . . . . . . . . . . . . . . . . . . . .
96
8.8.4
Rutherfordian scattering—small angle form
96
9 Lewis theory
. . . . . . . . . . . . . .
99
9.1
The formal solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
9.2
Isotropic scattering from uniform atomic targets . . . . . . . . . . . . . . . . 102
10 Geometry
107
10.1 Boundary crossing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 10.2 Solutions for simple surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 10.2.1 Planes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 10.3 General solution for an arbitrary quadric . . . . . . . . . . . . . . . . . . . . 114 10.3.1 Intercept to an arbitrary quadric surface? . . . . . . . . . . . . . . . . 117 10.3.2 Spheres . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 10.3.3 Circular Cylinders . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 10.3.4 Circular Cones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 10.4 Using surfaces to make objects . . . . . . . . . . . . . . . . . . . . . . . . . . 125 10.4.1 Elemental volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 10.5 Tracking in an elemental volume . . . . . . . . . . . . . . . . . . . . . . . . . 132 10.6 Using elemental volumes to make objects . . . . . . . . . . . . . . . . . . . . 135 10.6.1 Simply-connected elements . . . . . . . . . . . . . . . . . . . . . . . . 135 10.6.2 Multiply-connected elements . . . . . . . . . . . . . . . . . . . . . . . 140 10.6.3 Combinatorial geometry . . . . . . . . . . . . . . . . . . . . . . . . . 142 10.7 Law of reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 11 Monte Carlo and Numerical Quadrature
151
11.1 The dimensionality of deterministic methods . . . . . . . . . . . . . . . . . . 151 11.2 Convergence of Deterministic Solutions . . . . . . . . . . . . . . . . . . . . . 154 11.2.1 One dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 11.2.2 Two dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
vi
CONTENTS 11.2.3 D dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 11.3 Convergence of Monte Carlo solutions . . . . . . . . . . . . . . . . . . . . . . 156 11.4 Comparison between Monte Carlo and Numerical Quadrature . . . . . . . . 156
12 Photon Monte Carlo Simulation
161
12.1 Basic photon interaction processes . . . . . . . . . . . . . . . . . . . . . . . . 161 12.1.1 Pair production in the nuclear field . . . . . . . . . . . . . . . . . . . 162 12.1.2 The Compton interaction (incoherent scattering)
. . . . . . . . . . . 165
12.1.3 Photoelectric interaction . . . . . . . . . . . . . . . . . . . . . . . . . 166 12.1.4 Rayleigh (coherent) interaction . . . . . . . . . . . . . . . . . . . . . 169 12.1.5 Relative importance of various processes . . . . . . . . . . . . . . . . 170 12.2 Photon transport logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 13 Electron Monte Carlo Simulation
179
13.1 Catastrophic interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 13.1.1 Hard bremsstrahlung production . . . . . . . . . . . . . . . . . . . . 180 13.1.2 Møller (Bhabha) scattering . . . . . . . . . . . . . . . . . . . . . . . . 180 13.1.3 Positron annihilation . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 13.2 Statistically grouped interactions . . . . . . . . . . . . . . . . . . . . . . . . 181 13.2.1 “Continuous” energy loss . . . . . . . . . . . . . . . . . . . . . . . . . 181 13.2.2 Multiple scattering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 13.3 Electron transport “mechanics” . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.3.1 Typical electron tracks . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.3.2 Typical multiple scattering substeps . . . . . . . . . . . . . . . . . . . 183 13.4 Examples of electron transport
. . . . . . . . . . . . . . . . . . . . . . . . . 184
13.4.1 Effect of physical modeling on a 20 MeV e− depth-dose curve . . . . 184 13.5 Electron transport logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 14 Electron step-size artefacts and PRESTA
203
14.1 Electron step-size artefacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
CONTENTS
vii
14.1.1 What is an electron step-size artefact? . . . . . . . . . . . . . . . . . 203 14.1.2 Path-length correction . . . . . . . . . . . . . . . . . . . . . . . . . . 209 14.1.3 Lateral deflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 14.1.4 Boundary crossing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 14.2 PRESTA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 14.2.1 The elements of PRESTA . . . . . . . . . . . . . . . . . . . . . . . . 216 14.2.2 Constraints of the Moli`ere Theory . . . . . . . . . . . . . . . . . . . . 218 14.2.3 PRESTA’s path-length correction . . . . . . . . . . . . . . . . . . . . 223 14.2.4 PRESTA’s lateral correlation algorithm . . . . . . . . . . . . . . . . . 226 14.2.5 Accounting for energy loss . . . . . . . . . . . . . . . . . . . . . . . . 228 14.2.6 PRESTA’s boundary crossing algorithm . . . . . . . . . . . . . . . . 231 14.2.7 Caveat Emptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 15 Advanced electron transport algorithms
237
15.1 What does condensed history Monte Carlo do? . . . . . . . . . . . . . . . . . 240 15.1.1 Numerics’ step-size constraints . . . . . . . . . . . . . . . . . . . . . . 240 15.1.2 Physics’ step-size constraints . . . . . . . . . . . . . . . . . . . . . . . 243 15.1.3 Boundary step-size constraints . . . . . . . . . . . . . . . . . . . . . . 244 15.2 The new multiple-scattering theory . . . . . . . . . . . . . . . . . . . . . . . 245 15.3 Longitudinal and lateral distributions . . . . . . . . . . . . . . . . . . . . . . 247 15.4 The future of condensed history algorithms . . . . . . . . . . . . . . . . . . . 249 16 Electron Transport in Electric and Magnetic Fields
257
16.1 Equations of motion in a vacuum . . . . . . . . . . . . . . . . . . . . . . . . 258 ~ =constant, B ~ = 0; B ~ =constant, E ~ = 0 . . . . . . . . 259 16.1.1 Special cases: E 16.2 Transport in a medium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 16.3 Application to Monte Carlo, Benchmarks . . . . . . . . . . . . . . . . . . . . 264 17 Variance reduction techniques
275
17.0.1 Variance reduction or efficiency increase? . . . . . . . . . . . . . . . . 275
viii
CONTENTS 17.1 Electron-specific methods
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
17.1.1 Geometry interrogation reduction . . . . . . . . . . . . . . . . . . . . 277 17.1.2 Discard within a zone . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 17.1.3 PRESTA! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 17.1.4 Range rejection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 17.2 Photon-specific methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 17.2.1 Interaction forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 17.2.2 Exponential transform, russian roulette, and particle splitting . . . . 287 17.2.3 Exponential transform with interaction forcing . . . . . . . . . . . . . 290 17.3 General methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 17.3.1 Secondary particle enhancement . . . . . . . . . . . . . . . . . . . . . 291 17.3.2 Sectioned problems, use of pre-computed results . . . . . . . . . . . . 292 17.3.3 Geometry equivalence theorem . . . . . . . . . . . . . . . . . . . . . . 293 17.3.4 Use of geometry symmetry . . . . . . . . . . . . . . . . . . . . . . . . 294 18 Code Library
299
18.1 Utility/General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 18.2 Subroutines for random number generation . . . . . . . . . . . . . . . . . . . 302 18.3 Subroutines for particle transport and deflection . . . . . . . . . . . . . . . . 321 18.4 Subroutines for modeling interactions . . . . . . . . . . . . . . . . . . . . . . 325 18.5 Subroutines for modeling geometry . . . . . . . . . . . . . . . . . . . . . . . 328 18.6 Test routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335