TALK=T;RUN(1,1)
  PHOTON USE
  p
  parphi
  1 10 1

  vi -x
  con den1 x 1 fi;1
  msg density
  ENDUSE
  DISPLAY
  Oscillating water column, invented by Dennis Carey, 1970
  Two side-by-side water columns oscillate in a structure on the
  ocean floor influenced by sinusoidal pressure variations caused
  by surface waves.
  Water spills from the left (donor) column into the right
  (receptor) column and flows thence through a turbine back to the
  sea.
  This input file represents its idealised behaviour by
  use of In-Form, so as to:
      1. calculate heights of water in each column
      2. calculate corresponding density distributions
      3. estimate maximum possible power generation,
      4. (if findfreq = T) to determine the natural frequency
         of the donor column

                        /////////
                        !.......!
                        !.air...!
                        !.......!
                        !..!....!
              donor     !..!....!    receptor
              column    !..!....!    column
                        !..!    ! ^
                        !..!    !
                      ^ !  !    ! Hr
                        !  !    !
                     Hd !  !    !
        --- in/outflow--___!_____----outflow through turbine
        ^^^^^^^^^^^^^^ ocean floor ^^^^^^^^^^^^^^^^^^^

    In the following Q1 file, economies of calculation and display
    are achieved by treating the receptor column as standing on top
    of the donor, so that the system can be regerded as one-
    dimensional but time-dependent.

    Explanations are provided as comments in the Q1 file.

  ENDDIS
 ************************************************************
  Group 1. Run Title and Number
 ************************************************************
 ************************************************************
 
 TEXT(CAREY Oscillating water column          )
 
 ************************************************************
 ************************************************************
 
 IRUNN = 1 ;LIBREF = 0
 ************************************************************
  Group 2. Time dependence
 STEADY = F
    * Set overall time and no. of steps
 TFIRST =0. ;TLAST =25.
 FSTEP = 1 ;LSTEP = 2500
 TFRAC(1)=4.0E-04 ;TFRAC(251)=0.1004
 TFRAC(501)=0.2004 ;TFRAC(751)=0.3004
 TFRAC(1001)=0.4004 ;TFRAC(1251)=0.5004
 TFRAC(1501)=0.6004 ;TFRAC(1751)=0.7004
 TFRAC(2001)=0.8004 ;TFRAC(2251)=0.9004
 ************************************************************
  Group 3. X-Direction Grid Spacing
 CARTES = T
 NX = 1
 XULAST =1.
 XFRAC(1)=1.
 ************************************************************
  Group 4. Y-Direction Grid Spacing
 NY = 200
 YVLAST =4.
 YFRAC(1)=5.0E-03 ;YFRAC(21)=0.105
 YFRAC(41)=0.205 ;YFRAC(61)=0.305
 YFRAC(81)=0.405 ;YFRAC(101)=0.505
 YFRAC(121)=0.605 ;YFRAC(141)=0.705
 YFRAC(161)=0.805 ;YFRAC(181)=0.905
 ************************************************************
  Group 5. Z-Direction Grid Spacing
 PARAB = F
 NZ = 1
 ZWLAST =12.5
 ZFRAC(1)=1.
 ************************************************************
  Group 6. Body-Fitted Coordinates
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
 ONEPHS = T
 NAME(1)=P1 ;NAME(5)=V1
 NAME(149)=NPOR ;NAME(150)=DEN1
    * Y in SOLUTN argument list denotes:
    * 1-stored 2-solved 3-whole-field
    * 4-point-by-point 5-explicit 6-harmonic averaging 
 SOLUTN(P1,Y,Y,N,N,N,Y)
 SOLUTN(V1,Y,Y,N,N,N,Y)
 SOLUTN(NPOR,Y,N,N,N,N,Y)
 SOLUTN(DEN1,Y,N,N,N,N,Y)
 DEN1 = 150
 EPOR = 0 ;HPOR = 0 ;NPOR = 149 ;VPOR = 0
 ************************************************************
  Group 8. Terms & Devices
    * Y in TERMS argument list denotes:
    * 1-built-in source 2-convection 3-diffusion 4-transient
    * 5-first phase variable 6-interphase transport         
 TERMS(P1,Y,Y,Y,N,Y,Y)
 TERMS(V1,Y,Y,Y,Y,Y,Y)
 DIFCUT =0.5 ;ZDIFAC =1.
 GALA = T ;ADDDIF = F
 ISOLX = -1 ;ISOLY = -1 ;ISOLZ = -1
 ************************************************************
  Group 9. Properties used if PRPS is not
  stored, and where PRPS = -1.0 if it is!
 RHO1 =1000. ;TMP1 =0. ;EL1 =0.
 TSURR =0. ;TEMP0 =0. ;PRESS0 =0.
 DVO1DT =0. ;DRH1DP =0.
 EMISS =0. ;SCATT =0.
 RADIA =0. ;RADIB =0.
 ENUL =1.0E-05 ;ENUT =0.
 PRNDTL(V1)=1.
 PRT(V1)=1.
 CP1 =1. ;CP2 =1.
 ************************************************************
  Group 10.Inter-Phase Transfer Processes
 ************************************************************
  Group 11.Initial field variables (PHIs)
 FIINIT(P1)=1.0E-10 ;FIINIT(V1)=1.0E-10
 FIINIT(NPOR)=0. ;FIINIT(DEN1)=1000.
 
 PATCH(DONINIT ,INIVAL, 1, 1, 1, 50, 1, 1, 1, 1)
 
 PATCH(RECINIT ,INIVAL, 1, 1, 101, 151, 1, 1, 1, 1)
 INIADD = F
 FSWEEP = 1
 NAMFI =CHAM
 ************************************************************
  Group 12. Patchwise adjustment of terms
  Patches for this group are printed with those
  for Group 13.
  Their names begin either with GP12 or &
 ************************************************************
  Group 13. Boundary & Special Sources
 
 PATCH(NPORDON ,CELL , 1, 1, 1, 99, 1, 1, 1, 1)
 
 PATCH(VPORDON ,CELL , 1, 1, 1, 100, 1, 1, 1, 1)
 
 PATCH(NPORREC ,CELL , 1, 1, 101, 200, 1, 1, 1, 1)
 
 PATCH(TOPD ,CELL , 1, 1, 100, 100, 1, 1, 1, 2500)
 COVAL(TOPD ,P1 ,1.0E+07 ,0. )
 
 PATCH(TOPR ,CELL , 1, 1, 200, 200, 1, 1, 1, 2500)
 COVAL(TOPR ,P1 , FIXVAL ,0. )
 
 PATCH(DONBOT ,CELL , 1, 1, 1, 1, 1, 1, 1, 2500)
 COVAL(DONBOT ,P1 ,In-Form:source - see Grp 19)
 
 PATCH(RECBOT ,OUTFLO, 1, 1, 101, 101, 1, 1, 1, 2500)
 COVAL(RECBOT ,P1 ,In-Form:source - see Grp 19)
 
 PATCH(GRAVITY ,VOLUME, 1, 1, 1, 200, 1, 1, 1, 2500)
 COVAL(GRAVITY ,V1 ,In-Form:source - see Grp 19)
 
 PATCH(DONCOL ,CELL , 1, 1, 1, 1, 1, 1, 1, 2500)
 
 PATCH(RECCOL ,CELL , 1, 1, 101, 101, 1, 1, 1, 2500)
 
 PATCH(COLUMND ,VOLUME, 1, 1, 1, 100, 1, 1, 1, 2500)
 
 PATCH(COLUMNR ,VOLUME, 1, 1, 101, 200, 1, 1, 1, 2500)
 XCYCLE = F
 EGWF = T
 WALLCO = GRND2
 ************************************************************
  Group 14. Downstream Pressure For PARAB
 ************************************************************
  Group 15. Terminate Sweeps
 LSWEEP = 10 ;ISWC1 = 1
 LITHYD = 1 ;LITFLX = 1 ;LITC = 1 ;ITHC1 = 1
 SELREF = T
 RESFAC =0.
 ************************************************************
  Group 16. Terminate Iterations
 LITER(P1)=20 ;LITER(V1)=10
 ENDIT(P1)=0. ;ENDIT(V1)=0.
 ************************************************************
  Group 17. Relaxation
 RELAX(P1,LINRLX,0.5)
 RELAX(V1,FALSDT,0.041413)
 RELAX(DEN1,LINRLX,1.)
 OVRRLX =0.
 EXPERT = F ;NNORSL = F
 ************************************************************
  Group 18. Limits
 VARMAX(P1)=1.0E+10 ;VARMIN(P1)=-1.0E+10
 VARMAX(V1)=1.0E+06 ;VARMIN(V1)=-1.0E+06
 VARMAX(NPOR)=1.0E+10 ;VARMIN(NPOR)=-1.0E+10
 VARMAX(DEN1)=1.0E+10 ;VARMIN(DEN1)=1.
 ************************************************************
  Group 19. Data transmitted to GROUND
 PARSOL = F
 ISG21 = 10
 ISG52 = 2
 ISG62 = 1
 SPEDAT(SET,INITIAL,NPOR!NPORDON,C,=0.35+(0.)*YV)
 SPEDAT(SET,INITIAL,VPOR!VPORDON,C,=0.35+(0.)*YV)
 SPEDAT(SET,INITIAL,NPOR!NPORREC,C,=0.7+0.*(YV-2.))
 SPEDAT(SET,INITIAL,VPOR!NPORREC,C,=0.7+0.*(YV-2.))
 SPEDAT(SET,SOURCE,R1!DONBOT,C,=COVAL(1.E7&9800.19043+(RHO1-1.0)*9$)
 SPEDAT(SET,SOURCE,R1!DONBOT,C,.81*0.5*0.25*SIN(2.51328*TIM)))
 SPEDAT(SET,SOURCE,R1!RECBOT,C,=COVAL(0.5&9800.19043+(RHO1-1.0)*9.$)
 SPEDAT(SET,SOURCE,R1!RECBOT,C,81*0.5*0.25*SIN(2.51328*TIM)))
 SPEDAT(SET,INITIAL,P1!DONINIT,C,=9800.19043*(1-(YG-YG[&1])/1.))
 SPEDAT(SET,INITIAL,P1!RECINIT,C,=9800.19043*(1-(YG-YG[&101])/1.))
 SPEDAT(SET,SOURCE,V1!GRAVITY,C,=COVAL(2.0E-10&-9.81*VPOR*(DEN1-1.$)
 SPEDAT(SET,SOURCE,V1!GRAVITY,C,0)))
 SPEDAT(SET,STORED,VDC!DONCOL,C,=V1[1&1]*NPOR/(0.35+(0.)*HOD)!ZSLFIN)
 SPEDAT(SET,MAKE,HND,C,=0)
 SPEDAT(SET,MAKE,HNR,C,=0)
 SPEDAT(SET,MAKE,HOD,C,=0)
 SPEDAT(SET,MAKE,HOR,C,=0)
 SPEDAT(SET,MAKE,VDC,C,=0)
 SPEDAT(SET,MAKE,VRC,C,=0)
 SPEDAT(SET,MAKE,DHWL,C,=0)
 SPEDAT(SET,MAKE,HDMX,C,=0)
 SPEDAT(SET,MAKE,HRMX,C,=0)
 SPEDAT(SET,MAKE,PBOT,C,=0)
 SPEDAT(SET,STORED,VRC!RECCOL,C,=V1[1&100+1]*NPOR/(0.7+0.*HOR)!ZSL$)
 SPEDAT(SET,STORED,VRC!RECCOL,C,FIN)
 SPEDAT(SET,STORED,HOD,C,=1.!TSTSTR!IF(ISTEP.EQ.1))
 SPEDAT(SET,STORED,HOD,C,=HND!TSTSTR!IF(ISTEP.GT.1))
 SPEDAT(SET,STORED,HOR,C,=1.!TSTSTR!IF(ISTEP.EQ.1))
 SPEDAT(SET,STORED,HOR,C,=HNR!TSTSTR!IF(ISTEP.GT.1))
 SPEDAT(SET,STORED,HND,C,=HOD+VDC*DT!ZSLFIN)
 SPEDAT(SET,STORED,HNR,C,=HOR+VRC*DT!ZSLFIN)
 SPEDAT(SET,STORED,PBOT,C,=9800.19043!ZSLFIN)
 SPEDAT(SET,STORED,HND,C,=MIN(2.&HOD+VDC*DT)!TSTFIN)
 SPEDAT(SET,STORED,HNR,C,=HOR+VRC*DT!TSTFIN)
 SPEDAT(SET,STORED,DHWL,C,=MAX(0&HND-MAX(1.25&HNR))!TSTFIN)
 SPEDAT(SET,STORED,HND,C,=HND-DHWL!TSTFIN)
 SPEDAT(SET,STORED,HNR,C,=HNR+DHWL*0.5*(2*0.35+(0.)*(HND+1.25))/(0$)
 SPEDAT(SET,STORED,HNR,C,.7+0.*HNR)!TSTFIN)
 SPEDAT(SET,STORED,HRMX,C,=MAX(HNR&HRMX)!TSTFIN)
 SPEDAT(SET,STORED,HDMX,C,=MAX(HND&HDMX)!TSTFIN)
 SPEDAT(SET,MAKE,SPIL,C,=0)
 SPEDAT(SET,MAKE,RATE,C,=0)
 SPEDAT(SET,STORED,SPIL,C,=SPIL+DHWL*4375.!TSTFIN)
 SPEDAT(SET,STORED,RATE,C,=SPIL/TIM!TSTFIN)
 SPEDAT(SET,PROPERTY,RHO1!COLUMND,C,=1.0!IF(YG.GT.HND))
 SPEDAT(SET,PROPERTY,RHO1!COLUMNR,C,=1.0!IF(YG.GT.HNR+2.))
 SPEDAT(SET,PRINT,RATE,C,=RATE)
 SPEDAT(SET,PRINT,HDMX,C,=HDMX)
 SPEDAT(SET,PRINT,HRMX,C,=HRMX)
 SPEDAT(SET,PRINT,HND!P,C,=HND)
 SPEDAT(SET,PRINT,HNR!P2,C,=HNR)
 SPEDAT(SET,PRINT,DHWL!Q,C,=DHWL)
 SPEDAT(SET,PRINT,SPIL!Q2,C,=SPIL)
 SPEDAT(SET,GXMONI,PLOTALL,L,T)
 ************************************************************
  Group 20. Preliminary Printout
 ************************************************************
  Group 21. Print-out of Variables
 INIFLD = T ;SUBWGR = F
    * Y in OUTPUT argument list denotes:
    * 1-field 2-correction-eq. monitor 3-selective dumping      
    * 4-whole-field residual 5-spot-value table 6-residual table
 OUTPUT(P1,Y,N,N,Y,Y,Y)
 OUTPUT(V1,Y,N,N,Y,Y,Y)
 OUTPUT(NPOR,Y,N,N,N,N,N)
 OUTPUT(DEN1,Y,N,Y,N,N,N)
 ************************************************************
  Group 22. Monitor Print-Out
 IXMON = 1 ;IYMON = 3 ;IZMON = 1
 NPRMON = 100000 ;NPRMNT = 1 ;TSTSWP = -1
 UWATCH = T ;USTEER = T
 HIGHLO = F
 ************************************************************
  Group 23.Field Print-Out & Plot Control
 NPRINT = 100000 ;NUMCLS = 5
 NTPRIN = 250 ;ISTPRF = 1 ;ISTPRL = 100000
 NYPRIN = 20 ;IYPRF = 1 ;IYPRL = 10000
 IPLTF = 1 ;IPLTL = -1 ;NPLT = -1
 ISWPRF = 1 ;ISWPRL = 100000
 ITABL = 3 ;IPROF = 1
 ABSIZ =0.5 ;ORSIZ =0.2
 NTZPRF = 1 ;NCOLPF = 50
 ICHR = 2 ;NCOLCO = 45 ;NROWCO = 20
 
 PATCH(P ,PROFIL, 1, 1, 1, 1, 1, 1, 1, 2500)
 
 PATCH(P2 ,PROFIL, 1, 1, 101, 101, 1, 1, 1, 2500)
 
 PATCH(Q ,PROFIL, 1, 1, 1, 1, 1, 1, 1, 2500)
 
 PATCH(Q2 ,PROFIL, 1, 1, 101, 101, 1, 1, 1, 2500)
 
 PATCH(DONBOTTM,PROFIL, 1, 1, 1, 1, 1, 1, 1, 2500)
 PLOT(DONBOTTM,P1 ,0. ,0. )
 PLOT(DONBOTTM,V1 ,0. ,0. )
 
 PATCH(RECBOTTM,PROFIL, 1, 1, 101, 101, 1, 1, 1, 2500)
 PLOT(RECBOTTM,P1 ,0. ,0. )
 ************************************************************
  Group 24. Dumps For Restarts
 SAVE = T ;NOWIPE = F
 NSAVE =CHAM
 IDISPA = 1 ;IDISPB = 0 ;IDISPC = 0
STOP