-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_initdata_HCT_SP.m
80 lines (79 loc) · 2.67 KB
/
get_initdata_HCT_SP.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
function [gcoord,ele_nods,bcdof,bcval]=get_initdata_HCT_SP
global Lx Hy nx ny
dx=Lx/nx; % the length of side of elements in x-axis
dy=Hy/ny; % the length of side of elements in y-axis
gcoord=[];
for j=1:ny+1
for i=1:nx+1
gcoord=[gcoord; (i-1)*dx (j-1)*dy;];
end
end
for j=1:ny
for i=1:nx
e1=2*(j-1)*nx+i;
e2=e1+nx;
% Node's position of e1
ne1(1)=(j-1)*(nx+1)+i;
ne1(2)=ne1(1)+1;
ne1(3)=ne1(2)+nx+1;
% Node's position of e2
ne2(1)=ne1(1);
ne2(2)=ne1(3);
ne2(3)=ne2(2)-1;
% Matrix containing nodes of each element
ele_nods(e1,:)=[ne1(1) ne1(2) ne1(3)];
ele_nods(e2,:)=[ne2(1) ne2(2) ne2(3)];
end
end
% Boundary condition
L1 = find(gcoord(:,2)==min(gcoord(:,2))); % at y = 0 (along X-axes);
L2 = find(gcoord(:,1)==max(gcoord(:,1))); % at x = a (along Y-axes);
L3 = find(gcoord(:,2)==max(gcoord(:,2))); % at y = b (along X-axes);
L4 = find(gcoord(:,1)==min(gcoord(:,1))); % at x = 0 (along Y-axes);
n = length(L1) ;
m = length(L2) ;
% disp('plate is clamped at all the edges');
% dofL1 = zeros(1,3*n) ;
% dofL2 = zeros(1,3*m) ;
% dofL3 = zeros(1,3*n) ;
% dofL4 = zeros(1,3*m) ;
% for i = 1:n
% i1 = 3*i ; i2 = i1-1 ; i3 = i1-2 ;
% dofL1(i1) = 3*L1(i) ; dofL1(i2) = 3*L1(i)-1 ; dofL1(i3) = 3*L1(i)-2 ;
% dofL3(i1) = 3*L3(i) ; dofL3(i2) = 3*L3(i)-1 ; dofL3(i3) = 3*L3(i)-2 ;
% end
% for i = 1:m
% i1 = 3*i ; i2 = i1-1 ; i3 = i1-2 ;
% dofL2(i1) = 3*L2(i) ; dofL2(i2) = 3*L2(i)-1 ; dofL2(i3) = 3*L2(i)-2 ;
% dofL4(i1) = 3*L4(i) ; dofL4(i2) = 3*L4(i)-1 ; dofL4(i3) = 3*L4(i)-2 ;
% end
% L1UL3 = union(dofL1,dofL3) ;
% L2UL4 = union(dofL2,dofL4) ;
% bcdof = union(L1UL3,L2UL4) ;
% % bcval = 0;
% bcval = zeros(length(bcdof),1) ;
% end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % %
% disp('plate is simply Supported at all the edges');
% Qui uoc , w_x=-dw/dy, w_y=dw/dx
dofL1 = zeros(1,2*n) ;
dofL2 = zeros(1,2*m) ;
dofL3 = zeros(1,2*n) ;
dofL4 = zeros(1,2*m) ;
for i = 1:n
i1 = 2*i ; i2 = i1-1 ;
dofL1(i1) = 3*L1(i) ; dofL1(i2) = 3*L1(i)-2 ;
dofL3(i1) = 3*L3(i) ; dofL3(i2) = 3*L3(i)-2 ;
end
for i = 1:m
i1 = 2*i ; i2 = i1-1 ;
dofL2(i1) = 3*L2(i)-1 ; dofL2(i2) = 3*L2(i)-2 ;
dofL4(i1) = 3*L4(i)-1 ; dofL4(i2) = 3*L4(i)-2 ;
end
L1UL3 = union(dofL1,dofL3) ;
L2UL4 = union(dofL2,dofL4) ;
bcdof = union(L1UL3,L2UL4) ;
% bcval = 0;
bcval = zeros(length(bcdof),1) ;
end