1 function [LL_I, LL_E, bb, K_II, K_IE, K_EE, m_I, m_E, m] = rb_operators(rmodel, detailed_data, decomp_mode)
2 %
function [LL_I, LL_E, bb, K_II, K_IE, K_EE, m_I, m_E, m] = rb_operators(rmodel, [detailed_data], decomp_mode)
3 %
function computing the time-dependent reduced basis operators and vectors.
10 % LL_I : @copybrief LL_I
11 % LL_E : @copybrief LL_E
13 % K_II : @copybrief K_II
14 % K_IE : @copybrief K_IE
15 % K_EE : @copybrief K_EE
16 % m_I : @copybrief m_I
17 % m_E : @copybrief m_E
20 % In
'coefficients' mode the detailed data is empty.
22 % Bernard Haasdonk 23.7.2006
24 % determine affine_decomposition_mode as integer
26 model.decomp_mode = decomp_mode;
29 [L_I, L_E, b] = model.operators_ptr(model,[]);
31 Q_L_I = length(L_I(:));
32 Q_L_E = length(L_E(:));
35 % rb-
operator coefficients can simply be forwarded
40 % pairs: products of sigmas:
41 K_II = repmatrows(L_I(:), Q_L_I) .* repmat(L_I(:), Q_L_I, 1);
42 K_IE = repmatrows(L_I(:), Q_L_E) .* repmat(L_E(:), Q_L_I, 1);
43 K_EE = repmatrows(L_E(:), Q_L_E) .* repmat(L_E(:), Q_L_E, 1);
44 m_I = repmatrows(L_I(:), Q_b) .* repmat(b(:) , Q_L_I, 1);
45 m_E = repmatrows(L_E(:), Q_b) .* repmat(b(:) , Q_L_E, 1);
46 m = repmatrows(b(:) , Q_b) .* repmat(b(:) , Q_b , 1);
50 if isa(detailed_data,
'IDetailedData')
51 model_data = detailed_data.model_data;
53 model_data = detailed_data;
56 if decomp_mode == 0 % complete: simple projection on RB
58 %eval('u0 = ',params.init_value_algorithm,'(grid,params)']);
59 [L_I, L_E, b] = model.operators_ptr(model,model_data);
61 % apply all operator contributions to RB:
62 L_E_RB = L_E * detailed_data.RB;
63 L_I_RB = L_I * detailed_data.RB;
65 % fill output quantities
69 LL_I = detailed_data.RB' * A * L_I_RB;
72 LL_E = detailed_data.RB' * A * L_E_RB;
75 bb = detailed_data.RB' * A * b;
78 K_II = L_I_RB' * A * L_I_RB;
81 K_IE = L_I_RB' * A * L_E_RB;
84 K_EE = L_E_RB' * A * L_E_RB;
87 m_I = L_I_RB' * A * b;
90 m_E = L_E_RB' * A * b;
95 elseif decomp_mode == 1
97 %eval('u0 = ',params.init_value_algorithm,'(grid,params)']);
98 [L_I, L_E, b] = model.operators_ptr(model, model_data);
104 Nmax = size(detailed_data.RB,2);
105 H = size(detailed_data.RB,1);
108 % init output quantities
113 m_I = cell(Q_L_I*Q_b,1);
114 m_I(:) = {zeros(Nmax,1)};
115 m_E = cell(Q_L_E*Q_b,1);
116 m_E(:) = {zeros(Nmax,1)};
118 bb(:) = {zeros(Nmax,1)};
120 K_II = cell(Q_L_I*Q_L_I,1);
121 K_II(:) = {zeros(Nmax,Nmax)};
122 K_IE = cell(Q_L_I*Q_L_E,1);
123 K_IE(:) = {zeros(Nmax,Nmax)};
124 K_EE = cell(Q_L_E*Q_L_E,1);
125 K_EE(:) = {zeros(Nmax,Nmax)};
126 LL_I = cell(Q_L_I,1);
127 LL_I(:) = {zeros(Nmax,Nmax)};
128 LL_E = cell(Q_L_E,1);
129 LL_E(:) = {zeros(Nmax,Nmax)};
131 % apply all
operator contributions to RB:
132 L_E_RB = cell(Q_L_E,1);
133 L_E_RB(:) = {zeros(H,Nmax)};
134 L_I_RB = cell(Q_L_I,1);
135 L_I_RB(:) = {zeros(H,Nmax)};
137 L_E_RB{q}(:,:)= L_E{q} * detailed_data.RB;
140 L_I_RB{q}(:,:)= L_I{q} * detailed_data.RB;
143 % fill output quantities
146 LL_I{q} = detailed_data.RB
' * A * L_I_RB{q};
151 LL_E{q} = detailed_data.RB' * A * L_E_RB{q};
156 bb{q} = detailed_data.RB
' * A * b{q};
162 K_II{ (q1-1)*Q_L_I + q2}(:,:) = ...
163 L_I_RB{q1}' * A * L_I_RB{q2};
167 % K_IE : time sequence of matrices
168 % K_IE{1} = Gram matrix of L_I_RB{1} and L_E_RB{1}
169 % K_IE{2} = Gram matrix of L_I_RB{1} and L_E_RB{2}
170 % so L_E is
"inner loop". This must fit to the sigma-ordering
173 K_IE{ (q1-1)*Q_L_E + q2} = ...
174 L_I_RB{q1}
' * A * L_E_RB{q2};
181 K_EE{ (q1-1)*Q_L_E + q2} = ...
182 L_E_RB{q1}' * A * L_E_RB{q2};
189 m_I{ (q1-1)*Q_b + q2} = ...
190 L_I_RB{q1}
' * A * b{q2};
197 m_E{ (q1-1)*Q_b + q2} = ...
198 L_E_RB{q1}' * A * b{q2};
205 m{ (q1-1)*Q_b + q2} = ...
reduced model for linear evolution problems as given by a LinEvol.DetailedModel.
DataTree implementation for generated detailed and reduced data
tree node implementation for a detailed data structure holding a reduced basis
Reduced basis implementation for linear evolution equations.
DataTree specialization for detailed data generated by a Greedy algorithm instance.
Customizable implementation of an abstract greedy algorithm.