Skip to main content

Uncertainty Quantification

This is a basic tutorial of Uptimai software prepared to give a first introduction to the suite, and how to run the different features. To complete this tutorial will be needed Uptimai software and a *.zip file with some complementary files needed for the example problem to be solved. The Borehole.zip file can be found inside Member area -> Download -> Tutorial cases.

The *.zip file contains the whole project folder, so the user can start at any step of the given tutorial. Nevertheless, if the user wants to fulfil the tutorial from the beginning, only the Python script Borehole.py will be necessary, as all the other files will be generated during the process.

This tutorial will show you:

  • How to run each program of the package
  • What are the main features of each program and how to use them
  • What are the results you can expect
  • How to export and store output data
  • How to deal with basic issues you can encounter during the process

Part 1: Main Interface

1.1: Starting the program

Open Uptimai software, starting the Launcher GUI. You can use the shortcuts if this option was selected during the installation process, or find the executable inside the installation folder.

Figure 1: Main Interface - Initial state

1.2: Creating the project

Create a New Project with the button of the interface. You will have to choose an empty folder where all the project files will be located. The name of the folder will become the name of the project, in this example, we will use the name Borehole. You can create the folder directly from the interface.

info

Once you have created the project a *.uptim file will appear inside your project folder. That file is used as a flag so the folder is recognized as an Uptimai project and contains information about its available inputs and setups.

Figure 2: Main Interface - Project created

1.3: Start working on the project

Now, you have access to all the different features that conform to the Uptimai suite. In this tutorial, we will use them one by one.

Part 2: Input Preprocessor

2.1: Running the Input Preprocessor

The first step of all projects is always the Input Preprocessor, which can be opened directly from the main interface. The initial state can be seen in Figure 3.

Figure 3: Input Preprocess - Initial state

2.2: Inputs for the Uncertainty Quantification method

In this tutorial, we will select the Uncertainty Quantification method. It is possible to modify the Input name, but for simplicity, we will maintain the default name suggested by the software. Then, we can click the Create input button to start generating all the input files. You can see their names below the Input name entry.

Figure 4: Input Preprocess - Method selected

2.3: Add input variables

In this case, we have 8 input variables, so we will use the Add input variable button at the upper right to generate 8 variable spots.

2.4: Define input variables

Insert the following distribution to each variable. Remember to press the Confirm button to save the changes after editing each variable. In the end, you should have the same settings as in Figure 5

Open to view Input Distributions
NameTypeParameter 1Parameter 2
rw_boreholeNormal0.10.0161812
r_influenceLognormal7.711.0056
T_upperUniform63070115600
H_upperUniform9901110
T_lowerUniform63.1116
H_lowerUniform700820
L_boreholeUniform11201680
KwUniform985512045
Figure 5: Input Preprocess - Input distributions defined

2.5: Preparing distributions

Click the Prepare distributions button and continue with the Tweak distribution options to move forward.

2.6: Tweek distribution options

At this point, we can tune the domain of each variable. In this case, as variable number 11 has a normal distribution, we will crop the tails to ensure we don’t have any samples outside the domain. Set the minimum value to 0.03 and the maximum to 0.17.

Figure 6: Input Preprocess - Domain defined

2.7: Generate data

Finally, we can press the Generate data button, and move to visualizing the input distributions we just created. At this point, we have generated three files that store all the information provided inside an input folder in the project folder.

  • Borehole_UQ_InputSet.txt : Stores the information related to the probabilistic distributions
  • Borehole_UQ_InputDomain.txt : Stores the information related to the boundaries of the problem
  • Borehole_UQ_XDis.txt : Stores a Monte-Carlo set of samples used for the propagation of uncertainties

2.8: View data histogram

Visualize input distributions in the View data histogram section of the interface. Once we ensure that the histograms presented for every variable are the probability distributions wanted, we can close the Input Preprocessor with the Close Preprocessor button and move to the next tool.

Figure 7: Input Preprocess - Histogram visualization

Part 3: Set up Core Solver

3.1: Start the setup GUI

Once the inputs have been generated, it is time to prepare all the settings for the solver. We can do that using the Core Solver Setup, which once opened from the Uptimai main interface has the appearance as shown in Figure 8.

Figure 8: Set-up Core Solver - Initial State

3.2: Create new setup

Once the program is opened, the first thing we need to do is to create a new setup file. We can maintain the name of the file to the default value of UptimRes, and just click on the Create button.

3.3: Select the set of inputs

Then, we will see that the Core Solver Setup has three main tabs. The first one is to select the input files that will be used in this run. As in this case, we only have one set of available inputs, we will just select that one.

Figure 9: Set-up Core Solver - Input Files tab

3.4: Set up the case

The second tab, which is Cases / Outputs, details all the settings that are used for tuning the core solver to the needs of each specific problem. Thus, there is a setup specific to the Uncertainty Quantification method we are working with. Also, there is information about which outputs we would like to study. In this case, we will leave all the parameters to the default value except the Global residual which we will reduce to 0.01, to have a very accurate model of the problem.

Figure 10: Set-up Core Solver - Cases/Outputs tab

3.5: General setup

Finally, in the third tab, there is information regarding naming and other solver aspects. In this case, we don’t need to modify anything, and we can directly save the setup. When we do that, an UptimRes.json file will be generated in the project folder containing all the information that we saved. That file will be used by the solver itself.

Figure 11: Set-up Core Solver - General Setup tab

Part 4: Run Solver (Automation)

4.1: Third-party software

After the input distributions have been generated and all the settings have been saved, it is time to run the solver. For Uncertainty Quantification problems, there must be third-party software that converts a set of inputs to a set of outputs, so we can adaptively create the model. In this tutorial, this role is played by a Python script called Borehole.py that you can download from the Member Area, so the first step of this process would be to download it and paste the script into the project folder.

4.2: Automation GUI

Now it is time to open the Run Solver (Automation) from the Uptimai main interface.

Figure 12: Run Solver (Automation) - Initial state

4.3: Create new automation configuration

We will create a new automation file, by selecting the Create New button, choosing any name, and storing it in the project folder.

Figure 13: Run Solver (Automation) - File created

4.4: Add a connection

Then we will press the plus + button, and select the Python feature from the drop-down menu.

4.5: Locate the script

Finally, under the Location / CMD box, we will select the Borehole.py script that
we have previously pasted into the project folder. Since the connected script prints only one output value we want to catch, leave the parsing set to Console There is no need to define the Output file path or specify the Output column.

Display the menu with Advance options to see the Selected Python Executable. Select the system Python from the menu if needed.

Figure 14: Run Solver (Automation) - Python selected

4.6: Save the configuration

Clicking the Save & Run button will store all the information in an *.automation file, and move to the following screen where the log of the run is shown.

4.7: Run the Solver

Now, it is the moment to click the Run button and wait until the solver finishes. The solver will automatically call the Python script for the samples needed, and build the model. An Everything Finalized message will appear at the end of the log when the solver is finished.

Figure 15: Run Solver (Automation) - Solver finalized

Part 5: Result Postprocess

5.1: Open the Postprocessor

Congratulations, you just ran your first Uptimai project! Now is the time to see the results. To do that we will open the Postprocessor from the Uptimai main interface.

Figure 16: Result Postprocess - Initial state

5.2: Iterative file check

First of all, we will start opening the Iterative file. To do that we will click on the Borehole.itr file in the project files section. The iterative files store all the samples that have been computed, so they can be reused in future projects.

Figure 17: Result Postprocess - Iterative file table view

It has two ways of visualizing the data, or within a table which can be exported or as a scatter plot that allows to start visualizing the trends of how the outputs are distributed for each input.

Figure 18: Result Postprocess - Iterative file scatter plot

5.3: Open the model

Now we will open the model itself, opening the Borehole_UptimRes_O1_C1.upst.

5.4: Sensitivity analysis

In the top section, we have all the features available, we will start with the Sensitivity analysis, which shows which variables are more important. In this case, we can easily see that variables r_influence, T_upper and T_lower are irrelevant and can be neglected from the study. Also, if we switch the sensitivity analysis to increment we can see not only the importance of variables, but if they are important by themselves or by interacting with other variables. In this case, the interactions don’t have a huge impact on the results.

Figure 19: Result Postprocess - Sensitivity Analysis

5.5: Increment function

In the Increment Function, we can see the independent effect of each increment, to understand how they are affecting the output and in which zones we want to be to optimize the solution.

Figure 20: Result Postprocess - Increment Function

5.6: Function plot

In the Function plot, it is depicted the AI surrogate model so the user can extract the exact expected output for any possible combination of inputs. We can use both the Visualization mode and the Text mode.

Figure 21: Result Postprocess - Increment Function

5.7: Histogram plot

With the Partial/Full histogram, we can see the probability distribution of the output, to be able to see what are the expected zone of results given all the uncertainty from the inputs. Also, these can be shown for any combination of input variables or increment functions present in the model.

Figure 22: Result Postprocess - Partial/Full Histogram

5.8: Influencer

With the Influencer, we can go a step further and discover how every variable or increment is actually affecting the output distribution, to understand how we can tune our problem to reduce the variability of the results in a desired way.

Figure 23: Result Postprocess - Influencer

5.9: Regions of minimum/maximum

Finally, with the Regions of minimum/maximum, the software is doing a statistical optimization analysis. The Input option shows in which zones you should be from your original input distribution, no matter the uncertainties of the other variables have a statistical improvement on the output (to go to the maximum or the minimum).

Figure 24: Result Postprocess - Regions of Minimum/Maximum - Inputs

The Result option allows us to see which would be the expected result if the presented new input distributions were considered.

Figure 25: Result Postprocess - Regions of Minimum/Maximum - Results

Finally, in the Optimum option, the software is showing what is the absolute maximum and the absolute minimum found with a Monte Carlo approach, and where it is located.

Part 6: AI Surrogate Model

6.1: Open the AI Surrogate Model

The last feature of this tutorial is the AI surrogate model, which allows for easy access to the model and to receive the output for any set of samples given. We can access, as all the other features, from the Uptimai main interface.

Figure 26: AI Surrogate Model - Initial state

6.2: Select the model

First, we will need to Select Interpolant file (the model), that we have previously created in the solver. The Borehole_UptimRes_O1_C1.upsi file is a 'lite' version of the result file without data required for visualizations in the Postprocessor.

6.3: Define other files

Then we will need to select an Input File, which has to be in a comma-separated format with as many rows as samples wanted and as many columns as inputs have the problem. For this example, we can use the Borehole_UQ_XDis.txt file situated, in the inputs folder inside your project. Do not forget to select the correct Setup file that was used for the learning of the model. In our case, it is the UptimRes.json.

6.4: Evaluate the surrogate model

Finally, we can change the Result file name if needed, and press the Run button. A file will be generated in the project folder with the output given from the model from all the samples that were fed.

Figure 27: AI Surrogate Model - Computation finished