rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
porsche_diffusivity_tensor_coefficients.m
1 function diff_tensor_coeff=porsche_diffusivity_tensor_coefficients(glob, params)
2 %function diff_tensor_coeff=porsche_diffusivity_tensor_coefficients(glob, params)
3 %
4 % function defining the diffusivity tensor coefficients of the porsche_model
5 %
6 % input:
7 % - params: model
8 % - glob: n points of the microgrid (n-by-2-matrix)
9 %
10 % output:
11 % diff_tensor_coeff = (number of macro triangles)-by-4 vector, defining the diffusivity-tensor-coefficients
12 % so the coefficients a(x) in the PDE -div( a(x) grad u(x) ) + ...
13 %
14 %
15 % for the notation of the variables in this function see also:
16 % "Reduced basis approximation and error bounds for potential
17 % flows in parametrized geometries"
18 % by Gianluigi Rozza
19 % MATHICSE Technical Report, Nr 11.2010, July 2010
20 %
21 % Oliver Zeeb, 06.05.11
22 
23  % get the affine transformatins for every makrotriangle:
24  % e.g. the transformation from reference to original domain.
25 
26  % macro points of the original domain:
27  pmacro_ref=params.pmacro; % macro points of the reference domain
28  pmacro_glob = params.pmacro; % macro points of the original/global domain
29  % first points in pmacro_glob are the car points, all the others are
30  % points on the rectangular, so only the first points have to be
31  % changed:
32 
33  %alt: 12.05.2011, gilt so nur, wenn alle 7 punkte des models als parameter geführt werden!
34 % for k=1:length(params.mu_names)/2
35 % x = getfield(params, params.mu_names{k});
36 % y = getfield(params, params.mu_names{k+length(params.mu_names)/2});
37 % pmacro_glob(k,:) = [x,y];
38 % end
39  %neu: 12.05.11: lese alle felder aus!
40  for k=1:params.nr_macro_car_points
41  x = getfield(params, ['x', num2str(k)]);
42  y = getfield(params, ['y', num2str(k)]);
43  pmacro_glob(k,:) = [x,y];
44  end;
45 
46  % get all the transformations of the macrotriangles to the
47  % reference-triangle, calculate the K-Matrices and add them to the
48  % coefficient-vector
49  K_o = eye(2);
50  q = 1; %iteration variable
51  diff_tensor_coeff = zeros(length(params.tmacro)*4,1);
52  for k=1:length(params.tmacro)
53  tria_pts_ref = pmacro_ref(params.tmacro(k,:),:);
54  tria_pts_glob = pmacro_glob(params.tmacro(k,:),:);
55  [C, G] = aff_trafo_coef(tria_pts_ref, tria_pts_glob);
56  det_G=det(G);
57  G_inv = inv(G);
58 
59  %define the K-matrices (see equation (6.22) )
60  % K_o,k = eyes for potential flow!
61  K=det_G*G_inv*K_o*G_inv';
62  for l=1:2
63  for m=1:2
64  diff_tensor_coeff(q) = K(m,l);
65  q=q+1;
66  end
67  end
68  end
69