1 % small script performing a reduced basis simulation with the
2 % linear and nonlinear scheme and plotting the results
3 % the detailed_data
for the nonlinear
case can be modified and the
4 % simulation parameters switched, hereby checking suitability of a
5 % colateral basis
for different parameter settings.
7 % Bernard Haasdonk 24.5.2007
9 % prepare and run nonlin_evol simulation
13 % detailed_data = rb_detailed_prep(params);
15 % load demo_nonlin_evol_detailed_data_LE_on_RB_wo_offset;
16 % load demo_nonlin_evol_detailed_data3;
17 load demo_nonlin_evol_detailed_data_8_trajectories;
18 % load demo_nonlin_evol_detailed_data_LE_on_RB;
19 offline_data = rb_offline_prep(detailed_data,params);
21 %params.N = 25; params.M = length(detailed_data.TM);
22 %params.N = 123; params.M = length(detailed_data.TM);
23 params.N = size(detailed_data.RB,2); params.M = length(detailed_data.TM{1});
25 % M usually less than N !!
27 reduced_data = rb_online_prep(offline_data,params);
35 disp(
'performing nonlinear simulation:');
36 simulation_data = rb_simulation(reduced_data,params);
37 Unonlin = rb_reconstruction(detailed_data,simulation_data);
38 params.title =
'Solution from nonlinear rb-simulation';
39 plot_element_data_sequence([],Unonlin,params);
40 % plot_element_data_sequence([],Unonlin(:,1:100),params);
41 %plot_rb_reconstruction(detailed_data,simulation_data,params);
43 disp(
'performing linear simulation:');
44 % run linear simulation
46 lparams.rb_problem_type =
'lin_evol';
47 lparams.L_I_inv_norm_bound = 1;
48 lparams.L_E_norm_bound = 1;
49 %use same detailed-data, i.e. reduced basis
50 offline_data = rb_offline_prep(detailed_data,lparams);
51 reduced_data = rb_online_prep(offline_data,lparams);
52 simulation_data = rb_simulation(reduced_data,lparams);
53 Ulin = rb_reconstruction(detailed_data,simulation_data);
54 lparams.title =
'Solution from linear rb-simulation';
55 % plot_element_data_sequence([],Ulin(:,1:100),lparams);
56 plot_element_data_sequence([],Ulin,lparams);
59 params.title =
'Difference of linear and nonlinear';
60 % plot_element_data_sequence([],Ulin(:,1:100)-Unonlin(:,1:100),params);
61 plot_element_data_sequence([],Ulin-Unonlin,params);
63 l2_errors =
fv_l2_error(Ulin,Unonlin,detailed_data.W);
65 figure,plot(l2_errors);
67 title(
'l2-difference');
68 % TO BE ADJUSTED TO NEW SYNTAX