1 classdef ReducedData < Greedy.User.IReducedDataNode
2 % Reduced data implementation
for linear evolution problems with finite
3 % volume discretizations
5 % See @ref HO08a
for details on the implementation of the reduced matrices
10 % Dof vectors of projections `\left\{{ \cal P }_{\text{red}}[u_0^q]
11 % \right\}_{q=1}^{Q_{u_0}}`.
13 % @sa LinEvol.ReducedModel.rb_init_values()
for details.
16 % `Q_I` reduced matrix
for implicit
operator `{\cal L}_{h,I}`
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`.
23 % `Q_E`-sequence of reduced matrices for explicit operator `{\cal L}_{h,E}`
25 % The matrix entries are:
26 % ``({ \bf L}_E^q)_{ij} = \int \varphi_i {\cal L}^q_{h,E}[\varphi_j]``
27 %
for `i,j=1,\ldots,N` and `q=1,\ldots,Q_E`.
30 % `Q_b`-sequence of reduced vectors for constant contributions `b_h`
32 % The matrix entries are:
33 % ``({ \bf b})_{i} = \int \varphi_i b^q_h``
34 %
for `i=1,\ldots,N` and `q=1,\ldots,Q_b`.
37 % `Q_I \cdot Q_I`-sequence of gram matrices
39 % The matrix entries are:
40 % ``({ \bf K}_{II}^{q_1,q_2})_{ij} = \int {\cal L}^{q_1}_{h,I}[\varphi_i] {\cal L}^{q_2}_{h,I}[\varphi_j]``
41 %
for `i,j=1,\ldots,N` and `q_1,q_2=1,\ldots,Q_I`.
44 % `Q_I \cdot Q_E`-sequence of gram matrices
46 % The matrix entries are:
47 % ``({ \bf K}_{IE}^{q_1,q_2})_{ij} = \int {\cal L}^{q_1}_{h,I}[\varphi_i] {\cal L}^{q_2}_{h,E}[\varphi_j]``
48 %
for `i,j=1,\ldots,N` and `q_1=1,\ldots,Q_I, q_2=1,\ldots,Q_E`.
51 % `Q_E \cdot Q_E`-sequence of gram matrices
53 % The matrix entries are:
54 % ``({ \bf K}_{EE}^{q_1,q_2})_{ij} = \int {\cal L}^{q_1}_{h,E}[\varphi_i] {\cal L}^{q_2}_{h,E}[\varphi_j]``
55 %
for `i,j=1,\ldots,N` and `q_1,q_2=1,\ldots,Q_E`.
58 % `Q_I \cdot Q_b`-sequence of vectors
60 % The vector entries are:
61 % ``({ \bf m}_I^{q_1,q_2})_i = \int {\cal L}^{q_1}_{h,I}[\varphi_i] b_h^{q_2}``
62 %
for `i=1,\ldots,N` and `q_1=1,\ldots,Q_I, q_2=1,\ldots,Q_b`.
65 % `Q_E \cdot Q_b`-sequence of vectors
67 % The vector entries are:
68 % ``({ \bf m}_E^{q_1,q_2})_i = \int {\cal L}^{q_1}_{h,E}[\varphi_i] b_h^{q_2}``
69 %
for `i=1,\ldots,N` and `q_1=1,\ldots,Q_E, q_2=1,\ldots,Q_b`.
72 % `Q_b \cdot Q_b`-sequence of scalars
75 % ``{ \bf m}^{q_1,q_2} = \int b_h^{q_1} b_h^{q_2}``
76 % and `q_1,q_2=1,\ldots,Q_b`.
79 % in
case of output functional
this is a `Q_s`-sequence of vectors.
81 % The vector entries are:
82 % ``({ \bf s}^q)_i = s(\varphi_i)``
83 % for `i=1,\ldots,N` and `q_1=1,\ldots,Q_s`
86 % in
case of output functional
this is a `Q_s`-sequence of scalars.
89 % ``{ \bf s}_{l^2}^q = \|s(\varphi_1), \ldots, s(\varphi_N)\|_{l^2}``
90 %
for `q_1=1,\ldots,Q_s`
94 properties (SetAccess =
private, Dependent)
95 % number of reduced basis vectors stored in
this data node.
99 properties (SetAccess =
private)
100 % number of collateral reduced basis vectors stored in
this data node.
102 % number of collateral reduced basis vectors used
for error estimation
109 % Constructor
for the generation of the reduced matrices and vectors.
112 % rmodel: of type LinEvol.ReducedModel
117 error(
'LinEvol.ReducedData constructor needs an argument');
118 elseif nargin == 2 && isa(rmodel,
'IReducedModel') ...
119 && isa(detailed_data,
'LinEvol.ReducedData')
120 copy = detailed_data;
121 copy_extract(rd, copy, rmodel);
123 fill_fields(rd, rmodel, detailed_data);
125 error('Did not find constructor for your arguments');
129 function N = get.N(this)
131 N = size(this.a0{1},2);
137 function yesno = needs_subset_copy(
this, rmodel)
138 %
function yesno = needs_subset_copy(
this, rmodel)
139 % @copybrief .Greedy.User.IReducedDataNode.needs_subset_copy()
141 % @copydetails .Greedy.User.IReducedDataNode.needs_subset_copy()
144 % rmodel: of type LinEvol.ReducedModel
146 yesno = this.N ~= rmodel.N;
150 function conds = get_conds(
this)
151 disp('get_conds needs to be implemented for LinEvol.
ReducedData');
157 methods (Access=private)
158 function fill_fields(this, rmodel, detailed_data)
159 % function fill_fields(this, rmodel, detailed_data)
162 [this.LL_I, this.LL_E, this.bb, ...
163 this.K_II, this.K_IE, this.K_EE, ...
164 this.m_I, this.m_E, this.m ] ...
165 = LinEvol.ReducedData.rb_operators(rmodel, detailed_data, 1);
166 if isfield(rmodel.descr,'output_function_ptr')
168 md = detailed_data.model_data;
169 [OO, this.s_l2norm] = d.operators_output(d, md);
170 this.s_RB = OO' * detailed_data.RB;
174 function copy_extract(this, copy, rmodel)
175 % function copy_extract(this, copy, rmodel)
180 % number of reduced basis vectors to be used in the
181 % 'reduced_data_subset'
183 % extract correct N-sized submatrices and subvectors from reduced_data
185 error('N too large for current size of reduced basis!');
189 this.a0 = subblock_sequence(copy.a0,1:N);
190 this.LL_I = subblock_sequence(copy.LL_I,1:N,1:N);
191 this.LL_E = subblock_sequence(copy.LL_E,1:N,1:N);
192 this.bb = subblock_sequence(copy.bb,1:N);
193 this.K_EE = subblock_sequence(copy.K_EE,1:N,1:N);
194 this.K_IE = subblock_sequence(copy.K_IE,1:N,1:N);
195 this.K_II = subblock_sequence(copy.K_II,1:N,1:N);
196 this.m_I = subblock_sequence(copy.m_I,1:N);
197 this.m_E = subblock_sequence(copy.m_E,1:N);
199 % if ~isempty(copy.T)
200 % this.T = copy.T(1:N,1:N);
203 model = rmodel.detailed_model;
204 if isfield(model,'name_output_functional')
205 this.s_RB = copy.s_RB(1:N);
206 this.s_l2norm = copy.s_l2norm;
217 % detailed_data : of type Greedy.DataTree.Detailed.RBLeafNode
218 [LL_I, LL_E, bb, K_II, K_IE, K_EE, m_I, m_E, m] = rb_operators(rmodel, detailed_data, decomp_mode);