Link Uqlab and Castem

Hello, I am a beginner with the Uqlab software and I want to perform the sensitivity analysis of a finite element digital model implemented in the Castem software. My problem is that I can’t make the connection between the two software I read the Uqlink user manual I tried to follow the examples but I have no value. However, I was able to link my Castem to MatLab with the following code and the calculation goes correctly.
n_sim = 10;
F_ct Ft.m = 3.5e6; Ft.cov = 0.13; Ft.type = 'Lognormal'; Mod_E
mod_E.m = 35e9;
mod_E.cov = 0.12;
mod_E.type = ‘Lognormal’;
% Initiate the vector to store results

Ft.data = generRV(n_sim,Ft);
mod_E.data = generRV(n_sim,mod_E);

sigma = zeros(1,n_sim);
fleche = zeros(1,n_sim);
timeCPU = 0;

for i_sim = 1 : n_sim

%% Create vector x for ith simulation
x = [Ft.data(i_sim) mod_E.data(i_sim)];

%% Write vector x to file
fid = fopen('inputstat.txt','w');
%
n = max(size(x));
for i = 1:n    
    fprintf(fid,'%20.16E\n',x(i));
end
fclose(fid);

%% Call Castem to calculate
tic    

dos('castem18 essais_stat_OK.dgibi');
  
timeCPU =   timeCPU + toc;

%% Get Output
File        =   'resultstat.out';            
A           =   textread(File,'%f');      

 fleche(i_sim) =   A(1,1);
 sigma(i_sim)  =   A(2,1);      

end

Here is my uqlab code.

clearvars
rng(1,‘twister’)
uqlab

ModelOpts.Type = ‘UQLink’;
ModelOpts.Name = ‘CASTEM Wrapper’;

EXECUTABLE = ‘C:\Cast3M\PCW_18\bin’;
INPUTFILE = ‘essais_stat_OK.dgibi’;

COMMANDLINE = sprintf(’%s %s’,EXECUTABLE,INPUTFILE);

ModelOpts.Command = COMMANDLINE;

ModelOpts.Template = ‘essais_stat_OK.dgibi.tpl’;

ModelOpts.Output.FileName = ‘resultstat.out’;
ModelOpts.Output.Parser = ‘readresultOutput’;

ModelOpts.ExecutionPath = fullfile(uq_rootPath,…
‘Examples’,‘UQLink’,‘sens_stat’) ;

ModelOpts.Format = {’%1.8f’};

ModelOpts.Display = ‘quiet’;

monModelCASTEM = uq_createModel(ModelOpts);

InputOpts.Marginals(1).Name = ‘E’;
InputOpts.Marginals(1).Type = ‘Lognormal’;
InputOpts.Marginals(1).Moments = [35e9 4.2e9]; % (Pa)

InputOpts.Marginals(2).Name = ‘Ft’;
InputOpts.Marginals(2).Type = ‘Lognormal’;
InputOpts.Marginals(2).Moments = [3.5e6 0.455e6];

myInput = uq_createInput(InputOpts);

X = uq_getSample(10,‘LHS’);

Y = uq_evalModel(monModelCASTEM,X);

Thank you in advance for your return

This is a duplicate of the following (resolved) topic:

https://uqworld.org/t/linking-uqlab-and-castem

This topic is now closed.