Comparison of surrogates using a time-dependent problem
This example is meant to demonstrate how non-intrusive surrogate models can be generated for time-dependent problems. Nearest Point, Polynomial Regression and Polynomial Chaos Expansion Surrogates are compared on a non-linear diffusion problem with an oscillating source.
Overview
In this case, a time-dependent nonlinear diffusion problem is solved on a square with an oscillating source in the center. The geometry is presented in Figure 1. It consists of a square with a source region in the center. The boundaries of the problem are denoted by . The strong formulation of the problem is:
(1)(2)where is temperature, and is a selection function returning 1 when and 0 otherwise. Parameters and influence the magnitude of the diffusion coefficient and the oscillation frequency of the source. Furthermore, it is assumed that the system is initially (at ) at constant temperature, . The uncertain parameters in the this problem are , and . A reference solution for the first of the transient is presented in Figure 2.

Figure 1: The geometry of the problem.

Figure 2: Reference solution for the problem.
In this problem the Quantities of Interest (QoIs) are the minimum and maximum temperatures in the domain over the fist of the transient:
(3)The uncertain parameters are assumed to be uniformly distributed between their corresponding minimum () and maximum () values:
Parameter | Symbol | Distribution |
---|---|---|
Diffusion coefficient multiplier | ||
Frequency multiplier | ||
Initial temperature |
Solving the problem without uncertain parameters
The first step towards creating surrogate models is the generation of a full-order model which can solve Eq. (1) with fixed parameter combinations. The complete input file for this case is presented in Listing 1. It is visible that a mesh and timestep is used to solve the transient problem.
Listing 1: Complete input file for the time-dependent heat equation problem in this study.
(contrib/moose/modules/stochastic_tools/examples/surrogates/combined/trans_diff_2d/trans_diff_sub.i)Training surrogate models
This problem involves the generation of three surrogates: a NearestPointSurrogate, a PolynomialRegressionSurrogate and a PolynomialChaos. All three of them are constructed using multiple instances of the full-order problem as sub-applications. This step is managed by a trainer input file which is responsible for creating parameter samples, transferring those to sub-applications and collecting the corresponding results. The reader is recommended to read Training a Surrogate Model and Parameter Study to get a clear picture on how to train and set up a surrogate model.
The training phase starts with the definition of the distributions for the uncertain parameters in the Distributions
block. The uniform distributions can be defined as:
Next, multiple parameter vectors are prepared by sampling the underlying distributions using the objects in the Samplers
block. In this case, the samples are generated by a QuadratureSampler, which is optimal for the polynomial chaos expansion. Since the execution of this example is expensive in terms of computation time, the same samples are used to train the other surrogates as well. It is not visible, but the sampler prepares 216 parameter vectors altogether.
The objects in blocks Controls
, MultiApps
, Transfers
and Reporters
are responsible for managing the communication between the trainer and sub-applications, execution of the sub-applications and the collection of the results. For a more detailed description of these blocks see Parameter Study and Training a Surrogate Model.
Next, six trainers (three different surrogates for each QoI) are defined in the Trainers
block. These objects use the data from Samplers
and Reporters
. A polynomial chaos surrogate of order 5, a polynomial regression surrogate with a polynomial of degree at most 4 and a nearest point surrogate is used for both QoIs in this work. The PolynomialChaosTrainer also needs knowledge about the underlying parameter distributions to be able to select appropriate polynomials.
As a last step in the training process, the important parameters of the trained surrogates are saved into restartable data files, which can be used to construct the surrogate models again without repeating the training process.
(contrib/moose/modules/stochastic_tools/examples/surrogates/combined/trans_diff_2d/trans_diff_trainer.i)Evaluation of surrogate models
A new main input file has been created to evaluate the surrogate models. This input file uses the same parameter distribution as the one used for the training of the surrogates. Each surrogate model is tested using a new, test parameter sample set, which is generated using a LatinHypercube object in the Samplers
block. Since the surrogate models are orders of magnitude faster, samples are prepared for testing (compared to used for training).
Next, the necessary objects are created in the Surrogates
block using the information available within the corresponding restartable data files.
These surrogate models are then evaluated at the points defined in the testing sample batch. This is done using objects in the Reporters
block. Furthermore, the mean values and standard deviations of the QoI-s together with the confidence intervals are generated as well.
Results and Analysis
In this section the results from the different surrogate models are provided. Additionally, the full-order model has been tested with a 2,000 sample batch to serve as a reference solution. The main input file for testing with the full-order model is available here. A short analysis of the results is provided as well.
First, the distributions of QoI-s from the surrogates are compared to the reference results. The histograms showing the distribution of the maximum temperature through the transient are presented below. The figures can be enlarged by clicking on them.
Figure 3: Polynomial Chaos Expansion Surrogate.
Figure 4: Polynomial Regression Surrogate.
Figure 5: Nearest Point Surrogate.
It is visible that even with 2,000 samples, the reference results still exhibit a high statistical fluctuation. Unfortunately, having considerably more than 2,000 samples using the full-order model is not efficient due to the extremely long simulation time. It is also visible that both the polynomial chaos and polynomial regression surrogates yield approximately the same results, and with 100,000 samples, the distributions are much smoother. On the other hand, the nearest point surrogate introduces additional fluctuations which means that it is not capable of reconstructing the shape of the original distribution at all. The same phenomena is experienced with the minimum temperature. The corresponding histograms are presented below.
Figure 6: Polynomial Chaos Expansion Surrogate.
Figure 7: Polynomial Regression Surrogate.
Figure 8: Nearest Point Surrogate.
Next, the statistical moments are compared in Table 1 for the maximum temperature and in Table 2 for the minimum temperature of the system.
Table 1: The mean and standard deviation of the maximum temperature obtained using the surrogates and a reference full-order model.
Model | Number of samples | Mean | 95% CI | Std. Dev. | 95% CI |
---|---|---|---|---|---|
Full-order model (reference) | 2,000 | 396.74 | [395.90, 397.58] | 22.86 | [22.36, 23.33] |
Nearest Point Surrogate | 100,000 | 396.87 | [396.74, 396.99] | 23.57 | [23.50, 23.64] |
Polynomial Chaos Surrogate | 100,000 | 396.77 | [396.65, 396.88] | 22.85 | [22.78, 22.92] |
Polynomial Regression Surrogate | 100,000 | 396.77 | [396.65, 396.88] | 22.85 | [22.78, 22.93] |
Table 2: The mean and standard deviation of the minimum temperature obtained using the surrogates and a reference full-order model.
Model | Number of samples | Mean | 95% CI | Std. Dev. | 95% CI |
---|---|---|---|---|---|
Full-order model (reference) | 2,000 | 260.66 | [259.94, 261.38] | 19.30 | [18.96, 19.64] |
Nearest Point Surrogate | 100,000 | 260.46 | [260.36, 260.56] | 19.77 | [19.72, 19.82] |
Polynomial Chaos Surrogate | 100,000 | 260.46 | [260.36, 260.56] | 19.17 | [19.12, 19.21] |
Polynomial Regression Surrogate | 100,000 | 260.46 | [260.36, 260.56] | 19.17 | [19.12, 19.22] |
Even though there are small differences in the mean values, it can be concluded that all three of the surrogates managed to give the correct answer. The differences between the full-order model and surrogates are statistically insignificant. For the standard deviations, on the other hand, only the polynomial chaos and polynomial regression give back the statistically equivalent results. Lastly, the gain in computation time is presented in Table 3. It is important to mention that all of the results have been obtained using 8 cores of a single machine.
Table 3: The wall-clock times of different steps in the surrogate modeling process.
Case | Wall-clock time (s) |
---|---|
Creating reference results (2000 samples) | 16,374.2 |
Training surrogates | 1910.4 |
Evaluating surrogates (without computing CI) | 1.6 |
Evaluating surrogates (with computing CI) | 275.0 |
It is visible that training and using a surrogate model is beneficial in this case since it saves a considerable amount of computation time. It can also be observed that computing the confidence intervals for surrogate models is the most work intensive step in the testing phase. This is due to the frequent resampling of the results vectors.