-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrhs.m
71 lines (41 loc) · 1.51 KB
/
rhs.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
classdef rhs
properties
IF % incident field
dIF % normal derivative of the incident field
end
methods
%-------------------------------------------------------------------------%
function obj = cctor_local(obj,problem_data,geo,tag)
prt = geo.get_part(tag);
[obj.IF,obj.dIF] = boundary_data(problem_data,prt);
end
%-------------------------------------------------------------------------%
function obj = cctor_global(obj,problem_data,geo)
for p = 1:geo.n_parts
prt = geo.get_part(p);
[fi,dfi] = boundary_data(problem_data,prt);
if (p==1)
FI = fi;
dFI = dfi;
else
FI = [FI;fi];
dFI = [dFI;dfi];
end
end
obj.IF = FI;
obj.dIF = dFI;
end
end
end
% ----------------------------------------------------------------------- %
function [fI,dfI] = boundary_data(problem_data,prt)
Np = prt.Np;
fI = zeros(Np,1);
dfI = zeros(Np,1);
for i=1:Np
x = prt.x(i,:);
n = prt.normals(i,:);
[fI(i),du] = incident_field(x,problem_data);
dfI(i) = du(1)*n(1)+du(2)*n(2);
end
end