! ANSYS Script used to model beam with three node triangles
! Observe the difficulty.

NRUN=4
*DIM,stress,ARRAY,NRUN
*DIM,delta,ARRAY,NRUN

/PREP7  

! Element and Materials

ET,1,PLANE42
MP,EX,1,1.e7
MP,NUXY,1,0.3

! Create geometry

k,1,0,-0.5,0
k,2,10,-0.5,0   
k,3,10,0,0  
k,4,10,0.5,0
k,5,0,0.5,0 
k,6,0,0,0
A,6,1,2,3
A,6,3,4,5
AGLUE,ALL 

!  Boundary Conditions and Loads

DL,1,,ALL
DL,7,,ALL
FK,3,FY,-100
FINISH

!  Loop over the ever finer meshes

*DO,ic,1,NRUN

/PREP7

! Mesh

ESIZE,1/(2**ic)
MSHKEY,1
MSHAPE,1
AMESH,ALL
FINISH

!  Solve

/SOLU
SOLVE
FINISH

!  Post processing

/POST1

!  Tip Deflection

ntip=node(10,0,0)          ! Number of node nearest to the location
delta(ic)=UY(ntip)         ! The uy function produces the value of y-delfection of the node

!  Stress at x=5, top surface

ALLSEL
ntop=node(5,0.5,0)
*GET,stress(ic),NODE,ntop,S,X

finish

! Clear the mesh before the next run

/PREP7
ACLEAR,ALL
FINISH

*ENDDO