TALK=f;RUN(1,1)
  DISPLAY
  A cubical block is subjected to x-direction tension, under 
  three possible lateral-constraint conditions:
  1. no constraint
  2. lateral displacement in y and z directions prevented 
  3. lateral displacement prevented only in y direction
  
  Because the x-direction displacements depend only on x, NY and NZ, 
  the number of x- and z-direction intervals, are both set to 1.
  
  The boolean variable 'direct' toggles which end is fixed and which
  is pulled.
  
  The stresses and strains are calculated; and their textbook
  values also. the former divided by the latter are printed as: 
    SX/T, EX/T, etc, the values of which should be close to 1.0
  (but they will be printed as 0.0 if the theoretical value is
  0.0)
  
  
  Variables which may be altered by hand-editing include:
  * grid-fineness NX ; Poisson's Ratio POISSON ; 
  * Young's Modulus YOUNG ; applied stress APPSTR
  * block dimensions XULAST, YVLAST, ZWLAST
  * grid-uniformity POWER (in GRDPWR)
  ENDDIS
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
 
 TEXT(cube in x-direction tension
integer(caseno)     
mesg(caseno = 1 :x-direction tension, y & z free
mesg(caseno = 2 :  ditto            , y & z fixed
mesg(caseno = 3 :  ditto            , y fixed, z free
caseno=1
label ask
mesg(caseno=:caseno: Enter 1, 2 or 3 or blank
readvdu(caseno,int,1)
if(caseno.lt.1) then
 goto ask
endif  
if(caseno.gt.3) then
 goto ask
endif 
caseno
real(appstr)
appstr = 1.e9
mesg(applied stress is :appstr: N/m^2      
boolean(direct)
direct=t
     direct=f
mesg(fixed_at_low-x_end is :direct:
 ************************************************************
  Group 2. Time dependence
 STEADY  =    T
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    t
 NX      =         10
 XULAST  = 1.0*NX
 REAL(POWER)
 POWER=0.1
 mesg(power-law exponent of x-wise grid is :power:)
 GRDPWR(X,NX,XULAST,POWER)
 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NY      = 1
 YVLAST=1.0       
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 NZ      =         1
 ZWLAST  = 1.000000E+00
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
 SOLVE(DISX)
 STORE(PRPS,DEN1,ENUL,DVO1,DRH1)
 STORE(STRX,SXTH,STRY,SYTH,STRZ,SZTH,EPSX,EXTH,EPSY,EYTH,EPSZ,EZTH)
 ************************************************************
  Group 8. 
 STRA    =    T  ! To activate stress analysis
 ************************************************************
  GROUP 9. PROPERTIES 
 CSG10='Q1'           ! signal use of the following properties line
                      ! which correspond to steel
  MATFLG=T;NMAT=1
  160    7800.0    0.3       473.0   43.0    0.37e-5   0.5E-11 
REAL(YOUNG, POISSON)
POISSON = 0.3          ! must conform with matflg value
YOUNG   = 1/(0.5E-11)  ! must conform with matflg value 
 ************************************************************
  GROUP 11. INITIAL VALUES
 FIINIT(PRPS)=160
 FIINIT(DISX)=0.0
 
 ************************************************************
  GROUP 13. BOUNDARY & SPECIAL SOURCES
 
 IF(DIRECT) THEN
 PATCH(WES,WWALL,1,1,1,1,1,1,1,1)
 COVAL(WES,DISX,1, 0.0)
 
 PATCH(EFOR,EAST,NX,NX,1,1,1,1,1,1)! The stress APPSTR is to
 COVAL(EFOR,DISX,FIXFLU,APPSTR)      ! patch with 'EFOR' in name
 
 ELSE
 
 PATCH(EAS,EWALL,NX,NX,1,1,1,1,1,1)
 COVAL(EAS,DISX,1, 0.0)
 
 PATCH(EFOR,EAST,1,1,1,1,1,1,1,1)
 COVAL(EFOR,DISX,FIXFLU,-APPSTR)
 ENDIF
 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  = 10
 ISG21   = 10   ! to ensure at least isg21 sweeps
 ************************************************************
  GROUP 17. RELAXATION
 ************************************************************
  GROUP 23.FIELD PRINT-OUT & PLOT CONTROL
TSTSWP=-1  
#MAXMIN
#ENDPAUSE
REAL(P1TH,EXTH,EYTH,EZTH,SXTH,SYTH,SZTH,TERM)
  Formulae for the theoretical values
IF(CASENO.EQ.1) THEN
SXTH=APPSTR
EXTH=APPSTR/YOUNG
EYTH=-EXTH*POISSON
EZTH=-EXTH*POISSON
SYTH=0.0
SZTH=0.0
ENDIF

IF(CASENO.EQ.2) THEN
EYTH=0.0
EZTH=0.0
TERM=APPSTR
EXTH=(APPSTR/YOUNG)*(1+POISSON)*(1-2*POISSON)/(1-POISSON)    
SXTH=TERM 
SYTH=TERM*POISSON/(1-POISSON)    
SZTH=TERM*POISSON/(1-POISSON)    
ENDIF

IF(CASENO.EQ.3) THEN
EYTH=0
SZTH=0
SXTH=APPSTR
EXTH=(SXTH/YOUNG)*(1+POISSON)*(1-POISSON)
EZTH=-EXTH*POISSON/(1-POISSON)
P1TH=EXTH+EZTH
SYTH=P1TH*YOUNG*POISSON/(1-2*POISSON)/(1+POISSON)
ENDIF

  Effect of constraints in y and z directions
IF(CASENO.EQ.2) THEN
SPEDAT(BOUNDARY,YCONST,R,1.E20)  ! prevent y displacement
SPEDAT(BOUNDARY,ZCONST,R,1.E20)  ! prevent z displacement
ENDIF
IF(CASENO.EQ.3) THEN
SPEDAT(BOUNDARY,YCONST,R,1.E20)  ! prevent y displacement
ENDIF

#$S001
STOP