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

Post on 07-Mar-2021

6 views 0 download

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

7th COSSAN TRAINING COURSE - 08-10 April 2019

Introduction to Monte Carlo methodand reliability analysis

Edoardo Patelli, Matteo BroggiE: info@cossan.co.uk W: www.cossan.co.uk T: +44 01517944079

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Hands-on session Gettting started

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

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

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

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

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

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