PHOTON USE
p;parphi
1 0.15 1
up -y;view x;gr x 1
msg The grid. Z signifies time. Press RETURN for gas vol. fraction
pause;gr off;red;gr ou x 1
msg the volume fraction of gas; press RETURN for pressure
con gas x 1 fi;0.01;pause;con off;red
msg the pressure; press RETURN for gas velocity
con p1 x 1 fi;0.01;pause;con off;red
msg the gas velocity; press RETURN for liquid velocity
con av1 x 1 y 1 19 fi;0.01;pause;con off;red
msg the liquid velocity
con bv2 x 1 y 1 19 fi;0.01
enduse
GROUP 1. Run title
TEXT(COMPRESSION OF AIR BY WATER :W896
TITLE
DISPLAY
A vertical pipe is partially or completely closed at the upper
end. The pipe initially contains air at atmospheric pressure in
its upper half; and the lower half is filled by water.
At the bottom of the pipe there is free communication with a
large reservoir of water into which the pipe has been pushed so
that its upper end is flush with the surface of the reservoir.
Both air and water are initially at rest; but the excess pressure
causes the water level at first to rise in the tube, whereafter
an oscillation ensues.
The time considered is 5 seconds, divided into 100 equal
intervals. The tube is 20.0m long, divided into 20 equal
intervals.
The water is incompressible and has a density of 1000.0
kg/m3. The air is compressible,obeying the law
rho=(pressure/1.E5)**(1.0/1.4)
PHOTON USE commands are provided for graphical display.
ENDDIS
GROUP 2. Transience; time-step specification
STEADY=F;GRDPWR(T,100,5.0,1.0)
GROUP 4. Y-direction grid specification
GRDPWR(Y,20,20.0,1.0)
GROUP 7. Variables stored, solved & named
ONEPHS=F;SOLVE(P1,V1,V2,R1,R2)
DEN1=20;NAME(DEN1)=RHO1;SOLUTN(DEN1,Y,N,N,N,N,N)
GROUP 8. Terms (in differential equations) & devices
TERMS(R1,Y,Y,N,Y,Y,Y);TERMS(R2,Y,Y,N,Y,N,Y)
TERMS(V2,Y,Y,N,Y,N,Y);TERMS(V1,Y,Y,N,Y,Y,Y)
GROUP 9. Properties of the medium (or media)
RHO2=1000.0;RHO1=COMPRESS;RHO1B=0.714;RHO1A=1./1.E5**0.714
RHO1C=0.0;PRESS0=1.E5;DRH1DP=COMPRESS
GROUP 10. Inter-phase-transfer processes and properties
A linear interphase-friction law is presumed.
CFIPS=1.E6
GROUP 11. Initialization of variable or porosity fields
FIINIT(R1)=0.0001;FIINIT(R2)=0.9999;FIINIT(DEN1)=1.0
INIADD=T
PATCH(INIR,INIVAL,1,1,1,NY/2,1,1,1,1)
INIT(INIR,R1,0.0,0.9998);INIT(INIR,R2,0.0,-0.9998)
GROUP 13. Boundary conditions and special sources
Water entry at bottom of pipe ('north')
PATCH(BOTTOM,NORTH,1,1,NY,NY,1,1,1,LSTEP)
COVAL(BOTTOM,P2,FIXVAL,9.81*YVLAST*RHO2)
Gravity operating over the whole pipe
PATCH(GRAVITY,PHASEM,1,1,1,NY,1,1,1,LSTEP)
COVAL(GRAVITY,V1,FIXFLU,9.81);COVAL(GRAVITY,V2,FIXFLU,9.81)
Optional opening at the top
mesg(The top of the pipe is closed. Open it ? (y/n)
READVDU(ANS,CHAR,N)
IF(:ANS:.EQ.Y) THEN
PATCH(TOP,CELL,1,1,1,1,1,1,1,LSTEP)
COVAL(TOP,P1,1.E-3,0.0);COVAL(TOP,P2,1.0,0.0)
ENDIF
GROUP 15. Termination of sweeps
LSWEEP=50;SELREF=T;RESFAC=1.E-6
GROUP 17. Under-relaxation devices
RELAX(R1,LINRLX,0.5);RELAX(R2,LINRLX,0.25);RELAX(DEN1,LINRLX,0.25)
relax(p1,linrlx,0.5)
GROUP 20. Preliminary print-out
TSTSWP=LSWEEP-1;UWATCH=T
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
GROUP 21. Print-out of variables
OUTPUT(P1,Y,Y,Y,Y,Y,Y);OUTPUT(V1,Y,Y,Y,Y,Y,Y);OUTPUT(V2,Y,Y,Y,Y,Y,Y)
OUTPUT(R1,Y,Y,Y,Y,Y,Y);OUTPUT(RHO1,Y,Y,Y,Y,Y,Y)
GROUP 22. Spot-value print-out
IYMON=ny-1
GROUP 23. Field print-out and plot control
NTPRIN=LSTEP/2
PATCH(5,PROFIL,1,1,1,NY,1,1,1,LSTEP);PLOT(5,R2,0,0)
PATCH(6,PROFIL,1,1,NY/2,NY/2,1,1,1,LSTEP)
PLOT(6,P1,0,0);PLOT(6,R1,0,0);PLOT(6,V1,0,0);PLOT(6,V2,0,0)
NAME(R1)=GAS;NAME(R2)=LIQ;NAME(V1)=AV1;NAME(V2)=BV2
IDISPA=LSTEP/20