Learning Center

Sensitivity Analysis Using a Polynomial Chaos Expansion Surrogate Model


In this part of the course, you will learn how to perform a sensitivity analysis of an analytical function, the Ishigami function, using a Polynomial Chaos Expansion (PCE) surrogate model in COMSOL®. The Ishigami function is a random function of three variables and a well-known benchmark used to test global sensitivity analysis and uncertainty quantification algorithms. The mean, standard deviation, maximum, and minimum values as well as Sobol indices of the Ishigami function can be calculated analytically for the input distributions used here.

The Sobol indices are used in global sensitivity analyses to quantify the contribution of each input parameter to the overall variance of the output. These indices can be used to identify which input parameters have the most significant impact on the function's behavior, enabling more informed decision-making and model refinement. For example, Sobol indices can be used to limit the number of input parameters used in a more detailed uncertainty quantification analysis.

The Ishigami Function

The Ishigami function is:

where , , and where , , and are independent, uniformly distributed random variables in the interval . The function can be visualized in 3D by using, for example, a slice plot as in the figure below.

An array of five slices that shows a rainbow color distribution.

The Ishigami function used for benchmarking.

The mean, variance, maximum, minimum, and a number of other quantities can be computed analytically for the Ishigami function. The MPH-file for the Ishigami function and parameters, available under the reference files for this resource, already has these parameters defined, together with an analytical function definition and the slice plot of the function.

The Parameters 1 node Settings window, which contains a tabular list of parameters used in the model.

Analytically derived statistical values for the Ishigami function.

Sensitivity Analysis

Let's now start from the model file and perform a global sensitivity analysis of the Ishigami function.

Open the model file for the Ishigami function and parameters. Then, right-click the root node and select Add Study.

A close-up of the model tree with the root node selected and the menu of options open, with the Add Study option selected.

Adding a study for the Ishigami function.

In the Add Study window, select and add a Stationary study. Next, right-click the Study 1 node and under Uncertainty Quantification select Uncertainty Quantification.

A close-up of the model tree with the Study 1 node selected and the UQ section of options expanded, with the Uncertainty Quantification study.

Selecting the Uncertainty Quantification study.

In the Uncertainty Quantification study Settings window, change the UQ study type setting to Sensitivity analysis. There are two sensitivity analysis methods available, Sobol and Correlation. The default option is Sobol, which will be the one we use here. In the Surrogate model settings section, we will use the default Surrogate model option, which is Adaptive sparse polynomial chaos expansion. The PCE function is set to New, which means that the study will automatically build a PCE surrogate model.

A close-up of the settings for the Uncertainty Quantification study.

The Uncertainty Quantification study settings for the Ishigami function example.

Next, we will define the quantity of interest, which will be a call to the Ishigami function. In the list of global parameters, the three input parameters, X1, X2, and X3, are already defined. In the Quantities of Interest table, add a new row, and for the expression enter ishigami(X1,X2,X3). In the Input Parameters section, add the three input parameters with Distribution set to Uniform and the Lower bound and Upper bound set to -pi and pi, respectively, for each parameter, as shown below.

A close-up of the Uncertainty Quantification study settings with the Quantities of Interest and Input Parameters sections expanded.

The settings for the Quantities of Interest and Input Parameters sections.

We are now ready to perform the analysis. To do so, right-click Study 1 and select Compute. The computation takes a few seconds. The default plot is a Sobol index plot, which shows the first-order and total Sobol indices for each parameter in a bar graph, as shown in the figure below. For each parameter, the first-order index is to the left and the total index is to the right.

The Model Builder with the corresponding Settings window and Graphics window, which displays a bar chart with a set of two blue, green, and red bars. The Model Builder with the corresponding Settings window and Graphics window, which displays a bar chart with a set of two blue, green, and red bars.

The Sobol index plot for the Ishigami function.

The first-order Sobol index corresponds to the proportion of the total variance in the output that is attributed to a single input parameter, excluding interactions with other parameters. The total Sobol index corresponds to the proportion of the total variance in the output that is attributed to an input parameter, including both its main effects and all its interactions with other parameters. For more in-depth information on Sobol indices, see our resource that details "More on PCE Surrogate Models, Sensitivity Analysis, and Sobol Indices".

The Sobol indices are displayed in the Sobol table under the Results node in the Sensitivity Analysis Sobol group table. The computed values are consistent with the analytical ones stored in the Global Definitions > Parameters table.

A close-up of the model tree with the Tables node expanded and Sobol selected.

Selecting the Sobol table.

The Messages/Progress/Log window with the Sobol table shown, displaying numerical values.

The Sobol table containing the first-order and total Sobol indices.

For the parameter , we can see that both the first-order and total Sobol indices are relatively significant. The first-order Sobol index indicates a substantial direct contribution of to the output variance. The total Sobol index suggests that has a significant impact on the output, both directly and through interactions. The conclusions for are similar.

For the parameter , the relatively small value of the first-order index indicates it does not have any (or nearly any) direct contribution to the output variance. However, the relatively higher value of the total Sobol index implies that contributes significantly to the output variance through interactions with other variables. This can also be seen directly from the expression for the Ishigami function:

.

Here, and occur in their own terms, whereas only occurs in an interaction term with .

The PCE Surrogate Model

After the computation, a PCE surrogate model is available under the Global Definitions node.

Part of the Settings window for the Polynomial Chaos Expansion function, with the Model Settings and Data Column Settings sections expanded.

The PCE surrogate model Settings window.

The Information section displays the Estimated error for the PCE surrogate model — in this case, the error about 7e-4. The estimated error is based on the so-called leave-one-out cross-validation error.

A close-up of the Information section of the Settings window for the PCE function, which contains several brief lines of text.

The Information section for the PCE surrogate model.

Plot the surrogate model by clicking the Create Plot button at the top of the Polynomial Chaos Expansion function Settings window. The plot will show some artifacts compared to the original plot, due to the fact that the PCE surrogate model is highly optimized by the adaptive algorithm that only includes the essential polynomial terms in the chaos expansion. For more information, see our resource "More on PCE Surrogate Models".

An array of five slices that show a rainbow color distribution from dark red to dark blue, mostly displaying shades of light blue, green, and yellow.

A plot of the PCE surrogate model.

We can increase the accuracy of the model by using a larger number of samples for the input parameters. To do so, in the Uncertainty Quantification study Settings window, in the Input Parameters sampling settings section, change the Number of input points type to Manual. Change the values for both the Maximum number of input points and the Initial number of input points to 200. This will force the algorithm to sample the Ishigami function in 200 points. Click Compute to run the study again.

After the computation, we can compare the surrogate model to the original function by plotting the expression abs(ishigami(x1,x2,x3)-pce1_1(x1,x2,x3)). This is shown in the figure below.

An array of five slices that show a rainbow color distribution from dark red to dark blue, with the majority displaying shades dark and light blue.

A plot comparing the PCE surrogate model to the Ishigami function.

The maximum pointwise error is about 0.2, which is about 1% of the maximum absolute value of the Ishigami function. To create this plot, right-click 3D Plot Group 1 and select Duplicate. In the Dataset > Grid 3D 1 settings, change the Function setting to All. This is required so that the Grid 3D 1 dataset can recognize the surrogate model function. In the 3D Plot Group 4 > Function plot Settings window, change the Expression to abs(ishigami(x1,x2,x3)-pce1_1(x1,x2,x3)). Also change the Description setting to the same expression. Finally, in the 3D Plot Group 4 node Settings window, change the Title to the same expression (alternatively, change the Title type setting to Automatic).

Working with the Ishigami function mimics working with a finite element model in that we can use an adaptive method to iteratively compute more data points. In other words, this example using the Ishigami function is conceptually similar to an uncertainty quantification analysis of a finite element model (or other numerical models). This approach differs from working with imported experimental data. In the case of experimental data, we have to "work with what we have", and the only way to obtain additional data points is to perform additional experiments.


Submit feedback about this page or contact support here.