forked from bobbiesimpson/Isogeometric-BEM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assignDirichletAndNeumannNodes.m
191 lines (163 loc) · 4.92 KB
/
assignDirichletAndNeumannNodes.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
function [ presDispDOFs, presTracDOFs, dirichletVals, nonZeroXTracDOFs, nonZeroYTracDOFs ] = assignDirichletAndNeumannNodes(n, elConn, tracConn)
% we work out the nodes where disp is specified and trac specified
% n: number of elements per line
% elConn: the displacement element connectivity matrix
% tracConn: the traction element Connectivity matrix
% traction: the traction that is applied on the upper and left edges
% X- Displacements are specified on line 5 while y-displacements are
% specified on line 1
%% Hole in infinite plate problem
% % y-disps prescribed on first line
% elms=1:n;
% sctrY=elConn(elms,:);
% sctrY=unique(reshape(sctrY,1,numel(sctrY)));
%
% % x-disps
% elms=(2*n+1):(3*n);
% sctrX=elConn(elms,:);
% sctrX=unique(reshape(sctrX,1,numel(sctrX)));
%
% presDispDOFs=sort([sctrX*2-1 sctrY*2]);
% dirichletVals=zeros(1,length(presDispDOFs));
%
%
% % and now for the tractions
%
% % x-tracs
% elms=[1:2*n (3*n+1):5*n];
% sctrX=tracConn(elms,:);
% sctrX=unique(reshape(sctrX,1,numel(sctrX)));
%
% % y-tracs
% elms=(n+1):(5*n);
% sctrY=tracConn(elms,:);
% sctrY=unique(reshape(sctrY,1,numel(sctrY)));
%
% presTracDOFs=sort([sctrX*2-1 sctrY*2]);
%
% % work out the traction DOFs where we specify a nonzero traction
%
% % nonzero y-tractions
% elms=(3*n+1):4*n;
% sctrY=tracConn(elms,:);
% sctrY=reshape(sctrY,1,numel(sctrY));
% nonZeroYTracDOFs=unique(sctrY*2);
%
% % nonzero x-tractions
% elms=(4*n+1):5*n;
% sctrX=tracConn(elms,:);
% sctrX=unique(reshape(sctrX,1,numel(sctrX)));
% nonZeroXTracDOFs=sctrX*2-1;
%% L-plate problem
% The only displacements that we prescribe are the nodes in the notch and
% at the right hand corner
% elms=[4]*n + 1;
% sctrX = elConn(elms,1);
% sctrX=reshape(sctrX,1,numel(sctrX));
%
% elms=[1 4]*n + 1;
% sctrY = elConn(elms,1);
% sctrY=reshape(sctrY,1,numel(sctrY));
%
% presDispDOFs=sort([sctrX*2-1 sctrY*2]);
% dirichletVals=zeros(1,length(presDispDOFs));
%
%
% % Now let's prescribe our tractions - this is everywhere except the two
% % dirichlet nodes
% tracEndElms = [4]*n;
% tracStartElms = tracEndElms + 1;
% sctrX = [tracConn(tracEndElms,end) tracConn(tracStartElms,1)];
% sctrX = reshape(sctrX,1, numel(sctrX));
%
% tracEndElms = [1 4]*n;
% tracStartElms = tracEndElms + 1;
% sctrY = [tracConn(tracEndElms,end) tracConn(tracStartElms,1)];
% sctrY = reshape(sctrY,1, numel(sctrY));
%
% allTracDOFs = 1:2*max(tracConn(:,end));
% presTracDOFs = setxor(allTracDOFs, [sctrX*2-1 sctrY*2]);
%
% % and our non-zero trac DOF
%
% % and now get the nonzero x and y tractions
% nonZeroYTracDOFs = presTracDOFs(find(mod(presTracDOFs,2)==0));
% nonZeroXTracDOFs = presTracDOFs(find(mod(presTracDOFs,2)==1));
% nonzero tractions
% elms=[1:3*n 5*n+1:6*n];
% sctr=tracConn(elms,:);
% sctr=reshape(sctr,1,numel(sctr));
% nonZeroYTracDOFs=unique(sctr*2);
% nonZeroXTracDOFs=unique(sctr*2-1);
%% spanner example
% prescribe our Dirichlet nodes
% elms=[1 12] *n + 1;
% sctrX = elConn(elms,1);
% sctrX=reshape(sctrX,1,numel(sctrX));
%
% elms=[1 2 11 12]*n + 1;
% sctrY = elConn(elms,1);
% sctrY=reshape(sctrY,1,numel(sctrY));
%
% presDispDOFs=sort([sctrX*2-1 sctrY*2]);
% dirichletVals=zeros(1,length(presDispDOFs));
%
% % Now let's prescribe our tractions - this is everywhere except the two
% % dirichlet nodes
% tracEndElms = [1 12]*n;
% tracStartElms = tracEndElms + 1;
% sctrX = [tracConn(tracEndElms,end) tracConn(tracStartElms,1)];
% sctrX = reshape(sctrX,1, numel(sctrX));
%
% tracEndElms = [1 2 11 12]*n;
% tracStartElms = tracEndElms + 1;
% sctrY = [tracConn(tracEndElms,end) tracConn(tracStartElms,1)];
% sctrY = reshape(sctrY,1, numel(sctrY));
%
% allTracDOFs = 1:2*max(tracConn(:,end));
% presTracDOFs = setxor(allTracDOFs, [sctrX*2-1 sctrY*2]);
%
% % and our non-zero trac DOF
% prevElmt=6*n;
% tracElms = 6*n+1:7*n;
% procElmt=7*n+1;
% rightSideDOF = unique(reshape(tracConn(tracElms,:),1,numel(tracConn(tracElms,:))));
% sctrY = [tracConn(prevElmt,end) rightSideDOF tracConn(procElmt,1)];
%
% % and now get the nonzero x and y tractions
% nonZeroYTracDOFs = sctrY*2;
% nonZeroXTracDOFs = [];
%% uniaxial tension
% first prescribe out dirichlet nodes
elms=1:n;
sctrY=elConn(elms,:);
sctrY=unique(reshape(sctrY,1,numel(sctrY)));
% x-disps
elms=3*n+1:4*n;
sctrX=elConn(elms,:);
sctrX=unique(reshape(sctrX,1,numel(sctrX)));
presDispDOFs=sort([sctrX*2-1 sctrY*2]);
dirichletVals=zeros(1,length(presDispDOFs));
% and now for the tractions
% x-tracs
elms=1:3*n;
sctrX=tracConn(elms,:);
sctrX=unique(reshape(sctrX,1,numel(sctrX)));
%firstNode=1;
%sctrX = setxor(sctrX,firstNode);
% y-tracs
elms=(n+1):(4*n);
sctrY=tracConn(elms,:);
sctrY=unique(reshape(sctrY,1,numel(sctrY)));
%lastNode=tracConn(end,end);
%sctrY = setxor(sctrY,lastNode);
presTracDOFs=sort([sctrX*2-1 sctrY*2]);
% work out the traction DOFs where we specify a nonzero traction
% nonzero y-tractions
elms=(2*n+1):3*n;
sctrY=tracConn(elms,:);
sctrY=reshape(sctrY,1,numel(sctrY));
nonZeroYTracDOFs=unique(sctrY*2);
% nonzero x-tractions
nonZeroXTracDOFs=[];
end