TALK=f;RUN(1,1)
  DISPLAY
  
  ENDDIS
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
 
 TEXT(mechanical stress in a cube
integer(caseno)     
caseno = 1      ! 1=x-direction tension, x & z free
  caseno=2        !     ditto            , x & z fixed
caseno=3        !     ditto            , x free, z fixed
real(appstr)
appstr = 1.e9  ! applied stress 
boolean(direct)
direct=f 
 ************************************************************
  Group 2. Time dependence
 STEADY  =    T
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    t
 NX      =         1
 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NY      = 10
 YVLAST=1.0*(ny+2)
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 NZ      =         1
 ZWLAST  = 1.000000E+00
 #UNIGRID
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
 SOLVE(P1,V1)
 STORE(PRPS,DEN1,ENUL,DVO1,DRH1)
 STORE(PTH)
 STORE(STRX,SXTH)
 STORE(STRY,SYTH)
 STORE(STRZ,SZTH)
 STORE(EPSX,EXTH)
 STORE(EPSY,EYTH)
 STORE(EPSZ,EZTH)
  store(dils)  
  GROUP8. ITERATION NUMBERS ETC
 RESREF(V1)=0.0  
 ************************************************************
  GROUP 9. PROPERTIES 
 CSG10='Q1'
  MATFLG=T;NMAT=1
  160    7800.0    0.3       473.0   43.0     1.e-5   0.5E-11 
 ************************************************************
  GROUP 11. INITIAL VALUES
 FIINIT(PRPS)=0
 fiinit(p1)=0.0
 fiinit(u1)=0.0
 fiinit(v1)=0.0
 fiinit(w1)=0.0
 fiinit(exth)=-1.234e-11  ! to print as none
 fiinit(eyth)=-1.234e-11  ! to print as none
 fiinit(ezth)=-1.234e-11  ! to print as none
 fiinit(sxth)=-1.234e-11  ! to print as none
 fiinit(syth)=-1.234e-11  ! to print as none
 fiinit(szth)=-1.234e-11  ! to print as none
 PATCH(BLOCK,INIVAL,1,1,2,NY-1,1,1,1,1)
 INIT (BLOCK,PRPS,FIXVAL,160)
 
 ************************************************************
  GROUP 13. BOUNDARY & SPECIAL SOURCES
IF(DIRECT) THEN
 PATCH(SOU,NORTH,1,1,1,1,1,1,1,1)
 COVAL(SOU,V1,1.E6, 0.0)
 
 PATCH(NFORCE,NORTH,1,1,NY-1,NY-1,1,1,1,1)
 COVAL(NFORCE,V1,FIXFLU,APPSTR)
ELSE
 PATCH(NOR,NORTH,1,1,NY-1,NY-1,1,1,1,1)
 COVAL(NOR,V1,1.E6, 0.0)
 
 PATCH(NFORCE,NORTH,1,1,1,1,1,1,1,1)
 COVAL(NFORCE,V1,FIXFLU,-APPSTR)

ENDIF 
SPEDAT(RLXFAC,RLXV1D,R,1.0)
IF(CASENO.EQ.2) THEN
SPEDAT(BOUNDARY,XCONST,R,1.E20)
SPEDAT(BOUNDARY,ZCONST,R,1.E20)
ENDIF
IF(CASENO.EQ.3) THEN
SPEDAT(BOUNDARY,ZCONST,R,1.E20)   ! z fixed, x free
ENDIF
 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  =       200
 ISG21=LSWEEP
 ************************************************************
  GROUP 17. RELAXATION
  #CONPROM
relax(v1,linrlx,1.0)  
 ************************************************************
  GROUP 19. DATA TRANSMITTED TO GROUND
 STRA    =    T
 
 
 ************************************************************
  GROUP 23.FIELD PRINT-OUT & PLOT CONTROL
NYPRIN=1 
TSTSWP=-1  
#MAXABS
#ENDPAUSE
REAL(YOUNG, POISSON, PTH,EXTH,EYTH,EZTH,SXTH,SYTH,SZTH,term)
POISSON = 0.3          ! must conform with matflg value
YOUNG   = 1/(0.5E-11)  ! must conform with matflg value 

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

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

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

(STORED VAR SXTH IS :SXTH: WITH IMAT>100)
(STORED VAR SYTH IS :SYTH: WITH IMAT>100)
(STORED VAR SZTH IS :SZTH: WITH IMAT>100)
(STORED VAR EXTH IS :EXTH: WITH IMAT>100)
(STORED VAR EYTH IS :EYTH: WITH IMAT>100)
(STORED VAR EZTH IS :EZTH: WITH IMAT>100)

PTH=EXTH+EYTH+EZTH
(STORED VAR PTH IS :PTH:)

STOP