!!! FEA H2: EXCENTRICALLY LOADED U-SECTION BEAM
!! Initial setup
! Isometric view
/VIEW,1,1,1,1   
/ANG,1  
/REP,FAST   
! White canvas
/RGB,INDEX,100,100,100,0
/RGB,INDEX,0,0,0,15 
! Constant parameters
! Units: [N],[Nmm],[N/mm^2=MPa],[N/mm]
ELAST=2E5  
NU=0.3 
RHO=7.8e-9 
T=10   
F=3000

!! SETUP: element types, materials, layup
KEYW,PR_STRUC,1  ! Preferences / Structural
/PREP7
ET,1,SHELL181   
!
MPTEMP
MPTEMP,1,0  
MPDATA,EX,1,,ELAST  
MPDATA,PRXY,1,,NU
!
MPTEMP
MPTEMP,1,0  
MPDATA,DENS,1,,RHO  
!
! Layup definition
SECT,1,shell,,  
SECDATA, t,1,0.0,3  
SECOFFSET,MID   
SECCONTROL
!
! Define keypoints
K,1,0,0,0,   
K,2,0,0,1000,   
K,3,100,0,0,
K,4,0,200,0,
K,5,100,200,0,  
!
! Create lines
L,5,4
L,4,1
L,1,3
! Linene along the beam axis
L,1,2
! Create the surface model by extruding the contour of the U-section
ADRAG,1,2,3,,,,4
! Connect the extruded areas
AGLUE,ALL
!
! Set the number of elements on the lines
LESIZE,1,,,10
LESIZE,2,,,20
LESIZE,3,,,10
LESIZE,5,,,10
LESIZE,6,,,60   
LESIZE,7,,,60 
LESIZE,8,,,20
LESIZE,9,,,60
LESIZE,10,,,10
!
! Mesh the areas using mapped meshing algorithm
MSHKEY,1
AMESH,ALL
! Reset mesh option
MSHKEY,0
!
! Select nodes at z = 0
NSEL,S,LOC,Z,0,0
!
! Constrain all DoFs at this location
D,ALL,ALL ,0
!
ALLSEL,ALL
! select nodes at x = 0, z = 1000
NSEL,S,LOC,X,0,0
NSEL,R,LOC,Z,1000,1000  
! Apply the calculated force at every node at this location
F,ALL,FY,-F/21 
! Select everything
ALLSEL,ALL
FINISH
!
! Solve the finite element equation K.U = F
/SOL
SOLVE
! Post processing
/POST1
! Save the displaced structure as bmp
PLNSOL, U,X, 0,1.0  
/IMAGE,SAVE,disp_x,bmp
PLNSOL, U,Y, 0,1.0  
/IMAGE,SAVE,disp_y,bmp
PLNSOL, U,Z, 0,1.0  
/IMAGE,SAVE,disp_z,bmp
! Plott the stress values at the longitudinal edge of the beam
! x = 0, y = 0
PATH,2,2,30,100
PPATH,1,,0,0,0
PPATH,2,,0,0,1000
PDEF,SX,S,X,AVG 
PDEF,SY,S,Y,AVG 
PDEF,SZ,S,Z,AVG 
! Save the stress distribution along the path as bmp
PLPATH,SX 
/IMAGE,SAVE,sx,bmp
!
PLPATH,SY 
/IMAGE,SAVE,sy,bmp
!
PLPATH,SZ 
/IMAGE,SAVE,sz,bmp

FINISH
/SOL
!
! Modal analysis, first 10 natural frequencies
ANTYPE,2
!
MODOPT,LANB,10,0,0, ,OFF
EQSLV,SPAR  
MXPAND,10, , ,1 
LUMPM,0 
PSTRES,0
!  
SOLVE  
FINISH
!
/POST1  
SET,FIRST     
! Save the eigenshapes as bmp files
*DO, III, 1, 10,1
PLNSOL, U,Y, 2,1.0
/IMAGE,SAVE,strcat(chrval(III),'_eigenshape'),bmp
SET,NEXT
*ENDDO