TALK=f;RUN(1,1)
  DISPLAY
  Problem: Torsion of the long square beam.
   1. Bottom of the beam is fixed (U1=V1=W1 = 0), Top - for U1 and V1 
      is used exact decision: U(Y),V(X).  
   2. Comparison - a analytical solution (Timoshenko, Paragraph 104)
   3. Used Boundary Flow-layers


  ENDDIS

 
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
TEXT(3D TORSION of beam; s304)
libref=304
title
  Declarations and settings
REAL(LX,LY,LZ,POISSON,YOUNG)
REAL(SHEARZ,TAUZ) 
LX=10.e-3
LZ=100.e-3
LY=LX 

TAUZ= 1.0/180*3.14     
TAUZ

YOUNG   = 1/0.5E-11   ! Young's modulus
POISSON=0.3           ! Poisson's ratio
INTEGER(NXBODY,NYBODY,NZBODY)

 ************************************************************
  Group 2. Time dependence
 STEADY  =    T
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES  =    T
 NXBODY = 8
 NREGX=3                             ! 3 regions
 IREGX=1;GRDPWR(X,1,0.01*LX,1.0)     ! single inner fluid cell
 IREGX=2;GRDPWR(X,NXBODY,LX,1)  
 IREGX=3;GRDPWR(X,1,0.01*LX,1.0)     ! single outer fluid cell 

 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NYBODY = 8
 NREGY=3                             ! 3 regions
 IREGY=1;GRDPWR(Y,1,0.01*LY,1.0)     ! single inner fluid cell
 IREGY=2;GRDPWR(Y,NYBODY,LY,1)  
 IREGY=3;GRDPWR(Y,1,0.01*LY,1.0)     ! single outer fluid cell 
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 NZBODY = 8
 NREGZ=3                             ! 3 regions
 IREGZ=1;GRDPWR(Z,1,0.01*LZ,1.0)     ! single inner fluid cell
 IREGZ=2;GRDPWR(Z,NZBODY,LZ,1)  
 IREGZ=3;GRDPWR(Z,1,0.01*LZ,1.0)     ! single outer fluid cell 
 ************************************************************
  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)     ! Necessary to save storage DRH1,VISL

 STORE(STRX,STRY,STRZ,STXY,STXZ,STYZ)
 STORE(EPSY,EPSX,EPSZ)
 STORE(U1T,V1T,U1/T,V1/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'                  ! materials with various POISSON ratios
  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)=0
 PATCH(BODY,INIVAL,2,NX-1,2,NY-1,2,NZ-1,1,1)
 INIT(BODY,PRPS,FIXVAL,160)

 ************************************************************
  GROUP 13. BOUNDARY & SPECIAL SOURCES
 
char(FormU,FormV)  
FormU=-:TAUZ:*(ZG-0.01*:LZ:)*(YG-0.51*:LY:)
FormV=:TAUZ:*(ZG-0.01*:LZ:)*(XG-0.51*:LX:)
 
PATCH(DOWNZ,HIGH,2,NX-1,2,NY-1,1,1,1,1)            ! z=0 - fixed ALL
COVAL(DOWNZ,W1,FIXVAL,0.0)
PATCH(DOWN0X,CELL,1,NX-1,2,NY-1,2,2,1,1)
(SOURCE of U1 at DOWN0X is COVAL(FIXVAL,:FormU:)) 
PATCH(DOWN0Y,CELL,2,NX-1,1,NY-1,2,2,1,1)
(SOURCE of V1 at DOWN0Y is COVAL(FIXVAL,:FormV:)) 

PATCH(UP0X,CELL,1,NX-1,2,NY-1,NZ-1,NZ-1,1,1)            ! UP - Moment of two force
(SOURCE of U1 at UP0X is COVAL(FIXVAL,:FormU:)) 
PATCH(UP0Y,CELL,2,NX-1,1,NY-1,NZ-1,NZ-1,1,1)            ! UP - Moment of two force
(SOURCE of V1 at UP0Y is COVAL(FIXVAL,:FormV:)) 


PATCH(PRESS,CELL,1,NX,1,NY,1,NZ,1,1)
COVAL(PRESS,P1,FIXVAL,0)



 ************************************************************
  GROUP 15. TERMINATE SWEEPS
 LSWEEP  =      600
 ISG21=LSWEEP
 ************************************************************
  GROUP 17. RELAXATION
     #CONPROM
 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
 #maxmin

 ************************************************************
  GROUP 23.FIELD PRINT-OUT & PLOT CONTROL
TSTSWP = - 1   ! graphic-mode
NYPRIN = 1
NXPRIN = 1
NZPRIN = 1
IXMON = NX-2
IYMON = 2
IZMON = NZ-2
      #conprom 

  inform7begin
   **** CALCULATE analytical solution ***
(STORED VAR U1T IS :FormU:)
(STORED VAR V1T IS :FormV:)
(STORED VAR U1/T IS U1/(U1T+1.e-20) with imat>100)
(STORED VAR V1/T IS V1/(V1T+1.e-20) with imat>100)

  inform7end
STOP