rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
basisgen_fixed.m
1 function detailed_data = basisgen_fixed(model,detailed_data)
2 %function detailed_data = basisgen_fixed(model,detailed_data)
3 %
4 % script demonstrating the generation of a reduced basis with
5 % a fixed training set approach.
6 %
7 % RB is started with initial data by varying all parameters over M_train.
8 % The basis is extended by searching for the vector in the training set
9 % Mu_train with the maximum posterior error estimator or true error, for
10 % this mu a single vector is chosen for basisextension.
11 % The resulting reduced basis vectors are returned in RB which is a
12 % matrix of columnwise reduced basis vector-DOFS
13 % The algorithm supports restart, i.e. continuing of prescribed
14 % initial basis RB.
15 %
16 % outputs of detailed_data:
17 % RB,V,W etc. : collection of orthonormal reduced basis DOF
18 % vectors
19 % RB_info: datastructure with basis-generation
20 % information, see RB_greedy_extension for details
21 %
22 % required fields of detailed_data:
23 % RB_info.M_train : matrix with columnwise parameter
24 % vectors to use in greedy search
25 % grid : numerical grid, is constructed if not existent.
26 %
27 % required fields of model and detailed_data such that a reduced basis
28 % simulation can be performed and RB_greedy_extension can be performed.
29 
30 % Bernard Haasdonk 27.3.2007
31 
32 % We assume, that detailed_data is reasonably filled, e.g. contains
33 % the grid.
34 %
35 % generate grid
36 %if ~isfield(detailed_data,'grid') || isempty(detailed_data.grid)
37 % detailed_data.grid = construct_grid(model);
38 %end;
39 
40 %%%%%%%%%%%%%%% specific settings for fixed algorithm
41 
42 if (model.get_rb_size(model,detailed_data)==0)
43  % generate RBstart: all initial data constellations
44  RB = model.rb_init_data_basis(model, detailed_data);
45  detailed_data = model.set_rb_in_detailed_data(detailed_data,RB);
46 % if (get_rb_size(detailed_data)==0) % check if reduced basis is empty
47 % detailed_data = model.RB_init_data_basis(model, detailed_data, ...
48 % detailed_data.RB_info.M_train);
49 end;
50 %prepare model
51 %model.Nmax = size(detailed_data.RB,2);
52 
53 disp('Starting RB extension loop');
54 
55 % start time measurement
56 tic;
57 start_time_basisgen_fixed = tic;
58 
59 % extend basis
60 detailed_data = RB_greedy_extension(model, ...
61  detailed_data);
62 
63 disp(['Generated RB basis on fixed M_train with ',...
64  num2str(model.get_rb_size(model,detailed_data)), ...
65  ' basis vectors.']);
66 t = toc(start_time_basisgen_fixed);
67 disp(['Runtime = ',num2str(t)]);
68 
69 
70 
71 
72 %| \docupdate
function [ detailed_data , reduced_data ] = RB_greedy_extension(model, detailed_data)
function performing a greedy search loop for reduced basis generation.