TALK=F;RUN( 1, 1)                                         
TEXT(TWO VESSELS BY IN-FORM
#cls
TITLE 
  DISPLAY
                  /------------------------------\
                /XXXXXXXX/-----------------\XXXXXXX\
              /XXXXXXXX/                     \XXXXXXX\
            /XXXXXXXX/    /---------------\    \XXXXXXX\
          /XXXXXXXX/    /XXXXXXX-----XXXXXXX\    \XXXXXXX\
        /XXXXXXXX/    /XXXXXXX/       \XXXXXXX\    \XXXXXXX\
      /XXXXXXXX/    /XXXXXXX/           \XXXXXXX\    \XXXXXXX\
    /XXXXXXXX/    /XXXXXXX/               \XXXXXXX\    \XXXXXXX\
    !XXXXXXX!    !XXXXXXX!                 !XXXXXXX!    !XXXXXXX!
    !XXXXXXX!    !XXXXXXX!                 !XXXXXXX!    !XXXXXXX!
    !XXXXXX/      \XXXXXX!                 !XXXXXX/      \XXXXXX!
    !XXXX/          \XXXX!                 !XXXX/          \XXXX!
    !XX/    First     \XX!                 !XX/    Second    \XX!
    !X!     sphere     !X!                 !X!     sphere     !X!
    !X!     INFOB_1    !X!                 !X!     INFOB_2    !X!
    !XX\              /XX!                 !XX\              /XX!
    !XXXX\          /XXXX!                 !XXXX\          /XXXX!
    !XXXXXX\      /XXXXXX!                 !XXXXXX\      /XXXXXX!
    !XXXXXXX!    !XXXXXXX!                 !XXXXXXX!    !XXXXXXX!
    !XXXXXXX!    !XXXXXXX!                 !XXXXXXX!    !XXXXXXX!
  
  The task is a 3D steady flow into BFC geometry.
  This example illustrate a creation complex duct
  by means drilling of In-Form object.

  At first a wide bent channel is created by means of BFC.
  The narrow channel is created from it by blocking any cells.

  Then two In-Form objects are described as spheres inside
  a wide channel. Inside each sphere set PRPS=0.

  The Q1 uses the In-Form functions:
      INITIAL, INFOB and SPHERE.
  
  The Q1 contains PHOTON USE commands
  ENDDIS
  PHOTON USE
  P






  up z
  set prop off
  surf prps z 197.9
  surf prps y 197.9
  surf prps x 197.9
  msg Press  to continue
  pause
  vi x
  ve x 1 sh
  ve x 10 sh
  ENDUSE
    GROUP 1. Run title and other preliminaries
TEXT(TWO VESSELS BY IN-FORM
libref=787  
NONORT=T
real(DIAM,leng,leng1,leng2,leng3,angle,ycen,zcen,power)
DIAM=0.6; leng=1.0; angle=-3.14159; power=1.0
leng2=leng
real(leng11,leng12,leng13,leng31,leng32,leng33)
leng11=0.1*leng; leng12=0.6*leng; leng13=0.2*leng
leng31=0.6*leng; leng32=0.6*leng; leng33=0.1*leng
leng1=leng11+leng12+leng13;leng3=leng31+leng32+leng33

integer(lastk,firstk,nz1,nz2,nz3,nz11,nz12,nz13,nz31,nz32,nz33)
nz11=2; nz12=10; nz13=2; nz1=nz11+nz12+nz13
nz31=6; nz32=10; nz33=2; nz3=nz31+nz32+nz33
nz2=10; nz=nz1+nz2+nz3; nx=21;ny=10
ycen=-leng2/angle; zcen=leng1

REAL(lens); lens=leng11+leng12+leng13-leng31-0.5*leng32

  *   Description positions and sizes of drilling spheres
  *** Radius of spheres, m
REAL(RADIUS); RADIUS=leng12/2.

  *** Coordinates of centre first sphere, m
REAL(XPP1,YPP1,ZPP1); XPP1=0.0; YPP1=0.0; ZPP1=leng11+RADIUS

  *** Coordinates of centre second sphere, m
REAL(XPP2,YPP2,ZPP2); XPP2=0.0; YPP2=diam+0.0366; ZPP2=lens

    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
xcyiz(1,nz,t)
gset(c,k:nz11+1:,f,k1,1,nx,1,ny,+,0,0,leng11,inc,1.0)
firstk=nz11+1
lastk=firstk+nz12
gset(c,k:lastk:,f,k:firstk:,1,nx,1,ny,+,0,0,leng12,inc,1.0)
firstk=lastk
lastk=firstk+nz13
gset(c,k:lastk:,f,k:firstk:,1,nx,1,ny,+,0,0,leng13,inc,1.0)
firstk=lastk
lastk=firstk+nz2
gset(c,k:lastk:,f,k:firstk:,1,nx,1,ny,rx,angle,ycen,zcen,inc,:power$
:)
firstk=lastk
lastk=firstk+nz31
real(sl3,cl3)
sl3=-sin(angle)*leng31
cl3=cos(angle)*leng31
gset(c,k:lastk:,f,k:firstk:,1,nx,1,ny,+,0,sl3,cl3,inc,1.0)

firstk=lastk
lastk=firstk+nz32
sl3=-sin(angle)*leng32
cl3=cos(angle)*leng32
gset(c,k:lastk:,f,k:firstk:,1,nx,1,ny,+,0,sl3,cl3,inc,1.0)
firstk=lastk
lastk=firstk+nz33
sl3=-sin(angle)*leng33
cl3=cos(angle)*leng33
gset(c,k:lastk:,f,k:firstk:,1,nx,1,ny,+,0,sl3,cl3,inc,1.0)

    GROUP 7. Variables stored, solved & named
SOLVE(P1,V1,U1,W1); STORE(PRPS)
SOLUTN(P1,Y,Y,Y,n,Y,Y)
SOLUTN(U1,Y,Y,Y,n,Y,Y)
SOLUTN(V1,Y,Y,Y,n,Y,Y)
SOLUTN(W1,Y,Y,Y,n,Y,Y)

    GROUP 9. Properties of the medium (or media)
RHO1=1.; ENUL=0.1

    GROUP 11. Initialization of variable or porosity fields
FIINIT(W1)=1.;FIINIT(PRPS)=0.
INIADD=F
PATCH(INIT1,INIVAL,1,NX,NY/3+1,NY,1,NZ,1,1)
INIT (INIT1,PRPS,0.,198.0)

  INFORM11BEGIN
  *** Description of first sphere as INFOB_1 In-Form object
PATCH(PATCH1,CELL,1,NX,1,NY,1,NZ1,1,1)
(INFOB at PATCH1 is SPHERE(:XPP1:,:YPP1:,:ZPP1:,:RADIUS:$
) with INFOB_1)                                    

  *** Description of second sphere as INFOB_2 In-Form object
PATCH(PATCH2,CELL,1,NX,1,NY,NZ1+NZ2+1,NZ,1,1)
(INFOB at PATCH2 is SPHERE(:XPP2:,:YPP2:,:ZPP2:,:RADIUS:$
) with INFOB_2)

  *** Setting of PRPS=0 inside each spheres
(INITIAL of PRPS at PATCH1 is 0. with INFOB_1)
(INITIAL of PRPS at PATCH2 is 0. with INFOB_2)
  INFORM11END

    GROUP 13. Boundary conditions and special sources
PATCH(INLET,LOW,1,NX,1,NY,1,1,1,1)
COVAL(INLET,P1,FIXFLU,1.0)
COVAL(INLET,U1,ONLYMS,0.0)
COVAL(INLET,V1,ONLYMS,0.0)
COVAL(INLET,W1,ONLYMS,1.0)

PATCH(OUTLET,HIGH,1,NX,1,NY,NZ,NZ,1,1)
COVAL(OUTLET,P1,FIXP,0.0)

    GROUP 15. Termination of sweeps
LSWEEP=1000

    Group 16. Terminate Iterations
LITER(P1)=2

    GROUP 17. Under-relaxation devices
RELAX(P1,LINRLX,.2);RELAX(W1,FALSDT,.1)
RELAX(U1,FALSDT,.1);RELAX(V1,FALSDT,.1)

    GROUP 22. Spot-value print-out
TSTSWP=-1;IXMON=1; IYMON=2; IZMON=NZ/2
DISTIL=T
EX(P1)=6.536E-01; EX(U1)=2.435E-02; EX(V1)=1.798E-02;
EX(W1)=2.609E-01; EX(PRPS)=9.146E+01; EX(WCRT)=2.403E-01
EX(VCRT)=4.242E-02; EX(UCRT)=1.869E-02
STOP