2 % reduced model
for non-linear evolution problems as given by a
10 enable_error_estimator =
true;
12 % properties (Constant) @code
13 % nl_checks =
struct(
'Mstrich', {{@isscalar,
'minmax', [0, inf]}},...
14 %
'enable_error_estimator', {{@isscalar,
'own', ...
15 % @(model) ~model.enable_error_estimator || model.Mstrich > 0, ...
16 %
'model.Mstrich needs to be positive if error estimator is enabled'}} ...
21 compute_conditions =
false;
23 % defines how the stencil of the local grid is computed
26 % - 'edge' for all neighbours over edges
27 % - 'vertex' for all neighbours of a grid cell's vertices
29 % See also: #local_stencil_size
30 stencil_mode = 'edge';
32 % defines the number of neighbors that shall be added to the stencil of the
33 % local grid created
for efficient empirical interpolation evalutations.
35 % See also: stencil_mode
36 local_stencil_size = 1;
39 properties (Dependent)
40 % current time instance
48 % This constant is used
for a consistency check of the model descr with
50 ddescr_checks = struct(...
51 'init_values_algorithm', {{@(x) isequal(
class(x),
'function_handle')}},...
52 'error_norm', {{@ischar,
'values', {
'l2',
'energy'} }},...
53 'stencil_mode', {{@ischar,
'values', {
'edge',
'vertex'} }},...
54 'local_stencil_size', {{@isnumeric}}...
62 % Constructor
for the reduced model.
67 if nargin == 1 || isempty(bg_descr)
70 % this implements a copy constructor if necessary...
72 % are we NOT a copy constructor?
82 rm.stencil_mode = descr.stencil_mode;
83 rm.local_stencil_size = descr.local_stencil_size;
86 rm.crb_enabled = true;
91 function M = get_current_M(this,
id)
92 % function M = get_current_M(this[,
id])
93 % returns the collateral reduced basis size for the current parameter and
97 %
id: an optional
id in case there are many collateral reduced basis
98 % spaces for one parameter and time instant combination.
101 % M: the size of the collateral reduced basis space
108 M = get_active_leaf(this.M, this,
id);
115 function c = copy(this)
116 % function c = copy(this)
124 % function reduced_data = gen_reduced_data(this, detailed_data)
126 % if isfield(this.descr, 'stencil_mode')
127 % rd_creator.stencil_mode = this.descr.stencil_mode;
128 % rd_creator.local_stencil_size = this.descr.local_stencil_size;
131 % reduced_data = gen_reduced_data(detailed_data, this, rd_creator);
134 % function reduced_data = extract_reduced_data_subset(this, reduced_data)
136 % if isfield(this.descr, 'stencil_mode')
137 % rd_creator.stencil_mode = this.descr.stencil_mode;
138 % rd_creator.local_stencil_size = this.descr.local_stencil_size;
141 % reduced_data = extract_reduced_data_subset(reduced_data, this, rd_creator);
148 rb_sim_data = rb_simulation_impl(this, reduced_data);
150 % function [LL_I, bb_I] = rb_operators(model, detailed_data)
151 % [LL_I, bb_I] =
NonlinEvol.ReducedDataCreator.rb_operators(model, detailed_data);
154 function a0 = rb_init_values(this, detailed_data,
decomp_mode)
155 % function a0 = rb_init_values(this, detailed_data,
decomp_mode)
161 % detailed_data: detailed data tree
leaf object of type
GreedyDataTreeDetailed.PODEILeafNode.
164 % a0: coefficient vector of size 'N x 1' for the initial values.
168 function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
169 % function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
176 % rb_sim_data: struct holding reduced simulation data returned by
180 % rb_sim_data: struct holding the reduced simulation results and their
183 dd=get_active_leaf(detailed_data, this, 'rb');
187 function enable_error_estimator = get.enable_error_estimator(this)
188 if this.enable_error_estimator && this.Mstrich == 0
189 error('Mstrich needs to be positive if error estimator is enabled!')
190 elseif ~this.enable_error_estimator && this.Mstrich > 0
191 warning('RBMatlab:error_estimator', 'Mstrich is larger than zero, but error_estimator is disabled!');
193 enable_error_estimator = this.enable_error_estimator;
199 function Delta = get_estimators_from_sim_data(rb_sim_data)
200 % function Delta = get_estimators_from_sim_data(rb_sim_data)
204 Delta = rb_sim_data.Delta;
207 function Delta = get_estimator_from_sim_data(rb_sim_data)
208 % function Delta = get_estimator_from_sim_data(rb_sim_data)
212 Delta = rb_sim_data.Delta(end);
215 % function U = get_dofs_from_sim_data(sim_data)
216 % if isfield(sim_data, 'U')
220 % warning('RBMatlab:NonlinEvolReducedModel:ReconstructionMissing', 'No reconstructed data found in sim_data, execute rb_reconstruct() first');
226 function t = get.t(this)
230 function set.t(this, t)
231 this.detailed_model.t = t;
234 function tstep = get.tstep(this)
235 tstep = this.descr.tstep;
238 function set.tstep(this, tstep)
239 this.detailed_model.tstep = tstep;
IDetailedModel implementation for a non linear evolution problem.
reduced model for non-linear evolution problems as given by a NonlinEvol.DetailedModel.
function rb_sim_data = rb_reconstruction_default(model, detailed_data, rb_sim_data)
(trivial) function computing a detailed reconstruction by linear combination of the coefficients in t...
class generating the reduced basis space for the LinEvol problem with a Greedy algorithm.
This is the common interface for all models, detailed and reduced ones.
compute_conditions
boolean flag indicating whether conditions of system matrices shall be computed.
function a0 = rb_init_values_separable(IReducedModel rmodel,Greedy.DataTree.Detailed.RBLeafNode detailed_data, decomp_mode)
function computing initial values for a reduced simulation.
static function ok = struct_check(descr, checks)
executes checks on the fields of a structure object
Reduced basis implementation for non-linear evolution equations.
an interface specialization for detailed data objects used with the Greedy algorithm.
Interface classes to be implemented by the Greedy.Algorithm user.
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
Reduced data implementation for non-linear evolution problems with finite volume discretizations.
decomp_mode
Decomposition operation mode.
Customizable implementation of an abstract greedy algorithm.
interface specialization for a reduced model that can be used with the Greedy algorithm for basis gen...