1 classdef DetailedData < Greedy.User.IDetailedData
2 %
class generating the reduced basis space for the LinEvol problem with a
5 % Parameters given by the constructor argument
'bg_descr' of type
7 % - trainings sample (#train_sample_mode, #train_num_intervals, #train_seed)
8 % - trainings sample refinement (#refinement_mode, #val_size, #val_seed,
9 % #stop_max_val_train_ratio)
10 % - the error indicator (#indicator_mode)
11 % - general greedy controls (#Nmax, #stop_timeout, #stop_epsilon)
13 properties (Dependent, SetAccess=private)
14 % a basis generation algorithm of type Greedy.Interface used to generated
15 % the reduced basis space.
19 properties (Access=
private)
25 % flag indicating whether the parameter sampling for the training set
26 % `M_{\text{train}}` type.
29 % - 'uniform': (default) for a ParameterSampling.Uniform
30 % - 'random': for a ParameterSampling.Random
31 train_sample_mode = 'uniform';
33 % number of intervals in the ParameterSampling.Uniform
for the training
34 %
set `M_{\text{train}}` of the parameter space `{\cal M}`.
35 train_num_intervals = 3;
37 % If
'train_sample_mode == random', a ParameterSampling.Random is generated
38 %
for the training
set `M_{\text{val}}` with size
'train_num_intervals' and
42 % If
this value is non-zero, a ParameterSampling.Random is generated for the
43 % validation set `M_{\text{val}}` with size
'val_size' and seed
'val_seed'.
46 % If the value of
'val_size' is non-zero, a ParameterSampling.Random is
47 % generated for the validation set `M_{\text{val}}` with size
'val_size'
48 % and seed
'val_seed'.
57 indicator_mode =
'estimator';
67 % If
this value is
set to something less than
'inf', parameter sampling
68 % adaptation should be activated, by setting the
'refinement_mode' to
69 %
'adaptive' or
'uniform'.
70 stop_max_val_train_ratio = 1;
74 % Possible values are:
75 % - 'uniform': the parameter sampling is refined uniformly
76 % - 'adaptive': the parameter sampling is refined adaptively, such that
77 % only regions of the parameter space with high estimated
79 % - 'none': no Greedy.TrainingSetAdaptation object is created
80 refinement_mode = 'adaptive';
88 % constructor constructing the reduced basis spaces and storing it in a
92 % rmodel: of type LinEvol.ReducedModel
96 dd.rb_generator = SnapshotsGenerator.Trajectories(rmodel.detailed_model);
98 if isa(rmodel,
'LinEvolDune.ReducedModel')
102 dd.datatree = gen_detailed_data(dd.bg_algorithm, rmodel, model_data);
110 function basis_gen = get.bg_algorithm(this)
111 % generates a default @ref Greedy.Interface "basis generation
object" for
114 % This function generates a Greedy.Interface implementation, with at least
115 % a POD-Greedy extension algorithm for the reduced basis.
118 if isequal(this.train_sample_mode, 'uniform')
119 M_train = ParameterSampling.Uniform(this.train_num_intervals);
120 elseif isequal(this.train_sample_mode, 'random')
121 M_train = ParameterSampling.Random(this.train_num_intervals, this.train_seed);
123 error('unknown train_sample_mode');
126 M_val = ParameterSampling.Random(this.val_size, this.val_seed);
132 rb_extension = Greedy.Plugin.PODDune(this.rb_generator);
134 rb_extension = Greedy.Plugin.POD(this.rb_generator);
136 rb_extension.stop_Nmax = this.Nmax;
137 % decide, whether estimator or true error is error-indicator for greedy
138 rb_extension.indicator_mode = this.indicator_mode; %'estimator'; % Delta from rb_simulation
140 pod_greedy = Greedy.Algorithm(rb_extension, M_train, M_val);
141 pod_greedy.stop_timeout = this.stop_timeout; % 60*60;
142 pod_greedy.stop_epsilon = this.stop_epsilon; % 1e-9; % 0.003 is already realized by init data!!
143 pod_greedy.stop_max_val_train_ratio = this.stop_max_val_train_ratio; % 1.00;
145 if ~isequal(this.refinement_mode, 'none')
146 basis_gen = Greedy.TrainingSetAdaptation(pod_greedy);
147 basis_gen.refinement_mode = this.refinement_mode;
149 basis_gen = pod_greedy;
154 function rb_size = get_rb_size(this, rmodel)
155 leaf_dd = get_leaf(this, rmodel);
156 rb_size = get_rb_size(leaf_dd);