1 function rb_sim_data = rb_simulation(rmodel, reduced_data)
2 %
function simulation_data = rb_simulation(rmodel, reduced_data)
3 %
function, which performs a reduced basis online simulation
for
4 % the parameter vector `\mu`, which is assumed to be set by set_mu()
6 % - allowed dependency of data: Nmax, N, M, mu
7 % - not allowed dependency of data: H
8 % - allowed dependency of computation: Nmax, N, M, mu
9 % - not allowed dependency of computation: H
10 % - Unknown at
this stage: ---
13 % reduced_data: reduced data
object of type
LinStat.
ReducedData holding the reduced basis.
16 % rb_sim_data:
struct holding the reduced simulation data.
18 % B. Haasdonk 22.2.2011
20 model = rmodel.detailed_model.descr;
24 old_mode = model.decomp_mode;
25 model.decomp_mode = 2; % coefficients
27 [A_coeff,f_coeff] = ...
28 model.operators(model,[]);
30 AN = lincomb_sequence(reduced_data.AN_comp, A_coeff);
31 fN = lincomb_sequence(reduced_data.fN_comp, f_coeff);
41 % plus error estimator
42 % res_norm = ... % residual norm
44 %
for elliptic compliant
case, X-norm (=H10-norm) error estimator:
45 Q_r = size(reduced_data.G,1);
46 neg_auN_coeff = -A_coeff * uN';
47 res_coeff = [f_coeff; neg_auN_coeff(:)];
48 res_norm_sqr = res_coeff' * reduced_data.G * res_coeff;
50 % direct computation (expensive):
53 neg_auN_coeff = neg_auN_coeff(:);
54 Q_f = length(f_coeff);
55 res_norm_sqr_ff = f_coeff' * reduced_data.G(1:Q_f,1:Q_f) * f_coeff;
56 res_norm_sqr_fAu = f_coeff' * reduced_data.G(1:Q_f,(Q_f+1):end) * neg_auN_coeff;
57 res_norm_sqr_Auf = neg_auN_coeff' * reduced_data.G((Q_f+1):end,1:Q_f) * f_coeff;
58 res_norm_sqr_AuAu = neg_auN_coeff' * reduced_data.G((Q_f+1):end,(Q_f+1):end) * neg_auN_coeff;
60 model_data = gen_model_data(model);
61 detailed_data = gen_detailed_data(model,model_data);
62 model.decomp_mode = 0;
63 [A,f] = model.operators(model,model_data);
64 model.decomp_mode = 2;
65 resAu = A * (detailed_data.RB(:,1:model.N) * uN);
68 % residuum functional is res * v
69 % riesz representant: v_r' K v = (v_r,v) = res*v
71 K = model.get_inner_product_matrix(detailed_data);
75 % res_norm_sqr = (v_r,v_r) = v_r' K v_r = v_r' * res;
76 res_norm_sqr2 = v_r' * res;
77 res_norm_sqr2_ff = v_rf' * resf;
78 res_norm_sqr2_fAu = v_rf' * resAu;
79 res_norm_sqr2_Auf = v_rAu' * resf;
80 res_norm_sqr2_AuAu = v_rAu' * resAu;
84 % prevent possibly negative numerical disturbances:
85 res_norm_sqr = max(res_norm_sqr,0);
86 res_norm = sqrt(res_norm_sqr);
87 rb_sim_data.res_norm = res_norm;
88 rb_sim_data.Delta = ...
89 res_norm/model.coercivity_alpha(model);
90 rb_sim_data.Delta_s = ...
91 res_norm_sqr/model.coercivity_alpha(model);
93 if model.compute_output_functional
96 model.operators_output(model,reduced_data);
98 lincomb_sequence(reduced_data.lN_comp,l_coeff);
99 rb_sim_data.s = lN(:)' * rb_sim_data.uN;
100 % rb_sim_data.Delta_s = ...;
103 model.decomp_mode = old_mode;
class representing a continous piecewise polynomial function of arbitrary dimension. DOFS correspond to the values of Lagrange-nodes.
Reduced basis implementation for linear stationary PDEs.
Reduced data implementation for linear stationary problems with finite element discretizations.