INVERSION: SIMPLE BEAM CALIBRATION¶
In this example, the measured deflections of a simply supported beam under a uniform load $p$ are used to calibrate the Young's Modulus $E$ of the beam material. Basic uncertainty on the applied $p$ is assumed. The calibration is carried out with default model/data discrepancy options.
Package imports¶
from uqpylab import sessions
import numpy as np
Start a remote UQCloud session¶
# Start the session
mySession = sessions.cloud()
# (Optional) Get a convenient handle to the command line interface
uq = mySession.cli
# Reset the session
mySession.reset()
Processing .
.
done! uqpylab.sessions :: INFO :: This is UQ[py]Lab, version 1.00, running on https://uqcloud.ethz.ch. UQ[py]Lab is free software, published under the open source BSD 3-clause license. To request special permissions, please contact: - Stefano Marelli (marelli@ibk.baug.ethz.ch). A new session (157415016f764591ba6def75feccdaec) started.
uqpylab.sessions :: INFO :: Reset successful.
Set the random seed for reproducibility¶
uq.rng(100, 'twister');
The forward model computes the deflection of the beam $V$ at mid-span location, which reads:
$$ V = \frac{ 5 p L^4 }{32 E b h^3}$$
This computation is carried out by the function uq_SimplySupportedBeam(X) supplied with UQLab. The input variables of this function are gathered into the $N \times M$ matrix X, where $N$ and $M$ are the number of realizations input variables, respectively. The variables are given in the following order:
- $b$: beam width $(m)$
- $h$: beam height $(m)$
- $L$: beam length $(m)$
- $E$: Young's modulus $(MPa)$
- $p$: uniform load $(kN/m)$
Define the forward model as a MODEL object:
ModelOpts = {
'Type' : 'Model',
'mString': '(5/32)*(X(:, 5).*X(:, 3).^4)./(X(:, 4).*X(:, 1).*X(:, 2).^3)',
'isVectorized': True
}
myModel = uq.createModel(ModelOpts)
Prior distribution of the model parameters¶
The prior information about the model parameters is gathered in a probabilistic model that includes both known and unknown parameters.
The geometrical dimensions $b$ (beam width), $h$ (beam height) and $L$ (beam length) are perfectly known:
- $b = 0.15$ m
- $h=0.3$ m
- $L = 5$ m
The applied load $p$ is known up to some Gaussian measurement noise. The Young's modulus $E$, target of the calibration experiment, is given a lognormal prior distribution:
- $p \sim \mathcal{N}(\mu_p = 1.2\times10^{-2}, \sigma_p = 6\times10^{-4})$
- $E \sim \mathcal{LN}(\mu_E = 3\times10^4, \sigma_E = 4.5\times10^3)$
Specify these distributions as an INPUT object:
PriorOpts = {
"Marginals": [
{
"Name": "b", # beam width
"Type": "Constant",
"Parameters": [0.15], # (m)
},
{
"Name": "h", # beam height
"Type": "Constant",
"Parameters": [0.3], # (m)
},
{
"Name": "L", # beam length
"Type": "Constant",
"Parameters": [5], # (m)
},
{
"Name": "E", # Young's modulus
"Type": "LogNormal",
"Moments": [30e9,4.5e9] # (Pa)
},
{
"Name": "p", # uniform load
"Type": "Gaussian",
"Moments": [12000,600] # (N/m)
}
]
}
myPriorDist = uq.createInput(PriorOpts)
Constant model parameters in the prior indicate certainty about their value. These parameters will not be calibrated.
Measurement data¶
The measurement data consists of $N = 5$ independent measurements of the beam mid-span deflection. The data is stored in the column vector y:
myData = {
"y": (np.array([12.84, 13.12, 12.13, 12.19, 12.67])/1000).tolist(),
"Name": "Mid-span deflection",
}
Discrepancy model¶
By default, the Bayesian calibration module of UQLab assumes an independent and identically distributed discrepancy $\varepsilon\sim\mathcal{N}(0,\sigma^2)$ between the observations and the predictions for each data. The variance $\sigma^2$ of the discrepancy term is by default given a uniform prior distribution:
$$ \pi(\sigma^2) = \mathcal{U}(0,\mu_{\mathcal{Y}}^2), \quad \mathrm{with} \quad \mu_{\mathcal{Y}} = \frac{1}{N}\sum_{j=1}^{N}y_{j} \quad (\mathrm{here~equal~to}~0.01259)$$
Bayesian analysis¶
The options of the Bayesian analysis are specified with the following structure:
BayesOpts = {
"Type" : "Inversion",
"Data" : myData,
}
Run the Bayesian inversion analysis:
myBayesianAnalysis = uq.createAnalysis(BayesOpts)
Processing .
.
.
.
.
.
.
.
.
.
.
.
.
.
done!
Print out a report of the results:
uq.print(myBayesianAnalysis)
%----------------------- Inversion output -----------------------% Number of calibrated model parameters: 2 Number of non-calibrated model parameters: 3 Number of calibrated discrepancy parameters: 1 %------------------- Data and Discrepancy % Data-/Discrepancy group 1: Number of independent observations: 5 Discrepancy: Type: Gaussian Discrepancy family: Scalar Discrepancy parameters known: No Associated outputs: Model 1: Output dimensions: 1 %------------------- Solver Solution method: MCMC Algorithm: AIES Duration (HH:MM:SS): 00:01:12 Number of sample points: 3.00e+04 %------------------- Posterior Marginals --------------------------------------------------------------------- | Parameter | Mean | Std | (0.025-0.97) Quant. | Type | --------------------------------------------------------------------- | E | 2.4e+10 | 2.1e+09 | (2.1e+10 - 3e+10) | Model | | p | 1.2e+04 | 5.9e+02 | (1.1e+04 - 1.3e+04) | Model | | Sigma2 | 4.2e-06 | 1.3e-05 | (1e-07 - 3.8e-05) | Discrepancy | --------------------------------------------------------------------- %------------------- Point estimate ---------------------------------------- | Parameter | Mean | Parameter Type | ---------------------------------------- | E | 2.4e+10 | Model | | p | 1.2e+04 | Model | | Sigma2 | 4.2e-06 | Discrepancy | ---------------------------------------- %------------------- Correlation matrix (model parameters) ---------------------- | | E p | ---------------------- | E | 1 0.46 | | p | 0.46 1 | ----------------------
Create a graphical representation of the results:
uq.display(myBayesianAnalysis);
Terminate the remote UQCloud session¶
mySession.quit()
uqpylab.sessions :: INFO :: Session 157415016f764591ba6def75feccdaec terminated.
True