-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheval_solution_on_mesh.m
More file actions
62 lines (47 loc) · 1.64 KB
/
Copy patheval_solution_on_mesh.m
File metadata and controls
62 lines (47 loc) · 1.64 KB
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
%code by Lucka Barbeau
function F_X = eval_solution_on_mesh(TR,X,Solution)
%GET_LAGRANGE_MULTIPLIER_STANCIL Summary of this function goes here
% return the interpolation of of the point x from solution
cell=which_cell(TR,X);
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);
LM_stancil=zeros(1,length(Solution));
%u0
LM_stancil(TR.connect(cell,1))=(dy/hy-1)*dx/hx-(dy/hy)+1;
%u1
LM_stancil(TR.connect(cell,2))=(-dy/hy+1)*dx/hx;
%u2
LM_stancil(TR.connect(cell,3))=dy/hy*dx/hx;
%u3
LM_stancil(TR.connect(cell,4))=dy/hy*(-dx/hx+1);
% epsilone=0.0000001;
%
% order=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;
%
% LM_stancil=zeros(1,length(Solution));
% constant_factor=0;
%
% %u0
% LM_stancil(TR.connect(cell,1))=constant_factor/4+(1-constant_factor)*1/l1/totalnorm;
%
% %u1
% LM_stancil(TR.connect(cell,2))=constant_factor/4+(1-constant_factor)*1/l2/totalnorm;
%
% %u2
% LM_stancil(TR.connect(cell,3))=constant_factor/4+(1-constant_factor)*1/l3/totalnorm;
%
% %u3
% LM_stancil(TR.connect(cell,4))=constant_factor/4+(1-constant_factor)*1/l4/totalnorm;
%
F_X=LM_stancil*Solution;
% F_X=((dy/hy-1)*dx/hx-(dy/hy)+1)*Solution((TR.connect(cell,1)))+((-dy/hy+1)*dx/hx)*Solution((TR.connect(cell,2)))+(dy/hy*dx/hx)*Solution((TR.connect(cell,3)))+dy/hy*(-dx/hx+1)*Solution((TR.connect(cell,3)));
end