rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
t_part_model.m
1 function t_model = t_part_model(model, params)
2 %function t_model = t_part_model(model, params)
3 %
4 % model for t-partition inheriting infos from base_model
5 % In this model layer the repartition of the time domain is fixed.
6 %
7 % The implementation of the evolution scheme must accept fields
8 % model.starting_time_step and model.stopping_time_step to enable
9 % simulations restrained to specigfic partitions.
10 %
11 % The field 'basis_vector_overlap' fixes how many
12 % POD-Vectors/overlap-vectors are used for the initial basis in the
13 % following partition.
14 % The field 't_part_rb_generation_cut_error' should be set to 1. It fixes
15 % that only the error produced in the actual partition is regarded during
16 % the basis generation process.
17 %
18 %
19 % Optional fields of params:
20 % transisition_model: if this flag is set, then the projection between
21 % the reduced spaces is replaced by a transition
22 % phase (including projeciton in evolution
23 % step)(automatic creation only implemented for first
24 % order time integration)
25 % no_middle_point_bisection: if flag is set to one, the bisection is
26 % done, where half the error is reached.
27 %
28 % t_part_rb_generation_mode: 'fixed' or 'adaptive_error_restriction'
29 %
30 % Generated fields of t_model:
31 % t_part_range: cell-array giving the first and the last time step index in
32 % the respective time domain
33 % t_part_transition_range: cell-array giving the first and the last
34 % time step index of the transisiotn range
35 % between t-domains. (In Euler-time
36 % integrations the length of this range is
37 % 1.)
38 %
39 %
40 % Markus Dihlmann 11.02.11
41 %
42 
43 transition_model =0;
44 
45 if nargin>1
46  if isfield(params,'transition_model')
47  if params.transition_model
48  transition_model =1;
49  end
50  end
51 end
52 
53 %copy basically all information from the base model in the t-model (for
54 %basis generation this info is neccessary.)
55 t_model = model;
56 
57 t_model.t_part_middle_point_bisection=1;
58 
59 if nargin ==1
60  params=[];
61 end
62 
63 if isfield(params,'no_middle_point_bisection')
64  if params.no_middle_point_bisection
65  t_model.t_part_middle_point_bisection=0;
66  end
67 end
68 
69 if isfield(params,'t_part_rb_generation_mode')
70  t_model.t_part_rb_generation_mode = params.t_part_rb_generation_mode;
71 else
72  t_model.t_part_rb_generation_mode='adaptive_error_restriction';
73 end
74 
75 %copy basically all information from the base model in the t-model (for
76 %basis generation this info is neccessary.)
77 t_model = model;
78 
79 t_model.base_model = model;
80 t_model.transition_model = transition_model;
81 %t_model.model_type = 't-part model';
82 
83 %copy time information from model
84 %t_model.T = model.T;
85 %t_model.nt = model.nt;
86 %t_model.dt = model.dt;
87 %t_model.base_model.save_time_indices = 0:model.nt;
88 %t_model.mu_names = model.mu_names;
89 %t_model.mu_ranges = model.mu_ranges;
90 
91 t_model.set_mu=@set_mu_in_model_and_base_model;
92 
93 %Time domain information
94 %-----------------------
95 %
96 if (nargin==1)||(~isfield(params,'t_part_range'))
97  %initial t_part_model with only one time domain
98  t_model.t_part_range{1} = [0,t_model.nt];
99 else
100  %taking repartition of time domain from params
101  t_part_range = params.t_part_range;
102  t_model.t_part_range = t_part_range;
103  %fixing transisiton ranges (ranges between time domains)
104  if ~isfield(params,'t_part_transition_range')&&(length(t_part_range)>1)
105  if transition_model
106  %t_model.rb_operators = @rb_operators_t_part;
107  for i=2:(length(t_part_range))
108  %t_model.t_part_range{i} = [t_part_range{i}(1)+1,t_part_range{i}(2)];
109  t_model.t_part_transition_range{i-1} = [t_part_range{i-1}(2), t_part_range{i}(1)+1];
110  end
111  end
112  else
113  if transition_model
114  t_model.t_part_transition_range=params.t_part_transition_range;
115  end
116  end
117 end
118 
119 
120 
121 
122 % main function pointers
123 t_model.gen_model_data = @t_part_gen_model_data;
124 t_model.detailed_simulation = @t_part_detailed_simulation;
125 t_model.gen_reduced_data = @t_part_gen_reduced_data;
126 t_model.rb_simulation = @t_part_rb_simulation;
127 t_model.rb_reconstruction = @t_part_rb_reconstruction;
128 t_model.plot_sim_data = model.plot_sim_data;
129 t_model.gen_detailed_data = @t_part_gen_detailed_data;
130 
131 
132 %RB_generation fields
133 %t_model.t_part_rb_generation_mode = 'fixed'; %'adaptive'
134 t_model.t_part_rb_generation_cut_error = 1; %if set, only the error produced in the actual partition is used in greedy algorithm
135 t_model.basis_vector_overlap = 5; %how many basis vectors are used from the foregoing t-part RB as initial basis in the next
136 t_model.reduced_data_subset = @t_part_reduced_data_subset;@(model, reduced_data)reduced_data; %evtl. replace?!?
137 t_model.get_estimator_from_sim_data = model.get_estimator_from_sim_data;
138 t_model.RB_stop_epsilon_global = model.RB_stop_epsilon;
139 t_model.t_part_middle_point_bisection=1;
function reduced_data_sub = t_part_reduced_data_subset(model, reduced_data)
reduced_data)
function sim_data = t_part_rb_reconstruction(model, detailed_data, sim_data)
sim_data)