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
8 properties(Dependent, SetAccess=
private)
9 % empirical interpolation matrix `{\bf B}`
11 % The matrix entries are:
12 % ``({\bf B})_{ij} = q_i(x_j)``
13 %
for `1 \leq i \leq j \leq N` and vanish elsewhere.
16 % local grid of type .gridbase with added neighbours such that a sparse
17 % evaluation of the empirically interpolated operators in the interpolation
18 % points is possible on
this grid.
21 % synonym
for #grid_local_ext of type .gridbase
24 % indices of grid entities in the #grid_local_ext structure where the
25 % interpolation points are situated.
28 % indices of grid entities in the the global grid structure where the
29 % interpolation points are situated.
40 % empirical interpolation mass matrix.
42 % The matrix entries are:
43 % ``({ \bf M })_{ij} = \int q_i q_j``
44 %
for `i,j=1,\ldots,M`
49 properties(Dependent, SetAccess=
private)
50 % number of reduced basis vectors stored in
this data node.
53 % number of collateral reduced basis vectors stored in
this data node.
56 % number of collateral reduced basis vectors used
for error estimation.
62 % magnitudes based only on the reduced basis.
66 % magnitudes based only on the collateral reduced basis.
71 %
"transition" mass matrix
73 % The matrix entries are:
74 % ``({ \bf D })_{ij} = \int q_i \varphi_j``
75 %
for `i=1,\ldots,M, j=1,\ldots,N`
78 % empirical interpolation matrix
for operator with projection to reduced
79 % basis space with `M+M
'` basis vectors.
81 % This matrix is the solution `{\bf C}`of the equation system
82 % ``{ \bf B C } = { \bf D }``
83 % with @ref #BM "empirical interpolation matrix" `{ \bf B }` and @ref #DE
84 % "transition matrix" `{\bf D}`.
86 % In case you have a vector of interpolation evaluations `\bf l` at
87 % interpolation points, the interpolation can the be calculated as
91 % empirical interpolation matrix for operator with projection to reduced
92 % basis space for the empirical interpolation with only `M` basis vectors.
97 % restriction of the reduced basis vectors to interpolation DOFs of the
98 % local grid #grid_local_ext.
103 function rd = EiRbReducedDataNode(rmodel, ...
104 rb_reduced_data, rb_detailed_data, ...
105 ei_reduced_data, ei_detailed_data)
106 % Constructor for the generation of the reduced matrices and vectors.
109 % rb_reduced_data: pure reduced basis reduced data structure of type TwoPhaseFlow.RbReducedDataNode
110 % rb_detailed_data: detailed data structure of type Greedy.DataTree.Detailed.RbLeafNode
111 % storing the reduced basis.
112 % ei_reduced_data: pure EI reduced data structure of type TwoPhaseFlow.EiReducedDataNode
113 % ei_detailed_data: detailed data structure of type Greedy.DataTree.Detailed.EiLeafNode
114 % storing the collateral reduced basis.
119 copy = rb_reduced_data;
120 copy_extract(rd, copy, rmodel);
122 fill_fields(rd, rmodel, rb_reduced_data, rb_detailed_data, ei_reduced_data, ei_detailed_data);
124 error('Did not find constructor
for your arguments
');
128 function conds = get_conds(this)
129 conds_rb = create_tree(this.rb_rd, ...
130 DataTree.ScalarCreator(@(X) get_conds(X)),...
132 conds_ei = get_conds(this.ei_rd);
134 conds.CE = condest(this.CE);
136 if ~isempty(this.CE_red)
137 conds.CE_red = condest(this.CE_red);
139 conds = structcpy(conds_rb, conds_ei);
144 methods(Access=private)
146 function fill_fields(this, rmodel, rb_red, rb_det, ei_red, ei_det)
150 ret_vars = ei_det.ophandle.ret_vars;
151 MM = get_by_description(rmodel.M, ei_det.ophandle.id);
152 A = ei_det.ophandle.inner_product_matrix(ei_det.model_data);
154 RB = cell(1, length(ret_vars));
155 for i = 1:length(ret_vars)
156 rb_det_i = get_by_description(rb_det, ret_vars{i});
157 N_i = get_by_description(rmodel.N, ret_vars{i});
158 RB{i} = rb_det_i.RB(:,1:N_i);
161 this.DE = RB' * A * ei_det.QM(:,1:MM);
163 arg_vars = ei_det.ophandle.arg_vars;
164 arg_vars_short = ei_det.ophandle.arg_vars_short;
166 this.RB_local_ext = [];
167 for i = 1:length(arg_vars);
168 rb_det_i = get_by_description(rb_det, arg_vars{i});
169 TM_global_i = this.ei_rd.TM_global_args{i};
170 avs = arg_vars_short{i};
171 N_i = get_by_description(rmodel.N, arg_vars{i});
172 this.RB_local_ext.(avs) = rb_det_i.RB(TM_global_i, 1:N_i);
175 this.opdata = ei_det.ophandle.fill_opdata(rmodel, ei_det);
178 function copy_extract(
this, copy, rmodel)
179 MM = get_by_description(rmodel.M, copy.ei_rd.ophandle.
id);
180 ophandle = copy.ei_rd.ophandle;
181 arg_vars = ophandle.arg_vars;
182 arg_vars_short = ophandle.arg_vars_short;
183 ret_var = ophandle.ret_vars;
184 N_ret = get_by_description(rmodel.N, ret_var{1});
186 this.ei_rd = copy.ei_rd;
187 this.rb_rd = copy.rb_rd;
188 this.DE = copy.DE(1:N_ret, 1:MM);
189 for i = 1:length(arg_vars_short)
191 avs = arg_vars_short{i};
192 N_arg = get_by_description(rmodel.N, av);
194 this.RB_local_ext.(avs) = copy.RB_local_ext.(avs)(:, 1:N_arg);
196 if ~isempty(this.ei_rd.TM_reduction_args)
197 TM_reduction_i = this.ei_rd.TM_reduction_args{i};
198 this.RB_local_ext.(avs) = copy.RB_local_ext(TM_reduction_i, 1:N_arg);
200 error(
'the empirical interpolation points are _not_ cropped!');
204 this.opdata = ophandle.copy_extract_opdata(copy.opdata, rmodel,
this.ei_rd.ophandle.id);
210 function N =
get.N(
this)
211 N = create_tree(this.rb_rd, ...
216 function M =
get.M(
this)
220 function Mstrich =
get.Mstrich(
this)
224 function BM =
get.BM(
this)
228 function Mmass =
get.Mmass(
this)
229 Mmass = this.ei_rd.
Mmass;
232 function grid_local_ext =
get.grid_local_ext(
this)
236 function grid_local_ext =
get.grid(
this)
240 function TM_global =
get.TM_global(
this)
244 function gEI =
get.gEI(
this)
245 gEI = this.ei_rd.gEI;
248 function gn_edges =
get.gn_edges(
this)
249 gn_edges = this.ei_rd.gn_edges;
252 function gn_inner_edges =
get.gn_inner_edges(
this)
253 gn_inner_edges = this.ei_rd.gn_inner_edges;
256 function gn_boundary_edges =
get.gn_boundary_edges(
this)
257 gn_boundary_edges = this.ei_rd.gn_boundary_edges;
260 function TM_local =
get.TM_local(
this)
264 function yesno = needs_subset_copy(
this, rmodel)
265 %
function yesno = needs_subset_copy(
this, rmodel)
266 % @copybrief .Greedy.User.IReducedDataNode.needs_subset_copy()
268 % @copydetails .Greedy.User.IReducedDataNode.needs_subset_copy()
273 yesno = needs_subset_copy(this.rb_rd, rmodel) || needs_subset_copy(this.ei_rd, rmodel);
grid_local_ext
local grid with added neighbours such that a sparse evaluation of the empirically interpolated operat...
reduced model for non-linear evolution problems as given by a TwoPhaseFlow.DetailedModel.
TM_global
indices of grid entities in the the global grid structure where the interpolation points are situated...
TM_local
indices of grid entities in the grid_local_ext structure where the interpolation points are situated...
BM
empirical interpolation matrix
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...
Mstrich
number of collateral reduced basis vectors used for error estimation.
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on reduced basis sp...
Reduced data implementation for non-linear evolution problems with finite volume discretizations.
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...
Mmass
empirical interpolation mass matrix.
M
number of collateral reduced basis vectors stored in this data node.
Simple DataTree.ICreator copying the original tree and applying a custom function to its leafs retur...
Customizable implementation of an abstract greedy algorithm.