rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
ReducedModel.m
1 classdef ReducedModel < Greedy.User.IReducedModel
2  % reduced model for linear evolution problems as given by a
4  %
5  % This is compatible with Greedy.User.IReducedModel and can therefore make
6  % use of @ref Greedy.User.IDetailedData "detailed data objects" created by
7  % Greedy algorithms.
8 
9  properties
10  enable_error_estimator = true;
11  end
12 
13  properties(Constant)
14  % This constant is used for a consistency check of the model descr with
15  % help of IModel.struct_check()
16  ddescr_checks = struct(...
17  'operators_ptr', {{@(x) isequal(class(x), 'function_handle')}},...
18  'init_values_algorithm', {{@(x) isequal(class(x), 'function_handle')}},...
19  'error_norm', {{@ischar, 'values', {'l2', 'energy'} }}...
20  );
21  end
22 
23  methods
24  function rm = ReducedModel(dmodel, bg_descr)
25  % function rm = ReducedModel(detailed_model, basis_generator)
26  % Constructor for the reduced model.
27  %
28  % Parameters:
29  % dmodel: of type LinEvol.DetailedModel
30 
31  if nargin == 1 || isempty(bg_descr)
32  bg_descr = [];
33  end
34  % this implements a copy constructor if necessary...
35  rm = rm@Greedy.User.IReducedModel(dmodel, bg_descr);
36  % are we NOT a copy constructor?
37  if ~(isempty(bg_descr) || isa(dmodel, 'LinEvol.ReducedModel'))
38  if ~IModel.struct_check(dmodel.descr, ...
40  error('Consistency check for LinEvol.ReducedModel failed.');
41  end
42  end
43  end
44 
45  function a0 = rb_init_values(this, detailed_data, decomp_mode)
46  % function a0 = rb_init_values(this, detailed_data, decomp_mode)
47  % @copybrief rb_init_values_separable()
48  %
49  % This calls rb_init_values_separable().
50  %
51  % Parameters:
52  % detailed_data: detailed data tree leaf object of type Greedy.DataTree.Detailed.RBLeafNode.
53  %
54  % Return values:
55  % a0: coefficient vector of size 'N x 1' for the initial values.
56  a0 = rb_init_values_separable(this, detailed_data, decomp_mode);
57  end
58 
59  %
60  %
61  % Parameters:
62  % reduced_data: of type LinEvol.ReducedData
63  rb_sim_data = rb_simulation_impl(this, reduced_data);
64 
65  function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
66  % function rb_sim_data = rb_reconstruction(this, detailed_data, rb_sim_data)
67  % @copybrief rb_reconstruction_default()
68  %
69  % This calls rb_reconstruction_default().
70  %
71  % Parameters:
72  % detailed_data: of type LinEvol.DetailedData
73  % rb_sim_data: struct holding reduced simulation data returned by
75  %
76  % Return values:
77  % rb_sim_data: struct holding the reduced simulation results and their
78  % reconstructions.
79  if isa(detailed_data, 'Greedy.User.IDetailedData')
80  dd_leaf = get_leaf(detailed_data, this);
81  else
82  dd_leaf = detailed_data;
83  end
84  rb_sim_data = rb_reconstruction_default(this, dd_leaf, rb_sim_data);
85  end
86 
87  function c = copy(this)
88  % function c = copy(this)
89  % @copybrief IReducedModelcopy()
90  %
91  % Return values:
92  % c: an object of type LinEvol.ReducedModel which is a deep copy of this object.
93  c = ReducedModel(this);
94  end
95 
96  end
97  methods (Static)
98  function Delta = get_estimators_from_sim_data(rb_sim_data)
99  % function Delta = get_estimators_from_sim_data(sim_data)
100  % @copybrief IReducedModelget_estimators_from_sim_data()
101  %
102  % @copydetails IReducedModelget_estimators_from_sim_data()
103  Delta = rb_sim_data.Delta;
104  end
105 
106  function Delta = get_estimator_from_sim_data(rb_sim_data)
107  % function Delta = get_estimator_from_sim_data(sim_data)
108  % @copybrief IReducedModelget_estimator_from_sim_data()
109  %
110  % @copydetails IReducedModelget_estimator_from_sim_data()
111  Delta = rb_sim_data.Delta(end);
112  end
113 
114  end
115 end
reduced model for linear evolution problems as given by a LinEvol.DetailedModel.
Definition: ReducedModel.m:18
DataTree implementation for generated detailed and reduced data
Definition: DuneRBLeafNode.m:2
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...
This is the common interface for all models, detailed and reduced ones.
Definition: IModel.m:17
function a0 = rb_init_values_separable(IReducedModel rmodel,Greedy.DataTree.Detailed.RBLeafNode detailed_data, decomp_mode)
function computing initial values for a reduced simulation.
tree node implementation for a detailed data structure holding a reduced basis
Definition: RBLeafNode.m:20
static function ok = struct_check(descr, checks)
executes checks on the fields of a structure object
Definition: IModel.m:210
Reduced basis implementation for linear evolution equations.
DataTree specialization for detailed data generated by a Greedy algorithm instance.
Definition: DuneRBLeafNode.m:3
static const ddescr_checks
This constant is used for a consistency check of the model descr with help of IModel.struct_check() ...
Definition: ReducedModel.m:39
Definition: leaf.m:17
Reduced data implementation for linear evolution problems with finite volume discretizations.
Definition: ReducedData.m:18
an interface specialization for detailed data objects used with the Greedy algorithm.
Definition: IDetailedData.m:19
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...
Definition: IReducedModel.m:17
virtual function rb_sim_data = rb_simulation(reduced_data)
Executes a reduced simulation and optionally an error estimation.
class generating the reduced basis space for the LinEvol problem with a Greedy algorithm.
Definition: DetailedData.m:18
decomp_mode
Decomposition operation mode.
Definition: IModel.m:66
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1
interface specialization for a reduced model that can be used with the Greedy algorithm for basis gen...
Definition: IReducedModel.m:19
Detailed model for a linear evolution problem with a Finite volume discretization.
Definition: DetailedModel.m:18