rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
nonlin_evol_rb_operators.m
1 function [LL_I, bb_I] = nonlin_evol_rb_operators(model, detailed_data, reduced_data)
2 %function [LL_I, bb_I] = nonlin_evol_rb_operators(model, detailed_data, reduced_data)
3 %
4 % function computing the time-dependent reduced basis operator and
5 % vector. If the decomposition mode is 'coefficients', the detailed
6 % data are superfluous, can (and should for H-independence) be empty.
7 %
8 % required fields of model
9 % implicit_operators_algorithm: name of function for computing the
10 % L_I,b_I-operators with arguments (grid, params)
11 % example fv_operators_implicit
12 % inner_product_name: name of inner-product function for
13 % discrete function l2-scalar-product
14 %
15 % Function supports affine decomposition, i.e. different operation modes
16 % guided by optional field affine_decomp_mode in params. See also the
17 % contents.txt for general explanation
18 %
19 % optional fields of params:
20 % mu_names : names of fields to be regarded as parameters in vector mu
21 % affine_decomp_mode: operation mode of the function
22 % 'complete' (default): no parameter dependence or decomposition is
23 % performed. output is as described above.
24 % 'components': For each output argument a cell array of output
25 % arguments is returned representing the q-th component
26 % independent of the parameters given in mu_names
27 % 'coefficients': For each output argument a cell array of output
28 % arguments is returned representing the q-th coefficient
29 % dependent of the parameters given in mu_names
30 %
31 % In 'coefficients' mode the detailed data is empty.
32 
33 % Bernard Haasdonk 23.7.2006
34 
35 % determine affine_decomposition_mode as integer
36 %decomp_mode = get_affine_decomp_mode(model);
37 
38 decomp_mode = model.decomp_mode;
39 
40 if decomp_mode ==0 % complete: simple projection on RB
41 
42  A = detailed_data.W;
43 
44  RBtranspA = detailed_data.RB' * A;
45 
46 % if isequal(params.model_type, 'implicit_nonaffine_linear')
47 % L_I = detailed_data.implicit_operator;
48 % b_I = detailed_data.implicit_constant;
49 % else
50  [L_I, b_I] = model.implicit_operators_algorithm(model, detailed_data);
51 % end
52 
53  % apply all operator contributions to RB:
54  L_I_RB = L_I * detailed_data.RB;
55 
56  % fill output quantities
57  % LL_I : matrix
58  LL_I = RBtranspA * L_I_RB;
59 
60  % bb : vector
61  bb_I = RBtranspA * b_I;
62 
63 elseif decomp_mode == 1
64 
65  if model.newton_solver || model.implicit_nonlinear
66  disp('what is the use of the flag implicit_nonlinear ??');
67 % [dummy, b_I{1}] = fv_operators_diff_implicit(model, detailed_data, [], []);
68  L_I = cell(0,1);
69  b_I = cell(0,1);
70  else
71  [L_I, b_I] = model.implicit_operators_algorithm(model, ...
72  detailed_data);
73  end
74 
75  Q_L_I = size(L_I,1);
76  Q_b_I = length(b_I);
77 
78  RB = detailed_data.RB;
79  Nmax = size(RB,2);
80  A = detailed_data.W;
81 
82  RBtranspA = RB' * A;
83 
84  % init output quantities
85  % vectors:
86  bb_I = cell(Q_b_I,1);
87  bb_I(:) = {zeros(Nmax,1)};
88  % matrices:
89  LL_I = cell(Q_L_I,1);
90  LL_I(:) = {zeros(Nmax,Nmax)};
91 
92  % apply all operator contributions to RB:
93  L_I_RB = cell(Q_L_I,1);
94  L_I_RB(:) = {zeros(size(RB))};
95  for q=1:Q_L_I
96  L_I_RB{q}(:,:)= L_I{q} * RB;
97  end;
98 
99  % fill output quantities
100  % LL_I : matrices
101  for q = 1:Q_L_I;
102  LL_I{q} = RBtranspA * L_I_RB{q};
103  end;
104 
105  % bb_I : vectors
106  for q = 1:Q_b_I;
107  bb_I{q} = RBtranspA * b_I{q};
108  end;
109 
110 else % decomp_mode== 2 -> coefficients
111 
112  [L_I, b_I] = model.implicit_operators_algorithm(model, []);
113 
114  % rb-operator coefficients can simply be forwarded
115  LL_I = L_I;
116  bb_I = b_I;
117 
118 end;
119 
120 %| \docupdate