6 % computed by prepare_reduced_data().
10 properties (Dependent)
21 % @copybrief .Greedy.Plugin.Interface.indicator_mode
23 % @copydetails .Greedy.Plugin.Interface.indicator_mode
24 indicator_mode =
'error';
26 %
boolean flag indicating whether the `L^2(\Omega)`-norm is used by
29 % Otherwise the `L^{\infty}(\Omega)`-norm is applied.
35 relative_error =
false;
40 function ged =
Default(generator)
41 %
function ged =
Default(generator)
42 % constructor
for a greedy extension
object
46 % (high dimensional) basis functions
51 need_prepare = isequal(this.indicator_mode,
'error');
54 function [max_errs, max_err_sequence, max_mu_index] = ...
55 error_indicators(
this, rmodel, detailed_data, parameter_set, reuse_reduced_data)
56 %
function [max_errs, max_err_sequence, max_mu_index] = error_indicators(
this, rmodel, detailed_data, parameter_set, reuse_reduced_data);
62 % rmodel: an
object of type .Greedy.User.IReducedModel
64 % detailed_data: of type .Greedy.User.IDetailedData
66 % @note This method is controlled by the indicator_mode variable:
68 % If
'indicator_mode' equals
69 % -
'estimator', the method error_estimators() is called
70 % - 'error', compute_error() is used to compute "true" errors.
72 if nargin < 5 || isempty(reuse_reduced_data)
73 reuse_reduced_data = false;
76 if ~reuse_reduced_data
77 prepare_reduced_data(this, rmodel, detailed_data);
80 if isequal(this.indicator_mode, 'error')
81 nmus = size(parameter_set, 1);
83 tmperrs = cell(1, nmus);
84 tmpmaxerr = zeros(1, nmus);
86 rd = this.reduced_data;
93 set_mu(trmodel, parameter_set(i,:));
95 tmperrs{i} = compute_error(tthis, trmodel, trd, detailed_data);
96 tmpmaxerr(i) = max(tmperrs{i});
101 [dummy, max_mu_index] = max(tmpmaxerr);
102 max_err_sequence = tmperrs{max_mu_index};
105 [max_errs, max_err_sequence, max_mu_index] = error_estimators(
this, rmodel, detailed_data, parameter_set);
109 function errs = compute_error(
this, rmodel, reduced_data, detailed_data)
110 %
function errs = compute_error(
this, rmodel, detailed_data)
116 % rmodel: of type .Greedy.User.IReducedModel
117 % detailed_data: of type .Greedy.User.IDetailedData
118 % reduced_data: of type .Greedy.User.ReducedData
121 dmodel = rmodel.detailed_model;
124 model_data = detailed_data.model_data;
126 U = generate(this.generator, dmodel, model_data);
127 Uapprox = generate_reduced(
this, rmodel, reduced_data, detailed_data, U);
129 if isfield(model_data,
'grid')
130 grid = model_data.grid;
135 dmodel = rmodel.detailed_model;
138 errs = dmodel.l2_error_sequence_algorithm(U, Uapprox, model_data);
139 if this.relative_error
140 errs = errs./dmodel.l2_error_sequence_algorithm(U, 0, model_data);
143 errs = dmodel.linfty_error_sequence_algorithm(U, Uapprox, []);
145 errs = errs./dmodel.linfty_error_sequence_algorithm(U, 0, []);
154 % function [max_errs, max_err_sequence, max_mu_index] = error_estimators(this, rmodel, detailed_data, M_train);
155 % computes a posteriori error estimators for the reduced simulations for
156 % every parameter vector from a given parameter set `{\cal
157 % M}_{\text{train}}`.
159 % An a posteriori error estimator estimates an error
160 % ``\eta^k(\mu) \geq \| v_h(t^k;\mu) - v_{\text{red}}(t^k;\mu) \|``
161 %
for every time step `0\leq t^0, \ldots, t^K = T` and every parameter `\mu
162 % \in {\cal M}`. The norm is a problem specific norm determined by the
163 % options in
'rmodel'.
165 % This
function's main use is to find a parameter vector
166 % ``\mu_{\max} = \arg \sup_{\mu \in {\cal M}_{\text{train}} } \max_{k=0,\ldots,K} \eta^k(\mu).``
168 % @note The estimator must only depend on low dimensional data as computed
169 % by the prepare_reduced_data() method such that it is efficiently
173 % rmodel: an object of type .Greedy.User.IReducedModel specifying the
174 % basis generation process.
175 % detailed_data: of type .Greedy.User.IDetailedData
176 % M_train: a set of parameter vectors `{\cal M}_{\text{train}}` as
177 % returned by ParameterSampling.Interface.space .
180 % max_errs: a matrix of size 'n_parameters x model.nt+1
' storing the
181 % error indicator `\eta^k(\mu)` for every `k=0,\ldots,K` and
182 % `\mu \in {\cal M}_{\text{train}}`.
183 % max_err_sequence: a sequence of error indicators `\eta^k(\mu_{\max})`
184 % for every `k=0,\ldots,K`.
185 % max_mu_index: the index of the parameter vector `\mu_{\max}` in the
186 % 'parameter_set.set
' matrix.
188 [max_errs, max_err_sequence, max_mu_index] = error_estimators(this, rmodel, detailed_data, M_train);
virtual function errs = compute_error(Greedy.User.IReducedModel rmodel,Greedy.User.ReducedData reduced_data,Greedy.User.IDetailedData detailed_data)
computes the "true" error between a reduced and a detailed function .
Interface class for extension algorithms which define the basis extension routines used by the abstra...
Interface for the storage and generation of detailed data that can be used to build reduced basis fun...
virtual function [ max_errs , max_err_sequence , max_mu_index ] = error_indicators(Greedy.User.IReducedModel rmodel,Greedy.User.IDetailedData detailed_data, parameter_set, reuse_reduced_data)
computes error indicators for the reduced simulations for every parameter vector from a given paramet...
relative_error
boolean flag specifying whether we want to use the relative error for error_indicators() and compute_...
a default reduced data implementation which stores a data tree object copying the structure of a Gree...
needs_preparation
boolean indicating whether the prepare_reduced_data() method needs to be computed before error_indica...
Interface for parameter sampling classes producing discrete parameter sample in the parameter space ...
Specialization plugins for the greedy algorithm.
Cacheable generators of detailed data snapshots.
Default implementation of a Greedy.Plugin.Interface interface class.
Customizable implementation of an abstract greedy algorithm.