photon use
p
p1

msg the 40*40*625 computational grid
msg the 625-cell direction is normal to the screen
gr z 1;  pause;  gr off;  red
gr ou z 1
msg Upstream smoke injection region and smoke contours
gr z 1 x 18 23 y 18 23
con h1 z 1 fi;0.1
pause
p
p2

msg Smoke contours 1/5 of distance along tunnel
con h1 z 1 fi;0.1
pause
p
p3

msg Smoke contours 2/5 of distance along tunnel
con h1 z 1 fi;0.1
pause
p
p4

msg Smoke contours 3/5 of distance along tunnel
con h1 z 1 fi;0.1
pause
p
p5

msg Smoke contours 4/5 of distance along tunnel
con h1 z 1 fi;0.1
pause
p
phi

msg Smoke contours 5/5 of distance along tunnel
con h1 z 1 fi;0.1
pause;con off;red
msg contours of longitudinal velocity at tunnel exit
con w1 z 1 fi;0.1
pause
con off
red
msg velocity vectors at the tunnel exit
set vec ref 0.1
vec z 1 sh
enduse

GROUP 1. Run title and other preliminaries
TITLE
DISPLAY
This case shows how the parabolic option can be enployed with
advantage for fine-grid calculations on machines of modest size.

The problem concerns the way in which a smoke plume rises as
it is carried within a wind-tunnel having an imposed shear-flow
velocity profile at inlet.

The cross-stream grid is 40 * 40, and there are 625 z-direction
intervals, so that one million cells feature in the calculation.

The calculation is rather lengthy, but a tolerably good answer
can be obtained by halving the grid fineness in every direction
and reducing the number of iterations.

Also, since the flow is symmetrical, only one half needs to be
simulated; but both halves are simulated so as to demonstrate that
a truly symmetrical solution is indeed arrived at.
ENDDIS
NX=40;NY=40;NZ=625
nx
ny
nz
mesg(nx*ny*nz=:nx*ny*nz: Use coarser grid? (Y/n)
if(:ans:.eq.y) then
nx=20;ny=20;nz=300
nx
ny
nz
endif
TEXT(Buoyant Plume in tunnel, :nx*ny*nz: Cells
GROUP 3. X-direction grid specification
GRDPWR(X,NX,1.5,1.0)
GROUP 4. Y-direction grid specification
** Set a symmetrical grid as in GROUP 3
GRDPWR(Y,NY,1.0,1.0)
GROUP 5. Z-direction grid specification
PARAB=T;ZFRAC(1)=-NZ;ZFRAC(2)=1/NZ;ZWLAST=YVLAST*NZ/NY
GROUP 7. Variables stored, solved & named
SOLVE(P1,U1,V1,W1,H1)
GROUP 8. Terms (in differential equations) & devices
TERMS(H1,N,Y,Y,Y,Y,Y);OVRRLX=1.7
GROUP 9. Properties of the medium (or media)
** Set the temperature as TMP1A+TMP1B*H1
ENUL=1.E-5;TMP1=LINH;TMP1A=0.0;CP1=1.0
** Set the density as RHO1A+RHO1B*Temperature
RHO1=LINTEMP;RHO1A=1.0;RHO1B=-0.02;PRNDTL(H1)=0.7
GROUP 11. Initialization of variable or porosity fields
FIINIT(P1)=0.0;FIINIT(U1)=0.0;FIINIT(V1)=0.0;fiinit(h1)=0.0
GROUP 13. Boundary conditions and special sources
** Upstream entrance
REAL(WIN,TFL,TCL,TFA,TGR)
WIN=1.0
TFL=ZWLAST/WIN;TCL=TFL/NZ;TGR=(YVLAST/9.81)**2
TFA=TCL*1.E-6
PATCH(INLET1,LOW,1,NX,1,NY/5,1,1,1,1)
COVAL(INLET1,P1,FIXFLU,0.8*RHO1A*WIN)
COVAL(INLET1,W1,ONLYMS,0.8*WIN)
COVAL(INLET1,H1,ONLYMS,0.0)

PATCH(INLET2,LOW,1,NX,NY/5+1,2*NY/5,1,1,1,1)
COVAL(INLET2,P1,FIXFLU,0.9*RHO1A*WIN)
COVAL(INLET2,W1,ONLYMS,0.9*WIN)

PATCH(INLET3,LOW,1,NX,2*NY/5+1,3*NY/5,1,1,1,1)
COVAL(INLET3,P1,FIXFLU,RHO1A*WIN)
COVAL(INLET3,W1,ONLYMS,WIN)

PATCH(INLET4,LOW,1,NX,3*NY/5+1,4*NY/5,1,1,1,1)
COVAL(INLET4,P1,FIXFLU,1.1*RHO1A*WIN)
COVAL(INLET4,W1,ONLYMS,1.1*WIN)

PATCH(INLET5,LOW,1,NX,4*NY/5+1,NY,1,1,1,1)
COVAL(INLET5,P1,FIXFLU,1.2*RHO1A*WIN)
COVAL(INLET5,W1,ONLYMS,1.2*WIN)

** Smoke source
PATCH(SMOKE,LOW,NX/2-2,NX/2+3,NY/2-NY/20,NY/2+NY/20+1,1,1,1,1)
COVAL(SMOKE,P1,FIXFLU,RHO1A*WIN*0.01)
COVAL(SMOKE,H1,ONLYMS,100.0)
COVAL(SMOKE,W1,ONLYMS,0.01*WIN)

** Buoyancy
PATCH(BUOYANCY,PHASEM,1,nx,1,ny,1,nz,1,1)
COVAL(BUOYANCY,V1,FIXFLU,-9.81)

** Bottom wall
PATCH(BOTTOM,SWALL,1,NX,1,1,1,NZ,1,1)
COVAL(BOTTOM,W1,1.0,0.0);COVAL(BOTTOM,U1,1.0,0.0)

** Top wall
PATCH(TOP,NWALL,1,NX,NY,NY,1,NZ,1,1)
COVAL(TOP,W1,1.0,0.0);COVAL(TOP,U1,1.0,0.0)

** West wall
PATCH(WEST,WWALL,1,1,1,NY,1,NZ,1,1)
COVAL(WEST,W1,1.0,0.0);COVAL(WEST,V1,1.0,0.0)

** East wall
PATCH(EAST,EWALL,NX,NX,1,NY,1,NZ,1,1)
COVAL(EAST,W1,1.0,0.0);COVAL(EAST,V1,1.0,0.0)

GROUP 15. Termination of sweeps
RESREF(P1)=1.e-4;RESREF(U1)=1.e-4;RESREF(V1)=1.e-4
RESREF(W1)=1.e-4;RESREF(H1)=1.e-4

GROUP 16. Termination of iterations
ENDIT(H1)=1.E-6;ENDIT(U1)=1.E-6;ENDIT(V1)=1.E-6
LITER(P1)=100;LITER(U1)=10;LITER(V1)=10;LITER(W1)=10;LITER(H1)=10
LITHYD=100

GROUP 17. Under-relaxation devices
RELAX(U1,FALSDT,0.1);RELAX(V1,FALSDT,0.05)
RELAX(W1,FALSDT,0.1);RELAX(H1,FALSDT,0.1)

GROUP 21. Print-out of variables
OUTPUT(P1,Y,Y,Y,Y,Y,Y);OUTPUT(U1,Y,Y,Y,Y,Y,Y)
OUTPUT(V1,Y,Y,Y,Y,Y,Y);OUTPUT(H1,Y,Y,Y,Y,Y,Y)
OUTPUT(W1,Y,Y,Y,Y,Y,Y)
GROUP 22. Spot-value print-out
IXMON=NX/2;IYMON=NY/2
GROUP 23. Field print-out and plot control
NZPRIN=NZ;NXPRIN=NX/5;NYPRIN=NY/5;NPLT=LITHYD
**Settings to secure PHOTON-plottable print-out
IDISPD=NZ/5;IDISPB=1;IDISPC=NZ
tstswp=-5