forked from wozy13/DIAMOND
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdishls.m
230 lines (158 loc) · 6.38 KB
/
dishls.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
function [DImat,DIloc] = dishls(Nodes,SEMquads,phi_undam,phi_dam,respDOF,interpopt,numdiv,mode_anal,nu)
%
% Name:
%
% Usage:
%
% This m-file calculates the damage index for each shell element
% using the fractional strain energy technique (Cornwell, et. al.)
%
% Inputs:
% Nodes = List of nodes in DIAMOND geometry format
% Shells = List of shells in DIAMOND geometry format
% phi_undam = matrix of mode shapes from undamaged structure
% phi_dam = matrix of mode shapes from damaged structure
% interpopt = 'linear','spline', or 'cubic'
% numdiv = number of divisions for damage index computation
% mode_anal = vector of modes to use in the analysis
%
%
% Outputs:
%
% DImat = Matrix of Normalized Damage Index values for
% each interpolated element
% (# rows = size(Bars,1))
% (# columns = numdiv)
%
% Version SWD970916
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally %
% developed as part of "DIAMOND" at %
% Los Alamos National Laboratory. It may %
% be copied, modified, and distributed in %
% any form, provided: %
% a) This notice accompanies the files and %
% appears near the top of all source %
% code files. %
% b) No payment or commercial services are %
% received in exchange for the code. %
% %
% Original copyright is reserved by the %
% Regents of the University of California, %
% in addition to Scott W. Doebling, Phillip %
% J. Cornwell, Erik G. Straser, and Charles %
% R. Farrar. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fprintf(1,'Calculating damage index for Shell elements...');
%
% Allocate Variables
%
nquads = length(SEMquads);
nmod = length(mode_anal);
betanum = zeros(numdiv,numdiv);
betaden = zeros(numdiv,numdiv);
beta = zeros(nquads,numdiv,numdiv);
%
% Define number of integration points per division (in each direction)
%
nn = 3;
% Define total number of interpolated points per beam in each direction
numint = numdiv * nn + 1;
% Loop over the SEM quads
for iquad = 1:nquads,
thisquad = SEMquads{iquad}(2:end);
nnodes = length(thisquad); % Nodes which define this quad
% Determine which nodes define this quad
rnod = zeros(nnodes,1);
for inod = 1:nnodes,
rnod(inod) = find(Nodes(:,1) == thisquad(inod));
end
%
% ASSUME: quads lie in x-y plane, are oriented in x-y direction,
% and sensors are in +Z Direction
% Define which response DOF corresponds to each node
resprow = zeros(nnodes,1);
for iresp = 1:nnodes,
resprow(iresp) = find(respDOF(:,1)==Nodes(rnod(iresp),1) & respDOF(:,2) == 3);
end
%
% Define interpolation points
%
% Determine minimum and maximum x and y coordinate values
xmin = min(Nodes(rnod,2));
xmax = max(Nodes(rnod,2));
ymin = min(Nodes(rnod,3));
ymax = max(Nodes(rnod,3));
% Determine vectors of interpolated points
xintvec = linspace(xmin,xmax,numint);
yintvec = linspace(ymin,ymax,numint);
dx = xintvec(2) - xintvec(1);
dy = yintvec(2) - yintvec(1);
%intlocs{iquad} = struct('xloc',xintvec,'yloc',yintvec);
% Build vectors of coordinates and mode shapes for existing points
xvec = zeros(nnodes,1);
yvec = zeros(nnodes,1);
phiu_sort = zeros(nnodes,nmod);
phid_sort = zeros(nnodes,nmod);
for i = 1:nnodes,
xvec(i) = Nodes(rnod(i),2);
yvec(i) = Nodes(rnod(i),3);
for j = 1:length(mode_anal),
phiu_sort(i,j) = phi_undam{mode_anal(j)}(resprow(i));
phid_sort(i,j) = phi_dam{mode_anal(j)}(resprow(i));
end
end
% Interpolate each mode shape to interior quad locations,
% and compute curvature along each interpolated quad
phiu_int = zeros(numint,numint,nmod);
phid_int = zeros(numint,numint,nmod);
phiu_curv = zeros(numint,numint,nmod);
phid_curv = zeros(numint,numint,nmod);
for imod = 1:nmod,
phiu_int(:,:,imod) = griddata(xvec,yvec,phiu_sort(:,imod),xintvec',yintvec,'cubic');
phid_int(:,:,imod) = griddata(xvec,yvec,phid_sort(:,imod),xintvec',yintvec,'cubic');
[px_u,py_u]=gradient(phiu_int(:,:,imod),dx,dy);
[pxx_u,pxy_u]=gradient(px_u,dx,dy);
[pyx_u,pyy_u]=gradient(py_u,dx,dy);
[px_d,py_d]=gradient(phid_int(:,:,imod),dx,dy);
[pxx_d,pxy_d]=gradient(px_d,dx,dy);
[pyx_d,pyy_d]=gradient(py_d,dx,dy);
%
% Determine the integrand
%
fx_u=pxx_u.^2+pyy_u.^2+2*nu*pxx_u.*pyy_u+2*(1-nu)*pxy_u.^2;
fx_d=pxx_d.^2+pyy_d.^2+2*nu*pxx_d.*pyy_d+2*(1-nu)*pxy_d.^2;
%
% Do the integration
%
for i=1:numdiv
for j=1:numdiv
xvalues=xintvec((i-1)*nn+1:i*nn+1);
yvalues=yintvec((j-1)*nn+1:j*nn+1);
zvalues_u=fx_u((j-1)*nn+1:j*nn+1,(i-1)*nn+1:i*nn+1);
zvalues_d=fx_d((j-1)*nn+1:j*nn+1,(i-1)*nn+1:i*nn+1);
DIloc{iquad}.xloc{j,i} = xvalues([1 end]);
DIloc{iquad}.yloc{j,i} = yvalues([1 end]);
for k=1:nn+1
temp_u(k)=trapz(yvalues,zvalues_u(:,k));
temp_d(k)=trapz(yvalues,zvalues_d(:,k));
end
Efrac(j,i,imod)=trapz(xvalues,temp_u);
Efracd(j,i,imod)=trapz(xvalues,temp_d);
end
end
% Sum the fractional energy over each mode
Etot = sum(Efrac(:));
Etotd = sum(Efracd(:));
% Sum the betas
betanum = betanum + (Efracd(:,:,imod)+Etotd)/Etotd;
betaden = betaden + (Efrac(:,:,imod)+Etot)/Etot;
end % END of the integration over each mode shape
beta(iquad,:,:) = betanum ./ betaden;
end % END of the loop over each entry in SEMquad
avebeta=mean(beta(:));
stdbeta=std(beta(:));
DImat=(beta-avebeta)/stdbeta;
disp('DONE with SEM computation for Quad elements')
return