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
     pause
     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 west
                   side of an isothermal( linear temperature) slab.
  ENDDIS
 
REAL(LENGTH,WIDTH,ALFA,TISO,STRNX)
BOOLEAN(ISOTHER)
 
ALFA  =1.0;TISO=0.0
LENGTH=1.0;WIDTH =1.0
ALFA  =1.0;RG(1)=ALFA
STRNX =1.0;RG(2)=STRNX
 
NX  =10 ; NY  =10
ISOTHER=t
 
 
    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
fiinit(tem)=TISO
    GROUP 13. Boundary conditions and special sources
    ** Linear temperature field
   IF(.NOT.ISOTHER) THEN
   PATCH(TEMPW,WWALL,1,1,1,NY,1,1,1,1)
   COVAL(TEMPW,TEM,1.0,0.0)
   PATCH(TEMPE,EWALL,NX,NX,1,NY,1,1,1,1)
   COVAL(TEMPE,TEM,1.0,0.0)
   ENDIF

  PLANTBEGIN
              Stress - in -Solid BC
    ---------------- WEST ----------------------------
   ** Zero normal stress at the west solid  boundary
PATCH(WESZN,CELL,1,1,1,NY,1,1,1,1)
    VAL=U1[+1,,]$
            -0.333*(P1+4.*(RG(1)*TEM+RG(2)))*DXU2D
COVAL(WESZN,U1,FIXVAL,grnd)
   ** Zero shear stress at the west boundary
PATCH(WESZS,WEST,1,1,1,NY-1,1,1,1,1)
    VAL=-(U1[,+1,]-U1)/DYG2D
COVAL(WESZS,V1,FIXFLU,GRND)
   ** Fixed dilatation at the west solid boundary
PATCH(FDWSC,WEST,1,1,1,1,1,1,1,1)
    VAL=2.*(RG(1)*TEM-RG(2))$
                -1.5*(V1[,+1,]-V1)/DYV2D[,+1,]
COVAL(FDWSC,P1,FIXVAL, grnd)
PATCH(FXDWES,WEST,1,1,2,NY-1,1,1,1,1)
    VAL=2.*(RG(1)*TEM-RG(2))$
                -1.5*(V1-V1[,-1,])/DYV2D
COVAL(FXDWES,P1,FIXVAL, grnd)
PATCH(FDWNC,WEST,1,1,NY,NY,1,1,1,1)
    VAL=2.*(RG(1)*TEM-RG(2))$
                 -1.5*(V1[,-1,]-V1[,-2,])/DYV2D[,-1,]
COVAL(FDWNC,P1,FIXVAL, grnd)
    ---------------- 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 ----------------------------
   ** Zero displacement at the north symmetry
PATCH(NORZD,NWALL,1,NX,NY-1,NY-1,1,1,1,1)
COVAL(NORZD,V1,1.,0.0)
    ---------------- 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.0025)
RELAX(U1,FALSDT,0.0005)
RELAX(V1,FALSDT,0.00025)
 
NAMSAT=MOSG
 
    GROUP 15. Termination of sweeps
LSWEEP=3500
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
    GROUP 23. Field print-out and plot control
NXPRIN=1;NYPRIN=1
 LIBREF=459

tstswp=-1
dmpstk=t