Parameter Study
A parameter study is defined here as performing a simulation with varying uncertain parameters and computing quantities of interest for each set of uncertain parameters. This example is a more detailed example of what is presented in Monte Carlo Example, which is also a parameter study.
Problem Statement
To demonstrate how to perform a parameter study the transient heat equation will be used.
(1)where is temperature, is time, is diffusivity, and is a heat source term. For this example this problem is shall be solved on a 2D unit square domain. The left side is subjected to a Dirichlet condition . The right side of the domain is subject to a Neumann condition , where is the outward facing normal vector from the boundary.
The boundary conditions and as well as the diffusivity () and the source term are assumed to be known. However, these parameters have some associated uncertainty. The effect of the uncertainty on the average temperature and heat flux on the left boundary after one second of simulation time is desired, defined as and .
Heat Equation Problem
The first step in performing a parameter study is to create an input file that solves your problems without uncertain parameters. For the example problem this will be done assuming , , , and .
The complete input file for this problem is provided in Listing 1. The only item that is atypical from a MOOSE simulation input file is the existence of the Controls
block, which here simply creates a SamplerReceiver object. This block is required for the parameter study, but shall be discussed in Transfers Block section.
Listing 1: Complete input file for example heat equation problem to be used in parameter study.
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables/T]
[]
[Kernels]
[time]
type = ADTimeDerivative
variable = T
[]
[diff]
type = ADMatDiffusion
variable = T
diffusivity = diffusivity
[]
[source]
type = ADBodyForce
variable = T
value = 1
function = 1
[]
[]
[BCs]
[left]
type = ADDirichletBC
variable = T
boundary = left
value = -10
[]
[right]
type = ADNeumannBC
variable = T
boundary = right
value = -100
[]
[]
[Materials/constant]
type = ADGenericConstantMaterial
prop_names = 'diffusivity'
prop_values = 1
[]
[Executioner]
type = Transient
solve_type = NEWTON
num_steps = 4
dt = 0.25
[]
[Postprocessors]
[T_avg]
type = AverageNodalVariableValue
variable = T
[]
[q_left]
type = ADSideDiffusiveFluxAverage
variable = T
boundary = left
diffusivity = diffusivity
[]
[]
[Controls/stochastic]
type = SamplerReceiver
[]
[Outputs]
[]
(modules/stochastic_tools/examples/parameter_study/diffusion.i)Executing this file using the StochasticToolsApp can be done as follows
cd moose/modules/stochastic_tools/examples/parameter_study
../../stochastic_tools-opt -i diffusion.i
The simulation will perform four timesteps and should result in and .
Master Input
To perform a parameter study an input file that will drive the stochastic simulations is required. This file will be referred to as the master input file and is responsible for defining the uncertain parameters, running the stochastic simulations, and collecting the stochastic results. The following sub-sections will step through each portion of the master file to explain the purpose. The complete analysis is discussed in Stochastic Results.
StochasticTools Block
The StochasticTools block sets up the master file to be a driver for stochastic simulations but itself is not performing any sort of simulation. Setting up a master without a simulation itself is the default behavior for this block, as such it is empty in this example.
[StochasticTools]
[]
(modules/stochastic_tools/examples/parameter_study/master.i)Distributions and Samplers Blocks
The Distributions block defines the statistical distribution for each of the uncertain parameters (, , , and ) to be defined. For this example, the diffusivity () is defined by a uniform distribution, the flux () by a three-parameter Weibull, and and a normal distribution.
The Samplers block defines how the distributions shall be sampled for the parameter study. In this case a Latin hypercube sampling strategy is employed. A total of 5000 samples are being used.
[Samplers]
[hypercube]
type = LatinHypercube
num_rows = 5000
distributions = 'gamma q_0 T_0 s'
[]
[]
(modules/stochastic_tools/examples/parameter_study/master.i)For this problem the Sampler object is setup to run in "batch-restore" mode, which is a mode of operation for memory efficient creation of sub-applications. Please see Stochastic Tools Batch Mode for more information.
The input distributions for each of these four terms are included in Figure 1–Figure 4 for 5000 samples.
[Distributions]
[gamma]
type = Uniform
lower_bound = 0.5
upper_bound = 2.5
[]
[q_0]
type = Weibull
location = -110
scale = 20
shape = 1
[]
[T_0]
type = Normal
mean = -10
standard_deviation = 1.5
[]
[s]
type = Normal
mean = 1
standard_deviation = 0.25
[]
[]
(modules/stochastic_tools/examples/parameter_study/master.i)Figure 1: Input distribution of diffusivity ().
Figure 2: Input distribution of flux boundary condition ().
Figure 3: Input distribution of temperature boundary condition ().
Figure 4: Input distribution of source term ().
Transfers Block
The Transfers block serves two purposes. First, the "parameters" sub-block instantiates a SamplerParameterTransfer object that transfers each row of data from the Sampler object to a sub-application simulation. Within the sub-application the parameters listed in the in this sub-block replace the values in the sub-application. This substitution occurs using the aforementioned SamplerReciever object that exists in the Controls block of the sub-application input file. The receiver on the sub-application accepts the parameter names and values from the SamplerParameterTransfer object on the master application.
The results sub-blocks, serves the second purpose by transferring the quantities of interest back to the master application. In this cases those quantities are postprocessors on the sub-application that compute and . These computed results are transferred from the sub-application to a VectorPostprocessor object (as discussed next).
[Transfers]
[parameters]
type = SamplerParameterTransfer
multi_app = runner
sampler = hypercube
parameters = 'Materials/constant/prop_values Kernels/source/value BCs/right/value BCs/left/value'
to_control = 'stochastic'
[]
[results]
type = SamplerPostprocessorTransfer
multi_app = runner
sampler = hypercube
to_vector_postprocessor = results
from_postprocessor = 'T_avg q_left'
[]
[]
(modules/stochastic_tools/examples/parameter_study/master.i)VectorPostprocessor Block
The VectorPostprocessor block, as mentioned above, is used to collect the stochastic results. The "results" sub-block instantiates a StochasticResults object, which is designed for this purpose. The resulting object will contain a vector for each of the quantities of interest: and .
The "samples" sub-block simply is used as a means to output the sample data, it is used here for presenting the results in the next section.
This Statistics object is designed to compute multiple statistics and confidence intervals for each of the input vectors. In this case it computes the mean for and vectors in the "results" object as well as the 5% and 95% confidence level intervals. Please refer to the documentation for the Statistics object for further documentation and capabilities for this object.
[VectorPostprocessors]
[results]
type = StochasticResults
[]
[samples]
type = SamplerData
sampler = hypercube
[]
[stats]
type = Statistics
vectorpostprocessors = results
compute = 'mean'
ci_method = 'percentile'
ci_levels = '0.05'
[]
[]
(modules/stochastic_tools/examples/parameter_study/master.i)Outputs Block
The Outputs block enables the output of the VectorPostprocessor data using the comma separated files.
[Outputs]
csv = true
execute_on = 'FINAL'
[]
(modules/stochastic_tools/examples/parameter_study/master.i)Stochastic Results
Quantity of Interest Distributions
The resulting distributions are for the quantities of interest: and are presented in Figure 5 and Figure 6.
Figure 5: Resulting distribution of quantity of interest: .
Figure 6: Resulting distribution of quantity of interest: .
Statistics
Listing 2 includes the computed statistics and confidence level intervals as output by the VectorPostprocessor object for the example heat conduction problem with 5000 samples. The results of which can be written as:
Listing 2: Resulting statistics and confidence level intervals for the computed quantities of interest.
results_results:T_avg,results_results:q_left,stat_type
-22.689650670305,-67.109783446031,3
-22.916544124128,-67.782251379634,3.05
-22.461848597339,-66.436882255796,3.95