GROUP 1. Run title and other preliminaries
TEXT(1D PISTON-IN-CYLINDER; 2-FLUID    : 978
TITLE
 
  DISPLAY
  This is an application of the two-fluid model to
  1D turbulent combustion in reciprocating engines.
 
  Fluid 1 is defined as unburned combustible, and
  fluid 2 as fully burned combustion products.
 
  In a cylinder closed by a reciprocating piston, hot
  gas spreads from low z to high as a consequence entirely
  of the relative motion induced between hot and cold gas
  fragments. Cylinder walls and piston surface are impervious
  to heat and mass. Initially, the piston is at bottom dead
  centre, both fluids at rest, fluid 2 occupies first 10% of
  z-length, fluid 1 occupies the remainder.
 
  Inter-fluid friction is proportional to the square of the
  difference of velocities of the two fluids at each point.
  Inter-fluid mass transfer takes place, from fluid 1 to
  fluid 2, at a rate proportional to: r1*r2*velocity difference.
  Each fluid has density proportional to p**(1/gamma), where
  proportionality constant for fluid 2=0.3*that for fluid 1.
  ENDDIS
INTEGER(NZD,NTD,NZF)
NZD=20;NTD=24;NZF=NZD/10
REAL(GAMA,PI,OMEGA,SWIRL,CHATIM,STROKE,CONROD,COMRAT)
GAMA=1.4;PI=3.14159;STROKE=0.1;COMRAT=8.0
CONROD=0.1;OMEGA=24.;CHATIM=0.005/OMEGA;COMRAT=COMRAT*2.0
    GROUP 2. Transience; time-step specification
STEADY=F;GRDPWR(T,NTD,2.0*PI/OMEGA,1.0)
    GROUP 5. Z-direction grid specification
GRDPWR(Z,NZD,STROKE*(1.0+1.0/COMRAT),1.0)
    GROUP 7. Variables stored, solved & named
ONEPHS=F;SOLVE(P1,W1,W2,R2);SOLUTN(P1,Y,Y,Y,N,N,N)
SOLUTN(W1,Y,Y,N,Y,N,N);SOLUTN(W2,Y,Y,N,Y,N,N)
STORE(DEN1,R1,INTMDT,DEN2)
NAME(W1)=1W;NAME(W2)=2W;NAME(INTMDT)=MDOT
TERMS(R2,Y,Y,N,P,P,P)
    GROUP 9. Properties of the medium (or media)
RHO1=COMPRESS;RHO1B=1.0/GAMA;PRESS0=1.E5;RHO1A=PRESS0**(-RHO1B)
RHO2=COMPRESS;RHO2B=1.0/GAMA;RHO2A=RHO1A*0.3
DRH1DP=COMPRESS;DRH2DP=COMPRESS
    GROUP 10. Inter-phase-transfer processes and properties
CFIPS=GRND2;CFIPC=10.0/STROKE;CMDOT=-1.0
    GROUP 11. Initialization of variable or porosity fields
FIINIT(R1)=1.0;FIINIT(R2)=0.0
INIADD=T
PATCH(FLAME,INIVAL,1,1,1,NY,1,NZF,1,1)
INIT(FLAME,R1,0.0,-1.0);INIT(FLAME,R2,0.0,1.0)
   The following patch does not affect the calculation.
   It has been inserted as a signal to the Commander Search Engine
   that this is a two-fluid-model case
 PATCH(SHSO,CELL,1,1,1,1,1,1,1,1)
    GROUP 15. Termination of sweeps
LSWEEP=10
    GROUP 16. Termination of iterations
LITER(P1)=-10.0
    GROUP 17. Under-relaxation devices
RELAX(1W,FALSDT,0.1*CHATIM);RELAX(2W,FALSDT,0.1*CHATIM)
RELAX(R2,LINRLX,0.3);VARMAX(R2)=0.999; RELAX(P1,LINRLX,0.5)
    GROUP 19. Data communicated by satellite to GROUND
W1AD=ZMOVE;AZW1=OMEGA
   *** BZW1=crank radius; IZW1=IZ for non-expanding region
BZW1=STROKE/2.0;CZW1=CONROD/BZW1;IZW1=NZ
SPEDAT(SET,GXMONI,TRANSIENT,L,F)
    GROUP 21. Print-out of variables
OUTPUT(DEN1,N,N,N,N,N,N);OUTPUT(DEN2,N,N,N,N,N,N)
OUTPUT(R1,N,N,N,N,N,N);ORSIZ=0.2;TSTSWP=2
    GROUP 23. Field print-out and plot control
IZMON=NZ/2;IPLTF=2
NPLT=1;NZPRIN=3;NTPRIN=3;NPRINT=LSWEEP
PATCH(NZD1,PROFIL,1,1,1,1,NZ/2,NZ/2,1,LSTEP)
PLOT(NZD1,P1,0.0,1.E7)
PATCH(NZD2,PROFIL,1,1,1,1,NZ/2,NZ/2,1,LSTEP)
PLOT(NZD2,1W,-1.0,-1.0);PLOT(NZD2,2W,-1.0,-1.0)
PLOT(NZD2,R2,0.0,0.0);PLOT(NZD2,MDOT,0.0,0.0)
PATCH(LONGPLOT,PROFIL,1,1,1,1,1,NZ,1,LSTEP)
PLOT(LONGPLOT,1W,-1.0,-1.0);PLOT(LONGPLOT,2W,-1.0,-1.0)
PLOT(LONGPLOT,MDOT,0.0,0.0)
PATCH(LONPL,PROFIL,1,1,1,1,1,NZ,1,LSTEP)
PLOT(LONPL,R2,0.0,1.0)
    GROUP 24. Dumps for restarts
SUBWGR=T