PHOTON USE
  p
  phi
 

  msg      Irrotational flow past an inclined plate
  msg
  set ref vec 5
  msg   Velocity vectors:
  gr ou z 1;gr ou z 1 x 2 m y 2 m;vec z 1 sh
  msg
  msg Press  to continue
  pause
  vec off;red
  msg        west to east velocity contours:
  con u1 z 1 x 2 m y 2 m fi;.01
  msg
  msg Press  to continue
  pause
  msg        south to north velocity contours:
  con v1 z 1 x 2 m y 2 m fi;.01
  msg
  msg Press  to continue
  pause
  con off;red
  msg        Contours of stream function at cell centres:
  con PSID z 1 x 2 m y 2 m sh; int 20
  pause
  msg        Streamlines deduced from velocities by PHOTON
  stre 2d z 1 x 2 m y 2 m sh; int 20
  msg Press e to END
  enduse
    GROUP 1. Run title and other preliminaries
TEXT(Irrotational Flow; Inclined Plate    
#cls
TITLE
  DISPLAY
  
  A plate is held centrally in a square box through the walls of 
  which flows an inviscid fluid.
  
  The stream function is fixed to fit the formula:
  
      PSIV = a * x   -   b * y
   where a = - 1 and b = 1    
     (which can of course be changed by editing the Q1 file)
   
   The task is to compute the flow field within the box.
   
   In-Form is used in order to specify the boundary conditions.  
   
   The plate is represented by setting the stream function to zero. 
  
  ENDDIS
#pause
   GROUPs 3, 4 and 5: grid specification
nx=40; ny=40; nz=1
xulast=1.0; yvlast=1.0; zwlast=1.0
#unigrid    
 
    GROUP 7. Variables stored, solved & named
STORE(PSIV,PSID,U1,V1); SOLUTN(PSIV,Y,Y,Y,N,N,N)
 
   **Plate
PATCH(PLATE,CELL,NX/2,NX/2,NY/4+1-1,3*NY/4,1,1,1,1)
COVAL(PLATE,PSIV,FIXVAL,0.0)
 
    GROUP 13. Boundary conditions and special sources
PATCH(NORTH,NORTH,2, NX-1,NY,NY,1,1,1,1)
PATCH(SOUTH,SOUTH,2, NX-1,1 ,1 ,1,1,1,1)
PATCH(EAST ,EAST ,NX,NX,  1 ,NY,1,1,1,1)
PATCH(WEST ,WEST ,1 , 1,  1 ,NY,1,1,1,1)

  INFORM13BEGIN
REAL(A,B)
A=-1; B= 1
(source of PSIV at north is a*xg + b*yg with fixval)
(source of PSIV at south is a*xg + b*yg with fixval)
(source of PSIV at east  is a*xg + b*yg with fixval)
(source of PSIV at west  is a*xg + b*yg with fixval)
  INFORM13END

    GROUP 15. Termination of sweeps
LSWEEP = 1
    GROUP 16. Termination of iterations
LITER(PSIV)=-500;endit(psiv)=1.e-9;selref=f;resref(psiv)=1.e-20
    GROUP 22. Spot-value print-out
UWATCH=T
    GROUP 23. Field print-out and plot control
PATCH(CONT,CONTUR,1,NX,1,NY,1,1,1,1);PLOT(CONT,PSIV,0.0,20.0)
    GROUP 24. Dumps for restart