1 % script constructing a reduced basis space
3 % required variables that need to be
set:
7 % optional variables that can be set:
8 % - 'detailedfname': filename of MAT-file where the computed
9 % 'detailed_data' structure is stored. If this
10 % variable is empty, it is set to
11 % '[model.name, infix, '_detailed_interpol.mat'],
12 % where 'infix' is set to either 'model.model_type'
13 % if existent or the empty string.
15 % generated variables:
16 % - 'detailed_data': structure containing the reduced basis space and
17 % information on its construction process.
20 disp('constructing reduced bases')
21 %tmp = load(fullfile(rbmatlabresult,CRBfname));
22 %detailed_data = tmp.detailed_data;
24 %
if structcmp(model, tmp.model) ~= 1
25 % warning(
'model has changed since crb basis generation.');
29 detailed_data.W = model_data.W;
30 if ~isfield(params,
'Mstrich')
33 if params.Mstrich == 0
34 model.enable_error_estimator = 0;
38 if ~isfield(params,'M')
39 model.M = cellfun(@(x)(size(x,2) - model.Mstrich), detailed_data.BM, 'UniformOutput', true) ...
44 model.Mstrich = params.Mstrich;
50 detailed_data.RB_info.elapsed_time = t;
51 if isempty(detailedfname)
52 if isfield(model, 'model_type')
53 infix = model.model_type;
57 detailedfname = [model.name, infix, '_detailed.mat'];
59 save(fullfile(rbmatlabresult,detailedfname),...
60 'detailed_data','model','plot_params');
62 plot(detailed_data.RB_info.max_err_sequence);
63 set(gca,'Yscale','log');
64 title('RB-generation error convergence');