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
 
REAL(LENGTH,WIDTH,ALFA)
BOOLEAN(ISOTHER)
ALFA  =1.0
LENGTH=1.0
WIDTH =1.0
NX  =10 ; NY  =10
ISOTHER=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
fiinit(tem)=1.
    GROUP 13. Boundary conditions and special sources
    ** Fixed 2D temperature field
     PLANTBEGIN
   IF(.NOT.ISOTHER) THEN
PATCH(TEMP,CELL,1,NX,1,NY,1,1,1,1)
     VAL=XG2D+YG2D
COVAL(TEMP,TEM,FIXVAL,GRND)
   ENDIF
    ** Fixed analitical pressure field
PATCH(FIXP,CELL,1,NX,1,NY,1,1,1,1)
     VAL=2.*(XG2D+YG2D)
COVAL(FIXP,P1,FIXVAL,GRND)
              Stress - in -Solid BC
    ---------------- WEST ----------------------------
   ** Zero displacement at the WEST
PATCH(WESTZD,WWALL,1,1,1,NY,1,1,1,1)
COVAL(WESTZD,U1,1.,0.0)
    ---------------- EAST ----------------------------
   ** Zero normal stress at the EAST
PATCH(EASZN,CELL,NX-1,NX-1,1,NY,1,1,1,1)
    VAL=U1[-1,,]$
            +0.333*(P1+4.*(:ALFA:*TEM-1.5*YG2D))*DXU2D
COVAL(EASZN,U1,FIXVAL,GRND)
   ** Zero shear stress at the EAST
PATCH(EASZS,EAST,NX,NX,1,NY-1,1,1,1,1)
    VAL=-(U1[-1,+1,]-U1[-1,,])/DYG2D
COVAL(EASZS,V1,FIXFLU,GRND)
   ** Fixed dilatation at the EAST
PATCH(FXDEAS,EAST,nx-2,NX,2,NY,1,1,1,1)
    VAL=2.*(:ALFA:*TEM+1.5*YG2D)$
                -1.5*(V1-V1[,-1,])/DYV2D
   COVAL(FXDEAS,P1,FIXVAL, grnd)
 
PATCH(FXDEAC,EAST,nx-2,NX,1,1,1,1,1,1)
    VAL=2.*(:ALFA:*TEM+1.5*YG2D)$
                -1.5*(V1[,+1,]-V1)/DYV2D[,+1,]
   COVAL(FXDEAC,P1,FIXVAL, grnd)
    ---------------- SOUTH ----------------------------
   ** Zero displacement at the south base
PATCH(SOUZD,SWALL,1,NX,1,1,1,1,1,1)
COVAL(SOUZD,V1,1.,0.0)
    ---------------- NORTH ----------------------------
   ** Zero 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.*(:ALFA:*TEM-1.5*XG2D))*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)
   ** Fixed dilatation at the free north boundary
PATCH(FDNW,NORTH,1,1,ny-2,NY,1,1,1,1)
    VAL=2.*(:ALFA:*TEM+1.5*XG2D)$
                -1.5*(U1[+1,,]-U1)/DXU2D[+1,,]
   COVAL(FDNW,P1,FIXVAL, grnd)
PATCH(FDNOR,NORTH,2,NX-1,ny-2,NY,1,1,1,1)
    VAL=2.*(:ALFA:*TEM+1.5*XG2D)$
                -1.5*(U1-U1[-1,,])/DXU2D
   COVAL(FDNOR,P1,FIXVAL, grnd)
PATCH(FDNEC,NORTH,NX,NX,ny-2,NY,1,1,1,1)
    VAL=2.*(:ALFA:*TEM+1.5*XG2D)$
                -1.5*(U1[-1,,]-U1[-2,,])/DXU2D[-1,,]
COVAL(FDNEC,P1,FIXVAL, grnd)
 
   ** Volumetric mass source for dilatation
PATCH(DILAT,VOLUME,1,nx,1,ny,1,1,1,1)
    VAL=-P1/3.+8./3.*:ALFA:*TEM
COVAL(DILAT,P1,FIXFLU,GRND)
   PLANTEND
 
RELAX(U1,FALSDT,1.)
RELAX(V1,FALSDT,1.)

 
NAMSAT=MOSG
 
    GROUP 15. Termination of sweeps
LSWEEP=150
tstswp=-1
    GROUP 22. Spot-value print-out
IYMON=NY
    GROUP 23. Field print-out and plot control
NXPRIN=1;NYPRIN=1
 LIBREF=450

tstswp=-1
dmpstk=t
DISTIL=T
EX(P1)=2.001E+00; EX(U1)=3.164E-01
EX(V1)=3.146E-01; EX(TEM)=1.000E+00
 LIBREF=450
STOP