```

PHOTON USE
p; parphi;  1 1 500

gr ou y 1
msg pressure; distance is vertical, time horizontal
con p1 y 1 fi;1
msg Press  to continue
pause;con off;red
msg velocity; distance is vertical, time horizontal
con u1 y 1 fi;1
enduse

GROUP 1. Run title and other preliminaries
TEXT(Pressure Waves From Valve Closure
TITLE
DISPLAY
Air is moving steadily along a pipe. Valves are suddenly closed
at each end, bringing the air to rest there. The subsequent
distributions of velocity and pressure in the pipe are to be
predicted.

The analysis is one-dimensional, and the process is supposd to
be isentropic, ie without either friction or heat transfer.

ENDDIS
GROUP 2 and 3
l(unigrid

GROUP 7. Variables stored, solved & named
SOLVE(P1,U1); STORE(RHO1)

GROUP 8. Terms (in differential equations) & devices
** De-activate the diffusion term in the U1 equation
TERMS(U1,Y,Y,N,Y,Y,Y)

GROUP 9. Properties of the medium (or media)
#FLUIDMAT
SETPRPS(1,AIRISENT)
REAL(REFPRE,REFRHO);REFPRE=1.E5;REFRHO=1.0
MESG(Isentropic Air, Refrho=:REFRHO:, Refpre=:REFPRE:
RHO1A=REFRHO*(1.0/REFPRE)**RHO1B

GROUP 11. Initialization of variable or porosity fields
FIINIT(P1)=REFPRE; FIINIT(U1)=1.0; FIINIT(RHO1)=REFRHO

GROUP 15. Termination of sweeps
LSWEEP=10

GROUP 22. Spot-value print-out
IXMON=NX/2; TSTSWP=-1
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
GROUP 23. Field print-out and plot control
NTPRIN=LSTEP/5;NXPRIN=NX/5

PATCH(ALLX,PROFIL,1,NX,1,1,1,1,1,LSTEP)
PLOT(ALLX,P1,0.0,0.0); PLOT(ALLX,U1,0.0,0.0)

PATCH(TIMEPLOT,PROFIL,NX/2,NX/2,1,1,1,1,1,LSTEP)
PLOT(TIMEPLOT,P1,0.0,0.0); PLOT(TIMEPLOT,U1,0.0,0.0)

create parphi file for display via PHOTON
IDISPA=1;IDISPB=1;IDISPC=LSTEP
```