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.
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.
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.
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 m RANDU 65539 231 SLAC RAN1 69069 SLAC RAN6 663608491
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.
n Rn Rn*5 Rn+1=mod(Rn*a,m) 1 2 3 R0=3 15 15/16=0・・・Rest 15 R1=15 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.
n Rn Rn*5 Rn+1=mod(Rn*a,m) 1 2 3 4 R0=3 15 15/16=0・・・Rest 15 R1=15 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
Calculation p 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. AREA= p /4 p= 4 x (number of pairs which satisfy the condition.)/(Total number of pairs)
How to use Table 1
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
Reference Web page About random number http://www.nikonet.or.jp/spring/sanae/MathTopic/montecalro/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.
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.
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. F(xi) is called as Cumulative distribution function.
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%
Introduction of sampling from a disrete probability distribution (2) Random Probability of Compton scattering ”Cumulative distribution function” or “Adding up calculation”.
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
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”.
F(x) 1 x a x b
Example of direct sampling – Calculation of flight path length Let’s write an interaction probability of one incident particle per unit distance as St . The probability that first interaction occur between l and l+dl is, l: Flight path length l: Mean free path h: Random number (1-h and h are equivalent. )
Infinite medium Photon Incident condition:Energy, position, 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 Initial condition:Energy, position, and direction e0, x0, y0, z0, u0, v0, w0
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 x=x0+u0l, y=y0+v0l, z=z0+w0l l Initial Condition: Energy, position, and direction e0, x0, y0, z0, u0, v0, w0
Trace of generated particle Electron Sample energy and direction of each particle. Photon x=x0+u0l, y=y0+v0l, z=z0+w0l l Initial Condition: Energy, position, and direction e0, x0, y0, z0, u0, v0, w0
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 Region boundary Interaction point x=x0+u0l, y=y0+v0l, z=z0+w0l l d Calculate straight path length toward boundary (d) . Initial Condition: Energy, position, and direction e0, x0, y0, z0, u0, v0, w0
Record information Particle moves:Energy deposition Path length Boundary crossing Photoelectric effect:Energy deposition Below cut off energy Stop tracing (Ex: Out of boudary) Region boundary Calculate straight distance (d) toward boundary l d Initial Condition: Energy, position, and direction e0, x0, y0, z0, u0, v0, w0
Sample distance toward interaction point Condensed History Technique As the mean free path of elastic scattering of electron and positron is nm to mm range, direct treatment of this process is unrealistic from the point of calculation efficiency. Sample distance toward interaction point 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. l=-ln()/ l7 l8 l x x l5 x x l6 Charged particle looses part of its energy while moving via ionization or excitation. l4 x l3 x x l2 11 Energy deposition at each step is, Route distance x stopping power (dE/dx) Electron or positron Initial condition :Energy, position, and direction e0, x0, y0, z0, u0, v0, w0
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
How to use random number in Table 1
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)
Single layer No. d(cm) Random number l(cm) d>l dl Photo. Compt. Exp.1 50.0 0.234 29.0 * 0.208 Exp.2 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
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.
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)
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
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,
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.
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.
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 .
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.
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* * File name was mot changed as this is a fix of typo.