I am having a problem using UQlab that I am trying to solve, until now not successfully. I coupled UQlab with abaqus. I defined my inputs (matrix 200x5) and then rund 200 simulations with abaqus. I got then the output data (matrix 200x2). I already performed successfully PCE. I would like to use other technique, such as PCK. When performing the analysis, I get this error:

Index in position 2 exceeds array bounds (must not exceed 4).
Error in uq_PCK_eval (line 14)
X = X(:,current_model.Internal.Input.nonConst);
Error in uq_eval_uq_metamodel (line 14)
[varargout{1:nargout}] = uq_PCK_eval(current_model, X);
Error in uq_sobol_indices (line 88)
AllValues = uq_evalModel(Options.Model,[Sample1; Sample2; Pick2Freeze1]);
Error in uq_sensitivity (line 85)
results = uq_sobol_indices(CurrentAnalysis);
Error in uq_initialize_uq_sensitivity (line 863)
uq_runAnalysis(current_analysis);
Error in beammc2 (line 112)
PCESobolAnalysis = uq_createAnalysis(PCESobol) ;

I tried to load the sample that I want to use as experimental set for the metamodel in a separate code file, but then I get another error, different this time:

Dot indexing is not supported for variables of this type.
Error in uq_PCK_calculate_coefficients (line 44)
Xred = current_model.ExpDesign.X(:,current_model.Internal.Input.nonConst);
Error in uq_calculateMetamodel (line 24)
success = uq_PCK_calculate_coefficients(current_model);
Error in uq_initialize_uq_metamodel (line 362)
success = uq_calculateMetamodel(current_model);
Error in Untitled2 (line 47)
myPCE = uq_createModel(metaopts)

Can someone help me in understading what I am doing wrong?

Hello,
Does the same piece of code works with the PCE, but not for the PCK ?
For me it usually works fine when switching from PCE to PCK.
Based on my experience, the second error appears when I forget to start uqlab at the begining of the file.

Yes, thatâs the same piece of code that does not work if I switch it to PCK.
I tried to run another self-made example without UQLink and it works. It is that specific file that does not work with PCK. With PCE everything runs smoothly.

For the second error, I started uqlab at the beginning of the code.

Hello,
If you send your code, with the reproductible errors, maybe I can take a look if you want. You can save your experimental design in .mat variables, and save the programs in a .zip file.
Best regards,
Marc

Hi, thanks for the answer and for the offered help. Here attached the code. Please note that line 59-63 loads the experimental design, you just need to change that line in your local path. Thank you if you will have the time to look at it. UQLabBeam.zip (2.7 KB)

Dear @DorotC,
I was able to run your code, thanks. There is a small issue, when I switch from PCE to PCK in line 76. I am not really sure where it comes from, but to fix this issue: you just need to define which model and which input you want to use, when you define the Sobol and the Reliability analysis.

It means the end of your could should looks like :
For the sensitivity :

I have two smalls remark on your code, more about UQ :

20 samples in your experimental design is, I think, a too small sample size, specially with 5 inputs. I recommand to use a little bit more.

You do a PCK, and then AKMCS. Based on a PCK, I recommand to do the reliability analysis with Monte Carlo (AKMCS uses a metamodel, so you are doing a metamodel on a metamodel : it is not really relevant). To do your reliability analysis, you can get 10^6 samples and count how much are smaller than 0 :

X = uq_getSample(myInput,1000000);
Y = uq_evalModel(myPCK, X);
length(find(Y < 0))/length(Y)

I think this last point is quite related to your recent post.

My aim was to perform AKMCS using a metamodel constructed with PCK. As far as I understood, the algoritm has to update the metamodel using new point that it found using the learning function. The doubt that I had was that in the code that I sent you, the metamodel is defined âoutsideâ the structure of AKMCS and I was not sure was the same thing as defining the analysis as you just did.

Yesterday I tried to exclude the constant from the inputs and I worked. It is not returning anymore any mistake. Of course, I defined a model for AKMCS as well.

Thank you @M_Groslambert for pointing out the problem in the codes Dorotea shared.

I think issue is that the problem is not well set-up in UQLab. Generally UQLab uses by default the latest input and model objects created. In this case, the latest model defined is the PC-Kriging model. UQLab will then refer to it to do both the sensitivity analysis and reliability analysis.

For AK-MCS, I assume this is probably not what you intended to do. When you do AK-MCS, you would like the algorithm to call the original model (in this case the one in Abaqus through UQLink). Instead what happens is that the AK-MCS algorithm thinks the original model is the PC-Kriging model and calls it to enich the ED for the Kriging model, which doesnât make sense obviously. I guess what you wanted to do was to define PC-Kriging as the metamodel used in AK-MCS. In this case, the proper way to set this in UQLab is to use the option:

MCSopt.AKMCS.Metamodel = 'PCK'

So you still need to keep the definitoin of the UQLink model somewhere in the session. Furthermore, since your QoI is not directly the result of the Abaqus run but is post-processed in lines 65-70, you need to define a wrapper function that will i. take as input the random variables X and the UQLink model, ii. do the post-processing, and iii. eventually return the final response (Gtruss).
This model should then be the one fed to AK-MCS to perform enrichment.

I will let you have a look first. If you still have issues setting your problem I can guide you further.

I think once you fix this you wonât have problems with constants anymore. The error is probably due to a use-case that we did not anticipate.

Now to reply to your other questions:

I think 20 points are enough to start the algorithm, you just need to make sure that you donât have a premature convergence by properly setting your convergence criterion.

Yes exactly, that was the issue. As an additional point: Instead of using AK-MCS directly, you can also try the new active learning module where you have much more possibilities (i.e., not only limited to Kriging/PC-Kriging and Monte Carlo simulation).

Please let me know if that is helpful or if you have other questions.

thank you again for your tip. I did it and it works!

I just have other questions related to the use of APCK-MCS and on the module âactive learningâ.

I tested the code for probability of failure around 10^(-4) with APCK-MCS and I wanted the algorithm to stop when the criteria âstopPfâ is satisfied. the COV that the algorithm returned me is higher then the one I would like to have (0,1). Why does it happen? Is there any other criteria that becomes satisfied? This goes âworstâ when I decrease the probability of failure;

With the module of Active Learning, I selected as reliability method âsubsetâ (default) and PCK as metamodel. The results is very accurate, although even if I select a convergence methodology, the COV is more or less always around 0,02. Maybe did I do something wrong or is there any reason for that?

In your first question, I assume you are referring to the CoV of the reliability estimation algorithm. This is not really related to the use of PCK. It only depends on the number of samples you are using and the target failure probability. You can reduce it by increasing the sample size for Monte Carlo using the option .Simulation.MaxSampleSize. Generallly speaking, you can access all the options of the reliabililiy estimation algorithm and modify them as you would if you were not using active learning.

Similarly for the second question, the CoV is independent of the stopping criterion set for the ALR method. The stopping criterion mainly focuses on the convergence/accuracy of the surrogate model. You can get a higher/lower target CoV by directly modifying the options of the reliability method. By default, SuS is tuned such that the resulting CoV is very small.

Again, thank you for answer. I just have last question if it is possible: until now, I only used UQlink to construct metamodel and together I used a type of reliability method. However, now I want to perform only a reliability method without any metamodelling. So I thought that the way I created the model in matlab would work also for the âsimpleâ Importance sampling reliability.
It does not work, so now I have a doubt if it is correct at all or if now I have to formulate this in another way.

The matlab function given as a Model to the Reliability methodology (and previously as model for Active Learning) is:

function G = limitstatefunction(X, Ytruss)
AbaqusModel = Ytruss;
X2=X;
Y = uq_evalModel(AbaqusModel,X2);
%Y1 moment in the beam middle
%Y2 moment at joint location
%Y2 rotation at joint
G=(max((min((X(:,1)/1000.*X(:,4))/1.3-max(abs(1.5*Y(:,1)/1000),abs(1.5*Y(:,2)/1000)),(X(:,2)/1000.*(X(:,4)))/1.3-abs(1.5*Y(:,2)/1000))), abs(1.5*Y(:,2))-X(:,6)/1.3)
end

If it is correct, why does not work to give this as a model for IS reliability? Is it possible at all?

You can of course directly call your Abaqus model to run importance sampling. What is the error you get exactly?

The limit-state function you have defined looks good to me. I assume Ytruss is the UQLink model you have previously created.

You can directly define limitstatefunction.m as your Model for the reliability analysis. You however need to define the UQLink model as a parameter. More precisely:

ModelOpts.mFile = 'limitstatefunction'
ModelOpts.Parameters = Ytruss ; % i.e. your UQLink model defined earlier with Ytruss = uq_createModel(UQLinkOptions);

Alright, thanks for checking it.
Basically, When the algoritm is running and then when it is about to run a simulation (Maybe to compute the design point?) it fails. If I look inside the input file of Abaqus, I see that in the load field the value is âinfâ. Of course, this is not a valid value for Abaqus and the simulation cannot be completed. Maybe since the limit state equation is of the tipe: Resistance-Load, the algoritm has an âinterestâ to select the highest value for the variable âLoadâ? I also tried to bound that distribution but of course it did not fix the problem. Do you maybe have some suggestions?

Normally the candidates sample for enrichment are chosen from a pre-defined set. If you are using the active learning module, this set comes from the samples generated in the reliability analysis in the previous iteration.

Those samples are themselves generated using the input distribution you have provided. May be some of those inputs have parameters/moments that lead to sampling âInfâ. What you could do is to generate some large sample set (even very large) from the input model you have defined and then try to see if you get some Inf.

Sorry I am replying a bit late, so may be you have already figured it out. If so, I would be curious to know what was the issue.