rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
RB_extension_PCA_fixspace_flexible.m
Go to the documentation of this file.
1 function [RBext, dummy] = RB_extension_PCA_fixspace_flexible(model, ...
2  detailed_data)
3 %function [RBext, dummy] = RB_extension_PCA_fixspace_flexible(model, ...
4 % detailed_data)
5 % function computing a RB basis extension for given parameters by
6 % the POD-Greedy algorithm.
7 %
8 % The choice is made by complete time simulation for the current parameter `mu`
9 % set via last call to set_mu() and taking the principal component of PCA
10 % keeping the RB as fixspace. This single vector is orthonormalized with
11 % respect to RB and returned in RBext.
12 %
13 % Return argument dummy is a superfluous argument not used in this routine, but
14 % necessary for a uniform argument list compatible with other extension
15 % algorithms.
16 %
17 % required fields of model:
18 % mu_names : cell array of names of the parameter-vector
19 % entries
20 % nr_extension_modes : the number of the return basis vectors
21 % return values:
22 % RBext : the new reduced basis vectors meant for extension of the current
23 % reduced basis space
24 % dummy : dummy variable making argument list compatible with other extenstion
25 % algorithms.
26 %
27 
28 % Bernard Haasdonk 14.10.2005
29 
30 dummy = [];
31 
32 % cache detailed simulation
33 % sim_data = cached_detailed_simulation(model,detailed_data,sim_params);
34 %model_data.grid = detailed_data.grid;
35 %model_data.W = detailed_data.W;
36 
37 %tmp_params.mu = sim_params.mu;
38 %model = model.set_mu(model,mu);
39 % use detailed_data as model_data here
40 
41 % take care, that the arguments do not change throughout parameter variation!
42 % detailed_data: RB_info, V, W
43 % model: N, Nmax, base_model
44 
45 
46 % take care to remove some changed fields from model and detailed
47 % data, such that filecaching works!!! in RB_extension_algorithm
48 % !!!
49 tmp_model = model;
50 ifm = model.filecache_ignore_fields_in_model;
51 for i = 1:length(model.filecache_ignore_fields_in_model);
52  if isfield(model,ifm{i})
53  tmp_model = rmfield(tmp_model,ifm{i});
54  end;
55 end;
56 ifm = model.filecache_ignore_fields_in_detailed_data;
57 dim_RB = size(model.get_rb_from_detailed_data(detailed_data));
58 tmp_detailed_data = ...
59  model.set_rb_in_detailed_data(detailed_data, zeros(dim_RB(1),0));
60 for i = 1:length(model.filecache_ignore_fields_in_detailed_data);
61  if isfield(detailed_data,ifm{i})
62  tmp_detailed_data = rmfield(tmp_detailed_data,ifm{i});
63  end;
64 end;
65 
66 sim_data = filecache_function(@detailed_simulation,tmp_model, ...
67  tmp_detailed_data);
68 
69 U = model.get_dofs_from_sim_data(sim_data);
70 
71 % select vectors for extension
72 %keyboard;
73 RBextall = PCA_fixspace(U,...
74  model.get_rb_from_detailed_data(detailed_data), ...
75  model.get_inner_product_matrix(detailed_data), ...
76  model.nr_extension_modes);
77 
78 if ~isempty(RBextall)
79  RBext = RBextall(:, 1:model.nr_extension_modes);
80 else
81  disp('warning: did not find basis extension in PCA_fixspace!!!');
82  RBext = [];
83 end;
84 
85 %disp('check new basis-vector!!')
86 %keyboard;
87 
function varargout = filecache_function(funcptr, varargin)
function used for file-caching other function calls.
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1
function [ RBext , dummy ] = RB_extension_PCA_fixspace_flexible(model, detailed_data)
function computing a RB basis extension for given parameters by the POD-Greedy algorithm.