rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fem_h10_boundary_inner_product_matrix.m
Go to the documentation of this file.
1 function G = fem_h10_boundary_inner_product_matrix(df_info, ...
2  elind,edgeind)
3 % function G =
4 % fem_h10_boundary_inner_product_matrix(df_info,elind,edgeind)
5 %
6 % function computing the matrix of the h10 inner product on the
7 % boundary specified through elind and edgeind. elind and edgeind
8 % have to be vectors of the same length.
9 %
10 % Return values:
11 % G: ndofs x ndofs matrix with nonzero entries only for those
12 % dofs, who lie on the specified boundary.
13 
14 % I. Maier, 19.07.2011
15 
16 qdeg = 2*df_info.pdeg;
17 ndofs = df_info.ndofs;
18 nlagrange_nodes = df_info.nlagrange_nodes;
19 
20 j = sub2ind(size(df_info.grid.EL),elind,edgeind);
21 EL = df_info.grid.EL(j);
22 
23 G = spalloc(ndofs,ndofs,1);
24 for i = 1:nlagrange_nodes
25  for j = 1:nlagrange_nodes
26 
27  f = @(x) G_int_kernel(x,df_info,i,j,elind,edgeind);
28  res = intervalquadrature(qdeg,f);
29  res = res .* EL;
30 
31  gids_i = df_info.global_dof_index(elind,i);
32  gids_j = df_info.global_dof_index(elind,j);
33 
34  G_tmp = sparse(gids_i,gids_j,res,ndofs,ndofs);
35  G = G + G_tmp;
36  end;
37 end;
38 
39 function res = G_int_kernel(x,df_info,i,j,elind,edgeind)
40 % function res = G_int_kernel(x,df_info,i,j,elind,edgeind)
41 
42 res = zeros(0,1);
43 for local_edge_id = 1:3
44  lcoord = llocal2local(df_info.grid,local_edge_id,x);
45  hat_phi_i = fem_evaluate_scalar_basis_function_derivative(df_info,lcoord,i);
46  hat_phi_j = fem_evaluate_scalar_basis_function_derivative(df_info,lcoord,j);
47  inds = find(edgeind == local_edge_id);
48  switch (local_edge_id)
49  case 1
50  res = [res; ones(size(inds)) * hat_phi_i(1) * hat_phi_j(1)];
51  case 3
52  res = [res; ones(size(inds)) * hat_phi_i(2) * hat_phi_j(2)];
53  case 2
54  res = [res; ones(size(inds)) * (hat_phi_i(2)-hat_phi_i(1)) * ...
55  (hat_phi_j(2) - hat_phi_j(1))];
56  otherwise
57  end;
58 end;
function res = intervalquadrature(poldeg, func, varargin)
integration of function func over reference interval == unit interval. by Gaussian quadrature exactly...
function G = fem_h10_boundary_inner_product_matrix(df_info, elind, edgeind)
fem_h10_boundary_inner_product_matrix(df_info,elind,edgeind)