rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
lin_evol_opt_output_time_independent.m
1 function [sim_data] = lin_evol_opt_output_time_independent(model,sim_data, varargin)
2 %function [sim_data] = lin_evol_opt_output_time_independent(model,sim_data, model_data)
3 %
4 % This function returns a non time dependent output defined in the model.
5 %
6 % It can be used for detailed and reduced models.
7 % Be sure that sim_data has the correct field names needed for the
8 % calculation of the functional.
9 %
10 % Required fields of sim_data (detailed):
11 % U: the solution trajectory
12 %
13 % Optional fields of sim_data:
14 % U_der: the derivative solution trajectory
15 %
16 
17 % Markus dihlmann 01.08.2012
18 
19 %check if detailed or reduced simulation data
20 
21 if isfield(model,'p_part_ranges')
22  %yes_p_part model
23  model = model.base_model;
24 end
25 
26 
27 if isfield(varargin{1},'grid')
28  %--> model_data
29  model_data = varargin{1};
30  U = sim_data.U;
31 
32  model.decomp_mode=1;
33  v = model.operators_output(model,model_data);
34  sim_data.y = (v{1}') * U;
35  sim_data.y_der=[];
36  if model.compute_derivative_info
37  U_der = sim_data.U_der;
38  for i = 1:length(U_der)
39 
40  sim_data.y_der(i,:) = (v{1}')*U_der{i};
41 
42  end
43  end
44 
45 else
46  %--> reduced_data
47  reduced_data = varargin{1};
48  a = sim_data.a;
49  sim_data.s = reduced_data.s_RB'*a;
50  if isfield(model,'s_l2norm')
51  Delta_s = model.s_l2norm * sim_data.Delta; %war ursprünglich in reduced_data.s_l2norm
52  sim_data.Delta_s = Delta_s;
53  else
54  if (model.verbose >=5)
55  disp('warning: no L2_norm for output defined in lin_evol_rb_simulation...')
56  end
57  end
58 
59 
60  if model.compute_derivative_info
61  %derivative output and error estimation of gradient
62  %sum=0;%for l2-norm
63  c = sim_data.c;
64  for i=1:length(c)
65  %s_der{i} = reduced_data.s_RB'*c(:,:,i);
66  s_der{i} = reduced_data.s_RB_der{i}'*c{i};
67  %sum = sum + max(Delta_der(i,:))^2;
68  end
69  sim_data.s_der = s_der;
70  sim_data.Delta_s_grad = model.s_l2norm .*max(sim_data.Delta_der,[],2); %Gradient error bound
71  %simulation_data.Delta_s_der = model.s_l2norm * Delta_der;
72  end
73 
74 
75 end