-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo_stiffnessB.m
201 lines (183 loc) · 5.07 KB
/
demo_stiffnessB.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
191
192
193
194
195
196
197
198
199
200
201
function [Ke, Pe] = stiffnessB(x_a, y_b, t, E, v, q0, Int)
% syms zeta_i eta_i zeta eta;
% x_a = x_a/2;
% y_b = y_b/2;
% G = E/2/(1+v);
% D0 = E*t^3/12/(1 - v^2);
% alpha = 5/6;
% Ds = alpha*G*t*[1 0;0 1];
% Db = D0*[1 v 0;v 1 0; 0 0 (1 - v)/2];
%
% wts_1 = 2;
% wts_2 = [1 1; 1 1; 1 1; 1 1];
%
% pts_1 = [0 0];
% pts_2 = [-1/sqrt(3) -1/sqrt(3); 1/sqrt(3) -1/sqrt(3); 1/sqrt(3) 1/sqrt(3); -1/sqrt(3) 1/sqrt(3)];
%
% nodes = [-1 -1; 1 -1; 1 1; -1 1];
% Ni_x = (1/(4*x_a))*zeta_i*(1 + eta_i*eta);
% Ni_y = (1/(4*y_b))*eta_i*(1 + zeta_i*zeta);
% Ni = (1/4)*(1 + eta_i*eta)*(1 + zeta_i*zeta);
% var = [0 -Ni_x 0;
% 0 0 -Ni_y;
% 0 -Ni_y -Ni_x];
% var2 = [Ni_x -Ni 0;
% Ni_y 0 -Ni];
%
% Bb = sym('Bb', [3,12]);
% Bs = sym('Bs',[2,12]);
% for i=1:4
% Bb(:,3*i-2:3*i) = subs(var,[zeta_i eta_i],nodes(i,:));
% end
%
% for i=1:4
% Bs(:,3*i-2:3*i) = subs(var2,[zeta_i eta_i],nodes(i,:));
% end
%
% Kb_before_integral = transpose(Bb)*Db*Bb;
% Kb_after_integral = Kb_before_integral;
%
% Ks_before_integral = transpose(Bs)*Ds*Bs;
% Ks_after_integral = Ks_before_integral;
%
% if Int(1) == 1
% for i=1:12
% for j=1:12
% sum = 0;
% for k=1:1
% sum = sum + wts_1(1)^2*x_a*y_b*subs(subs(Kb_before_integral(i,j),zeta, pts_1(k,1)),eta,pts_1(k,2));
% end
% Kb_after_integral(i,j) = sum;
% end
% end
% elseif Int(1) == 2
% for i=1:12
% for j=1:12
% sum = 0;
% for k=1:4
% sum = sum + wts_2(k,1)*wts_2(k,2)*x_a*y_b*subs(subs(Kb_before_integral(i,j),zeta, pts_2(k,1)),eta,pts_2(k,2));
% end
% Kb_after_integral(i,j) = sum;
% end
% end
% end
%
% % Kb_after_integral = int(int(Kb_after_integral*x_a*y_b,eta,-1,1),zeta,-1,1);
% % Ks_after_integral = int(int(Ks_after_integral*x_a*y_b,eta,-1,1),zeta,-1,1);
%
% if Int(2) == 1
% for i=1:12
% for j=1:12
% sum = 0;
% for k=1:1
% sum = sum + wts_1(1)^2*x_a*y_b*subs(subs(Ks_before_integral(i,j),zeta, pts_1(k,1)),eta,pts_1(k,2));
% end
% Ks_after_integral(i,j) = sum;
% end
% end
% elseif Int(2) == 2
% for i=1:12
% for j=1:12
% sum = 0;
% for k=1:4
% sum = sum + wts_2(k,1)*wts_2(k,2)*x_a*y_b*subs(subs(Ks_before_integral(i,j),zeta, pts_2(k,1)),eta,pts_2(k,2));
% end
% Ks_after_integral(i,j) = sum;
% end
% end
% end
%
% N = sym('N',[12,1]);
%
% for i=1:4
% N(3*i-2:3*i) = subs([Ni;0;0],[zeta_i eta_i],nodes(i,:));
% end
%
% Pe = int(int(N*q0*x_a*y_b,eta,-1,1),zeta,-1,1);
%
% Ke = Kb_after_integral + Ks_after_integral;
syms zeta_i eta_i zeta eta;
x = zeta*(x_a/2);
y = eta*(y_b/2);
G = E/2/(1+v);
D0 = E*t^3/12/(1 - v^2);
alpha = 5/6;
Ds = alpha*G*t*[1 0;0 1];
Db = D0*[1 v 0;v 1 0; 0 0 (1 - v)/2];
wts_1 = 2;
wts_2 = [1 1; 1 1; 1 1; 1 1];
pts_1 = [0 0];
pts_2 = [-1/sqrt(3) -1/sqrt(3); 1/sqrt(3) -1/sqrt(3); 1/sqrt(3) 1/sqrt(3); -1/sqrt(3) 1/sqrt(3)];
nodes = [-1 -1; 1 -1; 1 1; -1 1];
Ni = (1/4)*(1 + eta_i*eta)*(1 + zeta_i*zeta);
J = [diff(x,zeta) diff(x,eta); diff(y,zeta) diff(y,eta)];
Ni_derivatives = J\[diff(Ni,zeta); diff(Ni,eta)];
Ni_x = Ni_derivatives(1);
Ni_y = Ni_derivatives(2);
var = [0 -Ni_x 0;
0 0 -Ni_y;
0 -Ni_y -Ni_x];
var2 = [Ni_x -Ni 0;
Ni_y 0 -Ni];
Bb = sym('Bb', [3,12]);
Bs = sym('Bs',[2,12]);
for i=1:4
Bb(:,3*i-2:3*i) = subs(var,[zeta_i eta_i],nodes(i,:));
end
for i=1:4
Bs(:,3*i-2:3*i) = subs(var2,[zeta_i eta_i],nodes(i,:));
end
Kb_before_integral = transpose(Bb)*Db*Bb;
Kb_after_integral = Kb_before_integral;
Ks_before_integral = transpose(Bs)*Ds*Bs;
Ks_after_integral = Ks_before_integral;
if Int(1) == 1
for i=1:12
for j=1:12
sum = 0;
for k=1:1
sum = sum + wts_1(1)^2*det(J)*subs(subs(Kb_before_integral(i,j),zeta, pts_1(k,1)),eta,pts_1(k,2));
end
Kb_after_integral(i,j) = sum;
end
end
elseif Int(1) == 2
for i=1:12
for j=1:12
sum = 0;
for k=1:4
sum = sum + wts_2(k,1)*wts_2(k,2)*det(J)*subs(subs(Kb_before_integral(i,j),zeta, pts_2(k,1)),eta,pts_2(k,2));
end
Kb_after_integral(i,j) = sum;
end
end
end
% Kb_after_integral = int(int(Kb_after_integral*x_a*y_b,eta,-1,1),zeta,-1,1);
% Ks_after_integral = int(int(Ks_after_integral*x_a*y_b,eta,-1,1),zeta,-1,1);
if Int(2) == 1
for i=1:12
for j=1:12
sum = 0;
for k=1:1
sum = sum + wts_1(1)^2*det(J)*subs(subs(Ks_before_integral(i,j),zeta, pts_1(k,1)),eta,pts_1(k,2));
end
Ks_after_integral(i,j) = sum;
end
end
elseif Int(2) == 2
for i=1:12
for j=1:12
sum = 0;
for k=1:4
sum = sum + wts_2(k,1)*wts_2(k,2)*det(J)*subs(subs(Ks_before_integral(i,j),zeta, pts_2(k,1)),eta,pts_2(k,2));
end
Ks_after_integral(i,j) = sum;
end
end
end
N = sym('N',[12,1]);
for i=1:4
N(3*i-2:3*i) = subs([Ni;0;0],[zeta_i eta_i],nodes(i,:));
end
Pe = int(int(N*q0*det(J),eta,-1,1),zeta,-1,1);
Ke = Kb_after_integral + Ks_after_integral;