# Cantilever Beam (Uncertainty Quantification)

This page shows how to perform Uncertainty Quantification of the Cantilever Beam with COSSAN-X.

# Problem Definition in COSSAN-X

## Define a Project

In the first step a new project named 'Cantilever_beam' is created: This can be done by pressing the 'new' icon, or from the menu File->New->Project.

After the project has been created, the project name 'Cantilever_beam' appears in the workspace. All the subfolders are empty

## Input

### Parameters

In the next step, the constant input parameters, i.e. the length L and the width b are specified. Clicking with the right button at the folder 'parameter' and selecting 'Add parameter' the following wizard appear on the screen (see also Parameter (wizard)):

After pressing finish, a Parameter object is created and it properties can edited (see also Parameter (editor)):

The same procedure is repeated to define the parameter b. Then, the length L and the width b are specified as parameters with COSSAN-X.

To save a created parameter, simply click the 'ctrl' and the 's' key simultaneously.

### Random Variables

In the next step, a probability distribution is associated to each uncertain quantity, i.e. the height h, the tip load P, the density $\rho$ and the Young's modulus E.

To define new random variables, right click on the sub-folder "Random Variables" and select "Add Random Variable". Then, the following input mask will pop up, which allows you to define the name and a description of the uncertain quantity:

After pressing "Finish"  the editor for Random Variable appears, where the distribution type can be selected from a list. In the following, the "Normal" distribution has been selected for the variable height h, and the mean of 0.24 and standard deviation of 0.01 have been inserted.

After all parameters of the distribution have been specified, the preview of the PDF and CDF of the random variable is shown. (It is necessary to save the data of the Random Variable by either pressing "Ctrl s" or pressing the save icon).

This procedure is repeated for all uncertain parameters. For instance, the follow figure shows the definition of the Young's Module:

Then an overview over all defined random variables are shown in the bottom part of the central window of the GUI:

### Random Variable Set

Next, at least one or more Random Variable Sets need to be specified. Random Variable sets allow users to define correlations between Random Variable. Please note that it is NOT necessary to define a Random Variable Set for the random variables that are independent or uncorrelated. In this simple case, one single set "rvset1" suffices.

To create a random variable set, right click on the sub-folder "Random Variable Sets" and select "Add Random Variables Set" (see also Random Variables Set (wizard). Then the following wizard pops up, where the name of the set can be modified:

After pressing Finish, the editor for Random Variable Set will open, as shown below. In this case all four random variables are inserted into the set. The GUI supports "drag and drop". Hence, the list is filled by simply drag all icons in the workspace to the window in the right.

Without pressing at the button "Correlations", all random variable in the set are assumed to be uncorrelated. In this case, the uncertainty in the tip load P and the height are obviously independent. However, the elasticity module E for wood is strongly correlated with the density. In this case, a correlation coefficient of 0.8 has been selected. Note that zero correlations can be left blank.

This completes the input in the sub-folder "Random Variable Sets".

### Functions

Functions of constant parameters and of random variables are very powerful and useful for many cases. In this simple case, however, the response quantitiy could be computed without using any function. Hence, the sub-folder could be left empty.

Since the response (i.e. tip displacement w) is analytically known, it may also be defined as a function. However, for demonstration, only the moment of inertia will be computed by using functions while w will be computed independently by a matlab script.

In the following, a function for the moment of inertia $I=bh^3/12$ will be created.

Analogously to create parameters and random variables, each function is created by right clicking the sub-folder "Function".

The pop up window allows to create a new function where the name and description can be edited. We use the name "I" and the description "moment of inertia".

After pressing finish, the editor for Function is open. Note that all previously defined names can be used within the function. Each name must be enclosed by <& &> as demonstrated below.

The function definition is:

 <&b&>.*<&h&>.^3/12


as shown in the following picture.

## Evaluator

An evaluator is used in a definition of a model. If a model could be seen as a black box that returns output values given the input values, an evaluator is actually the content of such a black box. Thus, an evaluator is a low-level definition of the functional relation between the inputs and outputs of a model.

### Matlab script

A Matlab script (also called MIO "Matlab Input Output") is used to calculate the quantity of interest. The new Matlab script is created using the wizard. To create a new Matlab script the following path must be followed:

Evaluators => Matlab Files => Right click => Add Matlab Script


Then the Matlab script editor will appear. First at all it is necessary to define the Input factors required to compute the beam displacement. In this examples all the defined inputs are required. Hence, pressing the plus button in Input windows of the Matlab script it is possible to add all the required inputs. Then, it is necessary to define a name of the computed quantity. The displacement is identified by the letter w.

In order to edit the script, please select the tab script from the Matlab script editor (indicated by the red arrow in the above picture). The displacement of the Beam is calculated by means of the following Matlab script:

Toutput(n).w=(Tinput(n).rho*9.81*Tinput(n).b*Tinput(n).h*Tinput(n).L^4)/(8*Tinput(n).E*Tinput(n).I) + ...
(Tinput(n).P*Tinput(n).L^3)/(3*Tinput(n).E*Tinput(n).I);


The above script can be copy and paste inside the for loop as shown in the figure at the right:

In this example Matlab structures are used to interact with the Engine. For more information about the Matlab script please refer to the following page: Mio (editor)

### Performance Function

The Performance function is used to define the domain of definition of the model into two sets, the safe set and the failure set. For more information see Performance function definition.

## Model

 To investigate the effect of uncertainties in the input to the response, it is necessary to define a model. As shown in the following three options are available. The first option "Physical Model" allows to generate independent samples by various methods to assess the variability (scatter) of the response. The second option "Optimization Models" is selected in case the response should be optimized in same sense. The third option "Probabilistic Models" is dedicated to reliability analysis. The "(0)" at end of the three options, indicate that none of the options have been established. ### Physical Model

In a first step the most basic option "Physical Model" is selected by moving the mouse pointer to "Physical Model" and clicking the right mouse button and selecting "Add Physical Model":

A wizard pops up showing default names which can be modified. In the following the default values are accepted by pressing the 'Finish' button.

Then, the editor appears, in which Evaluators and the Random Variable Sets can be added. The error message in red at the top indicate that the input is at the present state insufficient to perform an simulation analysis.

Clicking at the '+' of the evaluator (top left , the following window pops up, showing the available options. In this example, only the option "DisplacementBeam" is available and selected by pressing 'OK'.

Then the input and output associated with the evaluator are shown at the right in the windows 'Inputs' and 'Outputs' as shown in the following:

Saving the object, the error message on the top disapper and the Model is ready to be analyzed. However, it is necessary to add also the Random Variable set in order to consider correlation between the random variable.

In case the random variable set is not specified, the random variables required to evaluate the model are added automatically to an uncorrelated Random Variable set named "uncorrelated_rvs".

Next, all required Random Variable Sets need to be specified. Pressing at the '+' button of the Random Variable Sets, the available sets are shown:

After Pressing the 'OK' button, all required data is specified. Note that the warnings in red have now disappeared.

# Uncertainty Quantification Analysis

 After saving the data, the simulation is ready to start. Different simulations can be started by pressing at the small white triangle within a green circle at top right. ## Run the Analysis

The next window allows to choose among different analysis types such as: 'Design of Experiments', 'Sensitivity Analysis', 'Uncertainty Quantification'  and 'Userdefined Analysis'. In this tutorial 'Uncertainty Quantification' is selected.

After pressing 'Next' the following page appears and the method simulation is selected:

After pressing 'Next' in the above window, various options for simulation are provided. The well known Monte Carlo sampling procedure is selected. At the right, the number of independent samples can be declared. It is possible to split the computation into several batches which might be processed by different computers using parallel computing. It is recommended to keep the number of sample per simulation smaller than 10000 The computational performance degradate with the increase of the batch size

In this simple example with little computational effort, only a single batch is used. Choosing a zero maximum runtime, means that no limit for the runtime is given.

Pressing Next it is possible to specify the Grid Settings (i.e. how to perform the analysis). In this example the analysis will be performed on the local machine and it is not necessary to change the default values in the mask.

The actual computations starts after pressing the 'Finish' button. Then, the the following window appears.

When completed, a message of successful completion is provided:

## Show the Results

All results are accessible in the section "Analysis". The results are stored in sub-folders according to the performed analysis. In the present case only Uncertainty Quantification has been performed. This can be recognized by the value '(1)' in the folder 'Uncertainty Quantification'

### Uncertainty Quantification

 Expanding the folder 'Results' of the Uncertainty Quantification shows the following sub folders and all the involved variables defined in the input. In order to facilitate the visualization of the results the Perspectives 'Output view' can be selected. Alternatively, the 'Output view' can also be selected from the menu 'Window'>'Open Perspective'>'Output'. #### Scatter Plots

The following shows the 'Scatter View' and the 'Parallel Coordinates' view:

To visualize all 1000 realizations of the density rho and the Youngs modulus E, the variables can be selected using the mouse, and drags to the 'Scatter View':

A scatter of the load P and the tip displacement w_out is shown in the following scatter plot:

#### Parallel Coordinates

The 'Parallel Coordinates View' allows to show correlations between several variables:

#### Table View

Open a new table view, by clicking on the icon on the toolbar and then drag and drop the quantity of interest on the table.

#### Histogram

Open a new table view, by clicking on the icon on the toolbar and then drag and drop the quantity of interest on the Histogram view.