rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
fem_matrix_robin_integral_kernel.m
1 function res = fem_matrix_robin_integral_kernel(x,model,df_info,i,j,robin_elind,robin_edgeind)
2 %function res = fem_matrix_robin_integral_kernel(x,model,df_info,i,j,robin_elind,robin_edgeind)
3 %
4 % auxiliary function for integral kernel for A_robin
5 % integral kernel on all robin-edges simultaneously
6 % here x is a scalar value on unit interval
7 % f(x) = (alpha/beta + b^T n) hatphi_i hatphi_j
8 % multiplication with |edge| is realized in caller after
9 % quadrature.
10 % This function can handle cell-array valued data
11 
12 % B. Haasdonk 22.2.2011
13 % I. Maier 24.03.2011
14 
15 res = zeros(0,1);
16 grid = df_info.grid;
17 for local_edge_id = 1:3
18  lcoord = llocal2local(grid,local_edge_id,x); % local coord for x on edge 1
19  hat_phi_i = fem_evaluate_basis_function(df_info,lcoord,i);
20  hat_phi_j = fem_evaluate_basis_function(df_info,lcoord,j);
21  inds = find(robin_edgeind==local_edge_id);
22  elinds = robin_elind(inds);
23  b = model.velocity(grid,elinds,lcoord,model); % local model!
24 
25  if ~iscell(b)
26  res = [res; ( (model.robin_beta(grid,elinds,local_edge_id,x, ...
27  model).^(-1)) .* ...
28  model.robin_alpha(grid,elinds,local_edge_id,x, ...
29  model) ...
30  + b(:,1) .* grid.NX(elinds,local_edge_id) ...
31  + b(:,2) .* grid.NY(elinds,local_edge_id) ...
32  ) * hat_phi_i * hat_phi_j ]; % local model!
33  else % iscell => components mode
34 
35  % number of components = 1+ Q_velocity y
36  if ~iscell(res)
37  res = cell(1,length(b)+1);
38  for q = 1:length(b)+1
39  res{q} = zeros(0,1);
40  end;
41  end;
42  res{1} = [res{1}; ...
43  ( (model.robin_beta(grid,elinds,local_edge_id,x, ...
44  model).^(-1)) .* ...
45  model.robin_alpha(grid,elinds,local_edge_id,x, ...
46  model) ...
47  ) * hat_phi_i * hat_phi_j ]; % local model!
48  for q = 1:length(b)
49  res{q+1} = [res{q+1};...
50  ( b{q}(:,1).*grid.NX(elinds,local_edge_id) ...
51  + b{q}(:,2).*grid.NY(elinds,local_edge_id) ...
52  ) * hat_phi_i * hat_phi_j; ...
53  ];
54  end;
55 % keyboard;
56 
57  end;
58 end;