PHOTON USE
     p
 
 
 
     gr ou z 1
     vec z 1 sh
     msg Velocity and displacement vectors
     pause
     vec cl;red
     con u1 z 1 fil;.001
     msg X-component displacement contours.
     pause
     con cl;red
     con v1 z 1 fil;.001
     msg Y-component displacement contours
     pause
     con cl;red
     con p1 z 1 fil;.001
     msg Dilatation contours
     msg Press E to end
     enduse
    GROUP 1. Run title and other preliminaries
 
TEXT(2D Stress in solid, XY plane


  DISPLAY 
       CASE STUDY: Tensile ( compress ) load applied to the slab
                   of uniform  temperature field.
  ENDDIS
 
REAL(LENGTH,WIDTH,ALFA,TISO,STRNY)
BOOLEAN(ISOTHER,TEMLIN,TEMSOR)
 
ALFA  =1.0;TISO=0.0
LENGTH=1.0;WIDTH =1.0
ALFA  =1.0;RG(1)=ALFA
STRNY =-1.0;RG(2)=STRNY
 
NX  =10 ; NY  =10
 
ISOTHER=f;TEMLIN=t;TEMSOR=f
 
 
    GROUP 3. X-direction grid specification
GRDPWR(X,NX,LENGTH,1.0)
    GROUP 4. Y-direction grid specification
GRDPWR(Y,NY,WIDTH,1.0)
    GROUP 7. Variables stored, solved & named
SOLVE(P1,U1,V1,TEM)
    GROUP 8. Terms (in differential equations) & devices
TERMS(U1,Y,N,Y,Y,Y,Y)
TERMS(V1,Y,N,Y,Y,Y,Y)
terms(tem,n,n,y,p,p,p)
    GROUP 9. Properties of the medium (or media)
ENUL=1.
    GROUP 11. Initialization of variable or porosity fields
IF(ISOTHER) THEN
fiinit(tem)=TISO
ENDIF
    GROUP 13. Boundary conditions and special sources
    ** Linear temperature field
IF(TEMLIN) THEN
PATCH(TEMPN,NWALL,1,NX,NY,NY,1,1,1,1)
COVAL(TEMPN,TEM,1.0,0.0)
PATCH(TEMPS,SWALL,1,NX,1,1,1,1,1,1)
COVAL(TEMPS,TEM,1.0,1.0)
ENDIF
    ** Source generated temperature field
IF(TEMSOR) THEN
PATCH(TEMPN,NWALL,1,NX,NY,NY,1,1,1,1)
COVAL(TEMPN,TEM,1.0,0.0)
PATCH(TEMSOR,VOLUME,1,NX,1,NY,1,1,1,1)
COVAL(TEMSOR,TEM,FIXFLU,2.0)
ENDIF

   PLANTBEGIN
              Stress - in -Solid BC
    ---------------- WEST ----------------------------
   ** Zero displacement at the west boundary
PATCH(WESZD,WWALL,1,1,1,NY,1,1,1,1)
COVAL(WESZD,U1,1.,0.0)
    ---------------- EAST ----------------------------
   ** Zero displacement at the east boundary
PATCH(EASZD,EWALL,NX-1,NX-1,1,NY,1,1,1,1)
COVAL(EASZD,U1,1.,0.0)
    ---------------- NORTH ----------------------------
   ** Normal stress at the free north boundary
PATCH(NORZN,CELL,1,NX,NY-1,NY-1,1,1,1,1)
    VAL=V1[,-1,]$
            +0.333*(P1+4.*(RG(1)*TEM+RG(2)))*DYV2D
COVAL(NORZN,V1,FIXVAL,grnd)
   ** Zero shear stress at the free north boundary
PATCH(NORZS,NORTH,1,NX-1,NY,NY,1,1,1,1)
    VAL=-(V1[+1,-1,]-V1[,-1,])/DXG2D
COVAL(NORZS,U1,FIXFLU,GRND)
   ** Dilatation at the free north boundary
PATCH(FDNW,NORTH,1,1,NY,NY,1,1,1,1)
    VAL=2.*(RG(1)*TEM-RG(2))$
                -1.5*(U1[+1,,]-U1)/DXU2D[+1,,]
COVAL(FDNW,P1,FIXVAL, grnd)
PATCH(FDNOR,NORTH,2,NX-1,NY,NY,1,1,1,1)
    VAL=2.*(RG(1)*TEM-RG(2))$
                -1.5*(U1-U1[-1,,])/DXU2D
COVAL(FDNOR,P1,FIXVAL, grnd)
PATCH(FDNEC,NORTH,NX,NX,NY,NY,1,1,1,1)
    VAL=2.*(RG(1)*TEM-RG(2))$
                -1.5*(U1[-1,,]-U1[-2,,])/DXU2D[-1,,]
COVAL(FDNEC,P1,FIXVAL, grnd)
    ---------------- SOUTH ----------------------------
   ** Zero displacement at the south symmetry
PATCH(SOUZD,SWALL,1,NX,1,1,1,1,1,1)
COVAL(SOUZD,V1,1.,0.0)
    ==================================================
   ** Volumetric mass source for dilatation
PATCH(DILAT,VOLUME,1,nx,1,ny,1,1,1,1)
    VAL=-P1/3.+8./3.*RG(1)*TEM
COVAL(DILAT,P1,FIXFLU,GRND)
  PLANTEND
 
RELAX(P1,LINRLX,0.005)
RELAX(U1,FALSDT,0.0005)
RELAX(V1,FALSDT,0.0005)
 
NAMSAT=MOSG
 
    GROUP 15. Termination of sweeps
LSWEEP=8000
selref=f
RESREF(P1)=1.E-8
RESREF(U1)=1.E-8;RESREF(V1)=1.E-8
tstswp=-1
    GROUP 22. Spot-value print-out
IYMON=NY-1
    GROUP 23. Field print-out and plot control
NXPRIN=1;NYPRIN=1

tstswp=-1
dmpstk=t
DISTIL=T
EX(P1)=2.999E+00; EX(U1)=1.896E-08
EX(V1)=3.502E-01; EX(TEM)=5.000E-01
 LIBREF=455
STOP