rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
porsche_operators_output.m
1 function out_func=porsche_operators_output(model,detailed_data)
2 %function out_func=porsche_operators_output(model,detailed_data)
3 %
4 % This function calculates the coefficients or components of the
5 % output_functional, i.e.
6 % \int_{\Omega_{front,ref}} v \times t dx for every snapshot( saved in
7 % detailed_data.RB)
8 %
9 % needed fields in detailed_data:
10 % front_ref_domain.grad_in_midpts_front: k-cell of n-by-2-matrices
11 % containing the gradients of the
12 % points on the front domain for
13 % all of the k snapshots
14 % front_ref_domain.tangent_front: n-by-2-matrix containing the
15 % tangent-vectors in the midpoints
16 % of the edges of the front part of the
17 % reference-car
18 % front_ref_domain.edge_length_front: n-vector containing the length of the
19 % edges of the front-domain of the
20 % reference-car
21 %
22 % Oliver Zeeb, 18.05.11
23 
24 switch model.decomp_mode
25  case 0
26  error(['for detailed simulation with computation of output functional please use line 27 '...
27  'in lin_stat_detailed_simuation.m instead of lines 29-30!'])
28 
29  case 1
30  for k=1:size(detailed_data.RB,2)
31  %getting the data from detailed_data
32  grad_in_mid_pts_front = detailed_data.front_ref_domain.grad_in_midpts_front{k};
33  tangent_front = detailed_data.front_ref_domain.tangent_front;
34  edge_length = detailed_data.front_ref_domain.edge_length_front;
35  %calculating the integrand
36  grad_phi_times_t = grad_in_mid_pts_front .* tangent_front;
37  grad_phi_times_t = grad_phi_times_t(:,1) + grad_phi_times_t(:,2);
38  %summing up all the integrands multiplied by edge-length
39  sum_x = grad_phi_times_t' * edge_length;
40  out_func{k}=sum_x;
41  end
42 
43  case 2
44  error('model.decomp_mode = 2 should not bee needed!');
45 
46  otherwise
47  error('wrong decomp_mode! porsche_operators_output_components is only usable with decomp_mode=1!');
48 end