L(N111)
TEXT(1D SHOCKED TRANSONIC FLOW IN A LAVAL NOZZLE
TITLE
  ** Activate compressibility corrections of Malin & Sanchez
MESG(Compressibility corrections activated UCONV=T
NAMGRD=CONV;UCONV=T
REAL(MS,PS,AS,XS,MS2,DS,MD,PD,AD,ARAT,PDPO)
REAL(GA,GB,POWA,POWB,MGO,MG,AT1,FM,FPM,PRAT)
XS=2.4;PEX=0.7441*PTOT
MESG(Nozzle back pressure is Pexit/POin=0.7441
MESG(Normal shock expected at X=2.4 with Mexit=0.452
MESG(and Pexit/POin=0.744
COVAL(OUTLET,P1,1.E4*MFEX*AEX/PEX,PEX)
  ** In the following the areas and pressures and normalised
     by A* and Po respectively.
GA=GM1/2.;GB=GP1/2.;POWA=GB/GM1;POWB=POWA-1.
MS=DMDX*XS+MI;MS2=MS*MS;AS=((G1+G2*MS2)**G3)/MS
PS=1./(1.+0.5*GM1*MS2)**POW1;MD=((GM1*MS2+2.)/(2.*GAM*MS2-GM1))**0.5
PD=(2.*GAM*MS2/GP1-GM1/GP1);PDPO=1./(1.+GA*MD*MD)**POW1
PRAT=PD*PS/PDPO;AD=((G1+G2*MD*MD)**G3)/MD;ARAT=AD/AS
DO KK=1,N:DIRH:
IF(:DIRH:.EQ.Z) THEN
+ PATCH(INA:KK:,INIVAL,1,NX,1,NY,:KK:,:KK:,1,LSTEP)
+ XH=ZFRAC(KK)*ZWLAST
ENDIF
IF(:DIRH:.EQ.Y) THEN
+ PATCH(INA:KK:,INIVAL,1,NX,:KK:,:KK:,1,NZ,1,LSTEP)
+ XH=YFRAC(KK)*YVLAST
ENDIF
IF(:DIRH:.EQ.X) THEN
+ PATCH(INA:KK:,INIVAL,:KK:,:KK:,1,NY,1,NZ,1,LSTEP)
+ XH=XFRAC(KK)*XULAST
ENDIF
IF(XH.GT.XS) THEN
+ MX=DMDX*XH+MI;MX2=MX*MX;AREA=(((G1+G2*MX2)**G3)/MX)*ARAT
+ MGO=MD;MG=MD
DO JJ=1,10
+ AT1=(1.+GA*MG*MG)/GB;FM=MG-AT1**POWA/AREA
+ FPM=1.-(2.*POWA*GA*MG/GB)*AT1**POWB/AREA;MG=MGO-FM/FPM;MGO=MG
ENDDO
+ GP=PRAT/(1.+GA*MG*MG)**POW1
+ INIT(INA:KK:,PA,ZERO,GP);INIT(INA:KK:,MA,ZERO,MG)
ENDIF
ENDDO