1 function [RBext, dummy] = RB_extension_PCA_fixspace_flexible_hp(model, ...
3 %
function [RBext, dummy] = RB_extension_PCA_fixspace_flexible_hp(model, ...
6 % needed
for the hp algorithm
8 % change:
return a RB basis extension with nr_nodes basis vectors
9 % nr_nodes large enought to ensure POD error < error/(rho1*rho2)
11 %
function computing a RB basis extension
for given parameters by
12 % the POD-
Greedy algorithm.
14 % The choice is made by complete time simulation
for the current parameter `mu`
15 % set via last call to set_mu() and taking the principal component of PCA
16 % keeping the RB as fixspace. This single vector is orthonormalized with
17 % respect to RB and returned in RBext.
19 % Return argument dummy is a superfluous argument not used in
this routine, but
20 % necessary
for a uniform argument list compatible with other extension
23 % required fields of model:
24 % mu_names : cell array of names of the parameter-vector
28 % RBext : the
new reduced basis vector meant
for extension of the current
30 % dummy : dummy variable making argument list compatible with other extenstion
34 % original: Bernard Haasdonk 14.10.2005
35 % modified: David Kreplin, 12.04.2013
39 % cache detailed simulation
40 % sim_data = cached_detailed_simulation(model,detailed_data,sim_params);
41 %model_data.grid = detailed_data.grid;
42 %model_data.W = detailed_data.W;
44 %tmp_params.mu = sim_params.mu;
45 %model = model.set_mu(model,mu);
46 % use detailed_data as model_data here
48 % take care, that the arguments
do not change throughout parameter variation!
49 % detailed_data: RB_info, V, W
50 % model: N, Nmax, base_model
53 % take care to
remove some changed fields from model and detailed
54 % data, such that filecaching works!!! in RB_extension_algorithm
57 ifm = model.filecache_ignore_fields_in_model;
58 for i = 1:length(model.filecache_ignore_fields_in_model);
59 if isfield(model,ifm{i})
60 tmp_model = rmfield(tmp_model,ifm{i});
63 ifm = model.filecache_ignore_fields_in_detailed_data;
64 dim_RB = size(model.get_rb_from_detailed_data(detailed_data));
65 tmp_detailed_data = ...
66 model.set_rb_in_detailed_data(detailed_data, zeros(dim_RB(1),0));
67 for i = 1:length(model.filecache_ignore_fields_in_detailed_data);
68 if isfield(detailed_data,ifm{i})
69 tmp_detailed_data = rmfield(tmp_detailed_data,ifm{i});
76 U = model.get_dofs_from_sim_data(sim_data);
78 % select single vector
for extension
80 [RBextall,evalues] = PCA_fixspace_evalues(U,...
81 model.get_rb_from_detailed_data(detailed_data), ...
82 model.get_inner_product_matrix(detailed_data));%, ...
83 %model.nr_extension_modes);
86 % calculating the POD error:
87 error = sqrt(sum(evalues(2:end)));
88 % expand reduced basis until POD error < error/(roh1*roh2)
89 while error > model.error_tol1/(model.rho*model.rho_POD)
91 error = sqrt(sum(evalues(nr_nodes+1:end).^2));
95 RBext = RBextall(:, 1:nr_nodes);
97 disp('warning: did not find basis extension in PCA_fixspace!!!');
101 %disp('check new basis-vector!!')
function varargout = filecache_function(funcptr, varargin)
function used for file-caching other function calls.
Customizable implementation of an abstract greedy algorithm.
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.