48
Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Embed Size (px)

Citation preview

Page 1: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Radiation Transport Calculation by Monte Carlo Method

H. Hirayama, Y. Namito

KEK, High Energy Accelerator Research Organization

2009.8.8

Page 2: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Monte Carlo Method

• A mathematical method to solve problem using random number is called as “Monte Carlo Method”– Named by J. von Neumann S. M. Ulam

• Accordingly, generation of random number is the most important technique in Monte Carlo method.

Page 3: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Method to generate random number

• Utilize dice or roulette – Very slow

• Utilize table of random number

– Statistical nature is well studied.

– Need to hold total number necessary as data.

– Not most speedy way of generating random number.

• Utilize physical phenomena such as disintegration of radioisotope.

– Cumbersome in converting to numbers.

– Have problem in stability and reproducibility.

Page 4: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Pseudorandom number

• Select initial seed random number R0 , adequately. Generate next random number by recursion equation Rn+1= f(Rn) .

• The rest after divided by m is treated as next random number.

• The total number of integer less than m is m. Then, pseudorandom number has finite periodic length.

• Good pseudorandom number,– Can be generated QUICKLY.

– Have long periodic length.

– Have reproducibility.

– Have good statistical nature.

• A pseudorandom number can be obtained by dividing the generated pseudorandom number by m.

Page 5: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Pseudorandom number by linear congruential method

• Linear congruential method introduced by D. H. Lehmer is most widely used; Rn+1=mod(aRn+b,m)

– mod(aRn+b,m) is a rest when aRn+b is divided by m.

• a, b and m are positive integer. m is a maximum integer which compiler can handle.

Name a b mRANDU 65539 0 231

SLAC RAN1 69069 0 231

SLAC RAN6 663608491 0 231

Page 6: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Generation of pseudorandom number by pocket calculator

• Generate 10 pseudorandom number by setting R0=3, a=5, b=0 , and m=16.

• Certify that the same pseudorandom number is produced.

• What is a cycle length? • Generate pseudorandom number again from a

different R0 .

• Excel is NOT recommended to use.

Page 7: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

n Rn Rn*5 Rn+1=mod(Rn*a,m)

0 R0=3 15 15/16=0 ・・・ Rest 15 R1=15

1

2

3

mod(Rn*a,m) : The rest when Rn*a is divided by m.

Page 8: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

n Rn Rn*5 Rn+1=mod(Rn*a,m)

0 R0=3 15 15/16=0 ・ ・ ・ Rest 15 R1=15

1 R1=15 75 75/16=4 ・・・ Rest 11 R2=11

2 R2=11 55 55/16=3 ・・・ Rest 7  R3=7

3 R3=7 35 35/16=2 ・・・ Rest 3  R4=3

4 R4=3

Page 9: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Calculation using random number• Choose ten pairs of random numbers (,) from

left to right at an arbitrary place in Table 1 (made using SLAC RAN6).

• Count number of pair which satisfy following condition.

0.122 R

AREA= /4

x (number of pairs which satisfy the condition.)/(Total number of pairs)

Page 10: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

How to use Table 1

Page 11: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Trial No ξ η R R 1≦1 0.896 0.618 1.088

2 0.759 0.690 1.026

3 0.251 0.094 0.268 ○

4 0.371 0.148 0.399 ○

5 0.492 0.519 0.715 ○

6 0.789 0.567 0.972 ○

7 0.397 0.179 0.435 ○

8 0.576 0.341 0669 ○

9 0.517 0.583 0.779 ○

10 0.909 0.380 0.985 ○

A=8

A/10=0.8 (A/10)*4=3.2

Page 12: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Reference Web page

• About random number– http://www.nikonet.or.jp/spring/sanae/MathTopic/mo

ntecalro/montecalro.htm– Dice, Calculation of π using random number

• Pseudorandom number and Monte Carlo method – http://www.sm.rim.or.jp/~shishido/pie.html– Changing of value of π when trial number is

increased.

• Newton 2009. August Issue, Page 29.

Page 13: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Other way of generating random number

• Marasaglia-Zaman random number– G. Masaglia and A. Zaman, “A New Class of Random Number

Generator”, Annals of Applied Probability 1(1991)462-480.– Long period length –2144 ~1043

– A little bit cumbersome for controlling random number – Run on any 32-bit computer

• RANLUX random number– F. James, “A Fortran implementation of the high-quality

pseudorandom number generators”, Comp. Phys. Comm. 79 (1994) 111-114.

– Period length is 10 171

– By using seed number of 1-231, independent series of random number can be produced. No overlap of them is expected.

– Utilized in egs5 as a default random number generator.

Page 14: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Sampling from a discrete probability distribution

• Let’s write the physical processes which are independent and rebellion each other as x1, x2,......,xn . And let’s assume that their probability as p1, p2,......., pn. (For example, photoelectric effect, Compton scattering, and pair production in interaction of photon with matter.

• Let’s write a random number which distributes between 0 and 1 uniformly as . We choose an event xi when following condition is satisfied.

1)(1

n

iin pxF

i

jji

i

jji pxFpxF

1

1

11 )()(

F(xi) is called as Cumulative distribution function.

Page 15: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Introduction of sampling from a discrete probability distribution (1)

Example )  Sample interaction using a random number from a distribution of, Photoelectric effect :30 %, Compton scattering : 50 %, Pair production: 20%

0

0.1

0.2

0.3

0.4

0.5

0.6

Photoelectric Compton Pair

Page 16: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Introduction of sampling from a disrete probability distribution (2)

”Cumulative distribution function” or “Adding up calculation”.

0

0.2

0.4

0.6

0.8

1

1.2

Photoelectric Compton Pair

Rando

m Probability

of Compton scattering

Page 17: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Example of sampling from a discrete probability distribution.

• Let’s write probability of photoelectric effect, Compton scattering, and pair production as Pphoto, PCompt , Ppair.

    Pphoto +PCompt + Ppair =1

• Photoelectric effect is sampled when

• Compton scattering is sampled when

• Pair production is sampled when

,photoP,Comptphotophoto PPP

, Comptphoto PP

Page 18: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Sampling from a continuous probability distribution

• Let’s write a physical process emerge in a region of x and x+dx with a probability of f(x)dx [axb]. This f(x) is called as probability density function (PDF).

• Cumulative distribution function (CDF:F(x))

• Let’s write a random number which distribute between 0 and 1 uniformly as . Sampling procedure is written as,

   x is obtained as ,

This x can be obtained by direct calculation if this equation is analytically solved. This is called as “Direct sampling method”.

)1)(( dxxfb

a

ii

x

adxxfxF )()(

)(1 Fx

ii

x

adxxfxF )()(

Page 19: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

F(x)

x0

1

a b

x

Page 20: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Example of direct sampling – Calculation of flight path length

• Let’s write an interaction probability of one incident particle per unit distance as t . The probability that first interaction occur between l and l+dl is,

)ln(

)1ln()1ln(1

1)()(

)(

10 1

l

l

edllplP

dledllp

t

ll

tl

t

t

lFlight path length

: Mean free path

Random number and are equivalent.

Page 21: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 22: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Photon

Incident condition : Energy, position, direction e0, x0, y0, z0, u0, v0, w0

Infinite medium

Page 23: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Initial condition : Energy, position, and direction

e0, x0, y0, z0, u0, v0, w0

Sample distance l toward interaction point

   l=-ln()/

Coordinate after movement

x=x0+u0l, y=y0+v0l, z=z0+w0l

l

Page 24: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Initial Condition: Energy, position, and direction

e0, x0, y0, z0, u0, v0, w0

l

x=x0+u0l, y=y0+v0l, z=z0+w0l

Sample kind of interaction

Photoelectric effect : a, Compton scattering : b, Pair production :c

  <=a/(a+b+c): Photoelectric effect

a/(a+b+c)< <=(a+b)/(a+b+c): Compton scattering

>(a+b)/(a+b+c): Pair production  

Page 25: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

l

Photon

Electron

Sample energy and direction of each particle.

Trace of generated particle

x=x0+u0l, y=y0+v0l, z=z0+w0l

Initial Condition: Energy, position, and direction

e0, x0, y0, z0, u0, v0, w0

Page 26: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

l

Interaction point

x=x0+u0l, y=y0+v0l, z=z0+w0l

Region boundary

d

d>l : Move toward interaction point

d<=l : Move by a distance of d

Same material: Additional move by a distance of l-d

Different material : Sample interaction point again

Calculate straight path length toward boundary (d) .

Initial Condition: Energy, position, and direction

e0, x0, y0, z0, u0, v0, w0

Page 27: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

l

Region boundary

d

Calculate straight distance (d) toward boundary

Record information

   Particle moves : Energy deposition

           Path length

           Boundary crossing

   Photoelectric effect : Energy deposition

   Below cut off energy

   Stop tracing (Ex: Out of boudary)

Initial Condition: Energy, position, and direction

e0, x0, y0, z0, u0, v0, w0

Page 28: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Electron or positron

Initial condition : Energy, position, and direction

e0, x0, y0, z0, u0, v0, w0

   l=-ln()/

l

x x

x

x x

x x

Charged particle looses part of its energy while moving via ionization or excitation.

As the mean free path of elastic scattering of electron and positron is nm to m range, direct treatment of this process is unrealistic from the point of calculation efficiency.

Condensed History Technique

Divide a distance toward major interaction into many fine steps, evaluate changing of direction and position and route distance using multiple scattering model.

Energy deposition at each step is,

  Route distance x stopping power (dE/dx)

11

l2

l3

l4

l5l6

l7 l8

Sample distance toward interaction point

Page 29: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Transport calculation by hand calculation

• Use random numbers in Table 1 (Made by SLAC RAN6 )– Can start at arbitrary point and proceed to

arbitrary direction in a series. (No jump, no change direction) when use random number.

– Effective digit is 3 in calculation results

Page 30: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

How to use random number in Table 1

Page 31: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Photon transport calculation 1 by hand calculation (Fig.1)

• As is shown in Fig.1, there is a material A of 50 cm thickness. – Let’s assume that a photon of 0.5 MeV incident to material A vertically

from left side – Let’s assume that mean free path is 20 cm. – Let’s assume that ratio of photoelectric effect and Compton scattering as

1:1 .– Let’s assume that photon energy and direction are not changed after

Compton scattering.

• Example 1– Initial random number:0.234 -- l=-20.0 x ln(0.234)=29.0– 29.0(cm)<50.0(cm)– Next random number:0.208 (<0.5) – Photo electric effect ( Terminate )

• Example 2– Next random number:0.906 -- l=-20.0 x ln(0.906)=1.97– 1.97(cm)<50.0(cm)– Next random number :0.716 (>0.5) – Compton scattering– Next random number : 0.996 -- l=-20.0 x ln(0.996)=0.0802– 0.0802(cm)<50.0-1.97(cm)

Page 32: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Single layer

No. d(cm) Random

number

l(cm) d>l dl Random

number

Photo.

Compt.

Exp.1 50.0 0.234 29.0 * 0.208 *

Exp.2 50.0 0.906 1.97 * 0.716 *

48.03 0.996 0.0802 * 0.600 *

47.95 0.183 34.0 0.868 *

13.95 0.351 20.9 *

Page 33: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

0cm 10cm 20cm 30cm 40cm 50cm

Exp. 1

Exp. 2P

C C C

Fig. 1 Trajectories for a single layer

Page 34: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Photon transport calculation by hand 2 (Fig.2)

• As is shown in Fig. 2, there are material B of 20 cm thickness after material A of 30 cm thickness.– Let’s assume that a photon of 0.5MeV incident onto material A

vertically from left side.

– The mean free path and ratio of photoelectric effect to Compton in material A is the same as previous problem.

– Let’s assume that mean free path in material B to be 3 cm.– Let’s assume that Photo to Compton ration in material B

to be 3:1 .– Like previous example, photon energy and direction are

assumed to be un-changed after Compton scattering.

Page 35: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Example of calculation

• Used random number in table.1– Initial random number :0.329 -- l=-20.0 x

ln(0.329)=22.2– 22.2(cm)<30.0(cm)– Next random number 0.612 (>0.5) – Compton scatt.– Next random number:0.234 --l=-20.0 x ln(0.234)=29.0– 29.0(cm)>30.0-22.2(cm)– Move toward boundary between A and B (30.0cm)– Next random number :0.281 --l=-3.0 x ln(0.281)=3.80– 3.80(cm)<20.0(cm)

Page 36: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Medium A

No.

d(cm) Random number

l(cm) d>l dl Random

number

Photo.

Compt

Exp.1 30.0 0.329 22.2 * 0.612 *

7.8 0.234 29.0 *

Medium B

d(cm) Random number

l(cm) d>l dl Random

number

Photo.

Compt

20.00 0.281 3.80 * 0.906 *

16.20 0.716 1.00 * 0.996 *

15.20 0.600 1.53 * 0.183 *

Page 37: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 38: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Complex but realistic calculation of photon

• Geometry is Al slab of 10 cm thickness. Trace photon trajectory in following assumptions.

• Incident photon energy is 0.5 MeV.

• Photon scattering angle in Compton scattering is in the unit of 90 degree and scattering probability toward each angle is the same. This is independent of photon energy.

• Scattered photon energy is calculated as,

)cos1(511.0

1 0

0

E

EE

Page 39: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Complex but realistic calculation of photon

• Scattering azimuth angle is 0 degree and 180 degree with the same probability (1:1) . (Compton scattering occurs in X-Z plane. Left side from propagation direction is defined as 0 degree.)

• Read mfp and branching ratio of interaction from Figs. 4 and 5, respectively.

• Photon cut off energy is 0.05 MeV.

Page 40: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 41: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 42: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 43: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Electron trajectory without secondary particle

• Geometry is Al slab of 1 mm thickness as Fig.7. • 1.0 MeV electron incident vertically from left side.

 • Ignore correction of route distance due to multiple

scattering. • Ignore production of secondary particles, such as

ray and bremsstrahlung photon. • Electron step size is 0.01 cm regardless of electron

energy.

Page 44: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Electron trajectory without secondary particle

• Changing of electron direction due to multiple scattering is in unit of 90 degree with the same probability. This is independent of electron energy.– 0°-- 1/3, 90°-- 1/3, 180°-- 1/3

• Azimuth angle after multiple scattering is either 0 degree and 180 degree with the same probability. 0º and 180º are left side and right side of propagation.

• Energy loss due to inelastic scattering is 0.04 MeV per 0.01 cm. This is independent of electron energy.

• Electron cut off energy is 0.01 MeV .

Page 45: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 46: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8
Page 47: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Example of random walk

• A magazine, Newton, Page 42-43, Aug (2009). – Random walk in 1, 2, and 3 dimension is shown

as an example of irregular motion.– Step size is common. The different feature of

motion due to difference of dimension is shown.

Page 48: Radiation Transport Calculation by Monte Carlo Method H. Hirayama, Y. Namito KEK, High Energy Accelerator Research Organization 2009.8.8

Record of modification• English version was made on 16Jan2013 from

Japanese version of 2009.8.8. • Subscript number in inequality in Page 14 was

reduced by 1. 2013.1.17*