CERN home page CERN home page Consult pages Consult pages Writeups at CERN Writeups at CERN Garfield pages Garfield pages Help Help &CELL &CELL Table of contents Keyword index

&CELL


overview

Cell sections come in 2 formats:

Creating a new cell:

Command Short description
CELL-IDENTIFIER Provides a short description to the cell
DEFINE Sets local parameters for use with ROWS
DIELECTRICUM Enters a dielectric slab (do not use !)
FIELD-MAP Reads a finite element field map
OPTIONS Plotting of a layout etc
PERIODICITY Makes the cell periodic
PLANE Enters a plane
RESET Cancels part of the cell description
ROWS Header for the list of wires
SAVE-FIELD-MAP Writes a field map in binary format
SOLIDS Enters solid volumes for use with field maps
TUBE Enters a tube surrounding the wires
WRITE Writes a compact format dataset

Retrieving a cell from a dataset:

Command Short description
GET Retrieves a compact cell description
READ-FIELD-MAP Reads a binary field map


methods

Additional information on:
   
 


CELL-IDENTIFIER

Assigns an identification string to the cell description. The string is used in the plots when the information is relevant. It is advisable to enclose the identifying string by double quotes: this will preserve the case and you may have blanks inside the string.

The string can be retrieved by means of the GET_CELL_DATA procedure.

The identification string is displayed in the plots using the COMMENT text representation.

Format:

CELL-IDENTIFIER string

Example:

CELL-ID "DC1 central cell"

DEFINE

Defines a variable to be used in the listing of the ROWS of wires.

As usual, the current value of a variable is displayed if no new value is provided. All variables are displayed if arguments are absent altogether.

Do not confuse DEFINE with Global: DEFINE defines local variables for the cell section. Global defines variables that you can use anywhere. Expressions using local variables and the loop-variable are evaluated automatically. Expressions in terms of global variables have to be enclosed by curly brackets to obtain substitution.

Format:

DEFINE variable value

Example:

DEF VP_1=1000
DEF VP_2=2000
DEF R_1=5000
DEF R_2=5000
DEF VP_BETWEEN=(VP_1*R_2+VP_2*R_1)/(R_1+R_2)
DEF VP_BETWEEN

A simple resistor chain, the last line displays the value. You could in principle also enter the whole formula in the ROWS lines.

Global resistor=5000
define r_1 {resistor}
define r_2 {resistor}

The global variable RESISTOR is copied to the local variables R_1 and R_2. Note the use of curly brackets.

Additional information on:
   


DIELECTRICUM

+-----------------------------------------------------------------+
| The current version of Garfield only takes dielectrics into     |
| account in a small number of configurations. It is much better  |
| to use a finite elements program to generate a field map and to |
| read such a map in with the FIELD-MAP instruction.              |
+-----------------------------------------------------------------+

Adds a slab of dielectric material to your cell. The slab extends from -infinity to +infinity in one direction and has a range you choose in the other.

x-Slabs and y-slabs of dielectric material are allowed to overlap provided they have the same dielectric constant. Slabs in one direction are not allowed to overlap, even if they have the same dielectric constant.

Dielectrica may be located amidst the wires but the must be inside the equipotential planes, if there are any in your cell.

Dielectrica slow the program down by a significant amount.

Format:

DIELECTRICUM {X-RANGE|Y-RANGE} min max EPSILON eps

Example:

DIELECTRICUM X -10 10 EPS 5

This slab of dielectric material covers the -10 < x < 10 part in x and the whole of y. The dielectric constant for the material is chosen to be 5.

Additional information on:
   


FIELD-MAP

The electrostatics part of the Garfield program does not deal with dielectrics and 3-dimensional structures. However, Garfield can read field maps generated by an (external) finite program.

Currently, field maps in the format generated by Maxwell Parameter Extractor 2D and 3D as well as by Tosca and Maxwell Field Simulator 2D and 3D can be read. Interfaces for files produced by other such programs can be added (please contact the author).

When you read a field map, any wire, plane, periodicity, dielectric medium and magnetic field that you entered sofar is deleted. Also field map components read with earlier FIELD-MAP commands are deleted.

Reading large field maps is time consuming. To save time, you can after having read a set of external field maps with FIELD-MAP, write a binary field map with SAVE-FIELD-MAP and read it in with READ-FIELD-MAP. Such field maps are much smaller and much faster to read in, but are not portable between computer systems.

Also the optimisation section has a FIELD-MAP command. The field maps entered in the cell section serve as main field, i.e. the field map replaces the field due to wires and planes, while the field maps entered in the optimisation section are used for the computation of the background field. The two field maps share (for the moment) the same storage and can therefore not be used at the same time.

The FIELD-MAP command can also read magnetic fields computed by finite element programs. For the moment, there is no experience with such fields.

Format:

FIELD-MAP [FILES [contents_1] file_1 [LABEL label_1] ...
                 [contents_2] file_2 [LABEL label_2] ...
                 ...
                 [contents_n] file_n [LABEL label_n] ...
                 [format] ] ...
          [DRIFT-MEDIUM {SMALLEST-EPSILON | ...
                         SECOND-SMALLEST-EPSILON | ...
                         n | ...
                         SECOND-LARGEST-EPSILON | ...
                         LARGEST-EPSILON | ...
                         epsilon}] ...
          [NOT-X-PERIODIC | X-PERIODIC | ...
               X-MIRROR-PERIODIC | X-AXIALLY-PERIODIC] ...
          [NOT-Y-PERIODIC | Y-PERIODIC | ...
               Y-MIRROR-PERIODIC | Y-AXIALLY-PERIODIC] ...
          [NOT-Z-PERIODIC | Z-PERIODIC | ...
               Z-MIRROR-PERIODIC | Z-AXIALLY-PERIODIC] ...
          [LINEAR | QUADRATIC | CUBIC] ...
          [DELETE-BACKGROUND | KEEP-BACKGROUND] ...
          [WINDOW xmin ymin [zmin] xmax ymax zmax] ...
          [Z-RANGE zmin zmax] ...
          [PLOT-MAP | NOPLOT-MAP] ...
          [NOHISTOGRAM-MAP | HISTOGRAM-MAP] ...
          [RESET]

Example:

&CELL
field-map files "e_field.arg" "potential.arg" "epsilon.arg" ...
          drift-medium second-smallest ...
          x-periodic

(Maxwell Parameter Extractor 2D has been used to generate maps of the electric field, the potential and the dielectric constant. These maps are read in and the medium with the 2nd smallest dielectric constant is declared to be the drift medium. The map is also declared to be periodic in the x direction.)

Additional information on:
   
 


GET

Retrieves a compact format cell dataset written by WRITE. Any cell information you may already have entered, is cleared.

This command is executed immediately and you may - with caution - replace some of the elements of the description after issuing the command.

Format:

GET file [member]

Examples:

GET 'disk$zp:[veenhof.garfield]cell.dat'
GET lib

(The last example will presumably take the first member of type CELL from the library with file name LIB. Such libraries may contain members also of other types - only members of type CELL will be considered by GET. On Vax, the file name of the last example would be expanded to LIB.DAT.)

Additional information on:
   


GRAVITY

Orients the chamber in space. This orientation matters when one computes the sag of the wires due to gravitational forces.

The 3 arguments form a vector that indicates the direction in which gravity pulls on the wire. Only the direction of the vector is used, not its normalisation.

The default setting is (0,0,1) i.e. gravity works along the wires.

Format:

GRAVITY  x y z

Example:

gravity  0 0 1

This makes the wires run vertical, the default. In this situation, gravity does not produce a wire sag.


OPTIONS

Selects both cell related as well as top level OPTIONS.

Format:

OPTIONS [NOLAYOUT | LAYOUT] ...
        [NOCELL-PRINT | CELL-PRINT] ...
        [NOTISOMETRIC | ISOMETRIC] ...
        [NOWIRE-MARKERS | WIRE-MARKERS] ...
        [NOCHARGE-CHECK | CHARGE-CHECK]

Example:

OPT C-PR

Requests a summary of the elements present in the cell.

Additional information on:
   
 


PERIODICITY

States that the chamber has infinite periodicity in a direction. Use two of these lines if your chamber is doubly periodic.

Chambers which have a repetitive structure over a considerable distance, as for instance in multiwire proportional chambers, should be declared periodic if you wish to enhance the numerical precision of the calculations. You will also gain CPU time by doing so. There are however instances where you may wish to enter several copies of the cell, increasing the periodicity length accordingly:

This statement is only used with chambers constructed from wires and planes. If the field in the chamber is taken from a field map, options such as X-PERIODIC of the FIELD-MAP command should be used instead.

Format:

PERIODICITY direction = length

Example:

PERIOD X=1

Additional information on:
   


PLANE

Specifies an infinite equipotential plane in at constant x, y or phi or a circular plane with constant r.

Note that one is not allowed to put a wire at the centre of a circular plane. Wires inside a circular plane, whether at the centre or not, are handled by TUBE geometries.

Planes are not compatible with a TUBE geometry. To generate a pie wedge, use a plane at constant r and two planes at constant phi.

Format:

PLANE direction coordinate ...
      [V potential] ...
      [LABEL label] ...
      [{X-STRIP | Y-STRIP | R-STRIP | PHI-STRIP | Z-STRIP} strip_min strip_max ...
         [GAP gap] [LABEL strip_label]]

Examples:

pl x=-1, V=1000
plane phi=30

Additional information on:
   


READ-FIELD-MAP

Reads a binary field map file, written with SAVE-FIELD-MAP.

This command is executed immediately. Once the command has completed, you can use the FIELD-MAP command to modify for instance the selection of drift medium,

READ-FIELD-MAP has the same side effects as FIELD-MAP, i.e. the command deletes any wires, planes, periodicities, dielectric medium and magnetic field that may have been entered before the command is issued.

Reading binary field maps is, for most field map formats, much faster than reading the original files - but binary field maps are not portable. Files to be read with READ-FIELD-MAP must have been written on the same computer system.

Format:

READ-FIELD-MAP   file

Example:

&CELL
cell-id "Micromegas"
Global path=`/afs/cern.ch/exp/compass/scratch/d02/megas/Maxwell/mic3.pjt/`
Call inquire_file(path/`1000_400_0.1.bin`,exist)
If exist Then
   read-field-map {path/`1000_400_0.1.bin`}
Else
   field-map files potential "{path}/V_1000_400_0.1.arg" ...
                   e-field   "{path}/E_1000_400_0.1.arg" ...
             x-periodic y-mirror-periodic
Endif

If a binary field map exists, the map is read. Otherwise the field maps are read in their original format.


RESET

Resets either fully or selectively the cell data entered so far. A full reset is performed in the absence of arguments.

Format:

RESET [COORDINATES] ...
      [DIELECTRICA] ...
      [DEFINITIONS] ...
      [FIELD-MAP] ...
      [PERIODICITIES] ...
      [PLANES] ...
      [ROWS or WIRES] ...
      [SOLIDS] ...
      [TUBE]

Example:

RESET

Additional information on:
   


ROWS

ROWS is used to enter the wires. The following properties of the wires can be entered at this stage:

The coordinate system in which the wire position is specified can either be Cartesian or polar. The wires in a cell that has a tube, are listed in Cartesian coordinates. Polar coordinates will be assumed if you put the keyword POLAR after ROWS, if you have already entered a plane in polar coordinates and if you have already entered a phi periodicity. Otherwise Cartesian coordinates are assumed. Once a coordinate system has been selected in the cell section, it has to be used throughout the section.

ROWS is a multi-line command because chambers sometimes contain many wires. You may enter one wire per line, but if your cell contains regularly spaced series of wires, you may prefer to enter these as a single "row" in which at least the position, but possibly also the other properties, depends on the so-called loop-variable I which automatically assumes a series of values.

One may use control structures (If_block, If_line, Do_loop, Call) in the listing of wires. Please keep in mind that a blank line must be present to signal the end of the list, whether typed by hand or generated with a loop.

Format of the whole command:

ROWS [CARTESIAN | POLAR | TUBE]
row
...
row
(blank line)

Format of the rows:

label n diameter x y [V [weight [length [density]]]]

Examples:

ROWS
s * * 0 0 1000
p * * 0 1 -2000
p * * 0 -1 -2000

This is a very simple example in which 3 wires are entered at (0,0), (0,1) and (0,-1). Defaults are used for the number of wires and the diameter.

ROWS
S * * 0 0 1000
P 2 * -1+i*2 -1+i*2 -2000

This examples shows how the same cell can be entered using the loop variable.

ROWS
Global n=100
For i From 1 To n Do
   Global r=1+2*(i/n)
   Global phi=4*pi*i/n
   If 'i=2*entier(i/2)' Then
       P * * {r*cos(phi), r*sin(phi), -i*10}
   Else
       S * * {r*cos(phi), r*sin(phi), +i*10}
   Endif
Enddo

This, artificial, example illustrates the use of Global variables, the Do_loop and an If_block to generate a spiral. Do not forget the blank line to mark the end of the list of rows !

Additional information on:
   


SAVE-FIELD-MAP

Performs a binary write of the current field map. Files written by this command can be read by the READ-FIELD-MAP command.

This command is executed immediately, unlike the WRITE command which is only executed when the section is left. The field map must therefore be present (via a FIELD-MAP or a READ-FIELD-MAP) when you issue the SAVE-FIELD-MAP command.

Binary field maps tend to be much smaller than field maps in the original format, and also restoring field maps from binary files is usually much faster. However, binary files are not portable between computer systems.

Format:

SAVE-FIELD-MAP   file

Example:

See READ-FIELD-MAP


SOLIDS

The SOLIDS command is used to enter solid volumes which are present in the chamber.

Solids do not affect the field in the chamber, but defining them can nevertheless be useful for the following reasons:

Entering these volumes is not mandatory. The drift line calculation routines can infer their presence in most cases from the dielectric constant in the field map.

If you do not enter any solids in a chambers composed of wires and planes, then all wires are automatically copied to cylindrical solids to ensure the wires are visible in 3D and CUT type plots. This copy is not performed if you enter at least 1 solid yourself.

SOLIDS is a multi-line command. Each line after SOLIDS describes one volume. The end of the list is signalled by a blank line.

Only a few shapes are currently provided, other shapes can be added on request - contact the author.

Format:

SOLIDS
{CYLINDER | BOX | SPHERE | HOLE} parameters
...
(blank line)

Example:

solids
For x From -0.02 Step 0.02 To 0.02 Do
   For y From -0.02 Step 0.02 To 0.02 Do
      hole centre {x,y} +0.0110 dir 0 0 1 ...
         half-lengths 0.0100 0.0100 0.0010 ...
         upper-radius 0.0050 lower-radius 0.0050 ...
         conductor
      hole centre {x,y} +0.0050 dir 0 0 1 ...
         half-lengths 0.0100 0.0100 0.0050 ...
         upper-radius 0.0040 lower-radius 0.0020 ...
         dielectric
      hole centre {x,y} -0.0050 dir 0 0 1 ...
         half-lengths 0.0100 0.0100 0.0050 ...
         upper-radius 0.0020 lower-radius 0.0040 ...
         dielectric
      hole centre {x,y} -0.0110 dir 0 0 1 ...
         half-lengths 0.0100 0.0100 0.0010 ...
         upper-radius 0.0050 lower-radius 0.0050 ...
         conductor
   Enddo
Enddo

This represents an array of 9 double-tapered cylindrical holes in a copper clad foil of dielectric material - similar to a GEM foil.

Two holes, on the left with N=2, on the right with N=20. Both are drawn with outlining.

A set of cylinders, partially hiding each other. Each cylinder is drawn with 50 panels, and 20 colour shades are used.

A set of boxes that are intersecting each other. Shown using the default colour density table, with outlining.

A sphere with 50 by 50 panels, shown with a colour table of 50 elements.

Additional information on:
   


TUBE

A tube is a pipe that surrounds wires. A tube can be round, but can also be triangular, hexagonal etc.

The main difference between a cell described in polar coordinates with a plane at constant r and a tube with radius r, is that one can put a wire at the centre of a tube, but not at the centre of a cell with a circular plane.

With Tube coordinates, you enter the wire location in Cartesian coordinates which you can combine with a phi periodicity in degrees. Periodicities in x or y are not permitted, nor are planes in any direction.

The potential function for a square tube is expensive to compute compared to the equivalent potential which is used for a cell that has 2 planes at constant x and 2 planes at constant y.

Format:

TUBE  [RADIUS r] ...
      [VOLTAGE v] ...
      [EDGES n] ...
      [LABEL label] ...
      [{PHI-STRIP | Z-STRIP} strip_min strip_max ...
         [GAP gap] [LABEL strip_label]]

Examples:

tube r=2, v=2000
tube hexagonal r=5

In the first example, a circular tube (EDGES is not specified, one could also have added CIRCLE or EDGES=0) is defined with a radius of 2 cm and at a potential of 2000 V. In the second example, the tube is hexagonal and with radius 5 cm. This tube is grounded.

Additional information on:
   


WRITE

Writes a compact format cell dataset that can be retrieved using GET.

This kind of dataset is not meant ot be human-readable and should not be edited. The format is chosen to enable a fast restore of the data. Also the capacitance matrix and the chargees do not have to be computed anew, thus saving significant computation time if the cell contains a large number of wires.

The writing operation takes place when the section is left, not when the WRITE command is issued. The statement can appear at any place in the cell section.

Compact format cell datasets are written in a machine independent format - files written on one type of computer can be read on other computers.

Field maps are, because of their large size, not saved by the WRITE statement. If reading them with the FIELD-MAP command takes too much time, and if the size of the full field maps is a point of concern, then consider using SAVE-FIELD-MAP and READ-FIELD-MAP, which perform a binary (i.e. non-portable) save and retrieve.

Format:

WRITE DATASET file [member] [REMARK remark]

Examples:

WR DATA cell.dat cell1 REM "Some cell"
WR cell.dat cell1 "Some cell"

(These two examples are equivalent, they show that the keywords DATA and REMARK are not needed if the parameters are in the right order.)

Additional information on:
   
 


Go to the top level, to &CELL, to the topic index, to the table of contents, or to the full text.

Formatted on 15/01/01 at 23:07.