1 function [LL_I, LL_E, bb, M_E, M_b, M_EE, M_Eb, M_bb, M_I, M_II, M_IE, M_Ib, ...
2 varargout] = lin_evol_opt_rb_operators_separate_bases(model, detailed_data)
3 %
function [LL_I, LL_E, bb, M_E, M_b, M_EE, M_Eb, M_bb, M_I, M_II, M_IE, M_Ib, ...
4 % {M_EdEd, M_IdId, M_bdbd, M_Ed, M_Id, M_bd, M_IEd, M_IId, M_Ibd, M_EEd, ...
5 % M_EId, M_Ebd, M_EdId, M_Edbd, M_Idbd]} = ...
6 % lin_evol_opt_rb_operators_separate_bases(model, detailed_data)
9 %
function computing the time-dependent reduced basis operators and
10 % vectors (Galerkin Projection) including derivative operators.
11 % Splittet into different decomp modes
for returning operators, components
13 % We assume different reduced bases
for the original solution and the
14 % derivative solutions.
15 % The derivative reduced bases are stores in detailed_data.RB_der{i}.
17 % In contrast to lin_evol_rb_operators the time step (I+dt*L) is not
18 % included in the operators.
20 % When choosing decomp mode = 1, it gives back projections on ALL available
21 % bases in RB_der. A selection of parameters to
optimize is not done.
22 % When choosing decomp_mode = 2, it gives back the coefficients to ALL
23 % parameters in the model. A selection of parameters to
optimize is not
26 % required fields of model
27 % operators_algorithm: name of
function for computing the
28 % L_E,L_I,b-operators with arguments (grid, params)
29 % example fv_operators_implicit
30 % compute_derivative_info: 1
if derivative information is wanted
31 % 0
if derivative information is not wanted
34 % optional fields of model:
35 % mu_names : names of fields to be regarded as parameters in vector mu
36 % decomp_mode: operation mode of the
function
37 % -0=
'complete' (
default): no parameter dependence or decomposition is
38 % performed. output is as described above.
39 % -1=
'components': For each output argument a cell array of output
40 % arguments is returned representing the q-th component
41 % independent of the parameters given in mu_names
42 % -2=
'coefficients': For each output argument a cell array of output
43 % arguments is returned representing the q-th coefficient
44 % dependent of the parameters given in mu_names
46 % required fields of detailed_data:
47 % RB: the reduced basis
for the original solution
48 % RB_der: cell array of derivative reduced bases
50 % generated fields of varargout:
51 % L_E_dd: galerkin projection on derivative space
53 % dL_E_sd: galerkin projection of
operator applied on solution on
56 % db: b projected on derivative space
57 % K...: K error matrices (formulas in detail in Paper)
59 % In
'coefficients' mode the detailed data is empty.
61 % Markus Dihlmann 24.03.2011
63 % determine affine_decomposition_mode as integer
64 decomp_mode = model.decomp_mode;
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 %%% complete calculation matrices %%%
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 if decomp_mode == 0 % complete: simple projection on RB
74 %eval(
'u0 = ',params.init_value_algorithm,
'(grid,params)']);
75 [L_I, L_E, b] = model.operators_ptr(model,detailed_data);
77 % apply all
operator contributions to RB:
78 %$L_E_RB = L_E * detailed_data.RB;
79 %$L_I_RB = L_I * detailed_data.RB;
81 % fill output quantities
86 LL_I = detailed_data.RB
' * A * L_I * detailed_data.RB;
89 LL_E = detailed_data.RB' * A * L_E * detailed_data.RB;
92 bb = detailed_data.RB
' * A * b;
95 %Error estimation operators
97 % often used /Phi^T L_E^T A
98 RB_L_E = detailed_data.RB' * L_E
' * A;
100 M_E = RB_L_E * detailed_data.RB;
101 M_b = b' * A * detailed_data.RB;
102 M_EE = RB_L_E * L_E * detailed_data.RB;
108 % often used /Phi^T L_I^T A
109 RB_L_I = detailed_data.RB' * L_I
' * A ;
111 M_I = RB_L_I * detailed_data.RB;
112 M_II = RB_L_I * L_I * detailed_data.RB;
113 M_IE = RB_L_I * L_E * detailed_data.RB;
117 % creation of derivative matrices
118 % get components and coefficients and do linear combination
119 % if model.compute_derivative_info
120 % if isfield(model.optimization,'params_to_optimize
')
121 % indx_mu_i = find(model.optimization.params_to_optimize); %indexes i of \mu_i for which derivative information is needed
123 % indx_mu_i = 1:length(get_mu(model));
125 % nr_indx_mu_i= length(indx_mu_i); %nr of parameters to be optimized
127 % % create dummy files for derivative matrices --> memory
129 % if ~isfield(model,'t
')
133 % model.decomp_mode = 1;
134 % [dummy_LL_I, dummy_LL_E, dummy_bb, dummy_M_E, dummy_M_b, dummy_M_EE, ...
135 % dummy_M_Eb, dummy_M_bb, dummy_M_I, dummy_M_II, dummy_M_IE, ...
136 % dummy_M_Ib, dummy_M_EdEd, dummy_M_IdId, dummy_M_bdbd, ...
137 % dummy_M_Ed, dummy_M_Id, dummy_M_bd, dummy_M_IEd, dummy_M_IId, ...
138 % dummy_M_Ibd, dummy_M_EEd, dummy_M_EId, dummy_M_Ebd, dummy_M_EdId,...
139 % ]=rb_operators(model,detailed_data); %dummy_M_Edbd, dummy_M_Idbd] = rb_operators(model,detailed_data); --> MEdbd, M_Idbd not needed
141 % if isempty(dummy_M_EdEd)
142 % M_EdEd = zeros(1,1,nr_indx_mu_i);
144 % M_EdEd = zeros(nRB,nRB,nr_indx_mu_i);
147 % if isempty(dummy_M_IdId)
148 % M_IdId = zeros(1,1,nr_indx_mu_i);
150 % M_IdId = zeros(nRB,nRB,nr_indx_mu_i);
153 % if isempty(dummy_M_Ed)
154 % M_Ed = zeros(1,1,nr_indx_mu_i);
156 % M_Ed = zeros(nRB,nRB,nr_indx_mu_i);
159 % if isempty(dummy_M_Id)
160 % M_Id = zeros(1,1,nr_indx_mu_i);
162 % M_Id = zeros(nRB,nRB,nr_indx_mu_i);
165 % if isempty(dummy_M_IEd)
166 % M_IEd = zeros(1,1,nr_indx_mu_i);
168 % M_IEd = zeros(nRB,nRB,nr_indx_mu_i);
171 % if isempty(dummy_M_IId)
172 % M_IId = zeros(1,1,nr_indx_mu_i);
174 % M_Id = zeros(nRB,nRB,nr_indx_mu_i);
177 % if isempty(dummy_M_EEd)
178 % M_EEd = zeros(1,1,nr_indx_mu_i);
180 % M_EEd = zeros(nRB,nRB,nr_indx_mu_i);
183 % if isempty(dummy_M_EId)
184 % M_EId = zeros(1,1,nr_indx_mu_i);
186 % M_EId = zeros(nRB,nRB,nr_indx_mu_i);
189 % if isempty(dummy_M_EdId)
190 % M_EdId = zeros(1,1,nr_indx_mu_i);
192 % M_EdId = zeros(nRB,nRB,nr_indx_mu_i);
195 % M_bdbd = zeros(1 ,1 ,nr_indx_mu_i);
196 % M_bd = zeros(1 ,nRB,nr_indx_mu_i);
197 % M_Ibd = zeros(nRB,1 ,nr_indx_mu_i);
198 % M_Ebd = zeros(nRB,1 ,nr_indx_mu_i);
199 % M_Edbd = zeros(nRB,1 ,nr_indx_mu_i);
200 % M_Idbd = zeros(nRB,1 ,nr_indx_mu_i);
201 % % end of: create dummy files for derivative matrices --> memory
206 % model.decomp_mode = 1;
207 % [compLL_I, compLL_E, compbb, compM_E, compM_b, compM_EE, compM_Eb,...
208 % compM_bb, compM_I, compM_II, compM_IE, compM_Ib, compM_EdEd,...
209 % compM_IdId, compM_bdbd, compM_Ed, compM_Id, compM_bd, compM_IEd,...
210 % compM_IId, compM_Ibd, compM_EEd, compM_EId, compM_Ebd,...
211 % compM_EdId, compM_Edbd, compM_Idbd] = rb_operators(model,detailed_data);
215 % model.decomp_mode = 2;
216 % [sLL_I, sLL_E, sbb, sM_E, sM_b, sM_EE, sM_Eb, sM_bb, sM_I, sM_II,...
217 % sM_IE, sM_Ib, sM_EdEd, sM_IdId, sM_bdbd, sM_Ed, sM_Id, sM_bd,...
218 % sM_IEd, sM_IId, sM_Ibd, sM_EEd, sM_EId, sM_Ebd, sM_EdId,...
219 % sM_Edbd, sM_Idbd] = rb_operators(model,detailed_data);
222 % %do linear combination of components and coefficients
223 % for i=1:nr_indx_mu_i
224 % M_EdEd(:,:,i) = lincomb_sequence(compM_EdEd,sM_EdEd(:,i));
225 % M_IdId(:,:,i) = lincomb_sequence(compM_IdId,sM_IdId(:,i));
226 % M_bdbd(:,:,i) = lincomb_sequence(compM_bdbd,sM_bdbd(:,i));
227 % M_Ed(:,:,i) = lincomb_sequence(compM_Ed ,sM_Ed(:,i));
228 % M_Id(:,:,i) = lincomb_sequence(compM_Id ,sM_Id(:,i));
229 % M_bd(:,:,i) = lincomb_sequence(compM_bd ,sM_bd(:,i));
230 % M_IEd(:,:,i) = lincomb_sequence(compM_IEd ,sM_IEd(:,i));
231 % M_IId(:,:,i) = lincomb_sequence(compM_IId ,sM_IId(:,i));
232 % M_Ibd(:,:,i) = lincomb_sequence(compM_Ibd ,sM_Ibd(:,i));
233 % M_EEd(:,:,i) = lincomb_sequence(compM_EEd ,sM_EEd(:,i));
234 % M_EId(:,:,i) = lincomb_sequence(compM_EId ,sM_EId(:,i));
235 % M_Ebd(:,:,i) = lincomb_sequence(compM_Ebd ,sM_Ebd(:,i));
236 % M_EdId(:,:,i) = lincomb_sequence(compM_EdId,sM_EdId(:,i));
237 % M_Edbd(:,:,i) = lincomb_sequence(compM_Edbd,sM_Edbd(:,i));
238 % M_Idbd(:,:,i) = lincomb_sequence(compM_Idbd,sM_Idbd(:,i));
241 % varargout( 1) = {M_EdEd};
242 % varargout( 2) = {M_IdId};
243 % varargout( 3) = {M_bdbd};
244 % varargout( 4) = {M_Ed};
245 % varargout( 5) = {M_Id};
246 % varargout( 6) = {M_bd};
247 % varargout( 7) = {M_IEd};
248 % varargout( 8) = {M_IId};
249 % varargout( 9) = {M_Ibd};
250 % varargout(10) = {M_EEd};
251 % varargout(11) = {M_EId};
252 % varargout(12) = {M_Ebd};
253 % varargout(13) = {M_EdId};
254 % varargout(14) = {M_Edbd};
255 % varargout(15) = {M_Idbd};
257 % end %if model.compute_derivative_info
260 %set decomp_mode back to 0
261 model.decomp_mode = 0;
264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265 %%% decomp_mode 1 %%%
266 %%% calculation of components %%%
267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268 elseif decomp_mode == 1
270 %eval('u0 =
',params.init_value_algorithm,'(grid,params)
']);
271 [L_I, L_E, b] = model.operators_ptr(model, detailed_data);
278 Nmax = size(detailed_data.RB,2);
279 H = size(detailed_data.RB,1);
283 %reduced operator components:
285 LL_I = cell(Q_L_I,1);
287 LL_I(:) = {zeros(Nmax,Nmax)};
289 LL_I{q} = detailed_data.RB' * A * L_I{q} * detailed_data.RB;
293 LL_E = cell(Q_L_E,1);
294 LL_E(:) = {zeros(Nmax,Nmax)};
296 LL_E{q} = detailed_data.RB
' * A * L_E{q} * detailed_data.RB;
301 bb(:) = {zeros(Nmax,1)};
303 bb{q} = detailed_data.RB' * A * b{q};
307 % init output quantities
308 M_E = cell(Q_L_E,1); M_E(:) = {zeros(Nmax,Nmax)};
309 M_b = cell(Q_b,1); M_b(:) = {zeros(Nmax,1)};
310 M_EE = cell(Q_L_E*Q_L_E,1); M_EE(:) = {zeros(Nmax,Nmax)};
311 M_Eb = cell(Q_L_E*Q_b,1); M_Eb(:) = {zeros(Nmax,1)};
312 M_bb = cell(Q_b*Q_b,1); M_bb(:) = {zeros(1,1)};
313 M_I = cell(Q_L_I,1); M_I(:) = {zeros(Nmax,Nmax)};
314 M_II = cell(Q_L_I*Q_L_I,1); M_II(:) = {zeros(Nmax,Nmax)};
315 M_IE = cell(Q_L_I*Q_L_E,1); M_IE(:) = {zeros(Nmax,Nmax)};
316 M_Ib = cell(Q_L_I*Q_b,1); M_Ib(:) = {zeros(Nmax,1)};
319 % often used matrices:
320 RB_L_E = cell(Q_L_E,1);
321 RB_L_E(:) = {zeros(Nmax,H)};
323 RB_L_E{q}(:,:)= detailed_data.RB
' * L_E{q}' * A;
326 RB_L_I = cell(Q_L_I,1);
327 RB_L_I(:) = {zeros(Nmax,H)};
329 RB_L_I{q}(:,:)= detailed_data.RB
' * L_I{q}' * A;
332 L_E_RB = cell(Q_L_E,1);
333 L_E_RB(:) = {zeros(H,Nmax)};
335 L_E_RB{q} = L_E{q}*detailed_data.RB;
338 L_I_RB = cell(Q_L_I,1);
339 L_I_RB(:) = {zeros(H,Nmax)};
341 L_I_RB{q} = L_I{q}*detailed_data.RB;
345 % fill output quantities
347 M_E{q} = RB_L_E{q} * detailed_data.RB;
351 M_b{q} = b{q}
' * A * detailed_data.RB;
356 M_EE{q2+(q1-1)*Q_L_E} = RB_L_E{q1} * L_E_RB{q2};
362 M_Eb{q2+(q1-1)*Q_b} = RB_L_E{q1} * b{q2};
368 M_bb{q2+(q1-1)*Q_b} = b{q1}' * A * b{q2};
373 M_I{q} = RB_L_I{q} * detailed_data.RB;
378 M_II{q2+(q1-1)*Q_L_I} = RB_L_I{q1} * L_I_RB{q2};
384 M_IE{q2+(q1-1)*Q_L_E} = RB_L_I{q1} * L_E_RB{q2};
390 M_Ib{q2+(q1-1)*Q_b} = RB_L_I{q1} * b{q2};
395 if model.compute_derivative_info
397 if ~isfield(detailed_data,
'RB_der')
398 error('No derivative bases in detailed_data')
401 % %Projection on which bases is actually needed?
402 % if isfield(model,'compute_derivative_indices')
403 % indx_mu_i = find(model.compute_derivative_indices); %indexes i of \mu_i for which derivative information is needed
405 % indx_mu_i = 1:length(get_mu(model));
407 % nr_indx_mu_i= length(indx_mu_i);
408 % RB_der=detailed_data.RB_der(indx_mu_i);
410 RB_der=detailed_data.RB_der;
411 nr_indx_mu_i = length(RB_der);
414 L_E_dd = cell(nr_indx_mu_i,1);
415 L_I_dd = cell(nr_indx_mu_i,1);
416 dL_E_sd = cell(nr_indx_mu_i,1);
417 dL_I_sd = cell(nr_indx_mu_i,1);
418 db = cell(nr_indx_mu_i,1);
419 K_E = cell(nr_indx_mu_i,1);
420 K_I = cell(nr_indx_mu_i,1);
421 K_EE = cell(nr_indx_mu_i,1);
422 %K_Eb = cell(nr_indx_mu,1);
423 %K_bb = cell(nr_indx_mu,1);
424 K_II = cell(nr_indx_mu_i,1);
425 %K_Ib = cell(nr_indx_mu,1);
426 K_IE = cell(nr_indx_mu_i,1);
427 K_EdEd = cell(nr_indx_mu_i,1);
428 K_IdId = cell(nr_indx_mu_i,1);
429 K_bdbd = cell(nr_indx_mu_i,1);
430 K_Ed = cell(nr_indx_mu_i,1);
431 K_Id = cell(nr_indx_mu_i,1);
432 K_bd = cell(nr_indx_mu_i,1);
433 K_IEd = cell(nr_indx_mu_i,1);
434 K_IId = cell(nr_indx_mu_i,1);
435 K_Ibd = cell(nr_indx_mu_i,1);
436 K_EEd = cell(nr_indx_mu_i,1);
437 K_EId = cell(nr_indx_mu_i,1);
438 K_Ebd = cell(nr_indx_mu_i,1);
439 K_EdId = cell(nr_indx_mu_i,1);
440 K_Edbd = cell(nr_indx_mu_i,1);
441 K_Idbd = cell(nr_indx_mu_i,1);
446 for i=1:length(RB_der)
448 NRB = size(RB_der{i},2);
449 %make Galerkin projection
for every reduced basis
451 % dL_E_dd : components
452 L_E_dd{i} = cell(Q_L_E,1);
453 L_E_dd{i}(:) = {zeros(NRB,NRB)};
455 L_E_dd{i}{q} = RB_der{i}
' * A * L_E{q} * RB_der{i};
458 % dL_I_dd : components
459 L_I_dd{i} = cell(Q_L_I,1);
461 L_I_dd{i}(:) = {zeros(NRB,NRB)};
463 L_I_dd{i}{q} = RB_der{i}' * A * L_I{q} * RB_der{i};
467 % dL_E_sd : components
468 dL_E_sd{i} = cell(Q_L_E,1);
469 dL_E_sd{i}(:) = {zeros(NRB,Nmax)};
471 dL_E_sd{i}{q} = RB_der{i}
' * A * L_E{q} * detailed_data.RB;
474 % dL_I_sd : components
475 dL_I_sd{i} = cell(Q_L_I,1);
477 dL_I_sd{i}(:) = {zeros(NRB,Nmax)};
479 dL_I_sd{i}{q} = RB_der{i}' * A * L_I{q} * detailed_data.RB;
485 db{i}(:) = {zeros(NRB,1)};
487 db{i}{q} = RB_der{i}
' * A * b{q};
493 K_E{i} = cell(Q_L_E,1);
494 K_E{i}(:) = {zeros(NRB,NRB)};
496 K_E{i}{q} = (RB_der{i}'*L_E{q}
'*A)*RB_der{i};
500 %K_b{i} = cell(Q_b,1);
501 %K_b(:) = {zeros(1,NRB)};
503 % K_b{i}{q} = b{q}'*A*RB_der{i}
507 K_I{i} = cell(Q_L_I,1);
508 K_I{i}(:) = {zeros(NRB,NRB)};
510 K_I{i}{q} = (RB_der{i}
'*L_I{q}'*A)*RB_der{i};
514 K_EE{i} = cell(Q_L_E*Q_L_E,1);
515 K_EE{i}(:) = {zeros(NRB,NRB)};
518 K_EE{i}{q2+(q1-1)*Q_L_E} = (RB_der{i}
'*L_E{q1}'*A)*(L_E{q2}*RB_der{i});
523 K_II{i} = cell(Q_L_I*Q_L_I,1);
524 K_II{i}(:) = {zeros(NRB,NRB)};
527 K_II{i}{q2+(q1-1)*Q_L_I} = (RB_der{i}
' *L_I{q1}'*A)*(L_I{q2}*RB_der{i});
532 K_IE{i} = cell(Q_L_I*Q_L_E,1);
533 K_IE{i}(:) = {zeros(NRB,NRB)};
536 K_IE{i}{q2+(q1-1)*Q_L_E} = (RB_der{i}
'*L_I{q1}'* A) * (L_E{q2} * RB_der{i});
540 %erster buchstabe---aeussere schleife
542 K_EdEd{i} = cell(Q_L_E*Q_L_E,1);
543 K_EdEd{i}(:) = {zeros(Nmax,Nmax)};
546 K_EdEd{i}{q2+(q1-1)*Q_L_E} = (detailed_data.RB
'*L_E{q1}'*A)*(L_E{q2}*detailed_data.RB);
551 K_IdId{i} = cell(Q_L_I*Q_L_I,1);
552 K_IdId{i}(:) = {zeros(Nmax,Nmax)};
555 K_IdId{i}{q2+(q1-1)*Q_L_I} = (detailed_data.RB
'*L_I{q1}'*A)*(L_I{q2}*detailed_data.RB);
560 K_bdbd{i} = cell(Q_b*Q_b,1);
564 K_bdbd{i}{q2+(q1-1)*Q_b} = b{q1}
'*A*b{q2};
569 K_Ed{i} = cell(Q_L_E,1);
570 K_Ed{i}(:) = {zeros(NRB,Nmax)};
572 K_Ed{i}{q} = (detailed_data.RB'*L_E{q}
'*A)*(RB_der{i});
576 K_Id{i} = cell(Q_L_I,1);
577 K_Id{i}(:) = {zeros(NRB,Nmax)};
579 K_Id{i}{q} = RB_der{i}'*A*L_I{q}*detailed_data.RB;
583 K_bd{i} = cell(Q_b,1);
584 K_bd{i}(:) = {zeros(1,NRB)};
586 K_bd{i}{q} = b{q}
'*A*RB_der{i};
590 K_IEd{i} = cell(Q_L_I * Q_L_E,1);
591 K_IEd{i}(:) = {zeros(NRB,Nmax)};
594 K_IEd{i}{q2+(q1-1)*Q_L_E} = (RB_der{i}' * L_I{q1}
'*A)*(L_E{q2}*detailed_data.RB);
599 K_IId{i} = cell(Q_L_I*Q_L_I,1);
600 K_IId{i}(:) = {zeros(NRB,Nmax)};
603 K_IId{i}{q2+(q1-1)*Q_L_I} = (RB_der{i}' * L_I{q1}
'*A)*(L_I{q2}*detailed_data.RB);
608 K_Ibd{i} = cell(Q_L_I*Q_b,1);
609 K_Ibd{i}(:) = {zeros(NRB,1)};
612 K_Ibd{i}{q2+(q1-1)*Q_b} = (RB_der{i}'*L_I{q1}
') * A * b{q2};
617 K_EEd{i} = cell(Q_L_E*Q_L_E,1);
618 K_EEd{i}(:) = {zeros(NRB,Nmax)};
621 K_EEd{i}{q2+(q1-1)*Q_L_E} = (RB_der{i}' * L_E{q1}
'*A)*(L_E{q2}*detailed_data.RB);
626 K_EId{i} = cell(Q_L_E*Q_L_I,1);
627 K_EId{i}(:) = {zeros(NRB,Nmax)};
630 K_EId{i}{q2+(q1-1)*Q_L_I} = (RB_der{i}' * L_E{q1}
'*A)*(L_I{q2}*detailed_data.RB);
635 K_Ebd{i} = cell(Q_L_E*Q_b,1);
636 K_Ebd{i}(:) = {zeros(NRB,1)};
639 K_Ebd{i}{q2+(q1-1)*Q_b} = RB_der{i}' * L_E{q1}
' * A * b{q2};
644 K_EdId{i} = cell(Q_L_E*Q_L_I,1);
645 K_EdId{i}(:) = {zeros(Nmax,Nmax)};
648 K_EdId{i}{q2+(q1-1)*Q_L_I} = (detailed_data.RB'*L_E{q1}
' * A) * (L_I{q2}'* detailed_data.RB);
653 K_Edbd{i} = cell(Q_L_E*Q_b,1);
654 K_Edbd{i}(:) = {zeros(Nmax,1)};
657 K_Edbd{i}{q2+(q1-1)*Q_b} = detailed_data.RB
'*L_E{q1}'*A*b{q2};
662 K_Idbd{i} = cell(Q_L_I*Q_b,1);
663 K_Idbd{i}(:) = {zeros(Nmax,1)};
666 K_Idbd{i}{q2+(q1-1)*Q_b} = detailed_data.RB
'*L_I{q1}'*A*b{q2};
670 end %
for over all RB_der
673 varargout(1) = {L_E_dd};
674 varargout(2) = {L_I_dd};
675 varargout(3) = {dL_E_sd};
676 varargout(4) = {dL_I_sd};
678 varargout(6) = {K_E};
679 varargout(7) = {K_I};
680 varargout(8) = {K_EE};
681 varargout(9) = {K_II};
682 varargout(10) = {K_IE};
683 varargout(11) = {K_EdEd};
684 varargout(12) = {K_IdId};
685 varargout(13) = {K_bdbd};
686 varargout(14) = {K_Ed};
687 varargout(15) = {K_Id};
688 varargout(16) = {K_bd};
689 varargout(17) = {K_IEd};
690 varargout(18) = {K_IId};
691 varargout(19) = {K_Ibd};
692 varargout(20) = {K_EEd};
693 varargout(21) = {K_EId};
694 varargout(22) = {K_Ebd};
695 varargout(23) = {K_EdId};
696 varargout(24) = {K_Edbd};
697 varargout(25) = {K_Idbd};
700 % varargout( 1) = {M_EE}; % M_EdEd
701 % varargout( 2) = {M_II}; % M_IdId
702 % varargout( 3) = {M_bb}; % M_bdbd
703 % varargout( 4) = {M_E} ; % M_Ed
704 % varargout( 5) = {M_I} ; % M_Id
705 % varargout( 6) = {M_b} ; % M_bd
706 % varargout( 7) = {M_IE}; % M_IEd
707 % varargout( 8) = {M_II}; % M_IId
708 % varargout( 9) = {M_Ib}; % M_Ibd
709 % varargout(10) = {M_EE}; % M_EEd
710 % varargout(11) = {M_IE
'}; % M_EId
711 % varargout(12) = {M_Eb}; % M_Ebd
712 % varargout(13) = {M_IE'}; % M_EdId
713 % varargout(14) = {M_Eb}; % M_Edbd
714 % varargout(15) = {M_Ib}; % M_Idbd
719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
721 %%% calculation of coefficients
722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
723 else % decomp_mode== 2 -> coefficients
724 [L_I, L_E, b] = model.operators_ptr(model,[]);
725 [sLi,sLe,sb] = model.rb_derivative_operators_coefficients_ptr(model); %gives coefficients to all the parameters in the model!
727 Q_L_I = length(L_I(:));
728 Q_L_E = length(L_E(:));
731 % rb-
operator coefficients can simply be forwarded
737 % rb error operators -coefficients
741 M_EE = repmatrows(L_E(:),Q_L_E) .* repmat(L_E(:),Q_L_E,1);
742 M_Eb = repmatrows(L_E, Q_b) .* repmat(b,Q_L_E,1);
743 M_bb = repmatrows(b, Q_b) .* repmat(b,Q_b,1);
744 M_II = repmatrows(L_I(:),Q_L_I) .* repmat(L_I(:),Q_L_I,1);
745 M_Ib = repmatrows(L_I, Q_b) .* repmat(b,Q_L_I,1);
746 M_IE = repmatrows(L_I(:),Q_L_E) .* repmat(L_E(:),Q_L_I,1);
748 % computation of derivative coefficients
749 if model.compute_derivative_info
751 %
if isfield(model.optimization,
'params_to_optimize')
752 % indx_mu_i = find(model.optimization.params_to_optimize); %indexes i of \mu_i
for which derivative information is needed
754 % indx_mu_i = length(get_mu(model));
756 % nr_indx_mu_i= length(indx_mu_i); %nr of parameters to be optimized
758 %
if isfield(model,
'compute_derivative_indices')
759 % nr_indx_mu_i = length(model.compute_derivative_indices);
761 % nr_indx_mu_i = length(get_mu(model));
764 nr_indx_mu_i=length(get_mu(model));
765 %obsolete: use only those coefficients of parameters which are to be optimimzed
766 %sLe = sLe
';%sLe(indx_mu_i,:)';
767 %sb = sb
';%(indx_mu_i,:)';
768 % in
case of no implicit operator (e.g. sLi=[]) repmat does not work!
770 %sLi = sLi(indx_mu_i,:)';
772 sLi=repmat(repmatrows(L_I(:),Q_L_I),1,nr_indx_mu_i); %sLi ist a 0xn empty matrix, not only a 0x1 empty matrix
775 varargout(1) = {L_E};
776 varargout(2) = {L_I};
777 varargout(3) = {sLe
'};
778 varargout(4) = {sLi'};
779 varargout(5) = {sb
'};
782 varargout(6)= {L_E}; %K_E
783 %varargout(7) = b;%K_b
784 varargout(7) = {L_I}; %K_I
785 varargout(8) = {repmatrows(L_E(:),Q_L_E) .* repmat(L_E(:),Q_L_E,1)}; %K_EE
786 %varargout(9) = repmatrows(L_E, Q_b) .* repmat(b,Q_L_E,1); %K_Eb
787 %varargout(10) = repmatrows(b, Q_b) .* repmat(b,Q_b,1); %K_bb
788 varargout(9) = {repmatrows(L_I(:),Q_L_I) .* repmat(L_I(:),Q_L_I,1)}; %K_II
789 %varargout(12) = repmatrows(L_I, Q_b) .* repmat(b,Q_L_I,1); %K_Ib
790 varargout(10) = {repmatrows(L_I(:),Q_L_E) .* repmat(L_E(:),Q_L_I,1)}; %K_IE
791 varargout(11) = {repmatrows(sLe',Q_L_E) .* repmat(sLe
',Q_L_E,1)}; % K_EdEd
792 varargout(12) = {repmatrows(sLi',Q_L_I) .* repmat(sLi
',Q_L_I,1)}; % K_IdId
793 varargout(13) = {repmatrows(sb',Q_b) .* repmat(sb
',Q_b,1)}; % K_bdbd
794 varargout(14) = {sLe'}; % K_Ed
795 varargout(15) = {sLi
'}; % K_Id
796 varargout(16) = {sb'}; % K_bd
797 varargout(17) = {repmat(repmatrows(L_I(:),Q_L_E),1,nr_indx_mu_i) .* repmat(sLe
',Q_L_I,1)}; % K_IEd
798 varargout(18) = {repmat(repmatrows(L_I(:),Q_L_I),1,nr_indx_mu_i) .* repmat(sLi',Q_L_I,1)}; % K_IId
799 varargout(19) = {repmat(repmatrows(L_I(:),Q_b ),1,nr_indx_mu_i) .* repmat(sb
',Q_L_I,1)}; % K_Ibd
800 varargout(20) = {repmat(repmatrows(L_E(:),Q_L_E),1,nr_indx_mu_i) .* repmat(sLe',Q_L_E,1)}; % K_EEd
801 varargout(21) = {repmat(repmatrows(L_E(:),Q_L_I),1,nr_indx_mu_i) .* repmat(sLi
',Q_L_E,1)}; % K_EId
802 varargout(22) = {repmat(repmatrows(L_E(:),Q_b ),1,nr_indx_mu_i) .* repmat(sb',Q_L_E,1)}; % K_Ebd
803 varargout(23) = {repmatrows(sLe
',Q_L_I) .* repmat(sLi',Q_L_E,1)}; % K_EdId
804 varargout(24) = {repmatrows(sLe
',Q_b) .* repmat(sb',Q_L_E,1)}; % K_Edbd
805 varargout(25) = {repmatrows(sLi
',Q_b) .* repmat(sb',Q_L_I,1)}; % K_Idbd
807 end %
if model.compute_derivative_info
function [ opt_data , model ] = optimize(model, model_data, detailed_data, reduced_data)
opt_data = optimize(model, model_data, detailed_data, reduced_data)