PHOTON USE
  P;;;;;
 
  VIEW X
 
  CON POT X 1 FI;0.01
  CON POT X 6 FI;0.01
  CON UCRT X 1 FI;0.01
  CON UCRT X 6 FI;0.01
  CON VCRT X 1 FI;0.01
  CON VCRT X 6 FI;0.01
 
  PAUSE;CLS;CON OFF
  VIEW 1 2 3
  do kk=1,100
  CON POT Z kk FI;0.01
  CON W1 Z kk FI;0.01
  CON WCRT Z kk FI;0.01
  enddo
  ENDUSE
 
  ustrbegin
  namplt axis
  ustrend
 **************************************************************
  Group 1. Run title and other preliminaries
TEXT(Bent-pipe grid, created by GSET     :567)
TITLE
  DISPLAY
 
    This Q1 uses parameterised GSET commands to create a grid
    for a bent pipe of circular cross-section. It consists of
    a straight section of length LENG1, a section of length LENG2
    bent into a circular arc, and a further straight section of
    length LENG3.
 
    The diameter of the pipe is DIAM. The angle between the two
    straight sections is ANGLE.
 
  ENDDIS
REAL(DIAM,LENG1,LENG2,LENG3,ANGLE,YCEN,ZCEN,POWER)
DIAM=0.6;LENG1=1.0;ANGLE=-3.14159;POWER=1.0
LENG2=LENG1*2;LENG3=LENG1
 
INTEGER(LASTK,FIRSTK,NZ1,NZ2,NZ3)
NZ1=10;NZ2=20;NZ3=10
NX=10;NY=10
 
YCEN=-LENG2/ANGLE; ZCEN=LENG1
NZ=NZ1+NZ2+NZ3
 **************************************************************
  Group 3,4,5. X,Y,Z-direction grid specification
CARTES=F; XULAST=6.2832; YVLAST=DIAM*0.5; ZWLAST=LENG1*NZ/NZ1
L(UNIGRID
 **************************************************************
  Group 6. Body-fItted coordinates or grid dIstortion
BFC=T
NCRT=1
  first NZ1 cells remain unbent and bend the next NZ2 cells
 
FIRSTK=NZ1+1 ; LASTK=FIRSTK+NZ2
GSET(C,K:LASTK:,F,K:FIRSTK:,1,NX,1,NY,RX,ANGLE,YCEN,ZCEN,INC,:POWER$
:)
  next NZ3 cells are straight
FIRSTK=LASTK ; LASTK=NZ+1
REAL(SL3,CL3)
SL3=-SIN(ANGLE)*LENG3 ; CL3=COS(ANGLE)*LENG3
GSET(C,K:LASTK:,F,K:FIRSTK:,1,NX,1,NY,+,0,SL3,CL3,INC,:POWER:)
GSET(C,K:LASTK:,F,K:FIRSTK:,1,NX,1,NY,+,0,SL3,CL3,INC,:POWER:)
XCYIZ(1,NZ,T)
VIEW(I,1)
VIEW(J,NY+1)
GVIEW(P,1,1,1); GDRAW
 **************************************************************
  Group 7. Variables stored, solved & named
SOLVE(POT); SOLUTN(POT,Y,Y,Y,P,P,P)
STORE(U1,V1,W1,UCRT,VCRT,WCRT)
 **************************************************************
  Group 13. Boundary conditions and special sources
PATCH(IN,LOW,1,NX,1,NY,1,1,1,1)
COVAL(IN,POT,1.E5,1.0)
 
PATCH(OUT,HIGH,1,NX,1,NY,NZ,NZ,1,1)
COVAL(OUT,POT,1.0,0)
 ************************************************************
  Group 15. Terminate Sweeps
LSWEEP  =    100; RESFAC  = 1.000E-06
 ************************************************************
  Group 16. Terminate Iterations
LITER(POT)=-200
 ************************************************************
  Group 19. EARTH Calls To GROUND Station
POTVEL=T
 ************************************************************
  Group 22. Monitor Print-Out
IZMON  =     NZ/2; TSTSWP  =      -1
PATCH(AXIS,PROFIL,1,1,1,1,1,NZ,1,1)
COVAL(AXIS,POT,0.0,0.0)
COVAL(AXIS,W1,0.0,0.0)