# Examples

## Isoprobabilistic Transformation

### Nataf Transformation

# Generate a random vector X with correlated marginal random variables X₁ and X₂:
X₁  = generaterv("Gamma", "M", [10, 1.5])
X₂  = generaterv("Gumbel", "M", [15, 2.5])
X   = [X₁, X₂]

# Define the correlation matrix:
ρˣ = [1 0.90; 0.90 1]

# Perform the Nataf Transformation by defining a "NatafTransformation" object:
NatafObject = NatafTransformation(X, ρˣ)

# Generate 1000 samples of the random vector X in X-, Z-, and U-spaces:
XSamples, USamples, ZSamples = samplerv(NatafObject, 1000, ITS())

## Monte Carlo Simulations

# Generate a random vector X with correlated marginal random variables:
M₁  = generaterv("Normal", "M", [250, 250 * 0.3])
M₂  = generaterv("Normal", "M", [125, 125 * 0.3])
P   = generaterv("Gumbel", "M", [2500, 2500 * 0.2])
Y   = generaterv("Weibull", "M", [40000, 40000 * 0.1])
X   = [M₁, M₂, P, Y]
ρˣ  = [1 0.5 0.3 0; 0.5 1 0.3 0; 0.3 0.3 1 0; 0 0 0 1]

# Define a limit state function:
a   = 0.190
s₁  = 0.030
s₂  = 0.015
g(x) = 1 - x[1] / (s₁ * x[4]) - x[2] / (s₂ * x[4]) - (x[3] / (a * x[4])) ^ 2

# Define a reliability problem:
Problem = ReliabilityProblem(X, ρˣ, g)

# Perform the reliability analysis using curve-fitting SORM:
Solution = analyze(Problem, MCS())
println("MCS:")
println("β from g₂: $(Solution₂.β)") FORM: β from g₁: 2.108339767222378 β from g₂: 2.108339767222378 ## Second-Order Reliability Methods ### Curve-Fitting Method # Generate a random vector X with correlated marginal random variables: M₁ = generaterv("Normal", "M", [250, 250 * 0.3]) M₂ = generaterv("Normal", "M", [125, 125 * 0.3]) P = generaterv("Gumbel", "M", [2500, 2500 * 0.2]) Y = generaterv("Weibull", "M", [40000, 40000 * 0.1]) X = [M₁, M₂, P, Y] ρˣ = [1 0.5 0.3 0; 0.5 1 0.3 0; 0.3 0.3 1 0; 0 0 0 1] # Define a limit state function: a = 0.190 s₁ = 0.030 s₂ = 0.015 g(x) = 1 - x[1] / (s₁ * x[4]) - x[2] / (s₂ * x[4]) - (x[3] / (a * x[4])) ^ 2 # Define a reliability problem: Problem = ReliabilityProblem(X, ρˣ, g) # Perform the reliability analysis using curve-fitting SORM: Solution = analyze(Problem, SORM(CF())) println("SORM:") println("β from FORM:$(Solution.β₁)")
println("β from SORM: $(Solution.β₂[1]) (Hohenbichler and Rackwitz)") println("β from SORM:$(Solution.β₂[2]) (Breitung)")
println("PoF from FORM: $(Solution.PoF₁)") println("PoF from SORM:$(Solution.PoF₂[1]) (Hohenbichler and Rackwitz)")
println("PoF from SORM: $(Solution.PoF₂[2]) (Breitung)") SORM: β from FORM: 2.466021207388449 β from SORM: 2.3410266432353186 (Hohenbichler and Rackwitz) β from SORM: 2.359553628778695 (Breitung) PoF from FORM: 0.006831162248127732 PoF from SORM: 0.009615397348334088 (Hohenbichler and Rackwitz) PoF from SORM: 0.009148468013105492 (Breitung) ### Point-Fitting Method # Generate a random vector X with correlated marginal random variables: M₁ = generaterv("Normal", "M", [250, 250 * 0.3]) M₂ = generaterv("Normal", "M", [125, 125 * 0.3]) P = generaterv("Gumbel", "M", [2500, 2500 * 0.2]) Y = generaterv("Weibull", "M", [40000, 40000 * 0.1]) X = [M₁, M₂, P, Y] ρˣ = [1 0.5 0.3 0; 0.5 1 0.3 0; 0.3 0.3 1 0; 0 0 0 1] # Define a limit state function: a = 0.190 s₁ = 0.030 s₂ = 0.015 g(x) = 1 - x[1] / (s₁ * x[4]) - x[2] / (s₂ * x[4]) - (x[3] / (a * x[4])) ^ 2 # Define a reliability problem: Problem = ReliabilityProblem(X, ρˣ, g) # Perform the reliability analysis using curve-fitting SORM: Solution = analyze(Problem, SORM(PF())) println("SORM:") println("β from FORM:$(Solution.β₁)")
println("β from SORM: $(Solution.β₂[1]) (Hohenbichler and Rackwitz)") println("β from SORM:$(Solution.β₂[2]) (Breitung)")
println("PoF from FORM: $(Solution.PoF₁)") println("PoF from SORM:$(Solution.PoF₂[1]) (Hohenbichler and Rackwitz)")
println("PoF from SORM: $(Solution.PoF₂[2]) (Breitung)") SORM: β from FORM: 2.466021207388449 β from SORM: 2.3536666008296554 (Hohenbichler and Rackwitz) β from SORM: 2.36928554527003 (Breitung) PoF from FORM: 0.006831162248127732 PoF from SORM: 0.009294637816433898 (Hohenbichler and Rackwitz) PoF from SORM: 0.008911243806556333 (Breitung) ## Subset Simulation Method # Define a random vector of uncorrelated marginal distributions: X₁ = generaterv("Exponential", "P", 1) X₂ = generaterv("Exponential", "P", 1) X = [X₁, X₂] ρˣ = [1 0; 0 1] # Define a limit state function: g(x) = 10 - x[1] - x[2] # Define reliability problems: Problem = ReliabilityProblem(X, ρˣ, g) # Perform the reliability analysis using SSM: Solution = analyze(Problem, SSM()) println("SSM") println("PoF from SSM:$(Solution.PoF)")
SSM
PoF from SSM: 0.0005001000000000001