2 % Reduced data implementation
for non-linear evolution problems with finite
3 % volume discretizations.
5 % See @ref DHO11
for details on the implementations of the reduced matrices
10 % reduced basis space only
14 % collateral reduced basis space only
18 % the collateral reduced basis space and the reduced basis space
23 properties(Transient, Access=
public)
36 properties(Dependent, SetAccess=private)
37 % number of reduced basis vectors stored in this data node.
40 % number of collateral reduced basis vectors stored in this data node.
43 % number of collateral reduced basis vectors used for error estimation.
50 % Constructor for the generation of the reduced matrices and vectors.
62 copy_extract(rd, copy, rmodel);
64 fill_fields(rd, rmodel, detailed_data);
66 error('Did not find constructor for your arguments');
70 function conds = get_conds(this)
71 conds_rb = get_conds(this.rb_rd);
72 conds_ei = get_conds(this.ei_rd);
80 function index = get_index(this,
id, mu, nt)
81 index = get_index(this.ei_rb_rd,
id, mu, nt);
84 function node = get(this, index)
88 node = get(this.ei_rb_rd, index);
94 function yesno = needs_subset_copy(this, rmodel)
95 % function yesno = needs_subset_copy(this, rmodel)
96 % @copybrief ::
GreedyUser.IReducedDataNode.needs_subset_copy()
98 % @copydetails ::
GreedyUser.IReducedDataNode.needs_subset_copy()
99 % This method always returns true, because it is only a container element
100 % with no data and can be copied very cheaply! A traversal over leafs in
101 % order to check whether referencing is possible, is too slow.
109 methods(Access=private)
111 function fill_fields(this, rmodel, detailed_data)
112 ei_dd = detailed_data.ei;
113 rb_dd = detailed_data.rb;
114 sat_ei_dd = get_by_description(ei_dd, 'L_saturation');
115 vel_ei_dd = get_by_description(ei_dd, 'L_velocity');
116 sat_rb_dd = get_by_description(rb_dd, 'saturation');
117 vel_rb_dd = get_by_description(rb_dd, 'velocity');
118 prs_rb_dd = get_by_description(rb_dd, 'pressure');
120 this.rmodel = rmodel;
122 sat_ei_rd = create_tree(sat_ei_dd, this, 'L_saturation', [], [], []);
123 if rmodel.descr.linear_velocity
125 set(this.ei_rd, 1, sat_ei_rd);
127 vel_ei_rd = create_tree(vel_ei_dd,
this,
'L_velocity', [], [], []);
129 set(this.ei_rd, 1, sat_ei_rd);
130 set(this.ei_rd, 2, vel_ei_rd);
134 sat_rb_rd = create_tree(sat_rb_dd,
this, [], [], [], []);
135 vel_rb_rd = create_tree(vel_rb_dd,
this, [], [], [], []);
136 prs_rb_rd = create_tree(prs_rb_dd,
this, [], [], [], []);
138 set(this.rb_rd, 1, sat_rb_rd);
139 set(this.rb_rd, 2, vel_rb_rd);
140 set(this.rb_rd, 3, prs_rb_rd);
142 this.mode =
'separable_function';
143 this.separable_op = rmodel.
descr.init_values;
144 sat_init_rb_rd = create_tree(sat_rb_dd,
this, [], [], [], []);
146 this.detailed_rb_tree = rb_dd;
148 this.mode =
'separable_operator';
150 if rmodel.
descr.linear_velocity
152 this.rb_idsearch = {
'velocity',
'pressure'};
153 this.separable_op = rmodel.
descr.L_velocity;
154 L_vel_rb_rd = create_tree(vel_rb_dd,
this, [], [], [], []);
158 this.rb_idsearch = {
'velocity',
'pressure'};
159 this.separable_op = rmodel.
descr.L_divergence;
160 L_div_rb_rd = create_tree(vel_rb_dd,
this, [], [], [], []);
162 this.rb_idsearch = {
'pressure'};
163 this.separable_op = rmodel.
descr.L_pressure;
164 L_prs_rb_rd = create_tree(prs_rb_dd,
this, [], [], [], []);
165 this.separable_op = [];
170 this.detailed_ei_tree = sat_ei_dd;
171 this.reduced_ei_tree = sat_ei_rd;
172 this.mode =
'ei_rb_1';
173 this.rb_idsearch = {
'saturation',
'velocity'};
175 sat_ei_rb_rd = create_tree(sat_rb_dd,
this, [], [], [], []);
177 if ~rmodel.
descr.linear_velocity
178 this.detailed_ei_tree = vel_ei_dd;
179 this.reduced_ei_tree = vel_ei_rd;
180 this.rb_idsearch = {
'saturation',
'velocity',
'pressure'};
182 vel_ei_rb_rd = create_tree(sat_rb_dd,
this, [], [], [], []);
184 this.detailed_ei_tree = [];
185 this.reduced_ei_tree = [];
186 this.detailed_rb_tree = [];
187 this.rb_idsearch = [];
193 set(this.ei_rb_rd, 1, sat_ei_rb_rd);
194 if rmodel.
descr.linear_velocity
195 set(this.ei_rb_rd, 2, L_vel_rb_rd);
197 set(this.ei_rb_rd, 2, vel_ei_rb_rd);
199 set(this.ei_rb_rd, 3, L_div_rb_rd);
200 set(this.ei_rb_rd, 4, L_prs_rb_rd);
201 set(this.ei_rb_rd, 5, sat_init_rb_rd);
205 function copy_extract(
this, copy, rmodel)
206 this.rmodel = rmodel;
208 this.ei_rd = create_tree(copy.ei_rd, this, [], [], [], []);
210 this.rb_rd = create_tree(copy.rb_rd, this, [], [], [], []);
211 this.mode = 'ce_ei_rb';
212 this.ei_rb_rd = create_tree(copy.ei_rb_rd, this, [], [], [], []);
220 function node = create_leaf_node(this, arg_node, basepath, mu_cube, tslice)
221 % function new_node = create_leaf_node(this, node, basepath, mu_cube, tslice)
222 % specialization method for
leaf elements as described in
223 %
DataTreeICreator.create_leaf_node().
225 % @copydetails ::
DataTreeICreator.create_leaf_node()
227 % There are seven modes for the creation of new
leaf elements:
232 % - 'ei_rb_2' creates a "mixed"
leaf node
236 % - 'ei_rb_1' At this stage, the "mixed"
leaf node tree should be of
237 % the same state as the pure reduced basis tree. If this differs
238 % from the collateral space, the "mixed" tree needs to be refined
239 % by attaching tree levels from the EI tree. This is initiated by
242 % extracts smaller reduced matrices and vectors.
244 % extracts smaller reduced matrices and vectors.
246 % (optionally) extracts smaller reduced matrices and vectors.
253 case 'separable_function'
254 node =
Greedy.
DataTree.Reduced.SeparableFunctionNode(this.rmodel, arg_node, this.separable_op);
255 case 'separable_operator'
256 this.detailed_rb_leaf{this.id_ind} = arg_node;
257 if this.id_ind < length(this.rb_idsearch)
258 this.id_ind = this.id_ind + 1;
259 rb_dd_temp = get_by_description(this.detailed_rb_tree, this.rb_idsearch{this.id_ind}, [], []);
260 node = create_tree(rb_dd_temp,
this, this.rb_idsearch{this.id_ind}, mu_cube, tslice, []);
261 this.id_ind = this.id_ind - 1;
263 this.detailed_rb_leaf{this.id_ind} = arg_node;
266 this.detailed_rb_leaf = {};
269 this.detailed_rb_leaf{this.id_ind} = arg_node;
270 this.reduced_rb_leaf{this.id_ind} =
get(this.rb_rd, [this.id_ind, basepath]);
272 if this.id_ind < length(this.rb_idsearch)
273 this.id_ind = this.id_ind + 1;
274 rb_dd_temp = get_by_description(this.detailed_rb_tree, this.rb_idsearch{this.id_ind}, [], []);
275 node = create_tree(rb_dd_temp,
this, this.rb_idsearch{this.id_ind}, mu_cube, tslice, []);
276 this.id_ind = this.id_ind - 1;
278 this.mode =
'ei_rb_2';
280 node = create_tree(this.detailed_ei_tree,...
282 [], mu_cube, tslice,...
285 this.detailed_rb_leaf = {};
286 this.reduced_rb_leaf = {};
287 this.mode =
'ei_rb_1';
290 reduced_ei_leaf =
get(this.reduced_ei_tree, basepath);
291 detailed_ei_leaf = arg_node;
297 this.reduced_rb_leaf, ...
298 this.detailed_rb_leaf, ...
302 if needs_subset_copy(arg_node, this.rmodel)
303 node =
TwoPhaseFlow.EiReducedDataNode(this.rmodel, arg_node);
308 if needs_subset_copy(arg_node, this.rmodel)
309 node =
TwoPhaseFlow.RbReducedDataNode(this.rmodel, arg_node);
314 if needs_subset_copy(arg_node, this.rmodel)
325 function N = get.N(this)
327 N = create_scalar_tree(this.rb_rd, @(x) x.N);
330 function M = get.M(this)
332 M = create_scalar_tree(this.ei_rd, @(x) x.M);
335 function Mstrich = get.Mstrich(this)
337 Mstrich = create_scalar_tree(this.ei_rd, @(x) x.Mstrich);
Reduced data implementation for non-linear evolution problems with finite volume discretizations.
reduced model for non-linear evolution problems as given by a TwoPhaseFlow.DetailedModel.
DataTree implementation for generated detailed and reduced data
Interface for leaf nodes of the DataTree in Greedy.User.ReducedData objects.
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on collateral reduc...
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on reduced basis sp...
descr
The description structure holding information about the analytical parametrized problem and its discr...
Reduced data implementation for non-linear evolution problems with finite volume discretizations.
default implementation of the DataTree.ICreator interface
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...
DataTree specialization for reduced data constructed out of Greedy.DataTree.Detailed instances...
function s1 = structcpy(s1, s2)
copies the fields of structure s2 into structure s1. If the field to be copied does not exist in s1 y...
Customizable implementation of an abstract greedy algorithm.
Interface class for the generation and storage of reduced basis spaces as described in Module (M2)...