PHOTON USE
  p;;;;;
 
  msg             Numerical solution  contours
  con c1 z 1 fi;0.1
  msg  Press Enter to continue
  pause;clear;con errr z 1 fi;0.1
  msg               Error contours. Press e to END
  ENDUSE
  DISPLAY
    A two-dimensional transient diffusion problem with time-dependen
    boundary conditions and space-dependent initial fields is used a
    an illustration of how PLANT statements can be used to:-
 
    * set initial fields;
    * set boundary conditions and other sources;
    * make comparisons with exact solutions.
 
    The analytical solution is: C1 = X + Y + T ,
    where X and Y are cartesian coordinates and T is time.
 
    The C1 computed by PHOENICS, the exact solution (EXAC) and the
    difference between them (ERRR) are all printed out.
 
    The GROUND coding which the PLANT statements generate is
    appended to the Q1 file.
 
    This case enables the influences on accuracy to be investigated
    of numerical settings such as LITER(C1), RESFAC, ISOLX, ISOLY &
    CSG3. The latter, when set = CNGR, activates the conjugate-
    gradient solver.
  ENDDIS
    GROUP 1. Run title and other preliminaries
 
TEXT( 2D UNSTEADY DIFFUSION PROBLEM:Z104
title
NX=100;NY=100;LSTEP=5
    GROUP 2. Transience; time-step specification
STEADY=F;GRDPWR(T,LSTEP,1.,1.0)
    GROUP 3. X-direction grid specification
GRDPWR(X,NX,1,1.0)
    GROUP 4. Y-direction grid specification
GRDPWR(Y,NY,1,1.0)
    GROUP 7. Variables stored, solved & named
SOLVE(C1,ERRR);STORE(EXAC)
    GROUP 8. Terms (in differential equations) & devices
TERMS(C1,N,N,Y,P,P,P);TERMS(ERRR,N,N,N,P,P,P)
ISOLX=1;ISOLY=1
CSG3=CNGR
    GROUP 9. Properties of the medium (or media)
PRNDTL(C1)=1.0;ENUL=1.0
    GROUP 11. Initial values

   PLANTBEGIN 
solve(errr);store(exac)
  PLANT.. Following commands set the initial field as.. C1 = X + Y
PATCH(INIT,INIVAL,1,NX,1,NY,1,NZ,1,1)
   VAL=XG2D+YG2D
INIT(INIT,C1,0.0,GRND)
   VAL=XG2D+YG2D+TLAST
INIT(INIT,EXAC,0.0,GRND)
 
    GROUP 13. Boundary conditions and special sources
  PLANT.. Following commands set the west values as.. C1 = T + Y
PATCH(WEST,WWALL,1,1,1,NY,1,NZ,1,LSTEP)
   VAL=TIM+YG2D
COVAL(WEST,C1,1.,GRND)
 
  PLANT.. Following commands set the east values as.. C1 = T + 1 + Y
PATCH(EAST,EWALL,NX,NX,1,NY,1,NZ,1,LSTEP)
   VAL=TIM+1.0+YG2D
COVAL(EAST,C1,1.,GRND)
 
  PLANT.. Following commands set south values as.. C1 = T + X
PATCH(SOUTH,SWALL,1,NX,1,1,1,NZ,1,LSTEP)
   VAL=TIM+XG2D
COVAL(SOUTH,C1,1.,GRND)
 
  PLANT.. Following commands set north values as.. C1 = T + 1 + X
PATCH(NORTH,NWALL,1,NX,NY,NY,1,NZ,1,LSTEP)
   VAL=TIM+1.0+XG2D
COVAL(NORTH,C1,1.,GRND)
 
  PLANT.. Following commands set field values of EXAC as.. T + 1 + Y
PATCH(ERROR,CELL,1,NX,1,NY,1,NZ,1,LSTEP)
   VAL=TIM+XG2D+YG2D-C1
COVAL(ERROR,ERRR,FIXVAL,GRND)
   PLANTEND
 
  PLANT.. Following commands set the volumetric source as.. 1
PATCH(SOURC,VOLUME,1,NX,1,NY,1,NZ,1,LSTEP)
COVAL(SOURC,C1,FIXFLU,1.0)

    GROUP 15. Termination of sweeps
LITER(C1)=10
RESFAC=1.E-6
LSWEEP=2
    GROUP 19.
NAMSAT=MOSG
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
    GROUP 21. Print-out of variables
IXMON=NX/2;IYMON=NY/2
OUTPUT(C1,Y,Y,Y,Y,Y,Y)
OUTPUT(ERRR,Y,N,Y,N,N,N)
    GROUP 24. Dumps for restarts
dmpstk=t
DISTIL=T
 EX(C1)=1.999E+00; EX(EXAC)=2.000E+00; EX(ERRR)=1.181E-03
 LIBREF=104
STOP