rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
ldg_numerical_flux_operator_fct.m
1 function L = ldg_numerical_flux_operator_fct(lcoord,grid,params)
2 %function L = ldg_analytical_flux_operator_fct(lcoord,grid,params)
3 %
4 % function returning the integrand of the analytical flux integral
5 % evaluated in local coordinates lcoord.
6 %
7 % in 'components' mode, a 4 dimensional dense matrix is generated
8 % L(i,j,e,q) = v^q (lcoord) * JIT* grad phi_e_i(lcoord) phi_e_j (lcoord)
9 % * |Det(DF)|
10 % i.e. i and j local base function indices, e the element index and
11 % q the component number.
12 %
13 % in 'complete' mode, the above Q = Q_v components are weighted
14 % with Theta_v^q(mu), i.e. identical coefficients as velocity.
15 % result is a 3 dimensional matrix
16 % L(i,j,e) = v (lcoord) * JIT* grad phi_e_i(lcoord) phi_e_j (lcoord)
17 % * |Det(DF)|
18 %
19 % triaquad of this function should give the desired result used in
20 % ldg_operaotors_adv_explicit
21 
22 % Bernard Haasdonk 31.8.2009
23 
24 disp('to be adjusted!!');
25 keyboard;
26 
27 decomp_mode = params.decomp_mode;
28 
29 if params.dimrange~=1
30  error('currently only scalar valued implementation supported');
31 end;
32 if (decomp_mode == 2)
33  L = params.velocity_coefficients_fct(params);
34 else
35  % evaluate reference basis in lcoord
36  Phi_hats = ldg_evaluate_basis(lcoord,params);
37  nbasefct = size(Phi_hats,2);
38  nelements = grid.nelements;
39  Phi_hats_derivative = ldg_evaluate_basis_derivative(lcoord,params);
40  % extrude Phi_hats_derivative to all elements
41  Phi_hats_derivative = reshape([Phi_hats_derivative{:}],2, ...
42  nbasefct);
43  Phi_hats_derivative = repmat(Phi_hats_derivative,1,grid.nelements);
44  JIT = repmat(grid.JIT(:)',nbasefct,1);
45  JIT = reshape(JIT,nbasefct*nelements,2,2);
46 
47  % multiply Phi_hats_derivative with JIT (JacobianInverseTransposed)
48  Phi_derivative_x = JIT(:,1,1)*Phi_hats_derivative(1,:) ...
49  + JIT(:,1,2)*Phi_hats_derivative(2,:);
50  Phi_derivative_y = JIT(:,2,1)*Phi_hats_derivative(1,:) ...
51  + JIT(:,2,2)*Phi_hats_derivative(2,:);
52  Phi_derivative = [Phi_derivative_x; Phi_derivative_y];
53 
54  % evaluate velocity in lcoord
55  v = params.velocity_ptr(...
56  local2global(grid,1:grid.nelements,lcoord,params), params);
57 
58  if (decomp_mode == 1)
59  Q_v = length(v);
60  L = zeros(nbasefct, nbasefct, nelements, Q_v);
61  for q=1:Q_v
62  % extrude v_q, such that simple componentwise multiplication
63  % with others is possible
64  vq = repmat(v{q}(:),1,nbasefct);
65  vq = reshape(vq,2,nbasefct*nelements);
66  % sort results into L: First v * grad Phi_e_i in identical columns
67  L0 = v(1,:).*Phi_derivative(1,:)+ v(2,:).*Phi_derivative(2,:);
68  L0 = reshape(L0,[nbasefct,1,nelements]);
69  Lq = repmat(L0,1,nbasefct,1);
70  % then multiply with phi_e_j
71  for j = 1: nbasefct
72  L(:,j,:,q) = Lq(:,j,:).*Phi_hats(:,j);
73  end;
74  end;
75 
76  else % decomp_mode = 0 === "complete"
77 
78  % extrude v_q, such that simple componentwise multiplication
79  % with others is possible
80  v = repmat(v(:),1,nbasefct);
81  v = reshape(v,2,nbasefct*nelements);
82  % sort results into L: First v * grad Phi_e_i in identical columns
83  L0 = v(1,:).*Phi_derivative(1,:)+ v(2,:).*Phi_derivative(2,:);
84  L0 = reshape(L0,[nbasefct,1,nelements]);
85  L = repmat(L0,1,nbasefct,1);
86  % then multiply with phi_e_j
87  for j = 1: nbasefct
88  L(:,j,:) = L(:,j,:).*Phi_hats(:,j);
89  end;
90 
91  end;
92 end;%| \docupdate
nelements
number of overall elements (leaf + nonleaf)
Definition: gridbase.m:30
JIT
Jacobian inverse transposed JIT(i,:,:) is a 2x2-matrix of the Jacobian Inverse Transposed on element ...
Definition: gridbase.m:248