# How to calculate the reliability of a structure in uqlink

Hello!
I did the sensitivity analysis of a finite element model (Castem) on uqlink which works well. My model has 3 inputs (young’s modulus, load, tensile strength) and 2 outputs (deflection, tensile stress). I want to calculate the reliability of my beam with as limit state function g (X) = (tensile strength - tensile stress) which are input and output parameters of my model. how do I proceed?
Thank you

Hi!

Assuming you already defined your FEM model as myFEM using UQLink, you can create a second model that defines the limit state function as follows:

LSFModelOpts.mFile = 'myLimitStateFunction';
LSFModelOpts.Parameters = myFEM;
myLSFModel = uq_createModel(LSFModelOpts)


myLimitStateFunction.m is a separate m-file that might look like this (adaptation required):

function Y = myLimitStateFunction(X,P)
% Assuming X(:,1): Young's Modulus, X(:,2): Load, X(:,3): Tensile strength

myFEM = P;  % Bring the CASTEM model to this function scope
Yfem = uq_evalModel(myFEM,X); % Evaluate the Castem FEM model
Y = X(:,3) - Yfem(:,2);  % Assuming the tensile stress is in the second column

end


You can then use myLSFModel as the MODEL for the reliability analysis in UQLab. For instance, using Monte-Carlo simulation (assuming running the FEM model is not expensive) for reliability analysis, assign the model to the following options: MCSOpts.Model = myLSFModel; before running the analysis (see the second example below). Be sure to check out other, more advanced, methods.

I think these UQLab examples would be a good starting point for that.

For an example of using UQLink model in a reliability analysis:

For a quick overview of various reliability analysis methods in UQLab:

I hope this helps!

I tried to follow your example and the problem is that when I evaluate my model with “Yfem = uq_evalModel (myFEM, X);” it just returns me the values ​​of a single output (so the first which is the arrow here) but when I do it with “[Y1, Y2] = uq_evalModel (myFEM, X);” (which I also used in my sensitivity analysis for the same reason) I have my two outputs

Yes, it actually depends on how you define your UQLink parser. In my example above, I assume the output is N\times2 matrix, but it is also common to define the parser with multiple output arguments (i.e., function [Y1,Y2] = myParser(...)).

If that’s the case, indeed you simply replace the relevant lines with [~,Y2] = uq_evalModel(myFEM,X) (as you did, but simply get the second output of interest, assuming it is the tensile stress).

I forgot to ask whether, despite the problem you have regarding the two outputs, you manage to get the results you wanted in the end?

Hi! yes I have the desired results and thank you everything goes as I want.
on the other hand, the reliability analysis takes a long time for ( ‘‘MCSOpts.Simulation.MaxSampleSize = 100;’’ for example).
how to optimize the computation time please?

Great!

The MCS for reliability analysis would be very expensive indeed, I used it in my example above just to check if you manage to create the limit state function that contains a UQLink MODEL properly.

For a proper reliability analysis, I’d suggest you have a look at other available methods in UQLab, some of them are metamodel-based and can be much more faster.

Have a look at the Reliability analysis user manual as well as the relevant examples.

If you have any questions about any of these methods, don’t hesitate to open a new topic! 