-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_lagrange_multiplier_stancil_weak_sum.m
66 lines (52 loc) · 1.81 KB
/
get_lagrange_multiplier_stancil_weak_sum.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
function LM_stancil = get_lagrange_multiplier_stancil_weak_sum(TR,cell,X_all,cells_sum)
%GET_LAGRANGE_MULTIPLIER_STANCIL Summary of this function goes here
% return the stancil for the lagrange multiplier at point X
LM_stancil=zeros(1,length(TR.points));
line=find(cells_sum.index==cell);
if isempty(line)
error('the cell does not containt immersed boundary point')
end
constant_factor=1;
epsilone=0.00001;
order=02;
for i=1:length(cells_sum.boundary{line})
X=X_all(cells_sum.boundary{line}(i),:);
dx=X(1)-TR.points(TR.connect(cell,1),1);
dy=X(2)-TR.points(TR.connect(cell,1),2);
hx=TR.points(TR.connect(cell,2),1)-TR.points(TR.connect(cell,1),1);
hy=TR.points(TR.connect(cell,4),2)-TR.points(TR.connect(cell,1),2);
%u0
LM_stancil(TR.connect(cell,1))=LM_stancil(TR.connect(cell,1))+(dy/hy-1)*dx/hx-(dy/hy)+1;
%u1
LM_stancil(TR.connect(cell,2))=LM_stancil(TR.connect(cell,2))+(-dy/hy+1)*dx/hx;
%u2
LM_stancil(TR.connect(cell,3))=LM_stancil(TR.connect(cell,3))+dy/hy*dx/hx;
%u3
LM_stancil(TR.connect(cell,4))=LM_stancil(TR.connect(cell,4))+dy/hy*(-dx/hx+1);
%
% l1=((dx/hx)^2+(dy/hy)^2)^(order/2)+epsilone;
% l2=((1-dx/hx)^2+(dy/hy)^2)^(order/2)+epsilone;
% l3=((1-dx/hx)^2+(1-dy/hy)^2)^(order/2)+epsilone;
% l4=((dx/hx)^2+(1-dy/hy)^2)^(order/2)+epsilone;
%
% totalnorm=1/l1+1/l2+1/l3+1/l4;
%
%
%
%
% %u0
% LM_stancil(TR.connect(cell,1))=LM_stancil(TR.connect(cell,1))+constant_factor/4+(1-constant_factor)*1/l1/totalnorm;
%
% %u1
% LM_stancil(TR.connect(cell,2))=LM_stancil(TR.connect(cell,2))+constant_factor/4+(1-constant_factor)*1/l2/totalnorm;
%
% %u2
% LM_stancil(TR.connect(cell,3))=LM_stancil(TR.connect(cell,3))+constant_factor/4+(1-constant_factor)*1/l3/totalnorm;
%
% %u3
% LM_stancil(TR.connect(cell,4))=LM_stancil(TR.connect(cell,4))+constant_factor/4+(1-constant_factor)*1/l4/totalnorm;
%
%
%
end
end