-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathAssembleLuvhSSTREAM.m
70 lines (50 loc) · 1.18 KB
/
AssembleLuvhSSTREAM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function [L,cuvh,luvh]=AssembleLuvhSSTREAM(CtrlVar,MUA,BCs,l)
MLC=BCs2MLC(CtrlVar,MUA,BCs);
Luv=MLC.ubvbL;
cuv=MLC.ubvbRhs;
Lh=MLC.hL;
ch=MLC.hRhs;
% Luv : #uv constrains x 2MUA.Nnodes
% Lh : #h constrains x MUA.Nnodes
% L=[Luv 0]
% [0 Lh]
[nu,~]=size(Luv) ;
[nh,~]=size(Lh) ;
if CtrlVar.LinFEbasis
% L M L' L
%
% L -> L M
% c -> L M L' c
if ~isfield(MUA,'M')
MUA.M=MassMatrix2D1dof(MUA);
end
Mblock=MassMatrixBlockDiagonal2D(MUA);
if numel(Luv)>0
Luv=Luv*Mblock ;
end
if numel(Lh)>0
Lh=Lh*MUA.M ;
end
if numel(cuv)>0
cuv=(Luv*Mblock*Luv')*cuv ;
end
if numel(ch)>0
ch=(Lh*MUA.M*Lh')*ch ;
end
end
if isempty(Lh) && ~isempty(Luv)
L=[Luv sparse(nu,MUA.Nnodes)] ;
cuvh=cuv ;
luvh=l.ubvb;
elseif ~isempty(Lh) && isempty(Luv)
L=[sparse(nh,2*MUA.Nnodes) Lh] ;
cuvh=ch ;
luvh=l.h;
elseif ~isempty(Lh) && ~isempty(Luv)
L=[ Luv sparse(nu,MUA.Nnodes) ; sparse(nh,2*MUA.Nnodes) Lh];
cuvh=[cuv;ch];
luvh=[l.ubvb;l.h];
else
L=[] ; cuvh=[] ; luvh=[];
end
end