Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief...

38
7 th COSSAN TRAINING COURSE - 08-10 April 2019 Introduction to Monte Carlo method and reliability analysis Edoardo Patelli, Matteo Broggi E: [email protected] W: www.cossan.co.uk T: +44 01517944079

Transcript of Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief...

Page 1: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

7th COSSAN TRAINING COURSE - 08-10 April 2019

Introduction to Monte Carlo methodand reliability analysis

Edoardo Patelli, Matteo BroggiE: [email protected] W: www.cossan.co.uk T: +44 01517944079

Page 2: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 2 / 30

Page 3: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Monte Carlo method

Computation technique based onrandom numbersNumerical experiment by generating arandom sequence of number withprescribed probability distribution.Collecting quantity of interest

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 3 / 30

Page 4: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Monte Carlo applications

Solution of integrals,differential equation,complex systemsetc...Simulation randomeventsCryptography,Decision-MakingGames

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 4 / 30

Page 5: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Monte Carlo methodMain components

Probability distribution functions(describing the model)Random number generatorSampling rules (how to sample from PDFs)Error estimatorVariance reduction techniqueUse of High Performance Computing

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 5 / 30

Page 6: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Monte Carlo methodOrigins

1777 Comte de Buffon - earliestdocumented use of randomsampling

P(needle intersects the grid) =2 ∗ Lπt

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 6 / 30

Page 7: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Monte Carlo methodOrigins

1777 Comte de Buffon - earliestdocumented use of randomsampling

P(needle intersects the grid) =2 ∗ Lπt

1786 Laplace suggested toestimate π by random sampling

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 6 / 30

Page 8: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Buffon’s experimentMonte Carlo simulation

1 Sample an u1 ∼ U[0,1) and u2 U[0,1)2 Calculate distance from a line:

d = u1 ∗ t3 Calculate angle between needle’s axis

and the normal to the linesφ = u2 ∗ π/2

4 if d ≤ Lcosφ the needle intercepts aline (update counter Ns = Ns + 1)

5 Repeat procedure N times6 Estimate probability intersection

Pi =2 ∗ Lπt

= limN→∞Ns

N

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 7 / 30

Page 9: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Buffon’s experimentMonte Carlo simulation

1 Sample an u1 ∼ U[0,1) and u2 U[0,1)2 Calculate distance from a line:

d = u1 ∗ t3 Calculate angle between needle’s axis

and the normal to the linesφ = u2 ∗ π/2

4 if d ≤ Lcosφ the needle intercepts aline (update counter Ns = Ns + 1)

5 Repeat procedure N times6 Estimate probability intersection

Pi =2 ∗ Lπt

= limN→∞Ns

N

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 7 / 30

Page 10: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Buffon’s experimentMonte Carlo simulation

1 Sample an u1 ∼ U[0,1) and u2 U[0,1)2 Calculate distance from a line:

d = u1 ∗ t3 Calculate angle between needle’s axis

and the normal to the linesφ = u2 ∗ π/2

4 if d ≤ Lcosφ the needle intercepts aline (update counter Ns = Ns + 1)

5 Repeat procedure N times6 Estimate probability intersection

Pi =2 ∗ Lπt

= limN→∞Ns

N

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 7 / 30

Page 11: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Buffon’s experimentMonte Carlo simulation

1 Sample an u1 ∼ U[0,1) and u2 U[0,1)2 Calculate distance from a line:

d = u1 ∗ t3 Calculate angle between needle’s axis

and the normal to the linesφ = u2 ∗ π/2

4 if d ≤ Lcosφ the needle intercepts aline (update counter Ns = Ns + 1)

5 Repeat procedure N times6 Estimate probability intersection

Pi =2 ∗ Lπt

= limN→∞Ns

N

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 7 / 30

Page 12: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Buffon’s experimentMonte Carlo simulation

1 Sample an u1 ∼ U[0,1) and u2 U[0,1)2 Calculate distance from a line:

d = u1 ∗ t3 Calculate angle between needle’s axis

and the normal to the linesφ = u2 ∗ π/2

4 if d ≤ Lcosφ the needle intercepts aline (update counter Ns = Ns + 1)

5 Repeat procedure N times6 Estimate probability intersection

Pi =2 ∗ Lπt

= limN→∞Ns

N

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 7 / 30

Page 13: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction A brief overview

Buffon’s experimentMonte Carlo simulation

1 Sample an u1 ∼ U[0,1) and u2 U[0,1)2 Calculate distance from a line:

d = u1 ∗ t3 Calculate angle between needle’s axis

and the normal to the linesφ = u2 ∗ π/2

4 if d ≤ Lcosφ the needle intercepts aline (update counter Ns = Ns + 1)

5 Repeat procedure N times6 Estimate probability intersection

Pi =2 ∗ Lπt

= limN→∞Ns

N

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 7 / 30

Page 14: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Evaluation of Definite Integrals

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 8 / 30

Page 15: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Evaluation of Definite Integrals

Definite Integrals

G =

∫F

g(x)dx =

∫· · ·∫F

g(x1, . . . , xn)dx1 . . . dxn

Analytical solutionNumerical quadratureMonte Carlo estimation

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 9 / 30

Page 16: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Evaluation of Definite Integrals

Evaluation of Definite Integrals

G =

∫g(x)f (x)dx

x can be seen as a random variablef (x) has characteristic of a probability density functiong(x) is also a random variable

E [g(x)] =∫

g(x)f (x)dx = GVar [g(x)] = E [g2(x)]−G2

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 10 / 30

Page 17: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Evaluation of Definite Integrals

Monte Carlo darts method

G =

∫g(x)f (x)dx

1 Generate sample N points (xi)from f (x)

2 Evaluate function g(xi) (i.e. thescore of the i-th thrown)

3 Computed expected prise

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 11 / 30

Page 18: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Evaluation of Definite Integrals

Monte Carlo darts method

G =

∫g(x)f (x)dx

Main componentsf (x)dx probability to hit a pointg(x) the scoreGN = 1

N

∑Ni=1 g(xi) Average score

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 12 / 30

Page 19: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Evaluation of Definite Integrals

Estimation area of a circle

C =

∫∫F

f (x1, x2)dx1dx2 = π ∗ r2

f (x1, x2) = uniform distribution; F : x21 + x2

2 ≤ rThe integral can be rewritten as:

C =

∫∫H(x1, x2) · f (x1, x2)dx1dx2

H(x1, x2) =

{1 if x ∈ C; x2

1 + x22 ≤ r

0 otherwiseWe can use the dart game to estimate the area of the circle

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 13 / 30

Page 20: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Estimation of π

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 14 / 30

Page 21: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Estimation of π

Estimation of π

Area Circle: π ∗ r2

Area of the square:2 ∗ r2

Ratio of the areas:π ∗ r2

4 ∗ r2 =π

4Tool: dart game

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 15 / 30

Page 22: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Introduction Estimation of π

Estimation of πProcedure

1 Sample coordinate of a point

xi ∼ U [0, r ], yi ∼ U [0, r ]

2 Check if the sample is inside the circle ofradius r and update counterif x2

i + y2i < r then Nr = Nr + 1

3 Repeat steps 1-2 for N samples4 Compute π

π = 4 · Nr

NE.Patelli M.Broggi COSSAN Training Course 8 April 2019 16 / 30

Page 23: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Overview

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 17 / 30

Page 24: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Overview

Reliability Analysis

The ability of a system or component to perform its requiredfunctions under stated conditions for a specified period of time.

Reliability is a probability

R(t) = Pr{T > t} =∫ ∞

tf (x)dx

where f (x) is the failure probability density function and t is thelength of the period of time

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 18 / 30

Page 25: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Performance function

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 19 / 30

Page 26: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Performance function

Performance function

Function of input quantities thatdescribe the status of thesystem: g(X1, · · · ,Xn)

Failure domain: g ≤ 0Safe domain: g ≥ 0Limit State Function:g(X1, · · · ,Xn) = 0(N − 1 dimension surface)

X1

X2

pdf countour

g(X1,X2) > 0

g(X1,X2) < 0

g(X1,X2) = 0

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 20 / 30

Page 27: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Performance function

Performance function

Function of input quantities thatdescribe the status of thesystem: g(X1, · · · ,Xn)

Failure domain: g ≤ 0Safe domain: g ≥ 0Limit State Function:g(X1, · · · ,Xn) = 0(N − 1 dimension surface)

X1

X2

pdf countour

g(X1,X2) > 0

g(X1,X2) < 0

g(X1,X2) = 0

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 20 / 30

Page 28: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Performance function

Performance function

Function of input quantities thatdescribe the status of thesystem: g(X1, · · · ,Xn)

Failure domain: g ≤ 0Safe domain: g ≥ 0Limit State Function:g(X1, · · · ,Xn) = 0(N − 1 dimension surface)

X1

X2

pdf countour

g(X1,X2) > 0

g(X1,X2) < 0

g(X1,X2) = 0

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 20 / 30

Page 29: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Performance function

Performance FunctionDemand - Capacity

Identify capacityIdentify demand

Can be random variables, orfunctions of random variables

Probability of failure: P(Demand > Capacity)

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 21 / 30

Page 30: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Performance function

Performance FunctionExample

Failure: exceedance of the yieldstressg(θ) = σmax(θ)− σ(θ)

θ: structural and loaduncertainty vector

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 22 / 30

Page 31: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Estimation of probability of failure

Failure quantificationFailure (F):Demand σ(θ) ≥ σmax(θ) CapacitySafe (S):Demand σ(θ) < σmax(θ) Capacity∫

FfX(x) dx =

∫IF(x) fX(x) dx

where:

IF(X) ={

0 ⇐⇒ X ∈ S1 ⇐⇒ X ∈ F

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 23 / 30

Page 32: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Reliability Analysis Estimation of probability of failure

Failure quantification (”dart” game)f (x)dx probability to hit a point (generaterealisations of random variables)IF(x) the prize (evaluate the performance function)

Estimate: direct Monte Carlo simulation

Pf =

∫IF(x) fX(x) dx ≈ 1

N

N∑k=1

IF(X(k))

to meet specified accuracy: N ∝ 1Pf

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 24 / 30

Page 33: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Hands-on session Gettting started

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 25 / 30

Page 34: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Hands-on session Compute π

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 26 / 30

Page 35: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Hands-on session Compute π

Estimation of πUsing COSSAN-X

1 Input: Define 1 parameter representing r2 Input: Define 2 Random variables representing random

coordinate of points3 Evaluator: MIO connector that computes d =

√x2

i + y2i

4 Performance Function: Defined as Capacity d and Demand r(Reliability analysis collects values of the performancefunction when Capacity > Demand)

5 Analysis: Perform the reliability analysis6 Result: pf =

π4

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 27 / 30

Page 36: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Hands-on session Compute π

Buffon’s experimentUsing COSSAN-X

1 Define 1 random variable describing theangle φ

2 Define 1 random variable describingdistance d

3 Define 2 parameters (t and L)4 Define a function computing Lcosφ5 Define a performance function:

Demand (d) Capacity (t)6 Perform Monte Carlo simulation

(Reliability Analysis)E.Patelli M.Broggi COSSAN Training Course 8 April 2019 28 / 30

Page 37: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Hands-on session Cantilever Beam

Outline

1 IntroductionA brief overviewEvaluation of DefiniteIntegralsEstimation of π

2 Reliability AnalysisOverviewPerformance function

3 Hands-on sessionCompute πCantilever Beam

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 29 / 30

Page 38: Introduction to Monte Carlo method and reliability analysis · 2019. 4. 8. · Introduction A brief overview Buffon’s experiment Monte Carlo simulation 1 Sample an u 1 ˘U[0;1)

Hands-on session Cantilever Beam

Reliability Analysis of a Cantilever BeamL,H, ρ,E random variablesDisplacement:

w =ρgBHL4

8EI+

FL3

3EI

I =BH3

12

F

H

BL

Failure: excidence maximum displacement wmax = 0.01

Define a probabilistic model and perform reliability analysis

E.Patelli M.Broggi COSSAN Training Course 8 April 2019 30 / 30