TALK=f;RUN(1,1)
  DISPLAY
  A rectangular block of dimensions LX * LY * LZ is 
  * held fixed at it north, west and low faces
  * subjected to uniform compression at its south face
  * allowed to contract freely along its east and high faces
  
  The distributions of displacement in the xy plane are computed,
  and also the corresponding stresses and strains in all three 
  directions.
  A uniform cartesian grid is used.
  The computed results are compared with the analytically-derived
  values.  
    
  ENDDIS

 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(3D block in y-direction compression; s307
libref=307
TITLE
  Declarations and settings
REAL(FY,LX,LY,LZ,POISSON,YOUNG) 
FY= 40.0e6  ! H/m^2 = 40 N/mm^2
LX=90.e-3
LZ=90.e-3
LY=120.e-3 
YOUNG   = 1/0.5E-11  ! Young's modulus used for exact solutions 
POISSON=0.3          ! Poisson's ratio used for exact solutions 
                     ! The above must correspond to the data   
                     ! below MATFLG, which the simulation uses.
INTEGER(NXBODY,NYBODY,NZBODY)

 ************************************************************
  Group 2. Time dependence
 STEADY  =    T
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    T
 NXBODY = 10
 GRDPWR(X,NXBODY,LX,1)  

 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NYBODY = 10
 GRDPWR(Y,NYBODY,LY,1)  
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 NZBODY = 10
 GRDPWR(Z,NZBODY,LZ,1)  
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS  =    T
 SOLVE(P1,V1,U1,W1)
 SOLUTN(P1  ,Y,Y,Y,N,N,N)
 SOLUTN(U1  ,Y,Y,Y,N,N,Y)
 SOLUTN(V1  ,Y,Y,Y,N,N,Y)
 SOLUTN(W1  ,Y,Y,Y,N,N,Y)
 
 STORE(PRPS,DRH1,VISL) 
 STORE(STRX,STRY,STRZ,STXY,STXZ,STYZ)
 STORE(EPSY,EPSX,EPSZ)
 STORE(U1T,V1T,W1T,U1/T,V1/T,W1/T)

 ************************************************************
  GROUP 8. ITERATION NUMBERS ETC
RESFAC=1.e-7
RESREF(V1)=0.0 
RESREF(U1)=0.0  ! to prevent premature exit
LITER(V1) = 50 ! from solver
LITER(U1) = 50 
LITER(P1) = 50 
RESREF(W1)=0.0 
LITER(W1) = 50 

 ************************************************************
  GROUP 9. PROPERTIES
  
 CSG10='Q1'                  ! material properties
  MATFLG=T;NMAT=1         
  160    7800.0    0.3       473.0   43.0      1.0e-5   0.5e-11 
 
 ************************************************************
  GROUP 11. INITIAL VALUES
fiinit(p1)=0.0
fiinit(u1)=0.0
fiinit(v1)=0.0
fiinit(w1)=0.0
 
FIINIT(PRPS)=160

 ************************************************************
  GROUP 13. BOUNDARY & SPECIAL SOURCES
 
PATCH(UP,NWALL,1,NX,NY,NY,1,NZ,1,1)    ! north face fixed 
COVAL(UP,V1,1,0.0)

PATCH(FORs01,NORTH,1,NX,1,1,1,NZ,1,1)  ! south face compressed
COVAL(FORs01,V1,FIXFLU,FY)

PATCH(AXESXX,WWALL,1,1,1,NY,1,NZ,1,1)  ! west face fixed
COVAL(AXESXX,U1,1,0.0)

PATCH(AXESZZ,LWALL,1,NX,1,NY,1,1,1,1)  ! low face fixed
COVAL(AXESZZ,W1,1,0.0)

 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  =      100
 ISG21=LSWEEP
 ************************************************************
  GROUP 17. RELAXATION
 RELAX(P1  ,LINRLX, 1.000000E+00)
     spedat(rlxfac,rlxu1d,r,0.5)  
     spedat(rlxfac,rlxv1d,r,0.5)  
     spedat(rlxfac,rlxw1d,r,0.5)  
 ************************************************************
  GROUP 19. DATA TRANSMITTED TO GROUND
 STRA    =    T
 PARSOL  =    F
 ISG52   =    3   !   probe & res

 ************************************************************
  GROUP 23.FIELD PRINT-OUT & PLOT CONTROL
TSTSWP = - 1   ! graphic-mode
IXMON = NX-2
IYMON = 2
IZMON = NZ-2
#maxmin
#endpause
#$s003

  inform7begin
real(CEPSX,CEPSY,CEPSZ,CEPS,DDZZ)
DDZZ = LZ/NZBODY
CEPSX = FY/YOUNG*POISSON
CEPSY =  -FY/YOUNG
CEPSZ =  CEPSX
CEPS = CEPSX+CEPSY+CEPSZ
CEPSX
CEPSY
CEPSZ  
CEPS
   **** CALCULATE analytical solution ***
(STORED VAR W1T IS :CEPSZ:*ZW)
(STORED VAR U1T IS :CEPSX:*XU)
(STORED VAR V1T IS :CEPSY:*(YV -:LY:))

(STORED VAR U1/T IS U1/(U1T+1.e-20))
(STORED VAR V1/T IS V1/(V1T+1.e-20))
(STORED VAR W1/T IS W1/(W1T+1.e-20))

  inform7end

STOP
  photon use
  p;;;;
  
  set prop off
  con v1 x 9 y 1 9 z 1 9 fi;0.001
  con v1 y 9 x 1 9 z 1 9 fi;0.001
  con v1 z 9 y 1 9 x 1 9 fi;0.001
  pause
  con u1 x 9 y 1 9 z 1 9 fi;0.001
  con u1 y 9 x 1 9 z 1 9 fi;0.001
  con u1 z 9 y 1 9 x 1 9 fi;0.001
  enduse