TEXT(Fanno Flow - Subsonic Inlet       
TITLE
 
    GROUP 1. Run title and other preliminaries
REAL(GAMMA,GCP,GASCON,RHOIN,VELIN,PIN,TIN,PEXIT)
REAL(MACHI,TTOTIN,PSTAR,ZLEN,GAMM1)
GAMMA=1.4; GASCON=287.14; GAMM1=GAMMA-1.
GCP=GASCON*GAMMA/GAMM1
    ** Inlet values
PIN=330.E5;TIN=1123.;RHOIN=PIN/(GASCON*TIN)
MACHI=0.3;VELIN=MACHI*(GAMMA*GASCON*TIN)**0.5
TTOTIN=TIN*(1.+GAMM1*MACHI*MACHI*0.5)
    ** Expected duct discharge pressure
PSTAR=91.135E5
    ** External back pressure outside duct exit
PEXIT=1.E5
    GROUP 3. X-direction grid specification
NREGX=2
    ** Duct length for the attainment of choking
ZLEN=1321.62
IREGX=1;GRDPWR(X,150,ZLEN-71.62,-1.5)
IREGX=2;GRDPWR(X,50,71.62,-2.0)
    GROUP 7. Variables stored, solved & named
SOLVE(P1,U1);STORE(RHO1,TMP1)
    GROUP 8. Terms (in differential equations) & devices
    ** Remove viscous terms
TERMS(U1,Y,Y,N,N,Y,Y)
    GROUP 9. Properties of the medium (or media)
    ** Perfect gas law and temperature from total enthalpy
RHO1=IDEALGAS;RHO1B=1./GASCON;PRESS0=PSTAR
TMP1=CONSTAGH;TMP1A=GCP*TTOTIN;CP1=GCP
    GROUP 11. Initialization of variable or porosity fields
FIINIT(U1)=VELIN;FIINIT(P1)=PIN;FIINIT(RHO1)=RHOIN
FIINIT(TMP1)=TIN
    GROUP 13. Boundary conditions and special sources
    ** inlet - prescribed total pressure
REAL(CMIN,VMIN);CMIN=2.*GAMMA/VELIN/GAMM1
VMIN=RHOIN*GASCON*TTOTIN-PRESS0
PATCH(INLET,WEST,1,1,1,1,1,1,1,1)
COVAL(INLET,P1,CMIN,VMIN);COVAL(INLET,U1,ONLYMS,VELIN)
    ** outlet - fixed external back pressure
REAL(CMOUT);CMOUT=VELIN*RHOIN/(PSTAR-PEXIT)
PATCH(OUTLET,EAST,NX,NX,1,1,1,1,1,1)
COVAL(OUTLET,P1,CMOUT,PEXIT-PRESS0)
    ** wall friction - quadratic resistance law
REAL(FRDD);FRDD=0.001;FRDD=2.*FRDD
PATCH(FRICTION,PHASEM,1,NX,1,1,1,1,1,1)
COVAL(FRICTION,U1,-FRDD,0.0)
    GROUP 15. Termination of sweeps
LSWEEP=600;TSTSWP=10
RESREF(P1)=1.E-12*VELIN;RESREF(U1)=RHOIN*VELIN*RESREF(P1)
    GROUP 22. Spot-value print-out
IXMON=NX-1; ITABL=2 ;NPLT=100
NXPRIN=10
    GROUP 24. Dumps for restarts