*
#$b001
    display
  *
 
     This example Q1 demonstrates the use of Copy-Rotate
     option for BFC-type grid; it is used here to create
     S-bend of a tube.
 
CT1=TEXT(COPY-ROTATE_EXAMPLE :               B540
#$b002
  *
     Set the grid type to BFC
CT1=BFC=T
#$b002
REAL(RADIUS,ROOT)
 
     Enter circle radius (default 0.25m); root=0.707*radius
READVDU(radius,real,0.25)
INTEGER(NAB,NBC)
root=0.707*radius
     Input data used in this example:
MESG(  radius=:radius:      root  =:root:
 
  *
     Define points A,B,C and D
GSET(P,A,0,0,0)
     Point A positioned at (0,0,0)
       GSET(P,A,0,0,0)
     Point B positioned at (0,radius,radius)
       GSET(P,B,0,radius,radius)
GSET(P,B,0,RADIUS,RADIUS)
GSET(P,C,0,RADIUS*2,0)
     Point C positioned at (0,radius*2,0)
       GSET(P,C,0,radius*2,0)
     Point D positioned at (0,radius,-radius)
CT1=GSET(P,D,0,radius,-radius)
#$b003
  *
     Draw  four arc lines (AB,BC,CD,DA) from A to D
     to create a circle.
     Lines AB&CD must have equal number of cells, as
     well as lines BC&DA. Power is set to 1.0, ie. cells
     are uniformly distributed.
 
     Enter number of cells for AB(&CD) lines (default 5)
readvdu(nab,int,5)
     Arc AB (A-B) goes through point (0,radius-root,root)
       GSET(L,AB,A,B,nab,1.0,ARC,0,radius-root,root)
GSET(L,AB,A,B,NAB,1.0,ARC,0,RADIUS-ROOT,ROOT)
 
     Enter number of cells for BC(&DA) lines (default 5)
readvdu(nbc,int,5)
     Arc BC (B-C) goes through point (0,radius+root,root)
       GSET(L,BC,B,C,nbc,1.0,ARC,0,radius+root,root)
GSET(L,BC,B,C,NBC,1.0,ARC,0,RADIUS+ROOT,ROOT)
     Arc CD (C-D) goes through point (0,radius+root,-root)
       GSET(L,CD,C,D,nab,1.0,ARC,0,radius+root,-root)
GSET(L,CD,C,D,NAB,1.0,ARC,0,RADIUS+ROOT,-ROOT)
     Arc DA (D-A) goes through point (0,radius-root,-root)
CT1=GSET(L,DA,D,A,nbc,1.0,ARC,0,radius-root,-root)
#$b003
  *
     Define frame ABCD (circle) which has corner points
     A,B,C,D
CT1=GSET(F,ABCD,A,-,B,-,C,-,D,-)
#$b003
  *
     Enter number of cells for I direction (default 20)
if(iqalib.ne.0) then
+ nx=0 ! set nx=0 so that readvdu will take default 20
endif
readvdu(nx,int,20)
MESG(Set the BFC grid dimension as :nx: x :nbc: x :nab: cells with
     reference length 1 x radius*2 x radius*2.
CT1=GSET(D,nx,nbc,nab,1,radius*2,radius*2)
#$B004
  *
 
     Match grid plane I1 on frame ABCD using the
     trans-finite method
CT1=GSET(M,ABCD,+K+J,1,1,1,TRANS)
#$B004
  *
it2=nx/4
MESG(Copy I:it2: plane from I1 plane by shifting.
REAL(SHIFT)
     Enter shifting distance; it will define a straight part
     of the tube (default radius*4)
READVDU(SHIFT,REAL,4*RADIUS)
     Copy planes with a distance (dx=shift,dy=0,dz=0), including
     internal planes; internal planes are uniformly distributed,
     hence power is set to 1.
CT1=GSET(C,I:it2:,F,I1,1,nbc,1,nab,+,shift,0,0,INC,1)
#$B004
  *
it1=nx/2
MESG(Copy I:it1: plane from I:it2: plane by rotating it around
     Z axis located at X=shift, Y=-0.2 m, clock-wise by 90deg.(PI/2)
     Include internal planes and distribute them uniformly.
CT1=GSET(C,I:it1:,F,I:it2:,1,nbc,1,nab
CT1=:CT1:,RZ,-1.5700E+00,shift,-0.2,INC,1)
#$B004
  *
it1=nx/2
it2=it1+it2
MESG(Copy I:it2: plane from I:it1: plane by rotating it around
     Z axis located at X(axis)=shift+radius*2+0.4, Y=-0.2 m, anti-
     clock-wise by 90deg.(PI/2). Include internal planes and
     distribute them uniformly.
REAL(XAXIS);XAXIS=shift+radius*2+0.4
CT1=GSET(C,I:it2:,F,I:it1:,1,nbc,1,nab
CT1=:CT1:,RZ,1.5700E+00,xaxis,-0.2,INC,1)
#$B004
  *
it1=nx+1
MESG(Finish the shape by copying I:it1: plane from I:it2: plane by
     shifting it with a distance (shift,0,0), including internal
     planes, uniformly distributed.
CT1=GSET(C,I:IT1:,F,I:IT2:,1,nbc,1,nab,+,shift,0,0,INC,1)
#$B004
  enddis