rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fem_matrix_adv_integral_kernel.m
1 function res = fem_matrix_adv_integral_kernel(x,model,df_info,i,j)
2 % function res = fem_matrix_adv_integral_kernel(x,model,df_info,i,j)
3 %
4 % auxiliary function for integral kernel for A_adv
5 % integral kernel on all elements simultaneously
6 % here x is in reference triangle!
7 % f(x) = (hatphi_j) b^T * (JIT * grad hatphi_i)
8 % minus and multiplication with |det(DF)| is realized in caller
9 % after quadrature.
10 % function can integrate cell array valued functions
11 
12 % B. Haasdonk 22.2.2011
13 % I. Maier 24.03.2011
14 
15 gradient_hat_phi_i = fem_evaluate_scalar_basis_function_derivative(df_info,x,i)';
16 hat_phi_j = fem_evaluate_basis_function(df_info,x,j);
17 v = model.velocity(df_info.grid,1:df_info.grid.nelements,x,model);%local model!
18 JIT = df_info.grid.JIT;
19 
20 if ~iscell(v)
21  % the following is vectorial of size nelements!
22  res = hat_phi_j * ( v(:,1) .* (JIT(:,1,1) * gradient_hat_phi_i(1) ...
23  + JIT(:,1,2)* gradient_hat_phi_i(2)) ...
24  + v(:,2) .* (JIT(:,2,1) * gradient_hat_phi_i(1) ...
25  + JIT(:,2,2)* gradient_hat_phi_i(2)));
26 else
27  res = cell(1,length(v));
28  for q = 1:length(res)
29  res{q} = hat_phi_j * ( v{q}(:,1) .* (JIT(:,1,1) * gradient_hat_phi_i(1) ...
30  + JIT(:,1,2)* gradient_hat_phi_i(2)) ...
31  + v{q}(:,2) .* (JIT(:,2,1) * gradient_hat_phi_i(1) ...
32  + JIT(:,2,2)* gradient_hat_phi_i(2)));
33 
34  end;
35 end;