rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
demo_rb_error_gui.m
Go to the documentation of this file.
1 function demo_rb_error_gui(varargin)
2 %function demo_rb_error_gui(model,detailed_data,[reduced_data],...
3 % plot_params[,title, callbackfigure, ...
4 % cbhandle])
5 % demo gui for detailed simulations and reduced simulation and
6 % plotting the error
7 %
8 % (calling demo_rb_gui after switching some pointers)
9 
10 % B. Haasdonk 2.3.2012
11 
12 tlist = varargin;
13 if nargin < 1
14  disp('no model and data specified... generating thermalblock data')
15  params = [];
16  params.B1 = 2;
17  params.B2 = 2;
18  params.numintervals_per_block = 50;
19  params.mu_range = [0.1;10];
20  params.numintervals_per_block = 5;
21  model = thermalblock_model_struct(params);
22  model_data = gen_model_data(model);
23  detailed_data = gen_detailed_data(model,model_data);
24  reduced_data = gen_reduced_data(model,detailed_data);
25  my_reduced_data.reduced_data = reduced_data;
26  my_reduced_data.detailed_data = detailed_data;
27  plot_params = [];
28  plot_params.axis_equal = 1;
29  plot_params.axis_tight = 1;
30  plot_params.yscale_uicontrols = 0.7;
31  tlist{1} = model;
32  tlist{2} = detailed_data;
33  tlist{3} = my_reduced_data;
34  tlist{4} = plot_params;
35 end;
36 
37 model = tlist{1};
38 
39 model.original_rb_simulation = model.rb_simulation;
40 model.rb_simulation = @my_rb_simulation;
41 
42 model.original_gen_reduced_data = model.gen_reduced_data;
43 model.gen_reduced_data = @my_gen_reduced_data;
44 
45 model.original_rb_reconstruction = model.rb_reconstruction;
46 model.rb_reconstruction = @my_rb_reconstruction;
47 
48 model.original_reduced_data_subset = model.reduced_data_subset;
49 model.reduced_data_subset = @my_reduced_data_subset;
50 
51 model.original_get_dofs_from_sim_data = model.get_dofs_from_sim_data;
52 model.get_dofs_from_sim_data = @(sim_data) ...
53  my_get_dofs_from_sim_data(sim_data,model);
54 
55 model.original_plot_sim_data = model.plot_sim_data;
56 model.plot_sim_data = @my_plot_sim_data;
57 
58 model.enable_error_estimator = 0;
59 
60 tlist{1} = model;
61 tlist{5} = 'reduced basis error';
62 demo_rb_gui(tlist{:});
63 
64 function my_data = my_gen_reduced_data(model,detailed_data)
65 my_data.detailed_data = detailed_data;
66 my_data.reduced_data = model.original_gen_reduced_data(model,detailed_data);
67 
68 function my_sim_data = my_rb_simulation(model,my_data)
69 my_sim_data.sim_data = detailed_simulation(model,my_data.detailed_data);
70 if my_data.reduced_data.N ~= model.N
71  my_data = extract_reduced_data_subset(model,my_data);
72 end;
73 my_sim_data.rb_sim_data = model.original_rb_simulation(model, ...
74  my_data.reduced_data);
75 
76 function my_sim_data = my_rb_reconstruction(model,detailed_data,my_sim_data)
77 my_sim_data.rb_sim_data = model.original_rb_reconstruction(...
78  model,detailed_data,my_sim_data.rb_sim_data);
79 
80 function reduced_data_subset = my_reduced_data_subset(model,my_data)
81 reduced_data_subset = my_data;
82 reduced_data_subset.reduced_data = ...
83  model.original_reduced_data_subset(model,my_data.reduced_data);
84 
85 function dofs = my_get_dofs_from_sim_data(my_sim_data,model);
86 dofs = model.original_get_dofs_from_sim_data(my_sim_data.sim_data)-...
87  model.original_get_dofs_from_sim_data(my_sim_data.rb_sim_data);
88 
89 function p = my_plot_sim_data(varargin);
90 %function p = my_plot_sim_data(model,model_data,my_sim_data,plot_params);
91 model = varargin{1};
92 sim_data = varargin{3}.sim_data;
93 dofs_detailed = model.original_get_dofs_from_sim_data(sim_data);
94 dofs_reduced = model.original_get_dofs_from_sim_data(varargin{3}.rb_sim_data);
95 sim_data = model.set_dofs_in_sim_data(sim_data,...
96  dofs_detailed-dofs_reduced);
97 tlist = varargin;
98 tlist{3} = sim_data;
99 p = model.original_plot_sim_data(tlist{:});
100 
101 
102 
103 
104 
105 
106 
107 
function demo_rb_error_gui(varargin)
demo gui for detailed simulations and reduced simulation and plotting the error
function demo_rb_gui(varargin)
reduced basis demo with sliders
Definition: demo_rb_gui.m:17
function model = thermalblock_model_struct(params)
Thermal Block example similar as described in the book of A.T. patera and G. Rozza (just one paramete...