file name 2-branch.q1
  photon use
  p
 
 
 
  gr z 1
  msg velocity vectors
  vec z 1 sh
  pause
  msg pressure contours
  con p1 z 1 x 2 11 y 1 10 fi;0.001
  con p1 z 1 x 2 11 y 11 13 fi;0.001
  con p1 z 1 x 2 11 y 14 m fi;0.001
  pause
  con off
  red
  msg temperature contours
  con temp z 1 x 2 11 y 1 10 fi;0.001
  con temp z 1 x 2 11 y 11 13 fi;0.001
  con temp z 1 x 2 11 y 14 m fi;0.001
  vec z 1
  enduse
  DISPLAY
 
  This case tests the "link" procedure in the x-y plane.
  The geometry and boundary conditions are as shown:
 
                 |---------------------|
                 | this       nysec2   !
                 | /                   |
                 /---------------------|
               / | nysec1  this------\ |
             /   |                    \|
           /     |---------------------\
  -------/-------|                     |\
  out  / nysec2  |                     |-\-------------------|
  <---           | nymain              | nysec1              |-> out
  ---------------|                     |   \- becomes this   |
                 |         ^     iy1   |---------------------|
                 |       inflow        |        nx
                 |---------|-----------|
                         nx
  ENDDIS
mesg(Press RETURN to continue
READVDU(NX,INT,1)
      GROUP 1. Run title and other preliminaries
TEXT(Duct With 2 Side Branches;XYplane 
TITLE
REAL(XLENGTH,YLENGTH,ZLENGTH)
INTEGER(NXNOM,ISHFT1,ishft2,IYPLUS,IYBOT)
INTEGER(NYMAIN,NYSEC1,IYL1,NYSEC2,IYL2)
XLENGTH=1.0;YLENGTH=1.0;ZLENGTH=1.0
NXNOM=10;NZ=1
NYMAIN=10;NYSEC1=3;NYSEC2=3
IYL1=4;IYL2=4
IYL1=2;IYL2=6
NY=NYMAIN + NYSEC1 + NYSEC2
NPHI=20
NX=NXNOM+2
  link1 is at large x
ISHFT1 = -(NX-2)*NY + NYMAIN + 1 - IYL1
  link2 is at small x
ISHFT2 = (NX-2)*NY + NYMAIN + NYSEC1 + 1 - IYL2
ISHFT1
ISHFT2
DELAY(500)
    GROUP 3. X-direction grid specification
   **Domain is XLENGTH m long in x-direction, with equal intervals
XULAST=XLENGTH
  dummy link cells are made thin for print-out purposes
XFRAC(1)=-1
XFRAC(2)=0.01/NXNOM
XFRAC(3)=NXNOM
XFRAC(4)=1/NXNOM
XFRAC(5)=1
XFRAC(6)=XFRAC(2)
    GROUP 4. Y-direction grid specification
   **Domain is YLENGTH m long in y-direction, with equal intervals
GRDPWR(Y,NY,YLENGTH,1.0)
    GROUP 5. Z-direction grid specification
   **Domain is ZLENGTH m long in z-direction, with equal intervals
GRDPWR(Z,NZ,ZLENGTH,1.0)
    GROUP 7. Variables stored, solved & named
SOLUTN(H1,Y,Y,Y,N,N,N);NAME(H1)=TEMP
SOLVE(P1,U1,V1);SOLUTN(P1,Y,Y,Y,N,N,N)
    GROUP 8. Terms (in differential equations) & devices
   **For pure conduction, cut out built-in source and convection
     terms
TERMS(TEMP,N,N,Y,N,Y,Y)
    GROUP 9. Properties of the medium (or media)
   **Thermal conductivity will be ENUL*RHO1/PRNDTL(TEMP), so :
ENUL=1.0e-3;PRNDTL(TEMP)=1.0e-5
    GROUP 11. Initialization of variable or porosity fields
INIADD=F
    GROUP 13. Boundary conditions and special sources
   ** Cold inflow boundary on the bottom
PATCH(COLD,south,2,NX-1,1,1,1,1,1,1)
COVAL(COLD,TEMP,fixval,-0.9)
COVAL(COLD,P1,FIXFLU,1.0)
   ** hot outflow boundary on the right of branch1
PATCH(HOT1,CELL,nx,nx,nymain+1,NYmain+nysec1,NZ,NZ,1,1)
COVAL(HOT1,TEMP,fixval,0.9)
COVAL(HOT1,P1,1.E-2,0.0)
   ** hot outflow boundary on the left of branch2
PATCH(HOT2,CELL,1,1,nymain+nysec1+1,NY,NZ,NZ,1,1)
COVAL(HOT2,TEMP,fixval,0.9)
COVAL(HOT2,P1,1.E-2,0.0)
   ** the link patches
PATCH(+1m,EAST,NX,NX,iyl1,iyl1+nysec1-1,1,1,1,1)
COVAL(+1m,TEMP,fixval,ishft1)
COVAL(+1m,P1,fixval,ishft1)
COVAL(+1m,P1,fixp,ishft1)
COVAL(+1m,V1,fixval,ishft1)
PATCH(+1s, WEST,1,1,nymain+1,nymain+nysec1,1,1,1,1)
COVAL(+1s,TEMP,fixval,-ishft1)
COVAL(+1s,P1,fixval,-ishft1)
COVAL(+1s,P1,fixp,-ishft1)
COVAL(+1s,V1,fixval,-ishft1)
   ** the link patches
PATCH(+2m,WEST,1,1,iyl2,iyl2+nysec2-1,1,1,1,1)
COVAL(+2m,TEMP,fixval,ishft2)
COVAL(+2m,P1,fixval,ishft2)
COVAL(+2m,P1,fixp,ishft2)
COVAL(+2m,V1,fixval,ishft2)
PATCH(+2s,EAST,nx,nx,nymain+nysec2+1,NY,1,1,1,1)
COVAL(+2s,TEMP,fixval,-ishft2)
COVAL(+2s,P1,fixval,-ishft2)
COVAL(+2s,P1,fixp,-ishft2)
COVAL(+2s,V1,fixval,-ishft2)
   ** the barrier between the main and first secondary domains
PATCH(FENCE1,north,1,nx,nymain,nymain,1,1,1,1)
COVAL(FENCE1,V1,fixval,0.0)
PATCH(GP12DFN1,NORTH,1,nx,nymain,nymain,1,1,1,1)
COVAL(GP12DFN1,TEMP,0.0,0.0)
   ** the barrier between the first and second secondary domains
PATCH(FENCE2,north,1,nx,nymain+nysec1,nymain+nysec1,1,1,1,1)
COVAL(FENCE2,V1,fixval,0.0)
PATCH(GP12DFN2,NORTH,1,nx,nymain+nysec1,nymain+nysec1,1,1,1,1)
COVAL(GP12DFN2,TEMP,0.0,0.0)
    GROUP 15. Termination of sweeps
LSWEEP=20
    GROUP 16. Termination of iterations
  ** Set the frequencies of application of the one-dimensional
     correction features in the linear-equation solver to once
     per iteration for each direction.
ISOLY=1
LITER(TEMP)=10;LITER(P1)=100
LITER(u1)=10;LITER(v1)=10
    GROUP 21. Print-out of variables
   **Print fields of temperature
OUTPUT(TEMP,Y,Y,Y,Y,Y,Y)
    GROUP 22. Spot-value print-out
IYMON=NY/2+1;IZMON=NZ/2+1;IXMON=NX-1;ITABL=1
    GROUP 23. Field print-out and plot control
IXPRF=NXNOM/2;IXPRL=NXNOM/2+4
    GROUP 24. Dumps for restarts
NPLT=1;TSTSWP=-1
LSWEEP=200
SELREF=T;RESFAC=1.E-5
IF(NY.EQ.1) THEN
 SOLUTN(V1,N,N,N,N,N,N);OUTPUT(V1,N,N,N,N,N,N)
ENDIF
NXPRIN=1;NYPRIN=1;IXPRF=1;IXPRL=NX
LSWEEP=100;RELAX(TEMP,LINRLX,0.5)
PATCH(POROUS,VOLUME,1,NX,1,NY,1,NZ,1,1)
COVAL(POROUS,U1,1.0E3,0.0)
COVAL(POROUS,V1,1.0E3,0.0)
FIINIT(U1)=0.0;FIINIT(V1)=0.0;FIINIT(P1)=1.0