SWT-matlab程序
不管在低周疲劳还是高周疲劳,SWT是在裂纹萌生中最常用的一个参量。当我们采用Python提取出接触区域应力应变大小的时候,如何确定裂纹萌生位置,本实例中采用的一种方法是SWT方法。具体程序及实现方法如下所示:
代码语言:javascript复制clear all;clc
danyuanchangdu=0.078125;
bianhao=1:104;
distance=danyuanchangdu.*(bianhao-105/2);
renyi=[1869, 1875, 1885, 1888,1893, 1896, 1913, 1916, 1943, 1946, 1947, 1950, 1955, 1958, 1967, 1970,2007,2010, 2011, 2014, 2019, 2022, 2031, 2034, 2103, 2106, 2107, 2110, 2115, 2118,2127, 2130, 2159, 2162, 2229, 2232, 2241, 2244, 2245, 2248, 2297, 2304, 2325,2328, 2329, 2332, 2362, 2363, 2370, 2371, 2382, 2383, 2470, 2471, 2474, 2475,2550, 2551, 2562, 2563, 2570, 2571, 2574, 2575, 2614, 2615, 2626, 2627, 2634,2635, 2638, 2639, 2694, 2695, 2706, 2707, 2714, 2715, 2718, 2719, 2800, 2801,2812, 2813, 2820, 2821, 2824, 2825, 2864, 2865, 2876, 2877, 2884, 2885, 2888,2889, 2944, 2945, 2956, 2957, 2964, 2965, 2968, 2969];(需要提取SWT单元的set集合)
set=renyi';
changdu=length(set);
node=zeros(changdu,1);
ynode=zeros(changdu,2);
for i=1:changdu
node(i,1)=findelement(set(i,1));
ynode(i,1)=findnode(node(i,1));
ynode(i,2)=i;
end
setchange=zeros(changdu,3);
setchange(:,1)=sort(ynode(:,1),'descend');
for i=1:changdu
setchange(i,2)=ynode(find(ynode(:,1)==setchange(i,1)),2);
end
% swt=zeros(changdu,1);
for i=1:changdu
vvv=swtqu(setchange(i,2));
ylmax=max(vvv(1,:));
ybfu=max(vvv(2,:))-min(vvv(2,:));
setchange(i,3)=ylmax*ybfu;
end
jg(1,:)=distance;
jg(2,:)=setchange(:,3);
zuihoujieguo=jg';
plot(zuihoujieguo(:,1),zuihoujieguo(:,2))
function [ element4node ] =findelement( elementnumber )
%UNTITLED3´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% ´Ë´¦ÏÔʾÏêϸ˵Ã÷
element=[ ];(part单元集合)
element4node=element(find(element(:,1)==elementnumber),5);
end
function [ ynode ] = findnode( nodenumber )
%UNTITLED4´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% ´Ë´¦ÏÔʾÏêϸ˵Ã÷
node=[ ](节点单元集合)
ynode=node(find(node(:,1)==nodenumber),3);
end
function [ yinglichu ] = swtqu( number )
%UNTITLED6´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% ´Ë´¦ÏÔʾÏêϸ˵Ã÷
S=[ ];
Le=[ ];
changdu=length(s(:,1));
yingli=zeros(changdu,37);
yingbian=zeros(changdu,37);
for j=1:changdu
z=1;
for i=0:5:180
yingli(j,z)=0.5*(s(j,1) s(j,2)) 0.5*(s(j,1)-s(j,2))*cosd(2*i) s(j,4)*sind(2*i);
z=z 1;
end
end
yinglichu(1,:)=yingli(number,:);
for j=1:changdu
z=1;
for i=0:5:180
yingbian(j,z)=0.5*(le(j,2) le(j,3)) 0.5*(le(j,2)-le(j,3))*cosd(2*i) le(j,5)*sind(2*i);
z=z 1;
end
end
yinglichu(2,:)=yingbian(number,:);
end