1 function [a0,c0] = lin_evol_opt_rb_init_values_separate_bases(model,detailed_data)
2 %
function a0 = lin_evol_opt_rb_init_values_separate_bases(models,detailed_data)
4 %
function computing the reduced basis initial values
for the solution (a0) and the
5 % derivative solutions (c0). If the
6 % decomposition mode is 'coefficients', the detailed_data are
7 % superfluous, can (and should for H-independence) be empty.
9 % required fields of model
10 % init_values_algorithm: name of function for computing the
11 % detailed initvalues-DOF with arguments (grid, params)
12 % example: init_values_cog
16 % Function supports affine decomposition, i.e. different operation modes
17 % guided by optional field decomp_mode in params. See also the
18 % contents.txt for general explanation
21 % Markus Dihlmann 30.03.2011
23 % determine affine_decomposition_mode as integer
24 decomp_mode = model.decomp_mode;
26 if decomp_mode == 0 % complete: simple projection on RB
27 %Nmax = size(detailed_data.RB,2);
28 u0 = model.init_values_algorithm(model,detailed_data);
30 a0 = u0' * A * detailed_data.RB;
32 if model.compute_derivative_info
33 RB_der = detailed_data.RB_der;
34 p = sum(model.compute_derivative_indices);
35 der_indices = find(model.compute_derivative_indices);
38 c0{i} = u0
' * A * RB_der{der_indices(i)};
44 elseif decomp_mode == 1
45 Nmax = size(detailed_data.RB,2);
46 u0 = model.init_values_algorithm(model,detailed_data);
49 a0(:) = {zeros(Nmax,1)};
50 % a0 : initial data projected on RB set: starting coefficients
53 a0{q} = u0{q}' * A * detailed_data.RB;
56 % c0 :initial data projection on RB_derivatives
57 if model.compute_derivative_info
58 RB_der = detailed_data.RB_der;
59 if isfield(model,
'separate_bases_derivative_nr')
60 p=model.separate_bases_derivative_nr;
63 c0{p}(:) = {zeros(size(RB_der{p},2),1)};
65 c0{p}{q} = u0{q}
' * A * RB_der{p};
72 c0{i}(:) = {zeros(size(RB_der{i},2),1)};
74 c0{i}{q} = u0{q}' * A * RB_der{i};
82 else % decomp_mode== 2 -> coefficients simply transfered from u0
83 u0 = model.init_values_algorithm(model, []);
85 if model.compute_derivative_info
86 c0 = model.rb_derivative_init_values_coefficients(model);
87 %filter out coefficients actually needed
88 %der_indices = find(model.compute_derivative_indices);
89 %c0 = c0(der_indices,:);