```
GROUP 1. Run title and other preliminaries
TEXT(Bent-pipe grid, created by gset)
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
TITLE
originated by dbs 11.01.94
real(DIAM,leng1,leng2,leng3,angle,ycen,zcen,power)
DIAM=0.6;leng1=1.0;angle=-3.14159/2;power=1.0
leng2=leng1;leng3=leng1

integer(lastk,firstk,nz1,nz2,nz3)
nz1=10;nz2=10;nz3=10
nx=10;ny=10

mesg(nx=:nx:, ny=:ny:, nz1=:nz1:, nz2=:nz2:, nz3=:nz3:; DIAM=:diam:
mesg(leng1=:leng1:, leng2=:leng2:, leng3=:leng3:; angle=:angle:
mesg(Do you want to change input data? (y/n)
if(:ans:.eq.y) then
mesg(change cell numbers? (y/n)
if(:ans:.eq.y) then
+ mesg(nx ?
+ mesg(ny ?
+ mesg(nz1 ?
+ mesg(nz2 ?
+ mesg(nz3 ?
endif
mesg(insert angle if not :angle:
if(:angle:.eq.0) then
+ angle=0.0001
endif
mesg(change sizes? (y/n)
if(:ans:.eq.y) then
+ mesg(leng1 ?
+ mesg(leng2 ?
+ mesg(leng3 ?
+ mesg(diam ?
endif
endif
ycen=-leng2/angle;zcen=leng1
nz=nz1+nz2+nz3
GROUP 3. X-direction grid specification
cartes=f;xulast=6.2832
grdpwr(x,nx,xulast,1.0)

GROUP 4. Y-direction grid specification
yvlast=DIAM*0.5
grdpwr(y,ny,yvlast,1.0)

GROUP 5. Z-direction grid specification
zwlast=leng1*nz/nz1
grdpwr(z,nz,zwlast,1.0)

GROUP 6. Body-fitted coordinates or grid distortion
bfc=t
first 10 cells remain unbent

bend the next 10 cells

bend the next 10 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 10 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:)
view(i,1)
view(j,ny+1)
GVIEW(P,1,1,1);GDRAW
```