rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
EiRbReducedDataNode.m
1 classdef EiRbReducedDataNode < Greedy.User.IReducedDataNode
2  % Reduced data implementation for non-linear evolution problems with finite
3  % volume discretizations.
4  %
5  % See @ref DHO11 for details on the implementations of the reduced matrices
6  % and vectors.
7 
8  properties(Dependent, SetAccess=private)
9  % Dof vectors of projections `\left\{{ \cal P }_{\text{red}}[u_0^q]
10  % \right\}_{q=1}^{Q_{u_0}}`.
11  %
12  % @sa NonlinEvol.ReducedModel.rb_init_values() for details.
13  a0;
14 
15  % `Q_I` reduced matrix for implicit operator `{\cal L}_{h,I}` if it is
16  % affinely decomposable.
17  %
18  % The matrix entries are:
19  % ``({ \bf L}_I^q)_{ij} = \int \varphi_i {\cal L}^q_{h,I}[\varphi_j]``
20  % for `i,j=1,\ldots,N` and `q=1,\ldots,Q_I`.
21  LL_I;
22 
23  % `Q_b`-sequence of reduced vectors for constant contributions `b_h`
24  %
25  % The matrix entries are:
26  % ``({ \bf b})_{i} = \int \varphi_i b^q_h``
27  % for `i=1,\ldots,N` and `q=1,\ldots,Q_b`.
28  bb_I;
29 
30  % reduced basis mass matrix.
31  %
32  % The matrix entries are:
33  % ``({ \bf M })_{ij} = \int \varphi_i \varphi_j``
34  % for `i,j=1,\ldots,N`
35  Nmass;
36 
37  % empirical interpolation matrix `{\bf B}`
38  %
39  % The matrix entries are:
40  % ``({\bf B})_{ij} = q_i(x_j)``
41  % for `1 \leq i \leq j \leq N` and vanish elsewhere.
42  BM;
43 
44  % local grid of type .gridbase with added neighbours such that a sparse
45  % evaluation of the empirically interpolated operators in the interpolation
46  % points is possible on this grid.
47  grid_local_ext;
48 
49  % synonym for #grid_local_ext of type .gridbase
50  grid;
51 
52  % indices of grid entities in the #grid_local_ext structure where the
53  % interpolation points are situated.
54  TM_local;
55 
56  % indices of grid entities in the the global grid structure where the
57  % interpolation points are situated.
58  TM_global;
59 
60  % empirical interpolation mass matrix.
61  %
62  % The matrix entries are:
63  % ``({ \bf M })_{ij} = \int q_i q_j``
64  % for `i,j=1,\ldots,M`
65  Mmass;
66 
67  end
68 
69  properties(Dependent, SetAccess=private)
70  % number of reduced basis vectors stored in this data node.
71  N;
72 
73  % number of collateral reduced basis vectors stored in this data node.
74  M;
75 
76  % number of collateral reduced basis vectors used for error estimation.
77  Mstrich;
78  end
79 
80  properties
81  % handle of object of type NonlinEvol.RbReducedDataNode storing all reduced
82  % magnitudes based only on the reduced basis.
83  rb_rd;
84 
85  % handle of object of type NonlinEvol.EiReducedDataNode storing all reduced
86  % magnitudes based only on the collateral reduced basis.
87  ei_rd;
88 
89 
90  % "transition" mass matrix
91  %
92  % The matrix entries are:
93  % ``({ \bf D })_{ij} = \int q_i \varphi_j``
94  % for `i=1,\ldots,M, j=1,\ldots,N`
95  DE;
96 
97  % empirical interpolation matrix for operator with projection to reduced
98  % basis space with `M+M'` basis vectors.
99  %
100  % This matrix is the solution `{\bf C}`of the equation system
101  % ``{ \bf B C } = { \bf D }``
102  % with @ref #BM "empirical interpolation matrix" `{ \bf B }` and @ref #DE
103  % "transition matrix" `{\bf D}`.
104  %
105  % In case you have a vector of interpolation evaluations `\bf l` at
106  % interpolation points, the interpolation can the be calculated as
107  % ``{\bf C l}``.
108  CE;
109 
110  % empirical interpolation matrix for operator with projection to reduced
111  % basis space for the empirical interpolation with only `M` basis vectors.
112  %
113  % See also: #CE
114  CE_red;
115 
116  % restriction of the reduced basis vectors to interpolation DOFs of the
117  % local grid #grid_local_ext.
118  RB_local_ext;
119  end
120 
121  methods
122  function rd = EiRbReducedDataNode(rb_reduced_data, rb_detailed_data, ...
123  ei_reduced_data, ei_detailed_data)
124  % Constructor for the generation of the reduced matrices and vectors.
125  %
126  % Parameters:
127  % rb_reduced_data: pure reduced basis reduced data structure of type NonlinEvol.RbReducedDataNode
128  % rb_detailed_data: detailed data structure of type Greedy.DataTree.Detailed.RbLeafNode
129  % storing the reduced basis.
130  % ei_reduced_data: pure EI reduced data structure of type NonlinEvol.EiReducedDataNode
131  % ei_detailed_data: detailed data structure of type Greedy.DataTree.Detailed.EiLeafNode
132  % storing the collateral reduced basis.
133  if nargin == 0
134  error('NonlinEvol.EiRbReducedDataNode constructor needs an argument');
135  elseif nargin == 4 && isa(rb_reduced_data, 'IReducedModel') ...
136  && isa(rb_detailed_data, 'NonlinEvol.EiRbReducedDataNode')
137  rmodel = rb_reduced_data;
138  copy = rb_detailed_data;
139  copy_extract(rd, copy, rmodel, ei_reduced_data, ei_detailed_data);
140  elseif nargin == 4
141  fill_fields(rd, rb_reduced_data, rb_detailed_data, ei_reduced_data, ei_detailed_data);
142  else
143  error('Did not find constructor for your arguments');
144  end
145  end
146 
147  function conds = get_conds(this)
148  conds_rb = get_conds(this.rb_rd);
149  conds_ei = get_conds(this.ei_rd);
150  if ~isempty(this.CE)
151  conds.CE = condest(this.CE);
152  end
153  if ~isempty(this.CE_red)
154  conds.CE_red = condest(this.CE_red);
155  end
156  conds = structcpy(conds_rb, conds_ei);
157  end
158 
159  end
160 
161  methods(Access=private)
162 
163  function fill_fields(this, rb_red, rb_det, ei_red, ei_det)
164  this.rb_rd = rb_red;
165  this.ei_rd = ei_red;
166 
167  A = rb_det.model_data.W;
168  this.DE = rb_det.RB' * A * ei_det.QM;
169 
170  this.RB_local_ext = rb_det.RB(this.ei_rd.TM_global, :);
171  end
172 
173  function copy_extract(this, copy, rmodel, rb_reduced_data, ei_reduced_data)
174  MM = rmodel.M + rmodel.Mstrich;
175  this.rb_rd = rb_reduced_data;
176  this.ei_rd = ei_reduced_data;
177 
178  this.DE = copy.DE(1:rmodel.N, 1:MM);
179  if rmodel.M == copy.M && rmodel.Mstrich == copy.Mstrich
180  this.RB_local_ext = copy.RB_local_ext(:, 1:rmodel.N);
181  else
182  eind = compute_TM_global(this.ei_rd, copy.ei_rd.grid, copy.ei_rd.TM_local(1:MM), rmodel);
183  this.RB_local_ext = copy.RB_local_ext(eind, 1:rmodel.N);
184  end
185  end
186  end
187 
188  methods
189 
190  function N = get.N(this)
191  N = this.rb_rd.N;
192  end
193 
194  function M = get.M(this)
195  M = this.ei_rd.M;
196  end
197 
198  function Mstrich = get.Mstrich(this)
199  Mstrich = this.ei_rd.Mstrich;
200  end
201 
202  function BM = get.BM(this)
203  BM = this.ei_rd.BM;
204  end
205 
206 % function this = set.BM(this, BM)
207 % this.ei_rd.BM = BM;
208 % end
209 
210  function Mmass = get.Mmass(this)
211  Mmass = this.ei_rd.Mmass;
212  end
213 
214 % function this = set.Mmass(this, Mmass)
215 % this.ei_rd.Mmass = Mmass;
216 % end
217 
218  function grid_local_ext = get.grid_local_ext(this)
219  grid_local_ext = this.ei_rd.grid_local_ext;
220  end
221 
222 % function this = set.grid_local_ext(this, grid_local_ext)
223 % this.ei_rd.grid_local_ext = grid_local_ext;
224 % end
225 
226  function grid_local_ext = get.grid(this)
227  grid_local_ext = this.ei_rd.grid_local_ext;
228  end
229 
230 % function this = set.grid(this, grid_local_ext)
231 % this.ei_rd.grid_local_ext = grid_local_ext;
232 % end
233 
234  function TM_local = get.TM_local(this)
235  TM_local = this.ei_rd.TM_local;
236  end
237 
238  function TM_global = get.TM_global(this)
239  TM_global = this.ei_rd.TM_global;
240  end
242  function a0 = get.a0(this)
243  a0 = this.rb_rd.a0;
244  end
245 
246  function Nmass = get.Nmass(this)
247  Nmass = this.rb_rd.Nmass;
248  end
249 
250  function LL_I = get.LL_I(this)
251  LL_I = this.rb_rd.LL_I;
252  end
254  function bb_I = get.bb_I(this)
255  bb_I = this.rb_rd.bb_I;
256  end
257 
258  function yesno = needs_subset_copy(this, rmodel)
259  % function yesno = needs_subset_copy(this, rmodel)
260  % @copybrief ::GreedyUser.IReducedDataNode.needs_subset_copy()
261  %
262  % @copydetails ::GreedyUser.IReducedDataNode.needs_subset_copy()
263  %
264  % Parameters:
265  % rmodel: of type NonlinEvol.ReducedModel
266 
267  yesno = needs_subset_copy(this.rb_rd, rmodel) || needs_subset_copy(this.ei_rd, rmodel);
268  end
269 
270 
271  end
272 end
273 
reduced model for non-linear evolution problems as given by a NonlinEvol.DetailedModel.
Definition: ReducedModel.m:18
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on collateral reduc...
function a0 = rb_init_values(Greedy.DataTree.Detailed.PODEILeafNode detailed_data, decomp_mode)
function computing initial values for a reduced simulation.
Definition: ReducedModel.m:212
Interface for leaf nodes of the DataTree in Greedy.User.ReducedData objects.
Reduced basis implementation for non-linear evolution equations.
TM_global
indices of grid entities in the the global grid structure where the interpolation points are situated...
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
Reduced data implementation for non-linear evolution problems with finite volume discretizations.
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1
Implementation of a Greedy.User.IReducedDataNode storing reduced data depending on reduced basis sp...