1 % small script testing the empirical interpolation
3 % detailed_data is loaded and single large timestep from 0 to T is
4 % performed. The linear and nonlinear simulation are opened in the
5 % gui
for comparison and adjusting the parameters
7 % Bernard Haasdonk 31.5.2007
10 load demo_nonlin_evol_detailed_data3
13 params.k = 0; % deactivate implicit contribution
14 params.N = size(detailed_data.RB,2);
15 %params.M = size(detailed_data.QM{1},2);
18 paramslin.rb_problem_type =
'lin_evol';
20 % plot both linear and nonlinear simulation result: should be the same
21 demo_rb_gui(detailed_data,[],params,
'Nonlinear simulation');
22 demo_rb_gui(detailed_data,[],paramslin,
'Linear simulation');
24 % plot details on nonlinear evolution:
26 tmp = load(
'debug_rb_nonlin_evol_simulation');
28 % plot computed ll_E values on subgrid
30 UN_local_ext = -ones(size(tmp.U_local_ext));
32 UN_local_ext(tmp.reduced_data.TM_local) = tmp.U_local;
34 % plot data before
operator evaluation
35 figure, plot_element_data(tmp.reduced_data.grid_local_ext,...
38 title(
'U_local_ext before operator evaluation');
39 % plot data after
operator evaluation
40 figure, plot_element_data(tmp.reduced_data.grid_local_ext,...
41 UN_local_ext,tmp.params);
43 title(
'UN_local_ext after operator evaluation');
45 % plot exact reconstruction before Galerkin projection
46 sigma = detailed_data.BM(1:params.M,1:params.M) \ tmp.ll_E;
47 UNreconstr = detailed_data.QM(:,1:params.M) * sigma;
48 figure, plot_element_data(detailed_data.grid,...
49 UNreconstr,tmp.params);
50 title(
'Exact EI-reconstruction');
51 %
set(ax,
'clim',
get(gca,
'clim'));
53 % check difference in points: real interpolated values obtained?
55 mask = zeros(1,detailed_data.grid.nelements);
56 nbi = detailed_data.grid.NBI(detailed_data.TM,:);
59 mask(detailed_data.TM) = 2;
60 local_ext_ind = find(mask);
61 UNreconstr_local_ext = UNreconstr(local_ext_ind);
62 UNreconstr_local = UNreconstr_local_ext(tmp.reduced_data.TM_local(1:params.M));
64 figure,plot([UNreconstr_local(:), tmp.ll_E(:)]);
65 legend({
'ei-reconstruction-values',
'local_eval'});
66 title([
'Comparison of local evaluation values and the values',...
67 ' of the resulting interpolant']);
69 % peform galerkin projection and reconstruction, plot result
70 A = feval(params.inner_product_matrix_algorithm,detailed_data.grid,params);
71 a = detailed_data.RB
' * A * UNreconstr;
72 UN_RBreconstr = detailed_data.RB * a;
73 figure, plot_element_data(detailed_data.grid,...
74 UN_RBreconstr,tmp.params);
75 title('RB-reconstruction of EI-projection');
77 figure,plot([tmp.rhs, -params.dt * a(:)]);
78 legend({
'reconstr',
'simulation'});
79 title([
'Comparison of RB-coefficients from explicit reconstruction ', ...
86 % TO BE ADJUSTED TO NEW SYNTAX