3 %
function computing initial values
for a reduced simulation.
5 % This
function can be used in
case the initial values
function `u_0(\mu)` is
6 % parameter separable, i.e. has the form
7 % ``u_0(x;\mu) = \sum_{q=1}^{Q_{u_0}} \sigma^q_{u_0}(\mu) u_0^q(x)``.
9 % Depending on the argument
'decomp_mode',
this function returns:
10 % - 'decomp_mode == 0': `{\cal M}_{\text{red}}[u_0(\cdot;\mu)]`
11 % - 'decomp_mode == 1': `\left\{ {\cal M}_{\text{red}}[u_0^q(\cdot)] \right\}_{q=1}^{Q_{u_0}}`
12 % - 'decomp_mode == 2': `\left\{ \sigma^q(\mu) \right\}_{q=1}^{Q_{u_0}}`
14 % If the decomposition mode is
'2 == coefficients', the detailed_data are
15 % superfluous, can (and should
for `H`-independence) be empty.
18 % detailed_data: detailed data tree
leaf object of type Greedy.DataTree.Detailed.RBLeafNode .
21 % Required fields of rmodel:
22 % init_values_algorithm: name of function for computing the
23 % detailed initvalues-DOF with arguments (grid, params)
24 % - example: fv_init_values()
27 % a0: coefficient vector of size '1 x N' for the initial values.
29 % Bernard Haasdonk 23.7.2006
31 % determine affine_decomposition_mode as integer
38 model.decomp_mode = decomp_mode;
41 u0 = model.init_values_algorithm(model, []);
46 model_data = detailed_data.model_data;
48 model_data = detailed_data;
51 if decomp_mode == 0 % complete: simple projection on RB
52 u0 = model.init_values_algorithm(model,model_data);
54 a0 = u0' * A * detailed_data.RB;
55 %a0 = feval(params.inner_product_name, ...
56 % detailed_data.RB,u0,detailed_data.grid,params);
57 % equivalent for fv: a0 = (RB.*repmat(grid.A(:),1,Nmax))' * u0(:);
58 elseif decomp_mode == 1
59 Nmax = size(detailed_data.RB,2);
60 u0 = model.init_values_algorithm(model,model_data);
63 a0(:) = {zeros(Nmax,1)};
64 % a0 : initial data projected on RB
set: starting coefficients
67 a0{q} = u0{q}
' * A * detailed_data.RB;
69 if model.debug && length(u0) > 1
70 if max(abs(detailed_data.RB * a0{1}'-u0{1}))>0.001
72 U0_RB = [detailed_data.RB*a0{1}',detailed_data.RB*a0{2}'];
74 plot_params.plot = model.plot;
75 plot_params.title =
'U0 Components';
77 plot_params.title =
'U0_RB';
79 error(
'rb initial data badly approximating initial data!!');