PHOTON USE
  p;; 10 1;;;
 
  set prop off;vi -x
  msg temperature contours and velocity vectors
  msg Note that the y-scale has been magnified 10 times
  con tem1 x 1 fi;0.001
  vec x 1
  ENDUSE
 
    GROUP 1.  Run title and other preliminaries
TEXT(Water In A Heated Aluminium Pipe  
TITLE
  DISPLAY
  Water flows steadily through a thick-walled aluminium pipe.
  A constant heat flux is prescribed at the outer wall, while
  uniform temperature and velocity profiles are prescribed at
  the pipe inlet.
                      Thick metal pipe wall
                       |
             ^     .-----.-------------------------.
             |   /***.-.***\                         \
             |r /**/     \**\                         \
    Fixed    | |**|--->   |**|                         |->
    mass flux  |**|--->   |**|                         |->
    at pipe     \**\     /**/                         /
    inlet        \***`-'***/                         /
    boundary       `-----'-------------------------'
                             |  z---->
                          Fixed heat flux
                          at outer surface
  ENDDIS
 
  The locally-defined variables are:
 
      WIN           Inlet velocity.
      TIN           Inlet temperature
      HEATFLUX          Heat flux at outer wall
      INTDIAM       Internal diameter
      EXTDIAM       External diameter
      PIPELENGTH    Pipe length
 
REAL(WIN, TIN, HEATFLUX, INTDIAM, EXTDIAM, PIPELENGTH)
 
WIN=0.1; TIN=20.0; HEATFLUX=1000.
INTDIAM= 0.02; EXTDIAM= 0.03; PIPELENGTH= 0.3
 
NY=30; NZ=20
 
    GROUP 3. X-direction grid specification
CARTES=F; XULAST=0.01
 
    GROUP 4. Y-direction grid specification
 
INTEGER(IYMET, IYWAT); IYMET=2*NY/3 + 1; IYWAT=IYMET-1
REAL(THICKNESS,NWAT,NMET); THICKNESS = 0.5*(EXTDIAM - INTDIAM)
NWAT=IYWAT; NMET= NY-IYWAT
 
YVLAST = EXTDIAM*0.5
YFRAC(1)=-NWAT; YFRAC(2)=INTDIAM/(NWAT*EXTDIAM)
YFRAC(3)=NMET;  YFRAC(4)=THICKNESS/(NMET*EXTDIAM)
 
    GROUP 5. Z-direction grid specification
GRDPWR(Z,NZ,PIPELENGTH,1.0)
 
    GROUP 7. Variables stored, solved & named
#solvel
#soltem
 
    GROUP 9. Properties of the medium (or media)
#use_props
 
:fluid:=water20
 
    GROUP 11. Initialization of variable or porosity fields
FIINIT(W1)=WIN; INIADD=F
PATCH(METAL,INIVAL,1,1,IYMET,NY,1,NZ,1,1)
COVAL(METAL,PRPS,0.0,ALUMINIUM)
 
    GROUP 13. Boundary conditions and special sources
 
   ** Uniform temperature and velocity at pipe inlet
PATCH(IN,LOW,1,1,1,IYWAT,1,1,1,1)
COVAL(IN,P1,FIXFLU,1000.0*WIN); COVAL(IN,W1,ONLYMS,WIN)
COVAL(IN,TEM1,ONLYMS,TIN)
 
   ** Outer pipe wall:  uniform heat flux
PATCH(OUTER,NORTH,1,1,NY,NY,1,NZ,1,1)
COVAL(OUTER,TEM1,FIXFLU,HEATFLUX)
 
 
   ** Exit condition on water pressure
PATCH(EXIT,HIGH,1,1,1,IYWAT,NZ,NZ,1,1)
COVAL(EXIT,P1,FIXVAL,0.0)
 
    GROUP 15. Termination of sweeps
LSWEEP=200
 
    GROUP 17. Under-relaxation devices
RELAX(V1,FALSDT,ZWLAST/WIN);RELAX(W1,FALSDT,ZWLAST/WIN)
 
    GROUP 22. Spot-value print-out
IYMON=IYWAT-1; IZMON=NZ-1; TSTSWP=-1
 
    GROUP 23. Field print-out and plot control
  line-printer plots
PATCH(OUTSIDE,PROFIL,1,1,NY,NY,1,NZ,1,1)
COVAL(OUTSIDE,TEM1,0.0,0.0)
 
PATCH(WNEARM,PROFIL,1,1,IYWAT,IYWAT,1,NZ,1,1)
COVAL(WNEARM,W1,0.0,0.0); COVAL(WNEARM,TEM1,0.0,0.0)
 
PATCH(NEAREND,PROFIL,1,1,1,NY,NZ-1,NZ-1,1,1)
COVAL(NEAREND,W1,0.0,0.0); COVAL(NEAREND,TEM1,0.0,0.0)