Parameter Study on a Highly Nonlinear Problem

This example assumes that the reader has already visited the example in Parameter Study and is familiar with the fundamental blocks used in parent input files. In this example, the effect of varying the distribution of the uncertain parameters on the distribution of the Quantities of Interest (QoIs) is showcased as well.

Problem Description

The strong formulation of the problem is taken from Chaturantabut and Sorensen (2010) and can be written as

(1)

where is a scalar field variable, are the physical coordinates, while and are uncertain parameters with known (or assumed) probability distributions. This equation is supplemented with homogeneous Dirichlet boundary conditions on every side of the square.

Solution of the Problem

To be able to perform a parameter study, the application has to be able to solve the problem with fixed parameters first. The input file used for this purpose is provided in Listing 1. The nominal values of the uncertain parameters are and =9 in this case. There are two blocks in the input file that are worth examining in detail. The first is the Kernels block that shows that a custom test kernel has been implemented to be able to handle the exponential reaction term in Eq. (1). To use this kernel, the user has to add an additional argument for the Stochastic Tools executioner as follows:


cd moose/modules/stochastic_tools/examples/parameter_study/nonlin_diff_react
../../../stochastic_tools-opt -i nonlin_diff_react_sub.i --allow-test-objects

The second atypical block is Controls which is necessary to set up a channel to receive and substitute new parameter samples from the parent application. As shown in the Postprocessors block, the Quantities of Interest (QoIs) are the maximum value (), minimum value () and the average value () of the scalar field variable .

Listing 1: Complete input file for the nonlinear problem using the nominal values of the uncertain parameters.

[Functions]
  [source]
    type = ParsedFunction
    expression = "100 * sin(2 * pi * x) * sin(2 * pi * y)"
  []
[]

[Mesh]
  [gen]
    type = GeneratedMeshGenerator
    dim = 2
    nx = 50
    xmin = 0
    xmax = 1
    ny = 50
    ymin = 0
    ymax = 1
  []
[]

[Variables]
  [U]
    family = lagrange
    order = first
  []
[]

[Kernels]
  [diffusion]
    type = Diffusion
    variable = U
  []
  [nonlin_function]
    type = ExponentialReaction
    variable = U
    mu1 = 0.3
    mu2 = 9
  []
  [source]
    type = BodyForce
    variable = U
    function = source
  []
[]

[BCs]
  [dirichlet_all]
    type = DirichletBC
    variable = U
    boundary = 'left right top bottom'
    value = 0
  []
[]

[Executioner]
  type = Steady
  solve_type = PJFNK
  petsc_options_iname = '-pc_type -pc_hypre_type'
  petsc_options_value = 'hypre boomeramg'
[]

[Postprocessors]
  [max]
    type = ElementExtremeValue
    variable = U
  []
  [min]
    type = ElementExtremeValue
    variable = U
    value_type = min
  []
  [average]
    type = ElementAverageValue
    variable = U
  []
[]

[Controls]
  [stochastic]
    type = SamplerReceiver
  []
[]

[Outputs]
[]
(modules/stochastic_tools/examples/parameter_study/nonlin_diff_react/nonlin_diff_react_sub.i)

Parent application Input

As described in Parameter Study in detail, one needs a driver input (or parent input) to perform a parameter study. Two parent input files are provided for this example in Listing 2 and Listing 3. The first considers the uncertain parameters to be uniformly distributed around their nominal values , , while the second one assumes normal distribution . The only difference between the two input files is the Distributions block where the assumed probability distributions are defined for the uncertain parameters.

Listing 2: Complete input file for the driver of the parameter study with uniformly distributed uncertain parameters.

[StochasticTools]
[]

[Distributions]
  [mu1]
    type = Uniform
    lower_bound = 0.21
    upper_bound = 0.39
  []
  [mu2]
    type = Uniform
    lower_bound = 6.3
    upper_bound = 11.7
  []
[]

[Samplers]
  [hypercube]
    type = LatinHypercube
    num_rows = 5000
    distributions = 'mu1 mu2'
  []
[]

[MultiApps]
  [runner]
    type = SamplerFullSolveMultiApp
    sampler = hypercube
    input_files = 'nonlin_diff_react_sub.i'
    mode = batch-restore
  []
[]

[Transfers]
  [parameters]
    type = SamplerParameterTransfer
    to_multi_app = runner
    sampler = hypercube
    parameters = 'Kernels/nonlin_function/mu1 Kernels/nonlin_function/mu2'
  []
  [results]
    type = SamplerPostprocessorTransfer
    from_multi_app = runner
    sampler = hypercube
    to_vector_postprocessor = results
    from_postprocessor = 'max min average'
  []
[]

[VectorPostprocessors]
  [results]
    type = StochasticResults
  []
[]

[Reporters]
  [stats]
    type = StatisticsReporter
    vectorpostprocessors = results
    compute = 'mean'
    ci_method = 'percentile'
    ci_levels = '0.05'
  []
[]

[Outputs]
  csv = true
  execute_on = 'FINAL'
[]
(modules/stochastic_tools/examples/parameter_study/nonlin_diff_react/nonlin_diff_react_parent_uniform.i)

Listing 3: Complete input file for the driver of the parameter study with normally distributed uncertain parameters.

[Distributions]
  [mu1]
    type = Normal
    mean = 0.3
    standard_deviation = 0.045
  []
  [mu2]
    type = Normal
    mean = 9
    standard_deviation = 1.35
  []
[]
(modules/stochastic_tools/examples/parameter_study/nonlin_diff_react/nonlin_diff_react_parent_normal.i)

For the sampling of the uncertain parameters, a Latin Hypercube Sampling (LHS) strategy is utilized. Altogether 5000 parameter samples are created for the model. Furthermore, the parent application is executed in a "batch-restore" mode, which provides a memory-efficient way to run sub-applications. For the comparison between different running modes the interested reader is referred to Stochastic Tools Batch Mode.

The objects in the Transfers block are responsible for the communication between the parent and sub-applications. It streams parameter samples to sub-applications and receives the corresponding values for the selected QoIs. It is visible that in this example the type of the parameter transfer object is SamplerParameterTransfer which streams the parameter samples to a SamplerReceiver object (in Controls block) in the sub-application. This object then plugs the new parameter values into kernels, materials or boundary conditions. Unfortunately, this requires the parameters to be controllable in the sub-application, which might not be true in every case. For this specific example, the controllability of the parameters in ExponentialReaction kernel is ensured by the last two commands in the validParams function.

InputParameters
ExponentialReaction::validParams()
{
  InputParameters params = Kernel::validParams();
  params.addClassDescription(
      "Implements a simple reaction term with the following weak form "
      "$(\\psi_i,\\frac{\\mu_1}{\\mu_2}\\left[e^{\\mu_2 u_h}-1\\right])$.");
  params.addParam<Real>("mu1", 0.3, "First coefficient in the nonlinear term.");
  params.addParam<Real>("mu2", 9, "Second coefficient in the nonlinear term.");
  params.declareControllable("mu1");
  params.declareControllable("mu2");
  return params;
}
(modules/stochastic_tools/test/src/kernels/ExponentialReaction.C)

If the target parameters are not controllable, one can use a command line based communication between parent and sub-applications. For more information about this approach see the example covered in Polynomial Chaos Surrogate.

To run the parent application, it is still necessary to enable test objects using the following command


cd moose/modules/stochastic_tools/examples/parameter_study/nonlin_diff_react
../../../stochastic_tools-opt -i nonlin_diff_react_parent_uniform.i --allow-test-objects

Stochastic Results

The distributions of the QoIs for the uniformly distributed uncertain parameters are presented in Figure 1, Figure 2 and Figure 3. The same distributions with normally distributed uncertain parameters are shown in Figure 4, Figure 5 and Figure 6.

The estimated mean values of the QoIs with the corresponding confidence intervals are presented below assuming uniformly distributed parameters:

The same statistics for the normally distributed parameters are the following:

Figure 1: Resulting distribution of with uniformly distributed parameters.

Figure 2: Resulting distribution of with uniformly distributed parameters.

Figure 3: Resulting distribution of with uniformly distributed parameters.

Figure 4: Resulting distribution of with normally distributed parameters.

Figure 5: Resulting distribution of with normally distributed parameters.

Figure 6: Resulting distribution of with normally distributed parameters.

References

  1. Saifon Chaturantabut and Danny C Sorensen. Nonlinear model reduction via discrete empirical interpolation. SIAM Journal on Scientific Computing, 32(5):2737–2764, 2010.[BibTeX]