Presentation is loading. Please wait.

Presentation is loading. Please wait.

NIHES EERC Oct. 25, 2002 Monte Carlo Methods Mark A. Novotny Dept. of Physics and Astronomy Mississippi State U. Supported in part.

Similar presentations


Presentation on theme: "NIHES EERC Oct. 25, 2002 Monte Carlo Methods Mark A. Novotny Dept. of Physics and Astronomy Mississippi State U. Supported in part."— Presentation transcript:

1

2 NIHES EERC Oct. 25, 2002 Monte Carlo Methods Mark A. Novotny Dept. of Physics and Astronomy Mississippi State U. man40@ra.msstate.edu Supported in part by NSF DMR0120310 and ITR/AP(MPS)0113049 Random topics about random things for random people

3 NIHES EERC Oct. 25, 2002 Where is Monte Carlo? Europe Principality of Monaco Monte Carlo is 1 of 5 regions of Monaco Monte Carlo founded in 1866 by Prince Charles III Renowned casino, luxurious hotels, beaches, …

4 NIHES EERC Oct. 25, 2002 What is a Monte Carlo simulation? In a Monte Carlo simulation we attempt to follow the `time dependence’ of a model for which change, or growth, does not proceed in some rigorously predefined fashion (e.g. according to Newton’s equations of motion) but rather in a stochastic manner which depends on a sequence of random numbers which is generated during the simulation. Landau and Binder, A Guide to Monte Carlo Simulations in Statistical Physics (Cambridge U. Press, Cambridge U.K., 2000), p. 1.

5 NIHES EERC Oct. 25, 2002 Birth of the Monte Carlo method Los Alamos National Laboratory 1953 Physical Review Metropolis, Rosenbluth, Teller, and Teller Conferences/MonteCarloMethods/ “The only good Monte Carlo is a dead Monte Carlo.” Trotter and Turkey, 1954

6 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

7 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

8 NIHES EERC Oct. 25, 2002 (not-really, but almost) Random Numbers Uniformly distributed numbers in [0,1] How good is `good enough’? `religious question’ R2504-tapLinear congruential, R250, Marsaglia, 4-tap, system supplied Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin. John von Neumann (1951)

9 NIHES EERC Oct. 25, 2002 (not-really, but almost) Random Numbers from R250 X n = XOR( X n-p, X n-q ) XOR(,) is exclusive OR operator With p 2 +q 2 +1=prime (p and q are Mersine primes) R98: p=98, q=27 R250: p=250, q=103 R1279: p=1279, q=216 or 418 R9689: p=9689, q=84, 471, 1836, 2444, or 4187

10 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

11 NIHES EERC Oct. 25, 2002 Calculate p =pi using Monte Carlo Set N in =0 Do N times oCalculate 3 random numbers, r 1, r 2, r 3 oLet x=r 1 oLet y=r 2 oUse r 3 to choose quadrant (change signs of x and y) oIf x 2 +y 2.le.1 set N in =N in +1 Estimate for p =pi = 4 N in / N

12 Calculate p using Monte Carlo N=10 3 N=10 4 N=10 5 Live or die by the Law of Large Numbers

13 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

14 NIHES EERC Oct. 25, 2002 Importance Sampling Monte Carlo Old way: choose points with equal probability from rectangle with a<x i <b and 0<y<y 0 ; and then use estimate y estimate = S i f(x i ) (b-a) y 0 Rather choose points with importance of the value of the function at that point to the integral, p(x) Estimate of integral y estimate = S i p -1 (x i ) f(x i ) a b y00y00

15 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

16 NIHES EERC Oct. 25, 2002 Dynamic Monte Carlo For Static Monte Carlo the order of generation of points does not matter (like finding the integrals) For Dynamic Monte Carlo the order does matter This gives a Markov chain method, governed by the Master Equation

17 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

18 NIHES EERC Oct. 25, 2002 Birth and Death processes Decay (death) of nuclei (organisms) rate l =0.001 /msec N 0 =100 N(t) = N 0 exp(- l t) t 1/2 = ln(2)/ l = 693.15

19 NIHES EERC Oct. 25, 2002 Birth and Death processes Start with N=N 0 individuals Start time t=0 Assume that decay (death) constant l <1 For each nucleus which has not yet decayed uGenerate a random number 0<r<1  Nucleus decays if r< l, and set N=N-1, else the nucleus remains When done sampling all remaining nuclei, set t=t+1 Repeat until all nuclei have decayed

20 NIHES EERC Oct. 25, 2002 Birth and Death processes Event Driven --- n-fold way Start with N=N 0 individuals Start time t=0 Assume that decay (death) constant l <1 For each nucleus which has not yet decayed uGenerate a random number 0<r<1  Nucleus decays if r< l, and set N=N-1, else the nucleus remains When done sampling all remaining nuclei, set t=t+1 Repeat until all nuclei have decayed May be VERY SLOW if decay rate l is small!!! Does the nucleus decay? No no no no no no no no no no no no no no no...

21 NIHES EERC Oct. 25, 2002 Birth and Death processes Event Driven -- or -- n-fold way Start with N=N 0 individuals Start time t=0 Assume that decay (death) constant l <1 Until all the nuclei have decayed do: uGenerate two random number 0<r 1,r 2 <1  Calculate time to leave current state: D t=-ln(r 1 )/(N l )  S et t = t + D t uSet N = N - 1 uUse r 2 to pick which of remaining nuclei decayed One decay every algorithmic step, no matter how small l is

22 NIHES EERC Oct. 25, 2002 Birth and Death processes Birth and death of organisms l grow =0.001 /msec  l die =0.001 /msec N 0 =100

23 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

24 NIHES EERC Oct. 25, 2002 Random Walker coagulation Albena, Bulgaria model (2002)

25 NIHES EERC Oct. 25, 2002 Random Walker coagulation Albena, Bulgaria model (2002)

26 NIHES EERC Oct. 25, 2002 Random Walker coagulation

27 NIHES EERC Oct. 25, 2002 Random Walker coagulation Event driven (n-fold way) One algorithmic step step from current configuration

28 NIHES EERC Oct. 25, 2002 Random Walker coagulation Monte Carlo with Absorbing Markov Chains (MCAMC) (s=2) In one algorithmic step step out of low valleys

29 NIHES EERC Oct. 25, 2002 Random Walker coagulation Average time until coagulation All algorithms statistically the same

30 NIHES EERC Oct. 25, 2002 Random Walker coagulation Different algorithms require different amounts of computer time

31 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow Random motion (of a random walker) through a channel

32 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow

33 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow

34 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow

35 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow

36 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow Average lifetimes the same for all algorithms Computer times different for different algorithms

37 NIHES EERC Oct. 25, 2002 Random motion --- ion channel flow Square lattice for random walker, lifetime is time to get from one end to another

38 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

39 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models

40 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models Use spin classes for Ising model --- square lattice has 10 spin classes Every spin belongs to one of 10 classes Probability of flipping a spin in each class is the same If chosen, probability of flipping spin in class i is p(i) Number of spins in class i is c i

41 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models A GAME

42 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models MCAMC n-fold way

43 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models n-fold way with needed Bookkeeping

44 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models MCAMC

45 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models Square lattice Ising model

46 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models MCAMC results square Ising

47 NIHES EERC Oct. 25, 2002 Monte Carlo for Ising models Age of universe in femtoseconds? 10 -15 seconds

48 NIHES EERC Oct. 25, 2002 OUTLINE Random numbers Integrals via Monte Carlo Importance Sampling Monte Carlo Dynamic Monte Carlo Decay of nuclei (birth- death processes) Random motion in 1 dimension Long-time simulations (Monte Carlo with Absorbing Markov Chains, MCAMC) Parallel dynamic Monte Carlo simulations

49 NIHES EERC Oct. 25, 2002 Dynamic Monte Carlo Parallel Discrete Event Simulations Dynamics for Materials Dynamics for biological and ecological models Dynamics of Magnets Cell-phone switching Spread of infectious diseases Resource allocation following terrorist attacks War-game scenarios

50 NIHES EERC Oct. 25, 2002 “Nature” ? “Nature” ? computers & algorithms Parallel Discrete Event Simulations Best is trivial parallelization Each processor runs same program with different random number sequence

51 NIHES EERC Oct. 25, 2002 Two approaches to parallelization  Conservative  PE “idles” if causality is not guaranteed  utilization,  u  : fraction of non-idling PEs ii (site index) i d=1  Optimistic (or speculative)  PEs assume no causality violations  Rollbacks to previous states once causality violation is found (extensive state saving or reverse simulation)  Rollbacks can cascade (“avalanches”) d=2

52 NIHES EERC Oct. 25, 2002 Non-equilibrium surface growth e.g., kinetic roughening as in Molecular Beam Epitaxy Surface width = w Surface is FRACTAL

53 NIHES EERC Oct. 25, 2002  Utilization/efficiency Finite-size effects for the density of local minima/average growth rate (steady state): (d=1)

54 NIHES EERC Oct. 25, 2002 Implications for scalability Simulation reaches steady state for long times  Simulation phase: scalable  Measurement (data management) phase: not scalable  u   asymptotic average growth rate (simulation speed or utilization) is non-zero measurement at  meas :

55 NIHES EERC Oct. 25, 2002 Actual implementation 1. Local time incremented 2. If chosen site is on the boundary, PE must wait until  min{  nn } Dynamics of a thin magnetic film

56 NIHES EERC Oct. 25, 2002 The Physics of Queuing PDES applicable to many situations Can be made scalable (patent applied for) Use ideas from physics to understand & improve computer science & biological applications

57 NIHES EERC Oct. 25, 2002 References and Links Novotny and coworkers For a review of advanced dynamic methods see: M.A. Novotny in Annual Reviews of Computational Physics IX, ed. D. Stauffer, (World Scientific, Singapore, 2001), p. 153; preprint xxx.lanl.gov/cond- mat/0109182 click---HERE.HERE Metastability: Physical Review Letters, 81, 834 (1998). Monte Carlo with Absorbing Markov Chains: Physical Review Letters, 74, 1 (1995); erratum 75, 1424 (1995). Discrete-time n-fold way: Computers in Physics, 9, 46 (1995). Parallel Discrete Event Simulations, General: Physical Review Letters, 84, 1351 (2000). Implementation of non-trivial parallel Monte Carlo: Journal of Computational Physics, 153, 488 (1999). Projective Dynamics: Physical Review Letters, 80, 3384 (1998). Constrained Transfer Matrix for metastability: Physical Review Letters, 71, 3898 (1993).


Download ppt "NIHES EERC Oct. 25, 2002 Monte Carlo Methods Mark A. Novotny Dept. of Physics and Astronomy Mississippi State U. Supported in part."

Similar presentations


Ads by Google