UQWorld

How do I establish a connection between UQLab and my simulation code?

How Do I Establish a Connection Between UQLab and My Simulation Code?

As of V1.1, UQLab is shipped with the UQLink module, a universal code wrapper that allows you to define a computational model in UQLab involving a third-party software or code using templates and a mark-up system.

To wrap your own simulation code within UQLab, you need to do the following:

  • Create a template file based on the text-based input file of your simulation code and in which some markers are set. During an analysis, UQLab will generate input files of your simulation code by replacing the markers in the template with the actual values (e.g., realizations of the input random vector, points in the experimental design, etc.) and execute your simulation code with the generated input files;
  • Create a parser function in MATLAB that reads the text-based output file of your simulation code and extract the relevant quantities of interest for further analysis by UQLab;
  • Configure UQLink properly by defining the names of your template file, parser function, and executable of your simulation code.

After the wrapper has been configured, the corresponding computational model can be seamlessly used with any techniques available in other UQLab Modules to create complex analyses in no time.

To learn more about UQLink, read its User Manual and check out the relevant examples (including the couplings of UQLab with C/C++ executable, Abaqus and OpenSees) available on the UQLab website.


Back to the FAQ index

1 Like

Thank you for sharing this. I am facing a problem in establishing the wrapper between the UQLab and Comsol, is there any examples or suggestions for this ?
Highly appreciate the help!

Hi @TamadurAB,

I’m not familiar with Comsol, but according to this

it seems that COMSOL can be run in batch mode by specifying an input file. This is a pre-requisite to use UQLink. To proceed further, this input file should be text file or, at least, there should be a way to access the parameters inside the input file that are relevant for UQ analysis.

I don’t know anything about the structure of mph file mentioned in the article above. So perhaps, you could open a new topic in the Community Q&A section so we can discuss in detail your particular problem :wink:? Thanks a lot!

1 Like

Hi @damarginal … Thank you for your answer… I reached a point where I use COMSOL through matlab “livelink”, so in this case all the calculations are going to be within matlab with its formulation, but still not manage to make the wrapper between the comsol “livelink” and UQLab, I am missing something but I don`t know what is it!
Will move it to Community Q&A section. Thanks so much … the article you shared also present a good idea to use. Thanks :slight_smile: