PHOTON USE
  p;;;;
 
  GR OU Z 1
  msg    VISCOUS FLOW IN A S-SHAPED DUCT
  MSG    ---   FLOW DOMAIN   ---
  MSG Press RETURN to plot velocity vectors
  PAUSE;RED
  VEC Z 1 SH
  MSG Press E to end
  ENDUSE
 ************************************************************
  Group 1. Run Title
TEXT(Viscous flow in a S-shaped duct     :563
TITLE
 ************************************************************
  Group 6. Body-Fitted coordinates
REAL(REYNO,WIN,DIAM)
DIAM=.3;WIN=10.0
BFC=T;NONORT=T
REAL(L1,L2,L3,RAD1,RAD2);INTEGER(NZ1,NZ2,NZ3,NZ4,NZ5,IZ1,IZ2)
DIAM=0.03; L1=0.1; L2=0.1; L3=0.1
RAD1=.02 ; RAD2=.02
NZ1=6; NZ2=10; NZ3=6; NZ4=5; NZ5=6
NX=NZ1+NZ2+NZ3+NZ4+NZ5
GSET(D,NX,8,1,L1+L2+L3+RAD1+RAD2,DIAM,.1)
IZ2=NZ1+1
GSET(C,I:IZ2:,F,I1,+,L1,0,0,INC,-1.5)
IZ1=IZ2;IZ2=IZ1+NZ2
GSET(C,I:IZ2:,F,I:IZ1:,RZ,3.14159,L1,DIAM+RAD1,INC,1)
IZ1=IZ2;IZ2=IZ1+NZ3
GSET(C,I:IZ2:,F,I:IZ1:,+,-L2,0,0,INC,S1.5)
IZ1=IZ2;IZ2=IZ1+NZ4
GSET(C,I:IZ2:,F,I:IZ1:,RZ,-3.14159/2,L1-L2,2*(DIAM+RAD1)+RAD2,INC,1)
IZ1=IZ2;IZ2=IZ1+NZ5
GSET(C,I:IZ2:,F,I:IZ1:,+,0,L3,0,INC,1.5)
 ************************************************************
  Group 7. Variables: STOREd,SOLVEd,NAMEd
SOLVE(P1,V1,U1);SOLUTN(P1,Y,Y,Y,N,N,N)
 ************************************************************
  Group 9. Properties
ENUL=1.25E-2; REYNO=ENUL*WIN/DIAM; RHO1=0.5
 ************************************************************
  Group 11.Initialise Var/Porosity Fields
FIINIT(U1)=WIN
 ************************************************************
  Group 13. Boundary & Special Sources
INLET(INLET,WEST,1,1,1,NY,1,1,1,1)
VALUE(INLET,P1,RHO1*WIN); VALUE(INLET,U1,WIN)
PATCH(OUTLET,EAST,NX,NX,1,NY,1,1,1,1)
COVAL(OUTLET,P1,1000.,0.0)
COVAL(OUTLET,V1,ONLYMS,0.0);COVAL(OUTLET,U1,ONLYMS,0.0)
WALL(TOP1,NORTH,1,NZ1+NZ2,NY,NY,1,1,1,1)
WALL(TOP2,NORTH,NZ1+NZ2+NZ3+1,NX,NY,NY,1,1,1,1)
WALL(BOT1,SOUTH,1,NZ1+NZ2,1,1,1,1,1,1)
WALL(BOT2,SOUTH,NZ1+NZ2+NZ3+1,NX,1,1,1,1,1,1)
 ************************************************************
  Group 15. Terminate Sweeps
LSWEEP  =      35; RESFAC  = 1.000E-02; TSTSWP=-1
 ************************************************************
  Group 17. Relaxation
RELAX(P1,LINRLX,0.7)
REAL(DTF,FAC)
DTF=L1/WIN/NZ1; FAC=.1
RELAX(V1,FALSDT,FAC*DTF);RELAX(U1,FALSDT,FAC*DTF)
 ************************************************************
  Group 22. Monitor Print-Out
IYMON=NY/2; IXMON=NZ1+NZ2+NZ3+2