GROUP 1. Run title and other preliminaries
TEXT(2S K-E MODEL_1D DEVELOPED PIPE FLOW:T401
TITLE
  DISPLAY
  The case considered is fully-developed turbulent flow in a
  circular pipe at a Reynolds number of 1.E5. Calculations are made
  with both the standard 2-scale k-e turbulence model. For this
  case, both models produce very similar results.
  ENDDIS
CHAR(CTURB)
MESG( Enter the required turbulence model:
MESG(  KE   - Standard k-e model
MESG(  TSKE - 2-scale  k-e model (default)
MESG(
READVDU(CTURB,CHAR,TSKE)
REAL(DELT,US);BOOLEAN(TSKE)
REAL(DIAM,WIN,REY,TKEIN,EPSIN,MIXL,FRIC,DPDZ,MASIN,DTF)
DIAM=0.1;WIN=1.0; REY=1.E5;FRIC=1./(1.82*LOG10(REY)-1.64)**2
DPDZ=FRIC*RHO1*WIN*WIN/(2.*DIAM);US=WIN*(FRIC/8.)**0.5
US
TKEIN=0.25*WIN*WIN*FRIC
MIXL=0.09*0.5*DIAM;EPSIN=TKEIN**1.5/MIXL*0.1643
    GROUP 3. X-direction grid specification
CARTES=F;XULAST=0.1
    GROUP 4. Y-direction grid specification
ENUL=WIN*DIAM/REY;DELT=2.*40.*ENUL/US
NREGY=2; REGEXT(Y,0.5*DIAM)
IREGY=1;GRDPWR(Y,29,0.5*DIAM-DELT,0.8)
IREGY=2;GRDPWR(Y,1,DELT,1.0)
    GROUP 5. Z-direction grid specification
ZWLAST=0.1*DIAM
    GROUP 7. Variables stored, solved & named
SOLVE(W1);STORE(ENUT,LEN1,GENK)
CASE :CTURB: OF
WHEN TSKE,4
+ MESG(2-scale k-e turbulence model
  ** also store kt/kp & et/ep
+ TURMOD(TSKEMO);STORE(KTKP,ETEP);TSKE=T
WHEN KE,2
+ MESG(Standard k-e turbulence model
+ TURMOD(KEMODL);KELIN=1;TSKE=F
ENDCASE
    GROUP 8. Terms (in differential equations) & devices
  ** deactivate convection terms
TERMS(W1,N,N,P,P,P,P);TERMS(EP,Y,N,P,P,P,P)
IF(TSKE) THEN
+ TERMS(KP,Y,N,P,P,P,P)
+ TERMS(KT,Y,N,P,P,P,P);TERMS(ET,Y,N,P,P,P,P)
ELSE
+ TERMS(KE,Y,N,P,P,P,P)
ENDIF
    GROUP 11. Initialization of variable or porosity fields
FIINIT(W1)=WIN;FIINIT(EP)=EPSIN;FIINIT(KE)=TKEIN
IF(TSKE) THEN
+ REAL(KTDKP);KTDKP=0.25
+ FIINIT(ET)=EPSIN;FIINIT(KP)=TKEIN/(1.+KTDKP)
+ FIINIT(KT)=KTDKP*FIINIT(KP)
ENDIF
    GROUP 13. Boundary conditions and special sources
WALL(WALLN,NORTH,1,1,NY,NY,1,NZ,1,1)
PATCH(PFORW,VOLUME,1,1,1,NY,1,NZ,1,1)
COVAL(PFORW,W1,FIXFLU,DPDZ)
    GROUP 15. Termination of sweeps
LSWEEP=50;TSTSWP=-1;LITHYD=10
    GROUP 16. Termination of iterations
MASIN=RHO1*WIN*DIAM*DIAM/80.
    GROUP 17. Under-relaxation devices
DTF=15.*ZWLAST/WIN;VARMIN(W1)=1.E-10;WALPRN=T
    GROUP 22. Spot-value print-out
IYMON=NY-2;ITABL=3;NPLT=2;NZPRIN=1;NYPRIN=1;IYPRF=1
    GROUP 24. Dumps for restarts
RELAX(W1,FALSDT,DTF); RELAX(EP,FALSDT,DTF)
IF(TSKE) THEN
+ RESFAC=1.E-4; RELAX(KP,FALSDT,DTF); RELAX(EP,FALSDT,DTF)
+ RELAX(KT,FALSDT,DTF); RELAX(ET,FALSDT,DTF)
ELSE
+ RELAX(KE,FALSDT,DTF)
ENDIF