AERO 320

AERO 320
Spring 2002
Laboratory #10
Due: Thursday, April 25
Consider the simply supported beam shown below.
y
p
o
x
Assume EI = constant
NO MOMENTS AT ENDS
L
WITH SIMPLE SUPPORTS
The differential equation defining the transverse deflection uoy ( x) in the y direction is given by:
d 2uoy
dx
2

( p / 2) x( x  L)
M
 o
=f ( x)
EI zz
EI zz
The exact solution is: uoy ( x) 
with boundary conditions: uoy (0)  0, uoy ( L)  0
po
[ x 4  2 x3 L  xL3 ] .
24 EI zz
We want a finite difference solution to the differential equation. Replace uoy ( x) by u ( x) . Assume
the solution is ui at xi (i=0, 1, …,n+1) where x0  0 (left boundary), xn1  L (right boundary),
xi 1  xi  h (equal point spacing), and h  ( xn1  x0 ) /(n  1) . At xi , the differential equation is
ui "  fi . Replacing the derivative by 3-point centered finite difference, and rearranging, gives:
(1)ui 1  (2)ui  (1)ui 1  h2 fi
for i  1, 2,..., n (all xi points except boundaries)
with boundary conditions of u0  0 and un1  0 . If the n equations are written out, and the
boundary conditions are applied, one obtains the following tri-diagonal system of linear algebraic
equations [A]{u}={C} or:
 2

 2 1 0 0 0 0   u1   h f1  (1)u0 
 1 2 1 0 0 0   u  

h2 f2
2
 



 0 1 2 1 0 0   u3  
h 2 f3





...
...


  ...  

 0 0 0 1 2 1  un1  
2
  h f n 1



 0 0 0 0 1 2   un   2

h f n  (1)un 1 
1
We have a system of n linear algebraic equations [A]{u}={C} that define the solution to the
differential equation at the finite difference points. Note that the n equations are tri-diagonal, i.e.,
all non-zero terms appear on the main diagonal, and the diagonal above and below. Hence, you will
use the tri-diagonal solver (called TRIDIAG) shown on the attached page (also given on the web
page as a Fortran program). This tri-diagonal equation solver uses standard Gauss elimination, but
only stores the 3 diagonals (main, above and below) thus saving memory space. Note the particular
way that this subroutine expects its input for solving a system of tri-diagonal equations
[A]{u}={C}. The three non-zero columns of [A] are stored as one-dimensional columns a, b and c.
The "a" column is called the sub-diagonal (below main diagonal), the column "b" is the main
diagonal, and column "c" is the super-diagonal (above the main diagonal). Hence, you will actually
never use or define the [A] matrix shown above in solving for the unknowns {y}; you will only use
the three columns of [A] which are actually stored in columns {a}, {b} and {c}. Note that the first
row of column {a} is not used, i.e., a(2)=A(2,1), a(3)=A(3,2), …, a(n)=A(n,n-1), and the last row of
column {c} is not used, i.e., c(1)=A(1,2), c(2)=A(2,3), …,c(n-1)=A(n-1,n). As with any subroutine
that someone gives you, you MUST check the order of the subroutine arguments, array sizes, types
of variables, etc.
Write a Fortran program that will apply finite difference methods to solve for u at discrete x points
as outlined above.
For this case, assume the following values: L  100 in , E  10 x106 psi , I zz  10.4 in4 , and
p0  10 lb / in .
Do three cases: h = 25 in, h = 10 in, and h = 1 in.
Your program should print the result for x, u-approximate and u-exact at each finite difference point
in a format that is easily readable by someone unfamiliar with your program. u-approximate is your
finite difference solution. The following results are required:
a) program listing
b) program output for x, u-approximate and y-exact (include units in output headings)
c) plot of y vs. x (axis labels and units are a must) for the second case (h=10). Include the exact
solution on this plot.
d) What is the error in the value of the maximum displacement for h=10” case?
2
SUBROUTINE tridiag(a,b,c,r,u,n)
C ................................................................
C
Tri-diagonal equation solver.
C
a = sub-diagonal array, i=2,...,n
C
b = main diagonal array, i=1,...,n
C
c = super-diagonal array, i=1,...,n-1
C
r = right hand side array
C
u = solution vector
C
n = number of equations
C
WARNING - does not do any pivoting
C
WARNING - all real array are single precision
C
WARNING - NMAX=500 (max number of equations) - Reset if necessary
C .................................................................
INTEGER n,NMAX
REAL a(n),b(n),c(n),r(n),u(n)
PARAMETER (NMAX=500)
INTEGER j
REAL bet,gam(NMAX)
if(b(1).eq.0.)pause 'tridag: rewrite equations'
bet=b(1)
u(1)=r(1)/bet
do 11 j=2,n
gam(j)=c(j-1)/bet
bet=b(j)-a(j)*gam(j)
if(bet.eq.0.)pause 'tridag failed'
u(j)=(r(j)-a(j)*u(j-1))/bet
11
continue
do 12 j=n-1,1,-1
u(j)=u(j)-gam(j+1)*u(j+1)
12
continue
return
END
3