!****************************************************************************** !* Calculates beam deflection (in) for four different support/loading systems * !* -------------------------------------------------------------------------- * !* SAMPLE RUN: * !* * !* Give elasticity (lb/in^2) and moment of inertia (in^4): 30e6 797 * !* Give the beam length in ft: 20 * !* Choose one of these support/loading systems: * !* 1 - supported at each end, concentrated load * !* 2 - supported at each end, uniformly distributed load * !* 3 - supported at one end, concentrated load at free end * !* 4 - supported at one end, distributed load * !* Input your choice (1 to 4): 1 * !* Give the concentrated force: 50000 * !* * !* Deflection = -6.023E-01 * !* * !* More? (y/n): y * !* * !* Give elasticity (lb/in^2) and moment of inertia (in^4): 30e6 797 * !* Give the beam length in ft: 20 * !* Choose one of these support/loading systems: * !* 1 - supported at each end, concentrated load * !* 2 - supported at each end, uniformly distributed load * !* 3 - supported at one end, concentrated load at free end * !* 4 - supported at one end, distributed load * !* Input your choice (1 to 4): 3 * !* Give the concentrated force: 10000 * !* * !* Deflection = -1.927E+00 * !* * !* More? (y/n): n * !* -------------------------------------------------------------------------- * !* Reference: "Problem Solving with Fortran 90 By David R. Brooks, Springer- * !* Verlag New York, 1997". * !****************************************************************************** PROGRAM Beam2 IMPLICIT NONE REAL elasticity !lb/in^2 REAL moment_of_inertia !in^4 REAL length !ft REAL load !lb REAL deflection !in INTEGER systemID !1 - supported at each end, concentrated load !2 - supported at each end, distributed load !3 - supported one end, concentrated at free end !4 - supported one end, distributed CHARACTER YesNo ! 10 PRINT *,' ' WRITE(*,100,advance='no'); READ *, elasticity, moment_of_inertia WRITE(*,110,advance='no'); READ *, length PRINT *,'Choose one of these support/loading systems: ' PRINT *,'1 - supported at each end, concentrated load' PRINT *,'2 - supported at each end, uniformly distributed load' PRINT *,'3 - supported at one end, concentrated load at free end' PRINT *,'4 - supported at one end, distributed load' WRITE(*,120,advance='no'); READ *, systemID SELECT CASE (systemID) CASE (1,3) WRITE(*,130,advance='no') CASE (2,4) WRITE(*,140,advance='no') CASE DEFAULT STOP 'Program terminated because of input error.' END SELECT READ *, load ! length=length*12.0 SELECT CASE (systemID) CASE (1) deflection=-load*length**3/(48.0*elasticity*moment_of_inertia) CASE (2) deflection=& -5.0*load*length**3/(384.0*elasticity*moment_of_inertia) CASE (3) deflection=-load*length**3/(3.0*elasticity*moment_of_inertia) CASE(4) deflection=-load*length**3/(8.0*elasticity*moment_of_inertia) END SELECT ! PRINT 1000, deflection WRITE(*,200,advance='no'); READ *, YesNo IF (YesNo=='y') GO TO 10 ! 100 FORMAT(' Give elasticity (lb/in^2) and moment of inertia (in^4): ') 110 FORMAT(' Give the beam length in ft: ') 120 FORMAT(' Input your choice (1 to 4): ') 130 FORMAT(' Give the concentrated force: ') 140 FORMAT(' Give the distributed weight: ') 200 FORMAT(/' More? (y/n): ') 1000 FORMAT(/' Deflection = ',es10.3) END !end of file beam.f90