1 function rb_sim_data = lin_stat_rb_simulation(model,reduced_data)
2 %
function rb_sim_data = lin_stat_rb_simulation(model,reduced_data)
4 %
function performing a reduced simulation
6 % B. Haasdonk 22.2.2011
10 old_mode = model.decomp_mode;
11 model.decomp_mode = 2; % coefficients
12 [A_coeff,f_coeff] = model.operators(model,[]);
16 %AN = lincomb_sequence(reduced_data.AN_comp, A_coeff);
17 %fN = lincomb_sequence(reduced_data.fN_comp, f_coeff);
18 AN = reshape(reduced_data.AN_comp * A_coeff,N,N);
19 fN = reduced_data.fN_comp * f_coeff;
29 % plus error estimator
30 % res_norm = ... % residual norm
32 if isfield(model,
'RB_error_indicator') ...
33 && strcmp(model.RB_error_indicator,
'estimator')
35 %
for elliptic compliant
case, X-norm (=H10-norm) error estimator:
36 Q_r = size(reduced_data.G,1);
37 neg_auN_coeff = -uN * A_coeff';
38 %neg_auN_coeff = -A_coeff * uN';
39 res_coeff = [f_coeff; neg_auN_coeff(:)];
40 res_norm_sqr = res_coeff' * reduced_data.G * res_coeff;
42 % direct computation (expensive):
45 neg_auN_coeff = neg_auN_coeff(:);
46 Q_f = length(f_coeff);
47 res_norm_sqr_ff = f_coeff' * reduced_data.G(1:Q_f,1:Q_f) * f_coeff;
48 res_norm_sqr_fAu = f_coeff' * reduced_data.G(1:Q_f,(Q_f+1):end) * neg_auN_coeff;
49 res_norm_sqr_Auf = neg_auN_coeff' * reduced_data.G((Q_f+1):end,1:Q_f) * f_coeff;
50 res_norm_sqr_AuAu = neg_auN_coeff' * reduced_data.G((Q_f+1):end,(Q_f+1):end) * neg_auN_coeff;
52 model_data = gen_model_data(model);
53 detailed_data = gen_detailed_data(model,model_data);
54 model.decomp_mode = 0;
55 [A,f] = model.operators(model,model_data);
56 model.decomp_mode = 2;
57 resAu = A * (detailed_data.RB(:,1:model.N) * uN);
60 % residuum functional is res * v
61 % riesz representant: v_r' K v = (v_r,v) = res*v
63 K = model.get_inner_product_matrix(detailed_data);
67 % res_norm_sqr = (v_r,v_r) = v_r' K v_r = v_r' * res;
68 res_norm_sqr2 = v_r' * res;
69 res_norm_sqr2_ff = v_rf' * resf;
70 res_norm_sqr2_fAu = v_rf' * resAu;
71 res_norm_sqr2_Auf = v_rAu' * resf;
72 res_norm_sqr2_AuAu = v_rAu' * resAu;
76 % prevent possibly negative numerical disturbances:
77 res_norm_sqr = max(res_norm_sqr,0);
78 res_norm = sqrt(res_norm_sqr);
79 % if the SCM is being used perform an online-phase and use the resulting
80 % lower bound. Otherwise use the old code.
82 rb_sim_data.Delta = ...
83 res_norm/model.coercivity_alpha(model);
84 rb_sim_data.Delta_s = ...
85 res_norm_sqr/model.coercivity_alpha(model);
86 elseif model.use_scm == 1
87 if ~isfield(reduced_data, 'scm_offline_data')
88 error('There are no scm_offline_data to work with. They must be included in the reduced_data!')
91 rb_sim_data.Delta = ...
93 rb_sim_data.Delta_s = ...
94 res_norm_sqr/constant_LB;
97 end % error estimation
99 if model.compute_output_functional
101 l_coeff = model.operators_output(model,reduced_data);
102 % lN = lincomb_sequence(reduced_data.lN_comp,l_coeff);
103 lN = reduced_data.lN_comp * l_coeff;
104 rb_sim_data.s = lN(:)' * rb_sim_data.uN;
107 model.decomp_mode = old_mode;
class representing a continous piecewise polynomial function of arbitrary dimension. DOFS correspond to the values of Lagrange-nodes.
function [ constant_LB , constant_UB ] = scm_lower_bound(model, reduced_data)
[constant_LB, constant_UB] = scm_lower_bound(model, reduced_data)