PHOTON USE
  p;;;;;;
 
  msg streamlines and potential contours for flow around a cylinder
 
  gr ou x 1
  msg streamlines
  stre 2d x 1 sh;-1 0 20
  pause
  msg constant-potential contours
  con pot x 1 sh;-0.95 0.95 20
  msg
  msg Press e to END
  ENDUSE
 
    GROUP 1. Run title and other preliminaries
#cls
TEXT(Potl. 2D Flow; Source-Sink Pair    
TITLE
  DISPLAY
 
  ******************************************************************
  *  Plane potential flow around a closely spaced source-sink pair,*
  *  within a uniform-potential-gradient field, is known to        *
  *  generate a field in which a closed stream-line has the shape  *
  *  of a circular cylinder.                                       *
  *                                                                *
  *  This is illustrated in the present case.                      *
  *                                                                *
  *  A PHOTON USE file is provided to facilitate display.          *
  *                                                                *
  ******************************************************************
 
  ENDDIS
#pause 
    GROUP 4 & 5
ny=20; yvlast=1.0; nz=40; zwlast=2.0
ny=40;nz=80
l(unigrid
 
    GROUP 7. Variables stored, solved & named
SOLVE(POT);STORE(U1,V1,W1)
  ** Select whole-field solution procedure for potential,
SOLUTN(POT,Y,Y,Y,N,N,N)
    GROUP 8. Terms (in differential equations) & devices
  ** conjugate-gradient solver
TERMS(POT,N,N,Y,P,P,P); CSG3=CNGR
    GROUP 13. Boundary conditions and special sources
   ** Upstream boundary
PATCH(UPSTRM,LOW,1,NX,1,NY,1,1,1,1)
COVAL(UPSTRM,POT,FIXVAL,1.0)
   ** Downstream boundary
PATCH(DWNSTRM,HIGH,1,NX,1,NY,NZ,NZ,1,1)
COVAL(DWNSTRM,POT,FIXVAL,-1.0)
   
   ** Source and sink patches on the axis
PATCH(SOURCE1,CELL,1,1,1,1,NZ/2,NZ/2,1,1)
COVAL(SOURCE1,POT,FIXFLU,10.0)

PATCH(SINK1,CELL,1,1,1,1,NZ/2+1,NZ/2+1,1,1)
COVAL(SINK1,POT,FIXFLU,-10.0)
    
    GROUP 15. Termination of sweeps
LSWEEP=3;SELREF=T;RESFAC=1.E-2
    GROUP 16. Termination of iterations
LITER(POT)=-100
    Group 19.
POTVEL=T
    GROUP 21. Print-out of variables
YZPR=T
    GROUP 22. Spot-value print-out
IXMON=5; IYMON=5; IZMON=5; UWATCH=T
    GROUP 22. Spot-value print-out
OUTPUT(POT,Y,N,N,N,N,N); OUTPUT(U1,Y,N,N,N,N,N)
OUTPUT(V1,Y,N,N,N,N,N); OUTPUT(W1,Y,N,N,N,N,N)
    GROUP 23. Field print-out and plot control