Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
[Analytical solution]
Px
From x=0 to center: u
2 AE
Px PL
From center to ending point: u
2 AE 2 AE
1. CHOOSE ELEMENT TYPE AND GENERATE THE MESH
Element type: Linear
To find out the solution with arbitrary number of elements, suppose that the mesh is uniform.
end;
h=Dist(2)-Dist(1); %The distance between 2 ends of an element.
2. DERIVE THE GALERKIN’S INTERGRAL TO FIND THE ELEMENT
EQUATION
I now derive Galerkin’s integral to formulate the bar element stiffness equations for 1 arbitrary element.
I begin with the basic differential equation, without distributed load.
d du
AE 0 (1)
dx dx
where A and E are constants.
xj
d du
dx AE dx N
xi
k dx 0 with k = i, j (2)
Letting
dNk
u Nk du dx
dx
d du du
dv AE dx v AE
dx dx dx
I find that Equation (2) becomes
xj xj
du du dN k
N k AE
dx xi xi
AE
dx dx
dx 0 (3)
Because u N d , we have
du dNi dN j
ui uj (4)
dx dx dx
xj x x xi
With N i Nj , Equation (4) becomes
x j xi x j xi
du 1 1 ui
( h x j xi )
dx h h u j
(5)
1 ui
xj x
1 du
j
dN
AE k h dx N k AE
h u j
(6)
xi dx dx xi
Equation (6) is really two equations (one for N k N i and one for Nk N j ).
1 ui
xj x
1 du
j
dN
AE i h dx Ni AE (7)
xi dx h u j dx xi
d xj x 1 1
Substituting for dNi / dx , we obtain
dx x j xi x j xi h
1 ui
xj
1 1
AE dx fix
h h h u j
(8)
xi
xj
du
where fix Ni AE
dx xi
Evaluating Equation (8)
We have
1 ui
xj
1 1
AE dx
xi h h h u j
xj
1 1 1
AE ui u j dx
xi h h h
xj
AE 1 1
ui u j x
h h h xi
AE 1 1
ui u j x j xi
h h h
AE 1 1
ui u j h
h h h
AE
h
ui u j
AE
h
ui u j fix (9)
Similarly, using
Nk N j
d x xi 1 1
dN j / dx , we obtain
dx x j xi x j xi h
1 ui
xj x
1 1 du
j
AE dx N j AE
xi h h h u j dx xi (10)
Simplifying Equation (10) yields
AE
h
ui u j f jx (11)
xj
du
where f jx N j AE
dx xi
AE
h
ui u j fix
AE
h
ui u j f jx
AE 1 1 ui fix
h 1 1 u j f jx
Symbolically, we write
Ne Ne
F f (e)
and
K k (e)
e 1 e 1
1 1 0 0 0 0 0 u1 F1x
1 1 1 1
0 0 0 0 u2 F2 x
0 1 1 1 1 0 0 0 u3 F3 x
AE
0 0 1 1 1 1 0 0 u4 F4 x
h
0 0 0 1 1 1 1 0 u5 F5 x
0 0 0 0 1 1 1 1 u6 F6 x
0
0 0 0 0 1 1 u7 F7 x
F4 x P 1000 (F at center = P)
1 1 0 0 0 0 0 0 F1x
1 1 1 1
0 0 0 0 u2 0
0 1 1 1 1 0 0 0 u3 0
AE
0 0 1 1 1 1 0 0 u4 1000
h
0 0 0 1 1 1 1 0 u5 0
0 0 0 0 1 1 1 1 6u 0
0
0 0 0 0 1 1 0 F7 x
Now we can see that we have 5 variables (u2 to u6) and 5 equations. That’s enough!
1 1 0 0 0 0 0 0 F1x
1 1 1 1
0 0 0 0 u2 0
0 1 1 1 1 0 0 0 u3 0
AE
0 0 1 1 1 1 0 0 u4 1000
h
0 0 0 1 1 1 1 0 u5 0
0 0 0 0 1 1 1 1 6u 0
0
0 0 0 0 1 1 0 F7 x
0
1 1 1 1 0 0 0 0 u2 0
0 1 1 1 1 0 0
0 u3 0
AE
0 0 1 1 1 1 0 0 u4 1000
h
0 0 0 1 1 1 1 0 u5 0
0 0 0 0 1 1 1 1 57 u6 0 51
0 71
1 1 0 0 0 0 0
1 1 1 1 0 0 0 0
0 1 1 1 1 0 0 0
AE 0 0 1 1 1 1 0 0
0 0 0 1 1 1 1 0
0 0 0 0 1 1 1 1
0 1 1
0 0 0 0
1 1 1 1 0 0 0 0
0 1 1 1 1 0 0 0
AE
0 0 1 1 1 1 0 0
h
0 0 0 1 1 1 1 0
0 0 0 0 1 1 1 1 57
%Very IMPORTANT
New_K=K([2:Nd-1],:)*(A*E/L); %Cut the first and last rows of K
%This matrix is for solving U in MATLAB
4. SOLVE TO FIND DISPLACEMENT VALUES
And now we can solve to find vector U by just one command in MATLAB.
U = New_K\F;
1) We can see that the graph is consistent with the analytical solution: a linear line y=Ax+B
2) Along the first-half distance of the bar, the displacement function has positive slope. And long
the remaining-half distance of the bar, the displacement function has negative slope. This agrees
that the force is at the center.
3) Actually I plot both Finite solution and Analytical solution, but they appear only the red color of
Finite solution. The reason is that 2 lines are very likely the same.
plot(Dist,Ana_total,'blue',Dist,U,'red')
clc
clear all
close all
end;
h=Dist(2)-Dist(1); %The distance between 2 ends of an element.
%GENERATE THE GLOBAL STIFFNESS MATRIX K(Nd,Nd)
figure;
plot(Dist,Ana_total,'blue',Dist,U,'red')%Plot Ana line and Finite line
%together
xlabel('Distance (inch)');
ylabel('Displacement (inch)');
title('Comparision between Finite solution and Analytical Solution')
%THIS BLOCK AIMS TO FIND THE ERROR BETWEEN ANALYTICAL AND FINITE VALUES
Error=abs(([[Ana_total]'-U]./[Ana_total]'))*100; %transpose Ana_total
%to get the same dimension
figure;
plot(Dist,Error); %Plot Error vs Distance
xlabel('Distance (inch)');
ylabel('Error (%)');
title('Error along the bar distance')
%END.