GROUP 1. Run title and other preliminaries
TEXT(LAM-BRE K-E TURB. FLOW IN U-DUCT   :T214
TITLE
  DISPLAY
  This case concerns plane, 2d incompressible flow through a 180
  degree turnaround duct. The flow exhibits large streamline
  curvature together with flow separation near the bend exit next
  to the inner surface of the duct.
 
  Calculations are made with the low-Re k-e model of Lam and
  Bremhorst. Consequently, the numerical integration is taken down
  to the wall. The calculations employ a non-uniform mesh of NY=60
  and NZ=80, for which the solution is not as yet grid independent.
  The calculation may also be performed with the modified low-Re
  k-e model of Chen and Kim [1987,1990].
 
  The fine-mesh calculation employs a relatively coarse non-uniform
  mesh of NY=60 by NZ=80 which concentrates grid cells close to the
  wall. About 2000 sweeps are required for a converged solution with
  this mesh. However, for speed of computation the calculation is
  performed on a coarse mesh of NY=20 by NZ=40. Consequently, the
  solution is unlikely to be of sufficient quality because most of
  the near-wall cells are located too far from the wall for laminar
  conditions to apply on KE and EP. PHOENICS will actually activate
  log-law wall functions for velocities if the near-wall point lies
  outside the viscous sublayer. For demonstration purposes the
  calculation is set up for 20 sweeps, but 200 sweeps are required
  for complete convergence.
  ENDDIS
 
   PHOTON USE
   p
 
 
 
 
 
   view x
   gr ou x 1
   msg velocity vectors
   vec x 1 sh
   msg press  to continue
   pause
   vec off; redr
   msg contours of w velocity resolutes
   con w1 x 1 fi;0.1
   msg press  to continue
   pause
   con del; redr
   msg contours of turbulence energy
   con ke x 1 fi;0.1
   msg Press  and then  to END
   pause
 
   ENDUSE
 
 
    GROUP 1. Run title
BOOLEAN(FINEG,CHENKIM);FINEG=F;CHENKIM=F
REAL(REYNO,WIN,TKEIN,EPSIN,WIDTH,LENGTH,YAXIS)
REYNO=1.E5;WIDTH=.0381;WIN=26.25;YAXIS=1.5*WIDTH;LENGTH=3.5*WIDTH
    GROUP 6. Body-fitted coordinates or grid distortion
BFC=T;NONORT=T;NX=1
IF(FINEG) THEN
+ NY=60;NZ=80
ELSE
+ NY=20;NZ=40
ENDIF
GSET(D,NX,NY,NZ,1.0,WIDTH,LENGTH)
GSET(P,A,0.0,0.0,LENGTH);GSET(P,B,0.0,WIDTH,LENGTH)
GSET(P,C,1.0,0.0,LENGTH);GSET(P,D,1.0,WIDTH,LENGTH)
GSET(L,LAB,A,B,NY,S2.0);GSET(L,LBD,B,D,NX,1.0)
GSET(L,LCD,C,D,NY,S2.0);GSET(L,LCA,C,A,NX,1.0)
GSET(F,FABCD,A,-,B,-,D,-,C,-)
GSET(M,FABCD,+J+I,1,1,1,TRANS)
IF(FINEG) THEN
+ GSET(C,K81,F,K1,+,0.0,0.0,0.0)
+ GSET(C,K81,F,K81,+,0.0,(YAXIS+0.5*WIDTH),0.0)
  ** k81-k51 cells in the outlet length
+ GSET(C,K51,F,K81,+,0.0,0.0,-LENGTH,INC,0.8)
  ** k51-k21 cells in the bend
+ GSET(C,K21,F,K51,RX,-3.14159,YAXIS,0.0,INC,1.0)
  ** k21-k1 cells in the inlet length
+ GSET(C,K1,F,K21,+,0.0,0.0,LENGTH,INC,1.2)
ELSE
+ GSET(C,K41,F,K1,+,0.0,0.0,0.0)
+ GSET(C,K41,F,K41,+,0.0,(YAXIS+0.5*WIDTH),0.0)
  ** k41-k31 cells in the outlet length
+ GSET(C,K31,F,K41,+,0.0,0.0,-LENGTH,INC,0.8)
  ** k31-k11 cells in the bend
+ GSET(C,K11,F,K31,RX,-3.14159,YAXIS,0.0,INC,1.0)
  ** k11-k1 cells in the inlet length
+ GSET(C,K1,F,K11,+,0.0,0.0,LENGTH,INC,1.2)
ENDIF
   ** Set wup=t to account better for the high curvature of
      the w resolute...
WUP=T
    GROUP 7. Variables stored, solved & named
SOLVE(P1,V1,W1);SOLUTN(P1,Y,Y,Y,N,N,N)
IF(CHENKIM) THEN
+ TURMOD(KECHEN-LOWRE)
ELSE
+ TURMOD(KEMODL-LOWRE)
ENDIF
STORE(ENUT,LEN1);KELIN=1
    GROUP 8. Terms (in differential equations) & devices
    GROUP 9. Properties of the medium (or media)
ENUL=WIN*WIDTH/REYNO
    GROUP 11. Initialization of variable or porosity fields
FIINIT(P1)=1.E-10;FIINIT(W1)=WIN
TKEIN=(0.05*WIN)**2;EPSIN=TKEIN**1.5*0.1643/(0.09*WIDTH)
     ** Initial values
FIINIT(KE)=TKEIN;FIINIT(EP)=EPSIN
    GROUP 13. Boundary conditions and special sources
INLET(BFCIN,LOW,#1,#1,#1,#NREGY,#1,#1,1,1)
VALUE(BFCIN,P1,GRND1);VALUE(BFCIN,W1,GRND1)
VALUE(BFCIN,WCRT,-WIN);VALUE(BFCIN,KE,TKEIN)
VALUE(BFCIN,EP,EPSIN)
  *  Transfer density for GXBFC subroutine
BFCA=RHO1
PATCH(OUTLET,HIGH,#1,#1,#1,#NREGY,#NREGZ,#NREGZ,1,1)
COVAL(OUTLET,P1,1.E4,0.0)
COVAL(OUTLET,V1,ONLYMS,0.0);COVAL(OUTLET,W1,ONLYMS,0.0)
  **    N-wall
WALL(WFNN,NORTH,1,NX,NY,NY,1,NZ,1,1)
  **    S2-wall
WALL(WFNS,SOUTH,1,NX,1,1,1,NZ,1,1)
    GROUP 15. Termination of sweeps
LSWEEP=20; REAL(MASIN,DTF);MASIN=WIDTH*WIN*RHO1
RESREF(P1)=1.E-12*MASIN
RESREF(W1)=RESREF(P1)*WIN; RESREF(V1)=RESREF(W1)
RESREF(KE)=RESREF(P1)*TKEIN; RESREF(EP)=RESREF(P1)*EPSIN
    GROUP 16. Termination of iterations
LITER(P1)=10
    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,0.5);DTF=ZWLAST/WIN/NZ
IF(.NOT.FINEG) THEN
+ DTF=10.*DTF
ENDIF
RELAX(W1,FALSDT,DTF); RELAX(V1,FALSDT,DTF)
RELAX(KE,FALSDT,DTF); RELAX(EP,FALSDT,DTF)
    GROUP 22. Spot-value print-out
IYMON=2;IZMON=NZ/2;NPRMON=LSWEEP
    GROUP 23. Field print-out and plot control
NPRINT=LSWEEP;ITABL=2;NPLT=10;NYPRIN=2;NZPRIN=10
TSTSWP=-1;YPLS=T