GROUP 1. Run title and other preliminaries
TEXT(Rigid-Surface Flow, 3D Incompress 
TITLE
  DISPLAY
  The submarine part of a floating body sits in the domain of
  integration, which extends from the water surface to the bottom.
  The z coordinate is vertically downwards. The water flows in the
  positive x-direction around, & under the body. In this first case
  the flow is treated as incompressible, to contrast with the
  following case in which compressibility is introduced throughout
  the domain so as to simulate the surface waves. The model cases
  are subsequently refined in various ways.
    The results of the calculations resulting from the inputs
  in this and subsequent cases in this section, together with
  background information are in the paper entitled 'The Computation
  of Flow around Ships with Allowance for Free-Surface and
  Density-Gradient Effects' by D Brian Spalding in the
  Proceedings of the First Intercontinental Symposium on
  Maritime Simulation (June 1985).
  ENDDIS
REAL(CON);CON=1.0E+06
 
    GROUP 3. X-direction grid specification
NREGX=3
IREGX=1; GRDPWR(X,3,3.0,1.0)
IREGX=2; GRDPWR(X,4,4.0,1.0)
IREGX=3; GRDPWR(X,8,8.0,1.0)
 
    GROUP 4. Y-direction grid specification
NREGY=2
IREGY=1; GRDPWR(Y,2,1.0,1.0)
IREGY=2; GRDPWR(Y,8,4.0,1.0)
 
    GROUP 5. Z-direction grid specification
NREGZ=2
IREGZ=1; GRDPWR(Z,2,1.0,1.0)
IREGZ=2; GRDPWR(Z,3,1.5,1.0)
 
    GROUP 7. Variables stored, solved & named
solve(p1,u1,v1,w1)
SOLUTN(P1,Y,Y,Y,N,N,N);SOLUTN(U1,Y,Y,N,Y,N,Y)
SOLUTN(V1,Y,Y,N,Y,N,Y);SOLUTN(W1,Y,Y,N,Y,N,Y)
STORE(RHO1)
 
    GROUP 9. Properties of the medium (or media)
RHO2=1.0
RHO1=COMPRESS;RHO1A=CON**-5;PRESS0=CON;RHO1B=5;RHO1C=0.0
DRH1DP=COMPRESS
 
    GROUP 11. Initialization of variable or porosity fields
FIINIT(U1)=1.0;FIINIT(V1)=0.0;FIINIT(W1)=0.0
FIINIT(P1)=0.0;FIINIT(RHO1)=1.0
CONPOR(BODY,0.0,VOLUME,#2,#2,#1,#1,#1,#1)
 
    GROUP 13. Boundary conditions and special sources
  ** Upstream boundary
INLET(UPSTRM,WEST,#1,#1,#1,#NREGY,#1,#NREGZ,1,1)
VALUE(UPSTRM,P1,1.0);VALUE(UPSTRM,U1,1.0)
  ** Downstream boundary
PATCH(DWNSTRM,EAST,#NREGX,#NREGX,#1,#NREGY,#1,#NREGZ,1,1)
COVAL(DWNSTRM,P1,FIXVAL,0.0)
COVAL(DWNSTRM,U1,ONLYMS,0.0);COVAL(DWNSTRM,V1,ONLYMS,0.0)
COVAL(DWNSTRM,W1,ONLYMS,0.0)
 
    GROUP 15. Termination of sweeps
LSWEEP=25;RESREF(P1)=1.E-06
RESREF(U1)=1.E-3;RESREF(V1)=1.E-3;RESREF(W1)=1.E-3
 
    GROUP 16. Termination of iterations
LITER(P1)=-20
 
    GROUP 17. Under-relaxation devices
RELAX(U1,FALSDT,1.0);RELAX(V1,FALSDT,1.0);RELAX(W1,FALSDT,1.0)
 
    GROUP 18. Limits on variables or increments to them
VARMAX(RHO1)=2.0;VARMIN(RHO1)=0.5
VARMIN(W1)=-1.E11;VARMAX(W1)=2.0E-3
 
    GROUP 22. Spot-value print-out
IXMON=5;IYMON=5;IZMON=1;IPLTL=100;NPLT=1
 
    GROUP 23. Field print-out and plot control
IYPRL=10;NXPRIN=1;IXPRL=15;NZPRIN=1;IZPRL=1
  ** Print out flow field values in X-Z plane
PATCH(CONT1,CONTUR,1,NX,1,NY,1,1,1,1);PLOT(CONT1,P1,0.0,50.0)
PATCH(PROF1,PROFIL,NX/3,NX/3,1,NY,1,1,1,1)
PLOT(PROF1,U1,-0.5,1.5);PLOT(PROF1,P1,-0.5,1.0)
PATCH(PROF2,PROFIL,NX/5,NX/5,1,NY,1,1,1,1)
PLOT(PROF2,U1,-0.5,1.5);PLOT(PROF2,P1,-0.5,1.0)
PATCH(PROF3,PROFIL,8,8,1,NY,1,1,1,1)
PLOT(PROF3,U1,-0.5,1.5);PLOT(PROF3,P1,-0.5,1.0)