1 function detailed_data = basisgen_fixed(model,detailed_data)
2 %
function detailed_data = basisgen_fixed(model,detailed_data)
4 % script demonstrating the generation of a reduced basis with
5 % a fixed training set approach.
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
16 % outputs of detailed_data:
17 % RB,V,W etc. : collection of orthonormal reduced basis DOF
19 % RB_info: datastructure with basis-generation
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.
27 % required fields of model and detailed_data such that a reduced basis
30 % Bernard Haasdonk 27.3.2007
32 % We assume, that detailed_data is reasonably filled, e.g. contains
36 %
if ~isfield(detailed_data,
'grid') || isempty(detailed_data.grid)
37 % detailed_data.grid = construct_grid(model);
40 %%%%%%%%%%%%%%% specific settings
for fixed algorithm
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);
51 %model.Nmax = size(detailed_data.RB,2);
53 disp(
'Starting RB extension loop');
55 % start time measurement
57 start_time_basisgen_fixed = tic;
63 disp([
'Generated RB basis on fixed M_train with ',...
64 num2str(model.get_rb_size(model,detailed_data)), ...
66 t = toc(start_time_basisgen_fixed);
67 disp([
'Runtime = ',num2str(t)]);
function [ detailed_data , reduced_data ] = RB_greedy_extension(model, detailed_data)
function performing a greedy search loop for reduced basis generation.