talk=f;run(1,1)
  PHOTON USE
   p ; ; ; ; ;
 
   rot 90
   set vec av off
   msg Velocity Vectors:
   vec j 1 sh
   msg Press Any Key to Continue...
   pause
   cl
   msg Contours of Pressure:
   con p1 j 1 fi;0.01
   pause
   cl
   msg Contours of Salinity:
   con salt j 1 fi;0.01
   msg Press E  to exit PHOTON ...
  ENDUSE
  **************************************************************
    GROUP 1. Run title and other preliminaries
INTEGER(ICASE)
MESG(
MESG(
MESG(
MESG(          DARCY FLOW SIMULATION
MESG(
MESG(
MESG( This case illustrates different ways to   
MESG( use MIGAL for Darcy flow simulation. From
MESG( library case F108
MESG(
MESG(
MESG( Use MIGAL for :  1 - HYDRO + SALT (default)
MESG(                  2 - HYDRO only 
MESG(                  3 - P1 + SALT 
MESG(                  4 - None of them
MESG(
READVDU(ICASE,INT,1)
CASE ICASE
WHEN 1
+ TEXT(Darcy Flow Simulation : HYDRO + SALT
WHEN 2
+ TEXT(Darcy Flow Simulation : HYDRO only
WHEN 3
+ TEXT(Darcy Flow Simulation : P1 + SALT
WHEN 4
+ TEXT(Darcy Flow Simulation : SIMPLEST
ENDCASE
TITLE

REAL(COND); COND= 1.0

    GROUP 3. X-direction grid specification
GRDPWR(X,10,100.0,1.0)

    GROUP 5. Z-direction grid specification
GRDPWR(Z,10,50.0,1.0)

    GROUP 7. Variables stored, solved & named
NAME(H1)= SALT; 
SOLVE(P1,U1,W1,SALT)
STORE(RHO1)

    GROUP 8. Terms (in differential equations) & devices
TERMS(SALT,N,Y,Y,N,Y,N)

    GROUP 9. Properties of the medium (or media)
RHO1= LINSCAL;  RHO1A= 1000.;  RHO1B= 8.
ENUL= 0.0;    BUOYE= 1000.;  BUOYC= -9.81

    GROUP 13. Boundary conditions and special sources
    ** Fix salinity to 5.0 at boundary:
PATCH(SALT,CELL,NX,NX,1,NY,1,8,1,LSTEP)
 COVAL(SALT,SALT,FIXVAL,5.0)
    ** Fix pressure at sea:
PATCH(SPRESS,CELL,6,NX,1,NY,NZ,NZ,1,LSTEP)
 COVAL(SPRESS,P1,FIXVAL,0.0); COVAL(SPRESS,SALT,FIXVAL,0.0)
    ** Fix pressure below island:
PATCH(LPRESS,CELL,1,4,1,NY,NZ,NZ,1,LSTEP)
COVAL(LPRESS,  P1,FIXVAL,1.*1000.*9.81)
COVAL(LPRESS,SALT,FIXVAL,0.0)
    ** Buoyancy forces:
BUOYD= 1000.; PATCH(BUOY,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP)
COVAL(BUOY,W1,FIXFLU,DENSDIFF)
    ** The Darcy resistance term:
PATCH(LINRES,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP)
COVAL(LINRES, U1,9.81/COND,0.0); COVAL(LINRES, W1,9.81/COND,0.0)
    ** Tunnel:
PATCH(TUNNEL,CELL,1,1,1,NY,3,3,1,LSTEP)
COVAL(TUNNEL,P1,FIXP,0.0)

    GROUP 15. Termination of sweeps
LSWEEP= 300;  TSTSWP= -1

    GROUP 17. Under-relaxation devices
RELAX(SALT,LINRLX,0.1)
RELAX(U1, FALSDT,1.0)
RELAX(W1, FALSDT,1.0)

    GROUP 22. Spot-value print-out
IXMON= 3;  IZMON= 2

IF(ICASE.LE.2) THEN
+ spedat(MIGAL,SOLVED1,c,HYDRO)
+ spedat(MIGAL,LINRLX1,r,1.)
ENDIF

IF(ICASE.EQ.3) THEN
+ spedat(MIGAL,SOLVED1,c,P1)
+ spedat(MIGAL,LINRLX1,r,1.)
ENDIF

IF(ICASE.EQ.1.OR.ICASE.EQ.3) THEN
+ spedat(MIGAL,SOLVED2,c,SALT)
ENDIF

  IF(ICASE.EQ.2) THEN
  + SOLUTN(SALT,Y,Y,Y,N,N,Y)
  ENDIF