1 function L = ldg_edge_flux_operator_fct(llcoord,grid,params)
2 %
function L = ldg_edge_flux_operator_fct(llcoord,grid,params)
4 %
function returning the integrand of the edge flux integral
5 % evaluated in 1D local coordinates llcoord along the reference
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))
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
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)
26 % desired result used in ldg_operaotors_adv_explicit
28 % Bernard Haasdonk 31.8.2009
30 disp(['to be adjusted!!! ']);
33 decomp_mode = params.decomp_mode
36 error('currently only scalar valued implementation supported');
39 L = params.velocity_coefficients_fct(params);
41 % loop over edge types
42 %determine 2d lcoord for the 3 edge types
43 lcoords = llocal2local(grid,1:3,llcoord);
46 L = zeros(nbasefct, nbasefct, nelements, 3, Q_v);
48 L = zeros(nbasefct, nbasefct, nelements, 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);
62 % multiply with outer unit normal
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]);
79 else % decomp_mode = 0 ===
"complete"
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]);
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
NX
NX(i,j) = x-coordinate of unit outer normal of edge from el i to NB j