0001 function stress=StressCompute(m,inputs,type);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 global cluster gridset
0012
0013
0014 elements=m.elements;
0015 grids=m.grids;
0016 materials=m.materials;
0017 loads=m.loads;
0018 gridset=m.gridset;
0019
0020
0021 [n1,n2]=GetNumberOfActiveElements(elements);
0022 if strcmpi(type,'2d')
0023
0024
0025 stress=struct('xx',[],'yy',[],'xy',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[]);
0026 stress1=zeros((n2-n1)+1,3);
0027 A1=zeros((n2-n1)+1,1); Vx1=zeros((n2-n1)+1,1); Vy1=zeros((n2-n1)+1,1); Vz1=zeros((n2-n1)+1,1);
0028 A2=zeros((n2-n1)+1,1); Vx2=zeros((n2-n1)+1,1); Vy2=zeros((n2-n1)+1,1); Vz2=zeros((n2-n1)+1,1);
0029
0030
0031 for n=n1:n2,
0032 if ~isempty(elements(n).element),
0033 stressvector=Stress(elements(n).element,grids,materials,inputs)';
0034
0035 stressmatrix=[stressvector(1) stressvector(3)
0036 stressvector(3) stressvector(2)];
0037
0038
0039 [directions,value]=eig(stressmatrix);
0040
0041
0042 stress1(n,:)=stressvector;
0043 A1(n,1)=value(1,1); A2(n,1)=value(2,2);
0044 Vx1(n,1)=directions(1,1); Vx2(n,1)=directions(1,2);
0045 Vy1(n,1)=directions(2,1); Vy2(n,1)=directions(2,2);
0046 end
0047 end
0048
0049
0050
0051
0052 stress.xx=stress1(:,1);
0053 stress.yy=stress1(:,2);
0054 stress.xy=stress1(:,3);
0055
0056 stress.principalvalue2=A1;
0057 stress.principalaxis2=[Vx1 Vy1];
0058 stress.principalvalue1=A2;
0059 stress.principalaxis1=[Vx2 Vy2];
0060
0061 stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+2*stress.xy.^2);
0062
0063 else
0064
0065 stress=struct('xx',[],'yy',[],'zz',[],'xy',[],'xz',[],'yz',[],'principalvalue1',[],'principalaxis1',[],'principalvalue2',[],'principalaxis2',[],'principalvalue3',[],'principalaxis3',[]);
0066 stress1=zeros((n2-n1)+1,6);
0067 A1=zeros((n2-n1)+1,1); Vx1=zeros((n2-n1)+1,1); Vy1=zeros((n2-n1)+1,1); Vz1=zeros((n2-n1)+1,1);
0068 A2=zeros((n2-n1)+1,1); Vx2=zeros((n2-n1)+1,1); Vy2=zeros((n2-n1)+1,1); Vz2=zeros((n2-n1)+1,1);
0069 A3=zeros((n2-n1)+1,1); Vx3=zeros((n2-n1)+1,1); Vy3=zeros((n2-n1)+1,1); Vz3=zeros((n2-n1)+1,1);
0070
0071
0072 for n=n1:n2,
0073 if ~isempty(elements(n).element),
0074 stressvector=Stress(elements(n).element,grids,materials,inputs)';
0075
0076 stressmatrix=[stressvector(1) stressvector(4) stressvector(5)
0077 stressvector(4) stressvector(2) stressvector(6)
0078 stressvector(5) stressvector(6) stressvector(3)];
0079
0080
0081 [directions,value]=eig(stressmatrix);
0082
0083
0084 stress1(n,:)=stressvector;
0085 A1(n,1)=value(1,1); A2(n,1)=value(2,2); A3(n,1)=value(3,3);
0086 Vx1(n,1)=directions(1,1); Vx2(n,1)=directions(1,2); Vx3(n,1)=directions(1,3);
0087 Vy1(n,1)=directions(2,1); Vy2(n,1)=directions(2,2); Vy3(n,1)=directions(2,3);
0088 Vz1(n,1)=directions(3,1); Vz2(n,1)=directions(3,2); Vz3(n,1)=directions(3,3);
0089 end
0090 end
0091
0092
0093
0094
0095 stress.xx=stress1(:,1);
0096 stress.yy=stress1(:,2);
0097 stress.zz=stress1(:,3);
0098 stress.xy=stress1(:,4);
0099 stress.xz=stress1(:,5);
0100 stress.yz=stress1(:,6);
0101
0102 stress.principalvalue3=A1;
0103 stress.principalaxis3=[Vx1 Vy1 Vz1];
0104 stress.principalvalue2=A2;
0105 stress.principalaxis2=[Vx2 Vy2 Vz2];
0106 stress.principalvalue1=A3;
0107 stress.principalaxis1=[Vx3 Vy3 Vz3];
0108
0109 stress.effectivevalue=1/sqrt(2)*sqrt(stress.xx.^2+stress.yy.^2+stress.zz.^2+2*stress.xy.^2+2*stress.xz.^2+2*stress.yz.^2);
0110 end