next up previous contents
Next: -stlfile: CAD import via Up: Geometric primitives Previous: -ggcylinder: A general cylinder   Contents


-gbor: A general body of revolution in general direction

A gbor is a body of revolution with a cross section described as a general polygon. This cross section is swept along an axis in a general direction, additionally, only cells that fulfill some additional condition will be filled.
 ##############################################################################
 # Flags: nomenu, noprompt, nomessage,                                        #
 ##############################################################################
 # section -gbor                                                              #
 ##############################################################################
 # material       =  1                                                        #
 # whichcells     = all, taboo= none                                          #
 #     show       = off                 -- (off | all | later | now)          #
 #     name       = gbor-000000000                                            #
 # inside         = yes                 -- (yes|no)                           #
 # originprime    = ( 0.0, 0.0, 0.0 )                                         #
 # zprimedirection= ( 0.0, 0.0, 1.0 )                                         #
 # rprimedirection= ( 1.0, 0.0, 0.0 )                                         #
 # range          = ( 0.0, 360.0 )                                            #
 # xscaleprime    = 1.0                 -- elliptic coords.                   #
 # yscaleprime    = 1.0                 -- elliptic coords.                   #
 ##############################################################################
 ## syntax:                                                                   #
 #  point= (Zi, Ri)                                                           #
 #  arc, radius= RADIUS, type= [clockwise | counterclockwise]                 #
 #       size= [small | large ]                                               #
 #       deltaphi= 5                                                          #
 #  ellipse, center= (Z0, R0), size= [small | large ]                         #
 #       deltaphi= 5                                                          #
 ##############################################################################
 # doit, return, help, list, reset, clear                                     #
 ##############################################################################


Example The following describes something like a tuning-plunger.
 # /usr/local/gd1/examples-from-the-manual/plunger0.gdf

 define(PlungerInnerRadius, 100e-3/2 )
 define(PlungerCurvature, 16e-3 )
 define(PlungerAngle, -67.5*@pi/180 )

 -general
    outfile= /tmp/UserName/example
    scratch= /tmp/UserName/scratch-

    text()= A Plunger, modelled as a body of revolution.
    text()= Curvature     : PlungerCurvature
    text()= Radius        : PlungerInnerRadius
    text()= Angle of Axis : eval(PlungerAngle * 180 / @pi) Degrees

 -mesh
    spacing= 0.2e-2
    pxlow= -5e-2, pxhigh= 12e-2
    pylow= -18e-2, pyhigh= 3e-2
    pzlow= -6e-2, pzhigh= 6e-2

 -gbor
     material= 4
     originprime= ( 0, 0, 0 )
     zprimedirection= ( -cos(PlungerAngle), -sin(PlungerAngle), 0 )
     rprimedirection= ( 0, 0, 1 )
     range= ( 0, 360 )

     clear
        # point= ( z, r )
     point= ( 0, 0 )
     point= ( 0, PlungerInnerRadius-PlungerCurvature )
        arc, radius= PlungerCurvature, size= small, type= counterclockwise
     point= ( -PlungerCurvature, PlungerInnerRadius )
     point= ( -170e-3, PlungerInnerRadius )
     point= ( -170e-3, 0 )
     doit

 -volumeplot
     scale= 3
     doit
Figure 1.9: A simple gbor.
\begin{figure}\centerline{
\psfig{figure=gbor-example0.ps,width=18cm,bbllx=-2pt,bblly=-2pt,bburx=760pt,bbury=552pt,clip=}
}\end{figure}

Example The following discretises the connection of two circular waveguides, meeting each other at an angle of 90 degrees.
 # /usr/local/gd1/examples-from-the-manual/gbor-example1.gdf
define(LargeNumber, 10000)       # some big number

define(MAXCELLS, 1e+5)

define(XLOW, 0) define(XHIGH, 5e-2)
define(YLOW, 0) define(YHIGH, 6e-2)
define(ZLOW, -1.1e-2) define(ZHIGH, 0)

define(STPSZE, ((XHIGH-XLOW)*(YHIGH-YLOW)*(ZHIGH-ZLOW)/MAXCELLS)**(1/3) )

 -mesh
    volume= ( XLOW, XHIGH, \
              YLOW, YHIGH, \
              ZLOW, ZHIGH )

    spacing= STPSZE

 -general
    outfile= /tmp/UserName/example
    scratch= /tmp/UserName/scratch
 define(R, 1.0e-2)
    text()= Intersection of two circular cylinders with radius R
    text()= generated as general cylinders
    text()= where 'taboo' is specified
    text()= stpsze= STPSZE, maxcells= MAXCELLS

#
# Fill everything with metal
#
 -brick
    material= 1
    volume= ( -LargeNumber, LargeNumber, \
              -LargeNumber, LargeNumber, \
              -LargeNumber, LargeNumber )
    doit

#
# First step,
# fill cells above the diagonal with material 3
# these cells will not be filled by the first circular cylinder,
# since we will specify 'taboo= 3'
#
#
 -ggcylinder
    material= 3,
    origin= ( 0, 0, 0 ), xprime= ( 1, 0, 0 ), yprime= ( 0, 1, 0 ),
    range= ( ZLOW, ZHIGH ),

    clear
    point= ( XLOW, YLOW ), point= ( XLOW, YHIGH ),
    point= ( XLOW+(YHIGH-YLOW), YLOW )

    doit

#
# Second step:
# fill a circular cylinder in x-direction,
# but NOT cells with material index 3 (taboo=3)
#
 -ggcylinder
    material= 0, taboo= 3,
    xprime= ( 0, 1, 0 ), yprime= ( 0, 0, 1 ),  # so the axis will be in +x
    origin= ( 0, 4e-2, 0 ),                    # shift of origin
    range= ( XLOW, XHIGH ),

    clear
       point= ( -R, 0 ),
         arc, radius= R, type= counterclockwise,
       point= ( 0, -R ),
         arc, radius= R,
       point= ( R, 0 ),
    doit

#
# Third step:
# fill a circular cylinder in y-direction,
# but ONLY cells with material index 3 (whichcells=3),
#
 -ggcylinder
    material= 0, whichcells= 3, taboo= none
    xprime= ( 1, 0, 0 ), yprime= ( 0, 0, -1 ),  # so the axis will be in +y
    origin= ( 2.e-2, 0, 0 ),                    # shift of origin
    range= ( YLOW, YHIGH ),

    clear
       point= ( -R, 0 ),
          arc, radius= R, type= clockwise,
       point= ( 0, R ),
          arc, radius= R,
       point= ( R, 0 ),
    doit

 -volumeplot
    eyeposition= ( 1, 2, 1 )
    scale= 3.5
    doit
Figure 1.10: The intersection of two circular cylinders, where whichcells and taboo were specified.
\begin{figure}\centerline{
\psfig{figure=gbor-example1.ps,width=18cm,bbllx=-2pt,bblly=-2pt,bburx=760pt,bbury=552pt,clip=}
}\end{figure}

Example The following describes a reentrant cavity.
 # /usr/local/gd1/examples-from-the-manual/gbor-example.gdf
 define(MaxCells, 2e+6)

 #
 # define the geometry parameters
 #
 define(RBeamTube, 4.7625e-2)
 define(RCurve,  1.0e-2)
 define(ZGapNose, 10.9e-2)
 define(RLarge, 25.0e-2)  define(RSmall, 15.0e-2)  define(RCenter, 10.0e-2)

 define(INF, 10000) define(EL, 1) define(MAG, 2)

 define(XLOW, -0.250) define(XHIGH, 0.250)
 define(YLOW, -0.250) define(YHIGH, 0.250)
 define(ZLOW, -0.200) define(ZHIGH, 0.200)

 define(STPSZE, ((XHIGH-XLOW)*(YHIGH-YLOW)*(ZHIGH-ZLOW)/MaxCells)**(1/3) )

 #
 # gdfidl can evaluate sin(), cos(), atan() and X**Y
 # definition of functions degsin() and degcos()
 #
 sdefine(degsin, [sin((@arg1)*@pi/180)])
 sdefine(degcos, [cos((@arg1)*@pi/180)])
 sdefine(degtan, [sin((@arg1)*@pi/180)/cos((@arg1)*@pi/180)])

-general
   outfile= /tmp/UserName/example
   scratch= /tmp/UserName/scratch-

   text(3)= A quarter of a reentrant cavity
   text()= The cavity is described as a body of revolution,
   text()=
   text()= maxcells= MaxCells, stpsze= STPSZE

-mesh
   pxlow= 0*XLOW, pxhigh= 1*XHIGH
   pylow= 0*YLOW, pyhigh= 1*YHIGH
   pzlow= 1*ZLOW, pzhigh= 1*ZHIGH

   cxlow= mag, cxhigh= mag
   cylow= mag, cyhigh= mag
   czlow= ele, czhigh= ele

   spacing= 1*STPSZE

 -material
   material= 3, type= electric

 -brick
    #
    # we fill the universe with metal
    #
    material= 3
       volume= ( -INF,INF, -INF,INF, -INF,INF )
    doit

 #
 # carve out the cavity itself
 #
 -gbor
     material= 0, range= ( 0, 360 )
     origin= ( 0, 0, 0 )
     show= later,      # don't show now, but show later
#

     clear   # clear a possible previous polygon list

        point= (     0          , 0 ),
        point= ( ZHIGH+2*STPSZE , 0 ),
        point= ( ZHIGH+2*STPSZE , RBeamTube ),
        point= ( ZGapNose+RCurve, RBeamTube ),
           arc, radius= RCurve, size= small, type= clockwise,
           deltaphi= 10
define(rdum, RBeamTube+(1+degcos(30))*RCurve)
define(zdum, ZGapNose +(1-degsin(30))*RCurve)
        point= ( zdum, rdum )
define(deltaz, RSmall-zdum)
define(deltar, deltaz*degtan(30))
 define(ffac, 0.85)   ## adjust this for a smooth transition
define(zdum2, zdum+ffac*deltaz)
define(rdum2, rdum+ffac*deltar)
        point= ( zdum2, rdum2 )
          arc, radius= RCurve, size= small, type= counterclockwise,
          deltaphi 10
        point= ( RSmall, RCenter-0.8*RCurve ),
        point= ( RSmall, RCenter ),
           arc, radius= RSmall, size= small, type= counterclockwise,
           delta= 3
        point= ( -RSmall, RCenter ),
        point= ( -RSmall, RCenter-0.8*RCurve ),
           arc, radius= RCurve, size= small, type= counterclockwise,
           deltaphi= 10
        point= ( -zdum2, rdum2 )
        point= ( -zdum, rdum )
           arc, radius= RCurve, size= small, type= clockwise, delta 10
        point= ( -(ZGapNose+RCurve), RBeamTube ),

        point= ( ZLOW-2*STPSZE, RBeamTube ),
        point= ( ZLOW-2*STPSZE, 0 )
     list
     doit
#
# enforce some meshplanes:
#
-mesh
   zfixed( 2, -(ZGapNose+RCurve), -ZGapNose ) # at the noses
   zfixed( 2,  (ZGapNose+RCurve),  ZGapNose ) # at the noses

   zfixed( 2, -RSmall, RSmall)                # at the z-borders of the cavity

-volumeplot
   scale= 3
   doit
Figure 1.11: A complicated gbor
\begin{figure}\centerline{
\psfig{figure=gbor-example.ps,width=18cm,bbllx=-2pt,bblly=-2pt,bburx=760pt,bbury=552pt,clip=}
}\end{figure}


Example The following describes two bodies of revolution that look similiar to glasses. The shape is only specified once, but two different glasses are generated by varying 'zprime' and 'rprime'

 # /usr/local/gd1/examples-from-the-manual/gbor-glasses.gdf

define(MAXCELLS,1e+6)

define(XLOW,-5e-2) define(XHIGH,18e-2)
define(YLOW,-0e-2) define(YHIGH,17e-2)
define(ZLOW,-3e-2) define(ZHIGH,18e-2)

define(STPSZE, ((XHIGH-XLOW)*(YHIGH-YLOW)*(ZHIGH-ZLOW)/MAXCELLS)**(1/3) )


 -general
    outfile= /tmp/UserName/glasses
    scratch= /tmp/UserName/glasses-scratch-

 -mesh
    spacing= STPSZE
    volume= ( XLOW, XHIGH, \
              YLOW, YHIGH, \
              ZLOW, ZHIGH )

# Fill the universe with vacuum
 define(LargeNumber,10000)
 -brick
     material= 0
        volume= ( -LargeNumber, LargeNumber, \
                  -LargeNumber, LargeNumber, \
                  -LargeNumber, LargeNumber )
     doit

 #
 # The glasses:
 #
  -gbor

     #
     # Definition of the cross-section:
     #
     clear
     point= (  0.7e-2,      0 ),
     point= (       0, 4.0e-2 ),
       arc, radius=0.25e-2, size= large, type= clockwise
     point= (  0.3e-2, 4.0e-2 ),
     point= (  1.0e-2, 1.0e-2 ),
     point= (  8.0e-2, 0.8e-2 ),
     point= ( 10.0e-2, 1.4e-2 ),
     point= ( 15.0e-2, 6.0e-2 ),
       arc, radius= 0.4e-2, type= clockwise
     point= ( 15.2e-2, 5.4e-2 ),
     point= ( 10.0e-2,      0 )

     #
     # That cross-section is used twice,
     # with different parameters for origin, zprime etc..
     #

     material= 1,
     origin= ( -2e-2, 0, 4e-2 ),
     zprimedir= ( 1, 0, 0 ),
     rprimedir= ( 0, 1, 0 ),
     range= ( -90, 90 ),
     show= now
     doit                 # this 'doit' generates the first 'glass'


     material= 3
     origin= ( 0, 12e-2, 4e-2 ),
     zprimedir= ( 1, -0.5, 0.7 ),
     rprimedir= ( 0, 1, 0 ),
     range= ( 0, 360 ),
     show= all
     doit                 # this 'doit' generates the second 'glass'

 -volumeplot
     eyeposition= ( 0.7, 1, 0.5 )
     scale= 4
    doit
Figure 1.12: Two complicated gbors (glasses).
\begin{figure}\centerline{
\psfig{figure=gbor-glasses.ps,width=18cm,bbllx=-2pt,bblly=-2pt,bburx=760pt,bbury=552pt,clip=}
}\end{figure}


next up previous contents
Next: -stlfile: CAD import via Up: Geometric primitives Previous: -ggcylinder: A general cylinder   Contents