rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
nonlin_evol_plot_detailed_data.m
Go to the documentation of this file.
1 function h=nonlin_evol_plot_detailed_data(model, detailed_data, plot_params)
2 %function h=nonlin_evol_plot_detailed_data(model, detailed_data, plot_params)
3 % plot the reduced basis, the colateral reduced basis, the interpolation
4 % points and the maximum error decrease during CRB generation.
5 %
6 % return values:
7 % h : figure handle of plot
8 
9 % Bernard Haasdonk 23.5.2007
10 
11 %plot_RB_sequence(detailed_data,model);
12 
13 
14 
15 if ~isfield(plot_params,'plot')
16  plot_params.plot = model.plot;
17 end;
18 
19 if isfield(detailed_data,'RB') && ~isempty(detailed_data.RB)
20  tpp = plot_params;
21  tpp.clim = [];
22  tpp.title = 'Orthonormal reduced basis';
23  tpp = rmfield(tpp, 'clim');
24  tpp.clim_tight = 1;
25  plot_sequence(detailed_data.RB, detailed_data.grid, tpp);
26 else
27  disp('warning: no RB in detailed data!! not suitable for simulation yet!');
28 end;
29 
30 if isfield(detailed_data, 'QM')
31 
32 num_interpolations = min(3,length(detailed_data.QM));
33 
34 for i = 1:num_interpolations
35  tpp = plot_params;
36  tpp.title = ['Interpolation basis functions q_m for operator no. ', ...
37  num2str(i)];
38  tpp.clim = [];
39  tpp = rmfield(tpp, 'clim');
40  tpp.clim_tight = 1;
41  plot_sequence(detailed_data.QM{i}, detailed_data.grid, tpp);
42  figure;
43 end
44 
45 disp(['Interpolation matrices B should have lower-triangular structure,' ...
46  'one-diagonal:']);
47 for i = 1:num_interpolations
48  BM_n = length(detailed_data.BM{i});
49  mask_upper_triangular_block = repmat(1:BM_n,BM_n,1)>repmat((1:BM_n)',1,BM_n);
50  if(all(abs(detailed_data.BM{i}(mask_upper_triangular_block)) < 10000*eps))
51  disp([num2str(i), 'th matrix B fulfills the condition']);
52  else
53  if model.debug
54  disp('The following matrix is not of lower-triangular form');
55  pause
56  disp(detailed_data.BM{i});
57  end
58  end
59 end
60 
61 for i = 1:num_interpolations
62  u = zeros(detailed_data.grid.nelements,1);
63  u(detailed_data.TM{i}) = 1;
64  plot_params.plot(detailed_data.grid, u, plot_params);
65  title(['Interpolation points/DOFS for operator no.', num2str(i)]);
66 
67  figure;
68 end
69 
70 % plot selected snaphots (mu_1, mu_2, t^k) in a 3d plot in case of 2d parameter
71 % space
72 if length(model.mu_names)==2
73  for i = 1:num_interpolations
74  Msize = size(detailed_data.QM{i},2);
75  colorm = colormap(hot(Msize));
76  colorm = colorm(Msize:-1:1,:);
77  coord = [detailed_data.ei_info{i}.extension_mus(:,1:Msize); ...
78  detailed_data.ei_info{i}.extension_filepos(1:Msize)'];
79  scatter3(coord(1,:),coord(2,:),coord(3,:),20,colorm,'filled');
80  xlabel(['\mu_1 = ',model.mu_names{1}]);
81  ylabel(['\mu_2 = ',model.mu_names{2}]);
82  %ylabel(['\mu_2 = c_{init}']);%,model.mu_names{2}]);
83  zlabel('time index k');
84  title(['snapshots selected for collateral basis for operator no.', num2str(i)])
85  set(gca,'Box','on');
86  figure;
87  end
88 else
89  disp('skipped plot of ei-snapshot-distribution, dimension of mu not 2');
90 end;
91 
92 h=[];
93 for i = 1:num_interpolations
94  h=plot(detailed_data.ei_info{i}.max_err_sequence);
95  set(gca,'Yscale','log');
96  title(['EI-interpol error decrease for operator no.', num2str(i)]);
97  if i < num_interpolations
98  figure;
99  end
100 end
101 
102 end
function h = nonlin_evol_plot_detailed_data(model, detailed_data, plot_params)
plot the reduced basis, the colateral reduced basis, the interpolation points and the maximum error d...
function p = plot_sequence(varargin)
plotting a sequence of data slices on polygonal 2d grid (constructed from params if empty) and provid...
Definition: plot_sequence.m:17