3 % This
function performs a reduced basis simulation. The solution to the
4 % reduced
ARE is calculated by calling the
function "care".
6 % The resulting structure sim_data contains the following fields:
7 % PN ...................... The reduced solution (N x N dimensional)
8 % time.solve .............. Time
for solving the reduced equation
9 % time.estim .............. Time
for the estimation procedure
10 % time.residual ........... Time
for the residual calculation
11 % time.total .............. Total time
for the whole rb simulation
12 % P_residual .............. Frobenius norm of the residual
13 % P_residual_normalized ... Frobenius norm of the residual, normalized
15 % Additionally,
if model.RB_enable_estimator is
true, the structure
16 % estim is added to the structure, containing the following fields:
17 % valid ................... 1/0 stating
if the validity bound is valid
18 % validity_bound .......... Value of the validity bound
19 % bound ................... The error bound
20 % normPN .................. Norm of the reduced solution matrix W PN W
'
21 % bound_relative .......... The relative error bound Delta_P(mu)/|| P ||
23 % Andreas Schmidt, 2015
26 % Assemble the reduced matrices
27 [E,A,B,C] = riccati_assemble_system_matrices(model, reduced_data);
30 if norm(eye(size(A,1))-E) < 10e-6
32 sim_data.PN = care(A,B,C'*C);
41 sim_data.PN = real(care(full(A),full(B),full(C
'*C),R,full(B*0),full(E)));
45 warning('Equation not solveable
');
47 sim_data.PN = zeros(size(A,1));
48 sim_data.P_residual = -1;
54 [r,rn] = riccati_residual_norm(model, reduced_data, sim_data);
55 sim_data.P_residual = r;
56 sim_data.P_residual_normalized = rn;
57 time.residual = toc(t);
59 % Perform the estimation process
61 if model.RB_enable_estimator == 1
64 gamma = riccati_rb_gamma(model, reduced_data, sim_data);
65 sim_data.estim.gamma = gamma;
67 [validity_bound, valid] = riccati_validity_bound(model, ...
68 reduced_data, sim_data);
69 sim_data.estim.validity_bound = validity_bound;
70 sim_data.estim.valid = valid;
73 % Assemble the values for ||E||^2 and ||B||^2
74 model.decomp_mode = 2;
75 Ecoeff = model.E(model, reduced_data);
77 error('Q_E > 1 currently not implemented
');
79 normE2 = (reduced_data.estim.normE*Ecoeff(1))^2;
81 Bcoeff = model.B(model, reduced_data);
82 if reduced_data.estim.normBBT_use2norm
83 normBBT = (reduced_data.estim.normBBT*Bcoeff(1))^2;
86 for i = 1:length(Bcoeff)
87 for j = 1:length(Bcoeff)
88 for k = 1:length(Bcoeff)
89 for l = 1:length(Bcoeff)
90 normBBT = normBBT + Bcoeff(i)*Bcoeff(j)*Bcoeff(k)*Bcoeff(l)*reduced_data.estim.normBBT{i,j,k,l};
97 epsilon = sim_data.P_residual;
98 sim_data.estim.bound = gamma*epsilon/(1-4*gamma^2*epsilon*normE2*normBBT);
99 sim_data.estim.bound2 = 2*gamma*epsilon;
100 sim_data.estim.normPN = sqrt( trace(sim_data.PN'*sim_data.PN) );
101 sim_data.estim.bound_relative = sim_data.estim.bound/sim_data.estim.normPN;
102 sim_data.estim.bound_relative2 = 2*gamma*epsilon/sim_data.estim.normPN;
105 time.total = time.estim + time.solve + time.residual;
107 sim_data.time = time;
function sim_data = riccati_rb_simulation(model, reduced_data)
sim_data = riccati_rb_simulation(model, reduced_data) This function performs a reduced basis simulati...
Implementation of the parametric algebraic Riccati equation.