```
TEXT(DEMONSTRATIONS OF GRID GENERATION:  B532
TITLE
MESG(GRID GENERATION EXAMPLES.
MESG(The following examples are simple test cases exemplifying
MESG(the use of the grid generation commands
MESG(SETLIN, DOMAIN and MAGIC.
MESG(
MESG(Set the default grid and VIEW it...
DELAY(100)
NX=10;NY=1;NZ=10
CALL RESET_FRACS
BFC=T
VIEW(J,1)
MESG(Transform to a polar co-ordinate grid of unit radius....
DELAY(100)
Set XC over the whole DOMAIN
SETLIN(XC,LNK*CSI)
Set ZC over the whole DOMAIN
SETLIN(ZC,LNK*SNI)
VIEW the resultant grid
VIEW(J,1)
MESG(Construct a segment of a polar grid of 1 radian...
DELAY(100)
SETLIN(XC,LNK*COS(LNI));SETLIN(ZC,LNK*SIN(LNI));VIEW(J,1)
MESG(Construct an ellipse...
DELAY(100)
SETLIN(XC,0.6*LNK*CSI);SETLIN(ZC,LNK*SNI);VIEW(J,1)

MESG(Re-set the default grid with nx=1 ny=32 and nz=10...
DELAY(100)
NX=1;NY=32;NZ=10
CALL RESET_FRACS
BFC=T;VIEW(I,1)
MESG(Distort section of the low boundary into a semi-circle...
DELAY(100)
DOMAIN(1,1,((NY+1)*3)/8,((NY+1)*5)/8,1,1)
SETLIN(ZC,((YL-YF)/2)*(1.0-(2.0*(J-JF)/(JL-JF)-1.0)**2)**.5)
VIEW(I,1)
MESG(Generate interior coordinates by interpolation...
DELAY(100)
DOMAIN(1,2,1,NY+1,1,NZ+1)
MAGIC(T);VIEW(I,1)
MESG(Apply Laplace solver...
DELAY(100)
MSWP=10
LITYC=5;LITZC=5
IMON=1;JMON=5;KMON=5
MAGIC(L);VIEW(I,1)

MESG(Re-set the default grid with nx=1 ny=11 and nz=11...
DELAY(100)
NX=1;NY=11;NZ=11
CALL RESET_FRACS
BFC=T;VIEW(I,1)
MESG(Distort each side into an arc of a circle...
DELAY(100)
REAL(A)
A=YVLAST/2.0
DOMAIN(1,1,1,NY+1,1,1)
SETLIN(ZC,A*(1-(2-(2*(J-JF)/(JL-JF)-1)**2)**.5))
VIEW(I,1)
DOMAIN(1,1,1,NY+1,NZ+1,NZ+1)
SETLIN(ZC,A*(1+(2-(2*(J-JF)/(JL-JF)-1)**2)**.5))
VIEW(I,1)
DOMAIN(1,1,1,1,1,NZ+1)
SETLIN(YC,A*(1-(2-(2*(K-KF)/(KL-KF)-1)**2)**.5))
VIEW(I,1)
DOMAIN(1,1,NY+1,NY+1,1,NZ+1)
SETLIN(YC,A*(1+(2-(2*(K-KF)/(KL-KF)-1)**2)**.5))
VIEW(I,1)
MESG(Generate interior coordinates by interpolation...
DELAY(100)
DOMAIN(1,2,1,NY+1,1,NZ+1)
MAGIC(T);VIEW(I,1)
MESG(Apply Laplace solver...
DELAY(100)
IMON=1;JMON=5;KMON=5
MSWP=10;MAGIC(L);VIEW(I,1)
LIBREF=532
ENDMAIN     !
SUBROUTINE RESET_FRACS
Reset FRAC arrays to ensure uniform default grid set
DO II=1,NX
XFRAC(II)=0.0
ENDDO
DO II=1,NY
YFRAC(II)=0.0
ENDDO
DO II=1,NZ
ZFRAC(II)=0.0
ENDDO
ENDSUB
```