NOTE Similar to 522 but added enthalpy and questions
  PHOTON USE
  p
 
 
 
 
 
  gr y 1
  msg The body-fitted-coordinate grid
  msg            -
  msg Press  to continue
  pause
  gr off;gr ou y 1; red
  msg Contours of pressure
  con p1 y 1 fi;0.001
  msg            -
  msg Press  to continue
  pause
  con del;red
  *msg Contours of temperature
  *con temp y 1 fi;0.001
  *msg            -
  *msg Press  to continue
  *pause
  msg velocity vectors
  vec y 1 sh
  msg            -
  msg Press e to END
  enduse
 
    GROUP 1. Run title
TEXT(TRANSONIC FLOW IN A CONV.DIV. NOZZLE:B422
TITLE
mesg(PC486/50 time last reported as appx. 1.min
  DISPLAY
  The calculation is made using the BFC system, and the nozzle
  geometry corresponds to a linear Mach-number distribution, as
  predicted by one-dimensional gas-dynamic theory. The geometry
  is sketched out in the following diagram.
      ///////                                   //////
      *******///                          /////     **
               * //  wall    //////  *         --->   zero
    --->          * ////////   *                       pressure
                      *   *
    --->        --------->                    --->
       ************************************************
       ////////////////////////////////////////////////
  The inlet conditions are prescribed total pressure and
  total temperature at a Mach Number of 0.5. The design
  outlet Mach number is 2.0 for which Pex/Po,in = .1278.
  The exit boundary condition corresponds to a fixed pressure
  at the expected nodal Mach number.
  A system of units is chosen whereby the flow variables
  can be interpreted as: P/Po,in ; RHO/RHOo,in ; T/To,in ;
  and U*SQRT(GAMMA)/Ao. Here, Ao is the acoustic velocity
  at the stagnation temperature.
  enddis
 
    GROUP 1. Run title
TEXT(Plane transonic flow through a nozzle)
REAL(GASCON,GAMMA,PTOTAL,TTOTAL,RHOTOT,MACHI,AGAM1,RGAM)
REAL(MACHO,PIN,TIN,POWER,WIN,RHOIN,PEXIT,WEXIT,RHOOUT,GZLE)
REAL(CHORD,THROAT,GRADP,GRADW,GRADR,CMASS,VMASS,cpin,HIN)
GASCON=287;GAMMA=1.4;PTOTAL=3.0E5;TTOTAL=3.0E2;RHOTOT=3.5;MACHI=0.5
GZLE=0.4;CHORD=3.0;THROAT=0.5;MACHO=2.0
INTEGER(IZLE,IZTE);IZLE=2;IZTE=17
  ** Calculation of inlet velocity
AGAM1=GAMMA-1.; RGAM=1./GAMMA;POWER=GAMMA/AGAM1
PIN=PTOTAL/(1.+AGAM1*MACHI*MACHI/2.)**POWER
RHOIN=RHOTOT/(PTOTAL/PIN)**RGAM
WIN=MACHI*(GAMMA*PIN/RHOIN)**0.5
TIN=PIN/(GASCON*RHOIN)
cpin=gamma*gascon/agam1;hin=cpin*tin
PEXIT=PTOTAL/(1.+AGAM1*MACHO*MACHO/2.)**POWER
mesg(Inlet total pressure is :ptotal:
mesg(outlet pressure is :pexit:. OK? If not, insert new value.
readvdu(pexit,real,:pexit:)
mesg(outlet pressure = :pexit:
RHOOUT=RHOTOT/(PTOTAL/PEXIT)**RGAM
WEXIT=MACHO*(GAMMA*PEXIT/RHOOUT)**0.5
    GROUP 6. Body-fitted coordinates or grid distortion
  mesg(The body-fitted-coordinate option is used for
  mesg(representing the shape of the nozzle
BFC=T;NONORT=T
GSET(D,5,1,17,0.3350,1.0,CHORD+GZLE)
IZTE=NZ
   ** Obtain constants for A/A* expression
REAL(G5,G6,AAA,BBB,AAT,AT,MMO)
G5=GAMMA+1.0;G6=G5/(2.0*AGAM1)
AAA=2.0/G5;BBB=AGAM1/G5
AAT=((AAA+BBB*MACHI*MACHI)**G6)/MACHI
AT=XULAST/AAT
MMO=MACHO-MACHI
REAL(XX,XNK)
DO II=NZ,IZLE,-1
XNK=(II-IZLE)/(NZ-IZLE)
XX=AT/(MACHI+MMO*XNK)*(AAA+BBB*(MACHI+MMO*XNK)**2)**G6
GSET(C,I:NX+1:,F,I1,1,NY,:II:,:II:,+,XX,0.0,0.0,INC,1.0)
ENDDO
    GROUP 7. Variables stored, solved & named
SOLVE(P1,U1,W1,H1);STORE(RHO1,TMP1);SOLUTN(P1,Y,Y,Y,N,N,N)
    ASSUME SOLVING STATIC ENTHALPY
TMP1=LINH
CP1=CPIN
    GROUP 8. Terms (in differential equations) & devices
    GROUP 9. Properties of the medium (or media)
TERMS(U1,Y,Y,N,N,Y,N);TERMS(W1,Y,Y,N,N,Y,N)
PRESS0=PEXIT
    USE IDEAL GAS EQUATION FOR DENSITY
  mesg(The flow is isentropic; and the density is calculated
  mesg(from the Ideal Gas Law
RHO1=IDEALGAS;drh1dp=IDEALGAS
RHO1B=1./287
CP1=CPIN
    GROUP 11. Initialization of variable or porosity fields
FIINIT(W1)=0.5*(WIN+WEXIT)
FIINIT(H1)=HIN
FIINIT(RHO1)=RHOIN
    GROUP 13. Boundary conditions and special sources
PATCH(INLET,LOW,1,NX,1,1,1,1,1,1)
VMASS=RHOIN*PTOTAL/RHOTOT;CMASS=2.*POWER/WIN
COVAL(INLET,P1,FIXFLU,RHOIN*WIN);COVAL(INLET,W1,ONLYMS,WIN)
COVAL(INLET,H1,ONLYMS,hin)
PATCH(OUTLET,HIGH,1,NX,1,1,NZ,NZ,1,1)
COVAL(OUTLET,P1,1.0E5,0.0)
COVAL(OUTLET,U1,ONLYMS,0.0);COVAL(OUTLET,W1,ONLYMS,0.0)
COVAL(OUTLET,H1,ONLYMS,3.E5)
    GROUP 15. Termination of sweeps
LSWEEP=300
    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,0.3)
RELAX(W1,FALSDT,5.E-3)
RELAX(U1,FALSDT,5.E-3)
    GROUP 21. Print-out of variables
OUTPUT(RHO1,Y,N,N,N,Y,Y)
    GROUP 22. Spot-value print-out
IXMON=2;IZMON=12
    GROUP 23. Field print-out and plot control
NPRINT=LSWEEP
    GROUP 23. Field print-out and plot control
PATCH(XZ,CONTUR,1,NX,1,1,1,NZ,1,1)
PLOT(XZ,P1,0.0,20.0);PLOT(XZ,W1,0.0,20.0)
PATCH(CENTRE,PROFIL,1,1,1,1,1,NZ,1,1)
PLOT(CENTRE,P1,0.0,0.0);PLOT(CENTRE,W1,0.0,0.0)
NZPRIN=2
NCRT=1
OUTPUT(WCRT,Y,N,N,N,N,N)
OUTPUT(UCRT,Y,N,N,N,N,N)
TSTSWP=-1