rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
ldg_edge_flux_operator_fct.m
1 function L = ldg_edge_flux_operator_fct(llcoord,grid,params)
2 %function L = ldg_edge_flux_operator_fct(llcoord,grid,params)
3 %
4 % function returning the integrand of the edge flux integral
5 % evaluated in 1D local coordinates llcoord along the reference
6 % interval
7 %
8 % in 'components' mode, a 5 dimensional dense matrix is generated
9 % L(i,j,e,f,q) = v^q (lcoord(e,f,llcoord)) * n_(e,f) *
10 % phi_e_i(lcoord(e,f,llcoord))
11 % phi_e_j (lcoord(e,f,llcoord))
12 % * |f|
13 % i.e. i and j local base function indices, e the element index, f
14 % the face/edge index and q the component number. n_(e,f) the outer
15 % normal of face f wrt element e, |f| the length of edge f and
16 % lcoord(e,f,llcoord) the 2d local coordinates of the point in the
17 % reference triangle.
18 %
19 % in 'complete' mode, the above Q = Q_v components are weighted
20 % with Theta_v^q(mu), i.e. identical coefficients as velocity.
21 % result is a 4 dimensional matrix
22 % L(i,j,e,f) = v (lcoord) * n_(e,f)* phi_e_i(lcoord) phi_e_j (lcoord)
23 % * |f|
24 %
25 % intervalquadrature of this function over the edges should give the
26 % desired result used in ldg_operaotors_adv_explicit
27 
28 % Bernard Haasdonk 31.8.2009
29 
30 disp(['to be adjusted!!! ']);
31 keyboard;
32 
33 decomp_mode = params.decomp_mode
34 
35 if params.dimrange~=1
36  error('currently only scalar valued implementation supported');
37 end;
38 if (decomp_mode == 2)
39  L = params.velocity_coefficients_fct(params);
40 else
41  % loop over edge types
42  %determine 2d lcoord for the 3 edge types
43  lcoords = llocal2local(grid,1:3,llcoord);
44 
45  if decomp_mode == 1
46  L = zeros(nbasefct, nbasefct, nelements, 3, Q_v);
47  else % complete
48  L = zeros(nbasefct, nbasefct, nelements, 3);
49  end;
50 
51  for f = 1:3
52  % evaluate reference basis in 3 lcoords
53  Phi_hats = ldg_evaluate_basis(lcoord(:,f),params);
54  nbasefct = size(Phi_hats,2);
55  nelements = grid.nelements;
56  % evaluate velocity in lcoord of all elements
57  v = params.velocity_ptr(...
58  local2global(grid,1:nelements,lcoords(:,f),params), params);
59 
60  if (decomp_mode == 1)
61 
62  % multiply with outer unit normal
63  Q_v = length(v);
64  for q=1:Q_v
65  vn = v{q}(1,:).*grid.NX(:,f) + v{q}(2,:).*grid.NY(:,f);
66  % expand vn{q} over i range and j range
67  vv = repmat(reshape(vn,[1,1,nelements]),[nbasefct,nbasefct,1]);
68  % expand phi_i over j range and vn range
69  pphi_i = repmat(reshape(Phi_hats),[nbasefunc,1,1],...
70  [1,nbasefunc,nelements]);
71  % expand phi_j over i range and vn range
72  pphi_j = repmat(reshape(Phi_hats),[1,nbasefunc,1],...
73  [nbasefunc,1,nelements]);
74  % multiply and distribute into output matrix
75  L(:,:,:,f,q) = reshape(vv.*pphi_i.*pphi_j,...
76  [numbasefct,numbasefct,nelements]);
77  end;
78 
79  else % decomp_mode = 0 === "complete"
80 
81  % multiply with outer unit normal
82  vn = v(1,:).*grid.NX(:,f) + v(2,:).*grid.NY(:,f);
83  % expand vn{q} over i range and j range
84  vv = repmat(reshape(vn,[1,1,nelements]),[nbasefct,nbasefct,1]);
85  % expand phi_i over j range and vn range
86  pphi_i = repmat(reshape(Phi_hats),[nbasefunc,1,1],...
87  [1,nbasefunc,nelements]);
88  % expand phi_j over i range and vn range
89  pphi_j = repmat(reshape(Phi_hats),[1,nbasefunc,1],...
90  [nbasefunc,1,nelements]);
91  % multiply and distribute into output matrix
92  L(:,:,:,f) = reshape(vv.*pphi_i.*pphi_j,...
93  [numbasefct,numbasefct,nelements]);
94 
95  end; % else
96  end; % for f=1:3 loop
97 
98 end;%| \docupdate
function res = intervalquadrature(poldeg, func, varargin)
integration of function func over reference interval == unit interval. by Gaussian quadrature exactly...
NY
NY(i,j) = y-coordinate of unit outer normal of edge from el i to NB j
Definition: gridbase.m:149
NX
NX(i,j) = x-coordinate of unit outer normal of edge from el i to NB j
Definition: gridbase.m:140