1 classdef Interface < handle
2 % %Interface
class for extension algorithms which define the basis extension
3 % routines used by the
abstract Greedy algorithm
class Greedy.Algorithm
5 % Here, we usually assume, that we have
6 % - @em detailed algorithms producing high dimensional solutions
7 % `v_h(t^k;\mu) \in {\cal W}_h` and
8 % - @em reduced algorithms producing corresponding low dimensional
9 % solutions `v_{\text{red}}(t^k;\mu) \in {\cal W}_{\text{red}} \subset {\cal W}_h`.
11 % By enriching the subspace `{\cal W}_{\text{red}}`, we can improve the
14 % Most prominent examples of Interface implementations are the classes
17 properties(SetAccess =
private, Dependent)
18 % a
string identifying the basis extension algorithm, should be unique over
24 %
boolean flag specifying whether we want to use the relative error
for
25 % error_indicators() and compute_error() methods.
28 %
string specifying which indicators shall be used by the
29 % error_indicators() method.
31 % Possible values are:
32 % 'error' for an error between the detailed and the reduced computation.
33 % 'estimator' for an a posteriori error estimator
37 properties(Abstract, Dependent)
39 %
boolean indicating whether the prepare_reduced_data() method needs to be
40 % computed before error_indicators can be computed.
44 properties(Abstract, Constant)
61 % constructor for a greedy extension
object
65 % dimensional) basis functions
67 gei.generator = generator;
70 function
id = get.
id(this)
71 id = this.generator.
id;
77 % function detailed_data = init_basis(this, rmodel, model_data, M_train);
78 % creates an initial detailed data node storing an initial reduced basis
82 % basis generation process.
84 % vector set `{\cal M}_{\text{train}}` from which the basis
85 % functions are obtained.
89 % reduced basis vectors.
90 detailed_data = init_basis(
this, rmodel, model_data, M_train);
92 %
function prepare_reduced_data(
this, rmodel, detailed_data);
93 % prepares reduced data that is necessary
for the execution of other
94 % methods
if indicated by needs_preparation.
96 % Methods that might depend on the execution of
this method are:
98 % - generate_reduced()
102 % rmodel: an
object of type .Greedy.User.IReducedModel specifying the
103 % basis generation process.
104 % detailed_data: of type .Greedy.User.IDetailedData
105 prepare_reduced_data(
this, rmodel, detailed_data);
107 %
function [max_errs, max_err_sequence, max_mu_index] = error_indicators(
this, rmodel, detailed_data, parameter_set, reuse_reduced_data);
108 % computes error indicators
for the reduced simulations
for every parameter
109 % vector from a given parameter set `{\cal M}_{\text{train}}`.
111 % An error indicator estimates an error
112 % ``\eta^k(\mu) \geq \| v_h(t^k;\mu) - v_{\text{red}}(t^k;\mu) \|``
113 %
for every time step `0\leq t^0, \ldots, t^K = T` and every parameter `\mu
114 % \in {\cal M}`. The norm is a problem specific norm determined by the
115 % options in
'rmodel'.
117 % This
function's main use is to find a parameter vector
118 % ``\mu_{\max} = \arg \sup_{\mu \in {\cal M}_{\text{train}} } \max_{k=0,\ldots,K} \eta^k(\mu)``.
121 % rmodel: an object of type .Greedy.User.IReducedModel specifying the
122 % basis generation process.
123 % detailed_data: of type .Greedy.User.IDetailedData
124 % parameter_set: a set of parameter vectors `{\cal M}_{\text{train}}` as
125 % returned by ParameterSampling.Interface.space .
126 % reuse_reduced_data: optional flag indicating whether the reduced data needed for
127 % reduced simulations or computation of error estimators is
128 % still valid since its last generation. (default = 'false')
131 % max_errs: a matrix of size 'n_parameters x model.nt+1
' storing the
132 % error indicator `\eta^k(\mu)` for every `k=0,\ldots,K` and
133 % `\mu \in {\cal M}_{\text{train}}`.
134 % max_err_sequence: a sequence of error indicators `\eta^k(\mu_{\max})`
135 % for every `k=0,\ldots,K`.
136 % max_mu_index: the index of the parameter vector `\mu_{\max}` in the
137 % 'parameter_set
' matrix.
139 [max_errs, max_err_sequence, max_mu_index] = error_indicators(this, rmodel, detailed_data, parameter_set, reuse_reduced_data);
141 % function errs = compute_error(this, rmodel, detailed_data);
142 % computes the "true" error between a reduced and a detailed function `\|
143 % v_h(t^k;\mu) - v_{\text{red}}(t^k;\mu) \|`.
145 % @note This function might depend on a previous execution of prepare_reduced_data().
148 % rmodel: an object of type .Greedy.User.IReducedModel specifying the
149 % basis generation process. The parameter `\mu` for which the
150 % error shall be computed must be set by 'set_mu(rmodel, mu)
'
152 % reduced_data: of type .Greedy.User.ReducedData
153 % detailed_data: of type .Greedy.User.IDetailedData
156 % errs: a sequence of errors at every time step `k=0,\ldots,K`.
157 errs = compute_error(this, rmodel, reduced_data, detailed_data);
159 % function Uapprox = generate_reduced(this, rmodel, reduced_data, detailed_data, U);
160 % generates a reduced function `v_{\text{red}}(\mu)`.
162 % @note This function might depend on a previous execution of prepare_reduced_data().
165 % rmodel: an object of type .Greedy.User.IReducedModel specifying the basis
166 % generation process. The parameter `\mu` for which the error
167 % shall be computed must be set by 'set_mu(rmodel, mu)
' before.
168 % reduced_data: an object of type .Greedy.User.ReducedData storing all
169 % (low-dimensional) reduced matrices and vectors needed for
170 % reduced simulations.
171 % detailed_data: of type .Greedy.User.IDetailedData
172 % U: optional DOF vector, for example operator evaluations.
175 % Uapprox: A sequence of Dof vectors of the functions
176 % `v_{\text{red}}(\cdot;t^k,\mu)`.
177 Uapprox = generate_reduced(this, rmodel, reduced_data, detailed_data, U);
179 % function [breakloop, reason] = pre_check_for_end(this, rmodel, detailed_data);
180 % checks whether the basis generation process has come to an end.
182 % Global break conditions (error_tolerance, timeout and validation ratio)
183 % are handled by Greedy.Algorithm .
186 % rmodel: of type .Greedy.User.IReducedModel
187 % detailed_data: of type .Greedy.User.IDetailedData
190 % breakloop: boolean flag indicating whether the basis generation process
191 % is finished for this reduced basis space.
192 % reason: descriptive text telling about the reasons why, the
193 % extension process needs to break.
194 [breakloop, reason] = pre_check_for_end(this, rmodel, detailed_data);
196 % breakloop = post_check_for_end(this, detailed_data);
198 % function detailed_data = basis_extension(this, rmodel, detailed_data, max_err_seq, mu);
199 % extends the reduced basis space from a given function `v_{h}(\mu)`.
201 % This generates a new basis function `\varphi_{n+1} \in {\cal W}_h` from
202 % the sequence of detailed functions `v_h(t^k,\mu)` for `k=0,\ldots,K` as
203 % returned by the SnapshotsGenerator.Cached generator.
206 % rmodel: an object of type .Greedy.User.IReducedModel specifying the
207 % basis generation process.
208 % detailed_data: of type .Greedy.User.IDetailedData
209 % max_err_seq: sequence of error indicators as returned as second return
210 % argument of error_indicators()
211 % mu: paramter vector `\mu`.
214 % detailed_data: updated data tree node of type Greedy.DataTree.Detailed.INode .
215 detailed_data = basis_extension(this, rmodel, detailed_data, max_err_seq, mu);
217 % function detailed_data = finalize(this, rmodel, detailed_data);
218 % function called after the last extension process
221 % rmodel: an object of type .Greedy.User.IReducedModel specifying the
222 % basis generation process.
223 % detailed_data: of type .Greedy.User.IDetailedData
226 % detailed_data: updated data tree node of type Greedy.DataTree.Detailed.INode .
227 detailed_data = finalize(this, rmodel, detailed_data);
Interface class for extension algorithms which define the basis extension routines used by the abstra...
extension class implementing the POD-greedy algorithm extension routines
Specialization plugins for the greedy algorithm.
Cacheable generators of detailed data snapshots.
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
Plugin for the Greedy.Algorithm class generating a collateral reduced basis space plus interpolation ...
virtual function [ max_errs , max_err_sequence , max_mu_index ] = error_estimators(Greedy.User.IReducedModel rmodel,Greedy.User.IDetailedData detailed_data, M_train)
computes a posteriori error estimators for the reduced simulations for every parameter vector from a ...
Default implementation of a Greedy.Plugin.Interface interface class.
Interface class for general data tree nodes storing detailed data returned by Greedy.Interface.gen_detailed_data()
Customizable implementation of an abstract greedy algorithm.