Vous êtes sur la page 1sur 6

Q1 MATLAB CODE

% Analysing a cantilever beam using a FE Isoparametric approach


% Results of FE is compared with the direct Euler-Bernoulli formulation
clear all
clc
L=2;%Length of beam
D1=0.4;% Depth
D2=0.2;% Depth
t=.005;% %Thickness
E=200e9;% Elastic modulus
nu=0.3;% Possion's ratio
P=25000;%force applied on "top-right" node
n_x=50;% number of elements in the x-direction
n_y=10;% number of elements in the y-direction
% n_y should be an even number as we will plot results along the horizontal
middle line of the beam
C=E/(1-nu^2)*[1,nu,0;nu,1,0;0,0,(1-nu)/2];% The material matrix
K_G=zeros(2*(n_x+1)*(n_y+1),2*(n_x+1)*(n_y+1));% The global stiffness
matrix
%Gauss-Legendre sampling points and weight
alpha=[0.5555555556,0.5555555556,0.8888888889];
r=[-0.7745966692,0.7745966692,0,0000000000];
s=[-0.7745966692,0.7745966692,0,0000000000];

for i=1:n_x
for j=1:n_y
K_local=zeros(8,8);
for p=1:3
for q=1:3
x=[i*L/n_x,(i-1)*L/n_x,(i-1)*L/n_x,i*L/n_x];
y=[(j*(D1-((D1-D2)*i/n_x))/n_y)+(0.5*(D1D2)*i/(n_x)),(j*(D1-((D1-D2)*(i-1)/n_x))/n_y)+(0.5*(D1-D2)*(i1)/(n_x)),((j-1)*(D1-((D1-D2)*(i-1)/n_x))/n_y)+(0.5*(D1-D2)*(i1)/(n_x)),((j-1)*(D1-((D1-D2)*i/n_x))/n_y)+(0.5*(D1-D2)*i/(n_x))];
dxdr=1/4*(1+s(1,q))*x(1,1)-1/4*(1+s(1,q))*x(1,2)-1/4*(1s(1,q))*x(1,3)+1/4*(1-s(1,q))*x(1,4);
dxds=1/4*(1+r(1,p))*x(1,1)+1/4*(1-r(1,p))*x(1,2)-1/4*(1r(1,p))*x(1,3)-1/4*(1+r(1,p))*x(1,4);
dydr=1/4*(1+s(1,q))*y(1,1)-1/4*(1+s(1,q))*y(1,2)-1/4*(1s(1,q))*y(1,3)+1/4*(1-s(1,q))*y(1,4);
dyds=1/4*(1+r(1,p))*y(1,1)+1/4*(1-r(1,p))*y(1,2)-1/4*(1r(1,p))*y(1,3)-1/4*(1+r(1,p))*y(1,4);
J=[dxdr,dydr;dxds,dyds];
invJ=inv(J);
detJ=det(J);
I1=.25*[1+s(1,q),0,-1-s(1,q),0,-1+s(1,q),0,1s(1,q),0;1+r(1,p),0,1-r(1,p),0,-1+r(1,p),0,-1-r(1,p),0];
I2=.25*[0,1+s(1,q),0,-1-s(1,q),0,-1+s(1,q),0,1s(1,q);0,1+r(1,p),0,1-r(1,p),0,-1+r(1,p),0,-1-r(1,p)];
B=[1,0;0,0;0,1]*invJ*I1+[0,0;0,1;1,0]*invJ*I2;
K_local=K_local+alpha(1,p)*alpha(1,q)*B.'*C*B*t*detJ;
end
end

nb=1+2*(i-1)+2*(j-1)*(n_x+1);
nt=1+2*(i-1)+2*j*(n_x+1);
K_G([[nb:1:nb+3],[nt:1:nt+3]],[[nb:1:nb+3],[nt:1:nt+3]])=K_G([[nb:1:nb+3],[
nt:1:nt+3]],[[nb:1:nb+3],[nt:1:nt+3]])+K_local([5,6,7,8,3,4,1,2],[5,6,7,8,3
,4,1,2]);
end
end
F=zeros(2*(n_x+1)*(n_y+1),1);
F(2*(n_x+1)*(n_y+1),1)=-P;
dof=[1:2*(n_x+1)*(n_y+1)];
dof=setdiff(dof,[1:2*(n_x+1):2*(n_x+1)*(n_y+1)]);
dof=setdiff(dof,[2:2*(n_x+1):2*(n_x+1)*(n_y+1)]);
F2=F(dof,1);K_G2=K_G(dof,dof);d2=inv(K_G2)*F2;
d=zeros(2*(n_x+1)*(n_y+1),1);d(dof,1)=d2;
uy1=d;
figure(1)
plot([0:L/n_x:L].',uy1([(n_y/2*2*(n_x+1)+2):2:(n_y/2+1)*2*(n_x+1)],1)*1000,
'k','LineWidth',2);
%The displacement in [mm] under the load is given by
uy1(2*(n_x+1)*(n_y+1),1)*1000
%Euler-Bernoulli Calculations
x=[0:L/100:L];
I=(1/12)*t*(D2+(D1-D2)/L*(L-x)).^3;%
uy2=(6*P/(E*t*(((D1-D2)/L)^2)))*((2*log((1-(x./D1)*(D1-D2)/L).^(L/(D1D2))))+(x./D1)*(2-D2/D1)+(D2*x./((D1^2)*(1-(x./L)*(1-D2/D1)))));
%The displacement in [mm] under the load is given by -P*L^3/(3*E*I)*1000
figure(1)
hold on
plot(x,uy2*1000,'k:','LineWidth',2)
xlabel('Distance along the beam [m]')
ylabel('Displacement [mm]')
axis([0 2 -25 1])
legend('2D Plane-Stress','Euler-Bernoulli')
grid on
box on

Figure 1: Comparison of FE calculations (using MATLAB) and Euler-Bernoulli calculations of


the beam displacements

n_x
n_y
2D Plane Stress
Displacement
Euler-Bernoulli
Table 1
Choose

10
2
-17.74

50
10
-20.67
-20.44

100
20
-20.79

n_x = 100
n_y = 20

The vertical displacement under the load is


-20.79mm as calculated by the Isoparametric FE formulation (using MATLAB)
-20.44mm as calculated by Euler-Bernoulli Formulation

Q2 Using ANSYS with plane-stress solid elements


i)

The Vertical displacement under the load is


-20.79mm as calculated by the Isoparametric FE formulation (using MATLAB)
-20.44mm as calculated by Euler-Bernoulli Formulation
-20.93mm as calculated by ANSYS

From Table 1, vertical displacement calculated by Isoparametric FE formulation is converged


to value of ANSYS as the number of element increases. Vertical displacement calculated by
Euler-Bernoulli formulation is stiffer than both Isoparametric FE formulation and ANSYS
because the shear stress is neglected.

ii)

Undeformed and Deformed shapes of the beam

Figure 2: Undeformed and Deformed shapes of the beam

iii )

Figure 3: Stress contours in x directions

Figure 4: Stress contours in y directions


5

Figure 5: Stress contours in z directions


Discussion:
i)
From figure 3, the stress at top have a positive value, means there is tensile
stress acting on top. Where negative value is observed at bottom of the beam
indicating the compressive stress.
ii)
From Figure 4, point A observed a highest value of compressive stress. This is due
to the element at that point compressed by the point load acting on top. At point
B, tensile stress is observed. This is because finite element is based on continuum
mechanics. The compression at point A will caused tension in point B.
At the support, tension is observed at top and compression at bottom.
iii)
Due to the 2D plane stress problem, there is no load acting on z-direction.
Therefore, there is no stress at z-direction.

Vous aimerez peut-être aussi