principles of monte carlo calculations

41
MC principles 1 Principles of Monte Carlo calculations

Upload: others

Post on 22-Dec-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Principles of Monte Carlo calculations

MC principles 1

Principles of Monte Carlo calculations

Page 2: Principles of Monte Carlo calculations

Monte Carlo

MC principles 2

Numerical methods based on the use of random numbers

Able to solve deterministic problems (Monte Carlo)and problems with random components (simulation)

MC/simulation algorithms are fairly “natural”

Formally, a Monte Carlo calculation is equivalent to a set of integrations

Basic ingredient: Random number generator (rng)delivers r.v. ξ uniformly distributed in (0,1)

Simple example: congruential rng

Note: the ξ values are not truly random (pseudo-random)... but the computer does not know that

Page 3: Principles of Monte Carlo calculations

A good random number generator

MC principles 3

C *********************************************************************C FUNCTION RANDC *********************************************************************

FUNCTION RAND(DUMMY) ! To prevent changes by optimizerCC This is an adapted version of subroutine RANECU written by F. JamesC (Comput. Phys. Commun. 60 (1990) 329-344), which has been modifiedC to give a single random number at each call.C

IMPLICIT DOUBLE PRECISION (A-H,O-Z), INTEGER*4 (I-N)PARAMETER (USCALE=1.0D0/2.0D0**31)COMMON/RSEED/ISEED1,ISEED2 ! Define the ‘state’ of the generator

CI1=ISEED1/53668ISEED1=40014*(ISEED1-I1*53668)-I1*12211IF(ISEED1.LT.0) ISEED1=ISEED1+2147483563

CI2=ISEED2/52774ISEED2=40692*(ISEED2-I2*52774)-I2*3791IF(ISEED2.LT.0) ISEED2=ISEED2+2147483399

CIZ=ISEED1-ISEED2IF(IZ.LT.1) IZ=IZ+2147483562RAND=IZ*USCALE

CRETURNEND

Page 4: Principles of Monte Carlo calculations

Random sampling

Cumulative distribution function of x [or of p(x)]

0.0

0.2

0.4

0.6

0.8

1.0P(x)

p(x)

x

Generic problem: generate values of a random variable x with a givenprobability distribution function (pdf) p(x). Typically as a transformof one (or several) random numbers

MC principles 4

Increases monotonically from 0 to 1

Discrete random variables, xi withpoint probability pi , represented as

Page 5: Principles of Monte Carlo calculations

Inverse transform method

MC principles 5

Random values of x are generated by means of the sampling formula

0.0

0.2

0.4

0.6

0.8

1.0P(x)

p(x)

x

ξ

that gives sampled x values with pdf

the method does work

Example: exponential distribution

Page 6: Principles of Monte Carlo calculations

Sampling of discrete random variables

MC principles 6

1 0.06252 0.18753 0.50004 1.0000

xx

x

x

0

1

0.5

1

2

3

4

ξ

Lookup table

Page 7: Principles of Monte Carlo calculations

Generic sampling algorithms

MC principles 7

Discrete r.v.: Walker's aliasing method. Optimal: the sampling "speed" isindependent of the size (number of elements) of the sample space

Continuous r.v.: Piecewise Rational Inverse Transform with Aliasing (RITA)Adaptive interpolation; very accurate

Other sampling techniques:-- Rejection method-- Composition method-- Metropolis-Hastings for high-

dimensionality pdf's (not used in radiation transport)

Page 8: Principles of Monte Carlo calculations

Example: Isotropic radiation source

MC principles 8

Isotropic source: Emits particles with directions uniformly distributed on the unit sphere

Direction of motion defined as a unit vector

Sampling the initial direction of aparticle from the source:

Alternative method: introduce the variable

Page 9: Principles of Monte Carlo calculations

Monte Carlo integration

MC principles 9

Formally, all Monte Carlo (MC) calculations are equivalent to integrations

We introduce randomness by considering x as a r.v. with a pdf p(x) that 1) vanishes outside the interval (a,b) and 2) p(x) > 0. We write

with

Monte Carlo estimator: Sample a large number N of values xi from p(x)and compute

NOTE: the variance of f(x), , can be estimated similarly

Page 10: Principles of Monte Carlo calculations

MC principles 10

Multiple runs of the MC program (using different seeds of the rng) will give different results: is a random variable with mean and variance

The central limit theorem implies that follows a normal distribution

with standard deviation

The uncertainty interval contains the true value of the integral with probability 68.3% if n=1, 95.4% if n =2, 99.7% if n =3 (3σ rule)

Monte Carlo is more efficient than conventional (trapezoidal rule) integration when the dimension of the integration domain is >4

The efficiency of the integration algorithm isdetermined by the adopted pdf p(x) ==>variance reduction techniques

Page 11: Principles of Monte Carlo calculations

Radiation transport

MC principles 11

Basic problem: Given a radiation source in a material structure, determine the radiation flux and the space distribution of depositedenergy (particle penetration and slowing down, secondary particles)

Notice: 1) the interaction events are stochastic and so is the transportprocess

2) the problem involves multiple variables:- kind of particle- position coordinates (3) - energy (1) - direction of motion (2)

a problem well suited for Monte Carlo simulation

1954: E. Hayward and J. Hubbell, first simulation of photon transport 1963: M. Berger, general strategies for charged particles

Page 12: Principles of Monte Carlo calculations

Radiation transport

MC principles 12

Basic assumptions / simplifications:

-- The medium is homogeneous, isotropic and amorphous with known composition and density (random scattering medium)

atoms or molecules per unit volume

-- Collisions (interactions) are with single atoms (or molecules)Not valid at low energies (diffraction and coherence effects)

-- All physics is contained in the atomic cross sections (CS)

-- Interactions "localise" the particles (as in a cloud chamber)

-- Individual particle histories are generated as a succession of "free flights and collisions" (trajectory model)

Page 13: Principles of Monte Carlo calculations

Interactions of photons

MC principles 13electron rest energy

Page 14: Principles of Monte Carlo calculations

Interactions of electrons and positrons

MC principles 14electron rest energy

Page 15: Principles of Monte Carlo calculations

Differential cross section

MC principles 15

z

y

x

T

θ

dΩ, dW

φ

d, E

d0, E —W

jinc

ˆ

ˆ

W = energy transfer

Total cross section:

σ (an area) measures the ''interaction probability''Represents the "effective transverse area" of the target

σ may be very different from the "geometrical" x-section

Page 16: Principles of Monte Carlo calculations

Distribution of free flight lengths

MC principles 16

σ

J J — dJ

dJ = J Nσ ds

ds

N

Late

rally

hom

ogen

eous

bea

m The number of particles that interact equals the number of those that would hit any of the spheres of transverse "area" σ

The interaction probability per unitpath length is (inverse mean free path, IMFP)

The most probable path length to the next interaction is s=0 (!)

Mean free path to the next interaction:

Page 17: Principles of Monte Carlo calculations

Practical detailed simulation

MC principles 17

Scattering model: two interaction mechanisms, A and B, with DCSs

and

Total cross sections:

PDF of the path length to the next event:

Kind of interaction:

Effect of each interaction:

Page 18: Principles of Monte Carlo calculations

Angular deflections

MC principles 18

z

xy

θ

φ

dn = (u,v,w)

dn+1 = (u0,v0,w0)

rn+1ˆˆ

ˆ

ˆ

ˆˆ

Note: valid also for polarized radiation (Stokes parameters)

Page 19: Principles of Monte Carlo calculations

A toy model for electron transport

MC principles 19

Non-relativistic, physically motivated, fully analytical simulation

Elastic collisions (A): (Wentzel, screened Rutherford, DCS)

Inelastic collisions (B): (restricted Thomson DCS, binding)

Consistent with Bethe’s stopping power:

Page 20: Principles of Monte Carlo calculations

Practical detailed simulation

MC principles 20

mat. 1 mat. 2vacuum

sθ, φ

En, dn

rn

B

E2, d2

E1, d1r2

r3E3, d3

rn+1

ss

s

AA

B

r1

^

^^

^

W

Reliability depends on:1) Accuracy of the adopted DCSs2) Validity of the trajectory model ( ),

Page 21: Principles of Monte Carlo calculations

Generation of random trajectories

MC principles 21

1) Set the initial state of the particle (laboratory frame):

3) Sample the length of the free flight:

4) Move to the new position:

5) Sample the type of interaction:

6) Simulate the interaction from the corresponding DCS, i.e., sample theenergy loss W and the scattering angles θ and φ

7) New energy and direction of motion:

8) Check for absorption and interface crossings. If still "alive" go to 2

2) Determine the total cross sections and mean free path at this energy

a b means that the value a is replaced by b

Page 22: Principles of Monte Carlo calculations

MC principles 22

10 photons, no electrons

Page 23: Principles of Monte Carlo calculations

MC principles 23

10 electrons, no photons

Page 24: Principles of Monte Carlo calculations

What causes the problem?

MC principles 24

Al (Z=13)20 keV electrons

1 MeV electrons in gold undergo about 20,000 elastic collisions before slowing down to rest, and a similar number of inelastic collisions (!) ... but most of them are very ‘soft’

Page 25: Principles of Monte Carlo calculations

Possible simulation strategies

MC principles 25

Detailed (analogue) simulation, interaction by interaction+ Nominally exact− Doable only for low-E, thin media− Requires very large data bases (interpolation is not a problem)

Class I (condensed) simulation, complete grouping+ Works for high energies and/or thick media− Difficulties to describe space displacements − Interface crossings require specific actions− Difficult to incorporate purely numerical interaction models− Usually applied only to elastic scattering, not easy for inelastic cols.

and bremms.

Class II (mixed) simulation + Hard events are described "exactly" from their DCSs+ Elastic, inelastic and bremsstrahlung are “tuned” independently+ Flexible (from detailed to class I)− Slow when cutoffs are too small

Page 26: Principles of Monte Carlo calculations

Energy straggling

MC principles 26

From the transport equation:

with

(moments of the energy loss in a single interaction)

Simplification: small path lengths, accumulated energy loss

Moments of the energy-loss distribution:

Page 27: Principles of Monte Carlo calculations

Moments of the energy-loss distribution

MC principles 27

Stopping power:

S(E) represents the average energy loss per unit path length

Energy straggling parameter:

2(E) represents the increase of variance per unit path length

Page 28: Principles of Monte Carlo calculations

Continuous slowing down approximation (CSDA)

MC principles 28

Heavy charged particles undergo many interactions with small W (the central limit theorem is applicable)

Valid only if (not for electrons!)

Particles lose energy continuously at the rate given by the stopping power S(E)

CSDA range: average path length to rest

Energy loss ∆s after a path length s: exact (within CSDA)

Energy loss distribution:

Page 29: Principles of Monte Carlo calculations

The energy-loss distribution of Landau (1944)

MC principles 29

Assumptions:L1. No bremss (as in other straggling theories!), only collision losesL2. Short path lengths,L3. Thomson cross section for hard events,

L4. L5. Stopping power for soft events evaluated from the Bethe theory

with

Landau solved the transport equation using the Laplace transform, whichrequires setting early in the calculation

Note: the second moment (straggling) of soft interactions is neglected

Page 30: Principles of Monte Carlo calculations

The energy-loss distribution of Landau (1944)

MC principles 30

Landau distribution:

where

Page 31: Principles of Monte Carlo calculations

Beyond Landau...

MC principles 31

Blunk and Leisegang (1950) correction: includes second moment of soft interactions

(convolution of Landau and a normal distribution with zero mean and variance )

Vavilov (1957): accounts for the finite value of Wmax (removes L4)

Bichsel and Saxon (1975): Vavilov's theory modified by including the second moment of soft interactions

Numerical solution of transport eq.: finite difference method withrealistic cross sections (including bremss!)

Page 32: Principles of Monte Carlo calculations

Numerical straggling vs. Monte Carlo

MC principles 32

Page 33: Principles of Monte Carlo calculations

Numerical straggling vs. Monte Carlo

MC principles 33

Page 34: Principles of Monte Carlo calculations

Multiple (elastic) scattering

MC principles 34

Single-scattering distribution: axial symmetry

Wentzel (1927) model, screened Rutherford

First Born approximation:

Allows analytical calculations, basis of the Molière (1948) theory

ICRU 77 database. Electrons and positrons, Z = 1— 99 (relativistic,Dirac, partial-wave expansion method)

Legendre expansion

with

Page 35: Principles of Monte Carlo calculations

Goudsmit-Saunderson (1940) theory

MC principles 35

Folding theorem. Initial direction along the z axis

- 1 collision:

- 2 collisions:

- n collisions:

Collisions in a path length s (Poisson):

Goudsmit-Saunderson distribution: exact angular distribution

Page 36: Principles of Monte Carlo calculations

Goudsmit-Saunderson (1940) theory

MC principles 36

... after little rearrangement

with

transport cross sections

λ are the transport (mean) free paths

Moments:

"scattering power"

Molière (1948) theory: GS for the Wentzel DCS, with mathematical approximations (Fernández-Varea et al., 1993)

Page 37: Principles of Monte Carlo calculations

Goudsmit-Saunderson (1940) theory

MC principles 37

(ICRU 77 DCSs)

Page 38: Principles of Monte Carlo calculations

Multiple scattering with energy loss. Lewis (1950)

MC principles 38

Energy loss from the CSDA:

All energy-dependent quantities can be regarded as functions of sExample: average number of collision in s

Transport equation:

with the DIMFP

Lewis' solution method: expansion in spherical harmonics, gives the angular distribution and low-order spatial moments

where

Page 39: Principles of Monte Carlo calculations

Multiple scattering with energy loss. Lewis (1950)

MC principles 39

Angular distribution:

with

Reduces to the GS distribution when the energy loss ∆s is small

Moments:

Practical calculations: (Negreanu et al., 2005; ICRU Report 77)

- ICRU 77 DCSs (Dirac partial-wave method)

- ICRU 37 stopping powers

Page 40: Principles of Monte Carlo calculations

Lewis (1950) theory

MC principles 40

(ICRU 77 DCSs)

Page 41: Principles of Monte Carlo calculations

Lewis (1950) theory

MC principles 41

Spatial moments:

Results: Kawrakow and Bielajew (1998)

Completely determined by λ1(E) and λ2(E), independent of λ(E)