This is the code corresponding to the paper Efficient Adaptive Stochastic Collocation Strategies for Advection-Diffusion Problems with Uncertain Inputs (Preprint).
This repository also contains code for the experiments contained within Benjamin M Kent's thesis at the University of Manchester.
To use the package ensure the path contains:
This can be achieved by downloading the appropriate folders are ensuring the directories are placed within the adaptive_sc_fem/ directory.
These specific versions are required. Function names in the more recent release of the Sparse Grids MATLAB Kit have not been updated and tested in this code yet.
There are two examples included corresponding to the examples in Efficient Adaptive Stochastic Collocation Strategies for Advection-Diffusion Problems with Uncertain Inputs . These are the scripts
run_experiment_4_dim.mand
run_experiment_64_dimensional.mTo save on computational time it is possible to run run_experiment_4_dim_noreference.m and only construct an approximation.
The output results from the four parameter problem are slightly different when compared to those plotted in the paper due to small updates to the space--time approximation implementation.
The four parameter example is annotated below.
Firstly the path is set up.
Folders containing ifiss3.6, tifiss1.2 and sparse-grids-matlab-kit must be either be in the current directory, or added to the path by the user.
%% Set up path
% The following directories need to be subdirectories of adaptive_sc_fem,
% or independently added to the MATLAB path:
% /sparse-grids-matlab-kit_v-22-02_California
% /ifiss3.6
addpath(genpath(pwd),'-end')The test problem is then defined.
%% Define problem
problem = define_problem('doubleglazing');A reference solution is then set up. Approximation errors will be computed with respect to this reference solution. The main loop is run and produces a high fidelity reference approximation.
%% Set up reference for assessing error estimates
params = define_params('l4-jomp');
reference = define_reference('none');
params.l_initial = 5; % Set reference Smolyak sparse grid level (polynomials including TD 5).
params.letol = 1e-7; % Set reference local error tolerance
params.reference = 1; % Set as reference approximation
params.k_interp = inf; % Set parametric refinement threshold to inf (no refinement)
adaptive_sc_fem;
save(['reference.mat'],'reference','data_table','fem','problem','params', '-v7.3')The approximation is then constructed.
The reference approximation is specified to be precomputed and saved within the current folder (the test-folder option).
The parameters are set to the predefined set l4-jomp.
%% Run experiments
reference = define_reference('test-folder');
params = define_params('l4-jomp');Approximation parameters can then be varied within the params structure.
params.adapt_interp = 0; % Interpolate for new collocation points
params.k_interp = 10; % c_{tol} safety factor
params.marking_factor = 0.1; % Marking factor
params.letol = 1e-5; % Local error tolerance
The approximation is constructed and the outputs saved to l4-jomp.mat.
adaptive_sc_fem;
save(['l4-jomp.mat'],'reference','data_table','fem','problem','params','-v7.3')The results are post processed into MATLAB figures and CSV files.
process_output_data(data_table, reference,fem,params,problem)For example, the resulting error estimate, error and tolerance are output as the following figure.
The thesis experiments can be found within subfolders the folder thesisexperiments. The folder names are representative of the experiments within.
The path must be set up as described above.
All folders (and subfiles) in the adaptive_sc_fem root directory should be included in the path.
Examples in the thesis without dedicated folders are either easily recreated with the tools or the plotted data is derived from data generated in other experiments.
The output *.mat files will generally need postprocessing with the subroutine/process_output_data.m function.
| Example | Folder / tool |
|---|---|
| Motivational ODE example | ode (section 1.2) |
| 2.1 | ifiss3.6 |
| 2.2 | sparse-grids-matlab-kit_v-22-02_California |
| 2.3 | sparse-grids-matlab-kit_v-22-02_California |
| 2.4 | ifiss3.6 |
| 3.1 | dg4errorest (example 3.1) |
| 3.2 | dg4errorest (example 3.1) (change params structure) |
| 3.3 | dg4errorest_vardiffcnst (example 3.3) |
| 3.4 | dg4errorest_timedependentbc (example 3.4) |
| Fig 3.15 | change of basis from Lagrange polynomials to Legendre expansion using sparse-grids-matlab-kit_v-22-02_California |
| 4.1 | Subset of the output data from Examples 4.2-4.4 |
| 4.2 | dg_test_inputs_letol (example 4.1 and 4.2) |
| 4.3 | dg_test_inputs_safety (example 4.3) |
| 4.4 | dg_test_inputs_dorfler (example 4.4) |
| 4.5 | dg_adaptive_vardiff (example 4.5) |
| 4.6 | dg_adaptive_td (example 4.6) |
| 4.7 | dg-rf (example 4.7) |
| 5.1 | test_residual_est (examples 5)/test_spatial |
| 5.2 | test_residual_est (examples 5)/test_temporal |
| 5.3 | test_residual_est (examples 5)/test_interp |
