rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fem_matrix_neumann_integral_kernel.m
1 function res = fem_matrix_neumann_integral_kernel(x,model,df_info,i,j,neumann_elind,neumann_edgeind)
2 %function res = fem_matrix_neumann_integral_kernel(x,model,df_info,i,j,neumann_elind,neumann_edgeind)
3 %
4 % auxiliary function for integral kernel for A_neumann
5 % integral kernel on all neumann-edges simultaneously
6 % here x is a scalar value on unit interval
7 % f(x) = (b^T n) hatphi_i hatphi_j
8 % multiplication with |edge| is realized in caller after quadrature.
9 % function can handle cell-array valued data
10 
11 % B. Haasdonk 22.2.2011
12 % I. Maier 24.03.2011
13 
14 res = zeros(0,1);
15 for local_edge_id = 1:3
16  % transform 1d coordinate to 2d local coordinate
17  lcoord = llocal2local(df_info.grid,local_edge_id,x); % local coord for x on edge 1
18  hat_phi_i = fem_evaluate_basis_function(df_info,lcoord,i);
19  hat_phi_j = fem_evaluate_basis_function(df_info,lcoord,j);
20  inds = find(neumann_edgeind==local_edge_id);
21  b = model.velocity(df_info.grid,neumann_elind(inds),lcoord,model); % local model!
22  if ~iscell(b)
23  res = [res;...
24  ( b(:,1).*df_info.grid.NX(neumann_elind(inds),local_edge_id) ...
25  + b(:,2).*df_info.grid.NY(neumann_elind(inds),local_edge_id) ...
26  ) * hat_phi_i * hat_phi_j; ...
27  ];
28  else % iscell!!
29  if ~iscell(res)
30  res = cell(1,length(b));
31  for q = 1:length(b)
32  res{q} = zeros(0,1);
33  end;
34  end;
35  for q = 1:length(b)
36  res{q} = [res{q};...
37  ( b{q}(:,1).*df_info.grid.NX(neumann_elind(inds),local_edge_id) ...
38  + b{q}(:,2).*df_info.grid.NY(neumann_elind(inds),local_edge_id) ...
39  ) * hat_phi_i * hat_phi_j; ...
40  ];
41  end;
42 
43  end;
44 end;