-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDeletingP1D.m
76 lines (50 loc) · 1.62 KB
/
DeletingP1D.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
71
72
73
74
75
76
classdef DeletingP1D < handle
properties (Access = public)
end
properties (Access = private)
end
properties (Access = private)
mesh
fun
funP1
end
methods (Access = public)
function obj = DeletingP1D()
obj.init()
obj.createMesh();
obj.createAnalyticalFunciton();
obj.createP1ContinousFun();
obj.createP1DiscontinousFun();
end
end
methods (Access = private)
function init(obj)
end
function createMesh(obj)
m = TriangleMesh(1,1,20,20);
obj.mesh = m;
end
function createAnalyticalFunciton(obj)
s.fHandle = @(x) [cos(10*x(1,:,:)+x(2,:,:));sin(10*x(1,:,:)+x(2,:,:))];
s.ndimf = 2;
s.mesh = obj.mesh;
obj.fun = AnalyticalFunction(s);
end
function createP1ContinousFun(obj)
obj.funP1 = obj.fun.project('P1');
end
function createP1DiscontinousFun(obj)
funP1DC = obj.funP1.project('P1D');
obj.funP1.computeL2norm()
funP1DC.computeL2norm()
obj.funP1.plot()
funP1DC.plot()
gradP1DC = SymGrad(funP1DC).project('P1');
gradP1DC.plot()
gradP1 = SymGrad(obj.funP1).project('P1');
gradP1.plot()
dif = gradP1DC - gradP1;
dif.computeL2norm()/gradP1.computeL2norm()
end
end
end