talk=f;run(1,1)
  **************************************************************
  PHOTON USE
   p ; ; ; ; ;
 
   vi x
   msg Computational Domain:
   rot 90
   gr i 4
   msg Press Any Key to Continue...
   pause
   cl
   set vec av off
   msg Velocity Vectors:
   vec i 4 sh
   msg Press Any Key to Continue...
   pause
   cl
   msg Contours of Pressure:
   con p1 i 4 fi;0.001
   pause
   cl
   msg Contours of Salinity:
   con SALT i 4 fi;0.001
   msg Press E  to exit PHOTON ...
  ENDUSE
  **************************************************************
    GROUP 1. Run title and other preliminaries

INTEGER(SLV)
MESG(
MESG(
MESG(
MESG(            TRANSIENT SALTED WATER FLOW
MESG(
MESG(
MESG( This case illustrates how to use MIGAL with transient 
MESG( flows. From library case F109.
MESG(
MESG(
MESG(
MESG( Enter required solver ID :  1 - MIGAL (default)
MESG(                             2 - SIMPLEST 
MESG(
READVDU(SLV,INT,1)
 
IF(SLV.EQ.1) THEN
+ TEXT(Salted Water Flow : MIGAL
ENDIF
IF(SLV.EQ.2) THEN
+ TEXT(Salted Water Flow : SIMPLEST
ENDIF

INTEGER(NY1,NY2)
REAL(LENG1,DIAM,SALTIN,SALT0,REFDEN,ALFA,DTHYD,WIDTH,LENGTH,DEPTH)
REAL(VSIN,PFRSH)
  ** Problem definition:
SALT0= 10.; SALTIN= 50;      REFDEN= 1000.;   ALFA = 8.E-4
VSIN = 0.3; PFRSH = 200.
DIAM = 0.1; LENG1 = 5.*DIAM; LENGTH= 7.*DIAM; DEPTH= 1.75*DIAM
NY1  = 6;   NY2   = 8;       NY    = NY1+NY2
NZ   = 10;  WIDTH = 2.*DIAM; NX    = 6

    GROUP 2. Transience; time-step specification
STEADY= F; GRDPWR(T,30,9.0,1.0)

    GROUP 6. Body-fitted coordinates or grid distortion
BFC= T; GSET(D,NX,NY,NZ,WIDTH,LENGTH,DIAM)
GSET(P,P1,0.0,  0.0, 0.0);  GSET(P,P2,0.0,LENG1, 0.0)
GSET(P,P3,0.0,LENG1,DIAM);  GSET(P,P4,0.0,  0.0,DIAM)
GSET(L,L12,P1,P2,NY1,1.0);  GSET(L,L23,P2,P3,NZ,S1.5)
GSET(L,L34,P3,P4,NY1,1.0);  GSET(L,L41,P4,P1,NZ,S1.5)
GSET(F,F1,P1,-,P2,-,P3,-,P4,-); GSET(M,F1,+J+K,1,1,1)
GSET(C,I:NX+1:,F,I1,1,NY,1,NZ,+,WIDTH,0.0,0.0,INC,1.0)
GSET(P,P5,  0.0,LENGTH, 0.0); GSET(P,P6,   WIDTH,LENGTH,  0.0)
GSET(P,P7,WIDTH,LENGTH,DIAM); GSET(P,P8,WIDTH/2.,LENGTH,DEPTH)
GSET(P,P9,  0.0,LENGTH,DIAM)
GSET(L,L56,P5,P6,  NX, 1.0); GSET(L,L67,P6,P7,  NZ,S1.5)
GSET(L,L78,P7,P8,NX/2, 1.0); GSET(L,L89,P8,P9,NX/2, 1.0)
GSET(L,L95,P9,P5,  NZ,S1.5)
GSET(F,F2,P5,-,P6,-,P7,P8,P9,-); GSET(M,F2,+I+K,1,NY+1,1)
GSET(T,J:NY1+1:,F,J:NY+1:,1.5)

    GROUP 7. Variables stored, solved & named
NAME(H1)= SALT; SOLVE(P1,U1,V1,W1,SALT)
SOLUTN(P1,Y,Y,Y,N,N,N); SOLUTN(SALT,Y,Y,Y,P,P,P)

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

    GROUP 9. Properties of the medium (or media)
ENUL= 1.E-5;  RHO1= LINSCAL;  RHO1A= REFDEN; RHO1B= ALFA*REFDEN
PRNDTL(SALT)= 1000.

    GROUP 11. Initialization of variable or porosity fields
INIADD= F;  FIINIT(SALT)= SALT0

    GROUP 13. Boundary conditions and special sources
    ** North Boundary:
PATCH( NORR,NORTH,1,NX,NY,NY,     1,NZ/2,1,LSTEP)
 COVAL(NORR, P1,10.*FIXP,0.0); COVAL(NORR,SALT,ONLYMS,SAME)
PATCH(NORRL,NORTH,1,NX,NY,NY,NZ/2+1,  NZ,1,LSTEP)
 COVAL(NORRL,P1,1.E-20,1.E20*REFDEN*VSIN)
 COVAL(NORRL,SALT,ONLYMS,SALTIN)
    ** South Boundary:
PATCH(SYD,SOUTH,1,NX,1,1,1,NZ,1,LSTEP)
 COVAL(SYD,P1,1000.,PFRSH); COVAL(SYD,SALT,ONLYMS,SALT0)
    ** Bottom Friction:
PATCH(BOTFRI,HWALL,1,NX,1,NY,NZ,NZ,1,LSTEP)
COVAL(  NORR,U1,ONLYMS,SAME); COVAL(  NORR,V1,ONLYMS,SAME)
COVAL(  NORR,W1,ONLYMS,SAME)
COVAL( NORRL,U1,ONLYMS,SAME); COVAL( NORRL,V1,ONLYMS,SAME)
COVAL( NORRL,W1,ONLYMS,SAME)
COVAL(   SYD,U1,ONLYMS,SAME); COVAL(   SYD,V1,ONLYMS,SAME)
COVAL(   SYD,W1,ONLYMS,SAME)
COVAL(BOTFRI,U1,   1.0,0.0);  COVAL(BOTFRI,V1,   1.0, 0.0)
    ** Buoyancy forces:
BUOYC= 9.81
BUOYD= REFDEN*(1.+ALFA*SALT0)
PATCH(BUOY,PHASEM,1,NX,1,NY,1,NZ,1,LSTEP)
COVAL(BUOY,W1,FIXFLU,DENSDIFF)

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

    GROUP 16. Termination of iterations
SELREF= T;   RESFAC= 1.E-6

    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,0.5);    DTHYD= (LENGTH-LENG1)/NY2
RELAX(U1,FALSDT,DTHYD); RELAX( V1,FALSDT,DTHYD)
RELAX(W1,FALSDT,DTHYD); RELAX(SALT,FALSDT,DTHYD)
SPEDAT(SET,GXMONI,TRANSIENT,L,F)

    GROUP 19. Data communicated by satellite to GROUND
    GROUP 22. Spot-value print-out
IXMON = NX/2+1; IYMON=NY/2+1; IZMON=NZ/2+1

IF(SLV.EQ.1) THEN
+ lsweep=15

+ spedat(migal,solved1,c,hydro)
+ spedat(migal,linrlx1,r,1.)
+ RELAX(U1,FALSDT,1.E+10)
+ RELAX(V1,FALSDT,1.E+10)
+ RELAX(W1,FALSDT,1.E+10) 

+ spedat(migal,solved2,c,salt)
+ spedat(migal,linrlx2,r,1.)
+ RELAX(SALT,FALSDT,1.E+10)
ENDIF