! ANSYS command file to perform 2D Truss Tutorial (Chandrupatla p.123)
!
 /title, Bridge Truss Tutorial
/PREP7                  ! preprocessor phase
!
! define parameters (mm)
height = 3118
width = 3600
!
! define keypoints
!
K,1,    0,   0               ! keypoint, #, x, y
K,2,   width/2,height
K,3,     width,  0
K,4, 3*width/2,  height
K,5,   2*width,   0
K,6, 5*width/2,  height
K,7,   3*width,  0
!
! define lines
!
L,1,2                   ! line connecting kpoint 1 and 2
L,1,3
L,2,3
L,2,4
L,3,4
L,3,5
L,4,5
L,4,6
L,5,6
L,5,7
L,6,7

!
! element definition
!
ET,1,LINK1              ! element type      #1; spring element
R,1,3250                ! real constant     #1; Xsect area: 3200 mm^2
MP,EX,1,200e3          ! material property #1; Young's modulus: 200 GPa

LESIZE,ALL, , ,1,1,1    ! specify divisions on unmeshed lines
LMESH,all               ! mesh all lines
!
FINISH                  ! finish pre-processor
!
/SOLU                   ! enter solution phase
!
! apply some constraints
DK,1,ALL,0        ! define a DOF constraint at a keypoint
DK,7,UY,0
!
! apply loads
!
FK,1,FY,-280e3          ! define a force load to a keypoint
FK,3,FY,-210e3
FK,5,FY,-280e3
FK,7,FY,-360e3
!
SOLVE                   ! solve the resulting system of equations
FINISH                  ! finish solution

/POST1
PRRSOL,F                ! List Reaction Forces
PLDISP,2                ! Plot Deformed shape
PLNSOL,U,SUM,0,1        ! Contour Plot of deflection

ETABLE,SAXL,LS, 1         ! Axial Stress
PRETAB,SAXL               ! List Element Table
PLETAB,SAXL,NOAV          ! Plot Axial Stress
