Detector Simulation in Garfield++ With Open-Source Finite Element Electrostatics
Detector Simulation in Garfield++ With Open-Source Finite Element Electrostatics
The following are notes on the installation of Gmsh and Elmer on a Linux machine. As many
varieties of Linux machines exist, these notes do not cover details of every issue that could arise.
Notes:
To begin, obtain the Elmer source code. The code can be downloaded from the Elmer project on
Sourceforge. Click “browse code” and there should be a “Download GNU tarball” link at the bottom
of the list shown. Then compile each library using the ./configure, make, and make install com-
mands as described in the installation instructions.
Note that when compiling some of the libraries, an error may occur after running ./configure
stating: “cannot compile a simple Fortran program”. In this case, it is likely that the appropriate
environment variables have not been set. Enter the following lines in the command prompt and try
again (replacing the compiler names below with the ones available on the current system):
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=f77
There is also an associated user interface called ElmerGUI. This tool requires the use of the Qt and
optionally several other libraries. None of the examples in this document require this interface.
2
2 Constructing Finite Element Maps
2.1 Finite Element Maps
For the detailed simulation of electromagnetic fields, Garfield can import electromagnetic field maps
created by other programs using finite element analysis (see [4] for a short introduction and [5] for
a longer treatment).
After specifying a geometry and creating the mesh with Gmsh, the Elmer finite element analysis
program can be used to calculate the electrostatic fields using the mesh. During this process
one can assign materials to the different parts of the geometry and specify the properties of the
materials (such as the dielectric constant) and boundary conditions. Once imported into Garfield
this amounts to the creation of the entire detector geometry to be used in the simulation. Here the
steps of this process are described in some detail, and section 2.7 provides a full example of the
concepts discussed.
Geometry specified in Gmsh is saved in a file with extension .geo. The general procedure for the
creation of geometry is as follows:
1. Create points on a 3D coordinate system that can be connected by lines and curves to form
the desired geometry.
Example:
Point(1) = {0,0,0}
All points must have a distinct numerical ID. Parameterizing input becomes useful because
these ID numbers can be kept in numerical order if a point is removed or added during editing.
The coordinates can also be made relative to those of another point so that they do not have
to be changed if the other point is moved.
Example:
3
x=0; y=0; z=0; d=1;
p1 = newp; Point(p1) = {x,y,z};
p2 = newp; Point(p2) = {x+d,y,z};
... creates two new points separated by 1 unit on the x-axis. Note that the newp command
provides the point ID one greater than the last one used. There are similar commands for
other geometric types (see [6] pgs. 25-26) which will be used below. When assigned to a
variable, this ID can then be input as the ID of the point.
2. Connect the points by lines and curves.
Example:
Example:
... creates three points with lines, forms a line loop 4 → 5 → 6 → 4, and creates a surface
bounded by this line loop.
4. Create volumes by specifying surfaces as boundaries. This is also a two-step process which
involves first the creation of a surface loop from several surfaces and next the creation of
a volume. The process of creating line and surface loops and then assigning surfaces and
volumes may be more intuitive if done initially through the Gmsh GUI, as it will create the loop
automatically based on the selected lines or surfaces and then create the surface or volume.
However, it will save the actual numerical identifiers in the .geo file, so if variables are to be
used they must then be entered manually using text entry and the Tools->Visibility menu
option to match variables with ID numbers.
Example:
4
s_loop = newsl; Surface Loop(s_loop) = {s1, s2, s3, s4, s5, s6};
vol = newv; Volume(vol) = {s_loop};
... creates a surface loop from 6 surfaces enclosing a volume and then creates the enclosed
volume. Note that the order in which surfaces are listed in a surface loop does not affect the
volume defined, but a negative sign before the ID can be used to change the orientation of a
surface in the loop from that originally defined in the line loop. It is suggested in the Gmsh
manual that the orientation of all surfaces in a surface loop be consistent.
5. Create physical surfaces from one or more surfaces and physical volumes from one or more
volumes. These physical surfaces and volumes will be used later to identify the different parts
of the geometry, for example to tell Elmer which surfaces are assigned which boundary con-
ditions and to tell Garfield which part of the geometry is the gaseous drift medium.
Example:
Once the geometry has been specified, the mesh can be created from the command line.
Example:
The mesh will be saved with the same name as the geometry file but with a .msh extension. Note
that adding the -optimize flag may help improve the mesh (see [6] pg. 13). If the -order 2
option is removed, the mesh will be created with first-order tetrahedral elements. Note that only
second-order (quadratic) Gmsh/Elmer-based meshes are currently supported in Garfield++. See
[8] appendix D for more information on first and second-order tetrahedral elements.
5
1. ElmerGrid can be used to convert the mesh output by Gmsh to a form that Elmer can then
use to perform calculations.
2. ElmerSolver takes the output of ElmerGrid and performs the finite element calculation to
obtain the electric potential and fields.
Example:
ElmerGrid 14 2 <mesh_file>.msh -autoclean
... converts the mesh output by Gmsh and located in the current directory into the mesh format
readable by ElmerSolver.
The option 14 indicates that the input file will be a Gmsh .msh, the option 2 indicates that the out-
put will be in the format readable by ElmerSolver, and the -autoclean option indicates that the
physical elements defined in the geometry file will have their IDs re-numbered starting at 1 (see [7]
section 1.2). This command will work without the -autoclean option, but later assigning boundary
conditions and identifying materials may not be possible if this option is not specified. Note that
when the re-numbering is performed, the physical surfaces, which will later correspond to bound-
ary conditions, are re-numbered separately from the physical volumes, which will later correspond
to “bodies” in ElmerSolver. In each case, the lowest ID will be re-numbered as 1, and the second-
lowest as 2, etc. That means that if one uses the newreg keyword to specify the ID numbers, the
re-numbered physical elements will be in the same order as they are defined in the .geo file.
With the .sif file located in the same directory as the directory created by ElmerGrid containing
the converted mesh files, ElmerSolver can be run to perform the calculation.
Example:
ElmerSolver <solver_input_file>.sif
... performs the calculation described by the given solver input file.
ElmerSolver should output 2 files in the mesh directory created by ElmerGrid: <mesh name>.result
and <mesh name>.ep. Only the .result file will be relevant for simulations with Garfield, as the .ep
file is meant to be read into the visualization program ElmerPost (see [8] Appendix C). The results
of the calculation must next be imported into Garfield so that detector simulations can be performed
with them.
6
Block Notes
Header - Use the name and directory generated by ElmerGrid
Simulation - Use <mesh name>.result (same name as given to mesh) as the
“output file” for import into Garfield
Constants - Only 0 is necessary for electrostatics
Body N - N = the number of the physical volume (starting with 1); Be sure to
specify both equation and material
Solver/ - Use Stat Elec Solver for electrostatics
Equation
Material N - N is not related to the physical elements except as assigned in the
Body statement; The same material can be assigned to more than 1
body; specify dielectric constants here
Boundary Condition N - N is not the number of the physical volume; this is set with the
Target Boundary keyword. Periodic boundary conditions are set using the
Periodic BC keyword
1. A separate directory containing the mesh and result files produced by ElmerGrid and ElmerSolver
must be located in the directory containing the executable Garfield++ program that will import
the field map.
2. The mesh files must be left with their original names (mesh.boundary, mesh.elements, mesh.header,
and mesh.nodes), and the .result file must have the same name as the directory.
3. A file containing the dielectric constants called dielectrics.dat must be in this same direc-
tory. This file contains a list of dielectric constants indexed by their ElmerSolver “body” num-
bers. These numbers are the IDs of the physical volumes created in Gmsh after re-numbering
(starting at 1 due to the -autoclean flag of ElmerGrid). The body number is listed, followed
by a single space, followed by the dielectric constant. The first line of this file must contain a
single number that specifies the number of dielectrics that will be listed. For example, for a
geometry in which we have two volumes, one for the drift medium and one for the dielectric,
the dielectrics file will contain three lines:
2
1 1
2 <epsilon_for_dielectric>
For example, for a field map we will call “sample map,” the directory structure after the field map
has been created and the script is ready to be run may be as follows:
./
(a Garfield++ executable)
sample_map.geo
sample_map.msh
sample_map.sif
/sample_map
7
mesh.boundary
mesh.header
mesh.elements
mesh.nodes
sample_map.result
dielectrics.dat
In the source file compiled into the executable with the Garfield++ classes, the ComponentElmer
object can be used as follows.
The creation of this object imports the field map with the specified files into the Garfield simulation.
One can then include periodicity, for example:
elm->EnablePeriodicityX();
elm->EnableMirrorPeriodicityY();
adds X-periodicity and mirror Y-periodicity, dictating how Garfield repeats the field map in x and y.
One can also assign a medium object, such as a gas described by Magboltz [10], to any medium
that was assigned during the creation of the Elmer field map.
elm->SetMedium(0,gasArCO2);
Once set up, a field map can be assigned to a Sensor object which is passed to other objects to
perform different functions such as particle drift and visualization of the fields.
From the above discussion, we see that the weighting potential can be calculated using Elmer on
the same mesh used to calculate the drift fields by running ElmerSolver again, this time setting the
boundary conditions in the .sif file such that the readout electrode is assigned Potential = 1 and
all other conductors are assigned Potential = 0. Note that multiple field maps can be produced
in this way, and each can be assigned to its electrode within Garfield++. Assuming a detector
geometry called sample_map imported into Garfield++ in a ComponentElmer object called elm (as
in section 2.4), and the solution corresponding to a weighting field for an electrode in the geometry
output to sample_map/sample_map_W1.result, we can import the weighting field with
elm->SetWeightingField("sample_map/sample_map_W1.result","wt1");
Note that Garfield++ keeps track of weighting potential maps with a label, and we have chosen wt1
as the label for this map. Once the weighting potential has been imported, it can be assigned to the
Sensor object to which the primary field map was assigned.
The developed signal is binned according to a specified start time, bin size, and number of bins.
For example:
sensor->SetTimeWindow(tStart,(tEnd-tStart)/nsBins,nsBins);
To develop a signal, the Sensor object to which the weighting potential map was assigned can be
passed to another object, for example an AvalancheMicroscopic, so that it can be updated during
particle drift. Note that the calculation of the signal must be enabled for this to occur.
1. Produce and import the detector field map as discussed in previous sections.
2. Create a new .sif file which is an exact copy of the previous one, except:
a.) In the Simulation group, the Output File and Post File fields are modified with dif-
ferent names so that the original output files will not be overwritten.
b.) The boundary conditions are modified so that the electrode corresponding to this weight-
ing potential map has Potential = 1 and all other conductors have Potential = 0.
3. Solve using the newly created .sif file.
4. Import the weighting potential into Garfield++, add an electrode, and turn on signal generation
for the avalanche/drift mechanism used. The developed signal can be accessed once drifting
has completed using methods of the Sensor class or the ViewSignal class.
9
2.6 Modular Creation of Field Maps
Gmsh allows the user to define functions and loops in creating a geometry. This allows for the
creation of field maps via construction from individual objects defined in functions. The following
organizational scheme can be used to build a complex geometry out of several smaller components.
There is a single main .geo file organized as described below, and one or more smaller .geo files
that describe individual components of the larger geometry. Note that this is only one possibility
and will be used later (section 2.7) in a short example, however it may not be useful depending
on the geometry being simulated and is not used in the LEM example of section 3. Either way, it
highlights some key points of geometry creation in Gmsh. The procedure is as follows (compare to
parallel plate.geo in section 2.7.2):
a. n physv: Keeps a running count of the number of physical volumes in the geometry. This
should be incremented every time a new physical volume is defined.
b. n physs: Keeps a running count of the number of physical surfaces in the geometry,
similar to n physv.
c. n bdry: Incremented each time a new boundary surface loop is created. These are the
surface loops that will define the boundaries between the bulk (drift) medium and the
other components. Each surface loop on the boundary is added to the array bounds so
that it can be later used to create the main volume.
a. Assign values to the parameters of the function that will create the component. These
parameters are not “passed” to the functions upon calling the function but are placed in
variables with the appropriate names before calling the function. They are then used in
the function to describe the geometry created.
b. (Optional) Assign some default value to each of the return values. This step is not
necessary but helps in keeping track of what variables will be given values after calling
the function.
c. Call the function defined in the .geo file using for example call gf object.
d. Use the return values, for example, to collect the identifiers for each surface to be later
included as a physical surface.
More objects can be constructed if the available objects are not sufficient to specify the detector
geometry.
Function function_name
// Gmsh commands here
Return
10
where the word Function must be capitalized. The Gmsh commands entered between Function
and Return can be executed at another location in the script by calling
Call function_name
arr_name[index] = value;
All of the values assigned in an array can be placed in a list using the [] operator. For example, a
volume can be defined from an array called bounds containing IDs of surface loops as
For n In {1:3}
// code to be looped over here
EndFor
1: // *********************************************************************
2: // gf_rectangle.geo
3: // -----------------
4: // A rectangle.
5: //
6: // ---------------------------------------------------------------------
7: // Parameters
8: // ---------------------------------------------------------------------
9: // x0: x position of center
10: // y0: y position of center
11: // z0: z position of center
12: // lc: characteristic length
13: // l: length
14: // w: width
15: // h: height
16: //
17: // ---------------------------------------------------------------------
11
18: // Return Values
19: // ---------------------------------------------------------------------
20: // vol: the ID of the inner volume
21: // s1: ID of surface 1: normal -x
22: // s2: ID of surface 2: normal +y
23: // s3: ID of surface 3: normal +x
24: // s4: ID of surface 4: normal -y
25: // s5: ID of surface 5: normal +z
26: // s6: ID of surface 6: normal -z
27: //
28: // *********************************************************************
29
30: // Default parameters
31: x0 = 0;
32: y0 = 0;
33: z0 = 0;
34: l = 1;
35: w = 1;
36: h = 1;
37: lc = 1;
38:
39: Function gf_rectangle
40:
41: // *******************************
42: // Points
43: // *******************************
44:
45: p1 = newp; Point(p1) = {x0-l/2, y0-w/2, z0-h/2, lc};
46: p2 = newp; Point(p2) = {x0-l/2, y0-w/2, z0+h/2, lc};
47: p3 = newp; Point(p3) = {x0-l/2, y0+w/2, z0-h/2, lc};
48: p4 = newp; Point(p4) = {x0-l/2, y0+w/2, z0+h/2, lc};
49: p5 = newp; Point(p5) = {x0+l/2, y0-w/2, z0-h/2, lc};
50: p6 = newp; Point(p6) = {x0+l/2, y0-w/2, z0+h/2, lc};
51: p7 = newp; Point(p7) = {x0+l/2, y0+w/2, z0-h/2, lc};
52: p8 = newp; Point(p8) = {x0+l/2, y0+w/2, z0+h/2, lc};
53:
54: // *******************************
55: // Lines
56: // *******************************
57:
58: l1 = newl; Line(l1) = {p1,p2};
59: l2 = newl; Line(l2) = {p2,p4};
60: l3 = newl; Line(l3) = {p4,p3};
61: l4 = newl; Line(l4) = {p3,p1};
62: l5 = newl; Line(l5) = {p5,p6};
63: l6 = newl; Line(l6) = {p6,p8};
64: l7 = newl; Line(l7) = {p8,p7};
65: l8 = newl; Line(l8) = {p7,p5};
66: l9 = newl; Line(l9) = {p1,p5};
67: l10 = newl; Line(l10) = {p2,p6};
68: l11 = newl; Line(l11) = {p3,p7};
12
69: l12 = newl; Line(l12) = {p4,p8};
70:
71: // *******************************
72: // Surfaces
73: // *******************************
74:
75: lp1 = newll; Line Loop(lp1) = {l1, l2, l3, l4};
76: s1 = news; Plane Surface(s1) = {lp1};
77: lp2 = newll; Line Loop(lp2) = {l12, l7, -l11, -l3};
78: s2 = news; Plane Surface(s2) = {lp2};
79: lp3 = newll; Line Loop(lp3) = {-l5, -l6, -l7, -l8};
80: s3 = news; Plane Surface(s3) = {lp3};
81: lp4 = newll; Line Loop(lp4) = {-l10, l5, l9, -l1};
82: s4 = news; Plane Surface(s4) = {lp4};
83: lp5 = newll; Line Loop(lp5) = {-l2, -l12, l6, l10};
84: s5 = news; Plane Surface(s5) = {lp5};
85: lp6 = newll; Line Loop(lp6) = {-l9, l8, l11, -l4};
86: s6 = news; Plane Surface(s6) = {lp6};
87:
88: // *******************************
89: // Volumes
90: // *******************************
91:
92: sl = newsl; Surface Loop(sl) = {s5, s1, s4, s3, s2, s6};
93: vol = newv; Volume(vol) = {sl};
94: // ---------------------------------------
95:
96: // Update the boundaries array.
97: bounds[n_bdry] = sl; n_bdry += 1;
98:
99: Return
Lines 1-28 provide documentation describing the content of the file and the parameters and return
values. Note that in this context “parameter” refers to a variable that can be set before the function
is called and whose value is used within the function, and “return value” means a variable that is
set during the function that will remain set after the function has ended.
Lines 30-37 assign default values to the parameters. These values will be in effect if the user has
not assigned values to the parameters before calling the function gf rectangle.
Lines 39-99 describe the geometry of the rectangle according to the parameters. Note at the end
of the file that the surface loop containing all 6 surfaces is added to the array of boundaries. It
is important to keep the convention of using n bdry as the counter for the bounds array, as each
component will update the array and increment the counter. In the end the array will contain all of
the surfaces that will serve as boundaries between the internal volumes of each component and
the bulk drift volume of the detector.
13
bottom surfaces of the inner cube to which we will later assign potentials.
1: //----------------------------------------------------------------------
2: // parallel_plate.geo
3: // A parallel plate capacitor built from two gf_rectangle objects.
4: // ---------------------------------------------------------------------
5:
6: // Create the counters.
7: n_physv = 1; // physical volumes
8: n_physs = 1; // physical surfaces
9: n_bdry = 0; // number of boundary surfaces
10:
11: // Include the components.
12: Include "gf_rectangle.geo";
13:
14: // Create outer bounding box; first set parameters and then return values.
15: x0 = 0; y0 = 0; z0 = 0; lc = 1; l = 2; w = 2; h = 2;
16: vol = -1; s1 = -1; s2 = -1; s3 = -1; s4 = -1; s5 = -1; s6 = -1;
17: Call gf_rectangle;
18:
19: // Create the inner box, the top and bottom of which will be assigned voltages.
20: x0 = 0; y0 = 0; z0 = 0; lc = 1; l = 1; w = 1; h = 1;
21: vol = -1; s1 = -1; s2 = -1; s3 = -1; s4 = -1; s5 = -1; s6 = -1;
22: Call gf_rectangle;
23:
24: // Save the surface IDs for the top and bottom of the inner box and volume.
25: s_top_plate = s5;
26: s_bottom_plate = s6;
27: vol_inner = vol;
28:
29: // Create physical surfaces for the top and bottom plates.
30: physs_top_plate = n_physs; Physical Surface(physs_top_plate) = {s_top_plate};
--> n_physs += 1;
31: physs_bottom_plate = n_physs; Physical Surface(physs_bottom_plate) =
--> {s_bottom_plate}; n_physs += 1;
32:
33: // Create the bounding volume.
34: vol_bound = newv; Volume(vol_bound) = {bounds[]};
35:
36: // Create the physical volumes.
37: physv_gas = n_physv; Physical Volume(physv_gas) =
--> {vol_inner, vol_bound}; n_physv += 1;
38: physv_dielectric = n_physv; Physical Volume(physv_dielectric) =
--> {vol_inner}; n_physv += 1;
In lines 7-10 we define the counters necessary to keep track of the boundaries, physical volumes,
and physical surfaces. In line 12 we include the rectangle geometry file. In lines 15-17 we cre-
ate the outer bounding box, a cube with 2 cm sides, and in lines 20-22 we create the inner cube
with 1 cm sides. Lines 25-27 store the upper and lower surface IDs and the volume ID from the
inner box. Note this is not necessary in this example, as we could just use s5, s6, and vol, but it
makes the physical surface and volume assignments more clear later on, and would be necessary
in cases for which the return variables are later re-used such that their values are changed. Lines
14
Figure 1: Parallel plate geometry before meshing, from Gmsh. The outer box defines the bound-
aries of the geometry. The inner box provides the parallel plate geometry, as its top and bottom
surfaces will be assigned as separate physical surfaces to which potentials are applied. Note that
the remaining surfaces on the inner box will not be assigned as physical surfaces but are present to
define an inner volume and assign it a dielectric constant different from that of the rest of the total
volume.
30-31 assign physical surface IDs to these surfaces that correspond to the top and bottom parallel
plate in the capacitor. Line 34 creates the exterior gas volume using the boundaries defined in the
gf rectangle function. Lines 37-38 create the physical volumes for both the gas and the dielectric.
We note the order in which the physical surfaces and volumes are defined and assign dielectric
constants and boundary conditions accordingly. Upon running ElmerGrid with the -autoclean op-
tion these will be reordered starting at 1 and progressing in the order in which the physical surfaces
and volumes were defined. Note that the list kept for physical surfaces is separate from the list kept
for physical volumes. Therefore from the above geometry, boundary condition 1, corresponding to
the first defined physical surface, applies to the top plate of the capacitor. Boundary condition 2
then applies to the bottom plate. Likewise material 1 describes the gas and material 2 describes
the dielectric.
The parallel plate geometry as seen in Gmsh before meshing is shown in figure 1.
1: ! parallel_plate.sif
2: !
3: ! ElmerSolver input file for parallel plate geometry.
4: !
5: ! This is a modified version of "elstatics.sif" from the Elmer tutorials.
6: ! (see ElmerTutorials manual, Tutorial 14)
15
7: !
8: Check Keywords Warn
9:
10: ! Specify output folder and location.
11: Header
12: Mesh DB "." "parallel_plate"
13: End
14:
15: ! Details of the calculation and output files.
16: Simulation
17: Coordinate System = Cartesian 3D
18: Simulation Type = Steady State
19: Steady State Max Iterations = 1
20: Output File = "parallel_plate.result"
21: Post File = "parallel_plate.ep"
22: End
23:
24: ! Define constants.
25: Constants
26: Permittivity Of Vacuum = 8.8542e-12
27: End
28:
29: ! Specify equation and material for gas.
30: Body 1
31: Equation = 1
32: Material = 1
33: End
34:
35: ! Specify equation and material for the dielectric.
36: Body 2
37: Equation = 1
38: Material = 2
39: End
40:
41: ! Define the gas material.
42: Material 1
43: Relative Permittivity = 1
44: End
45:
46: ! Define the dielectric material.
47: Material 2
48: Relative Permittivity = 2
49: End
50:
51: ! Upper plate
52: Boundary Condition 1
53: Target Boundaries = 1
54: Potential = 0
55: End
56:
57: ! Lower plate
16
58: Boundary Condition 2
59: Target Boundaries = 2
60: Potential = 1000
61: End
62:
63: ! Details of the calculation procedure: all that must
64: ! be calculated is the potential.
65: Equation 1
66: Active Solvers(1) = 1
67: Calculate Electric Energy = True
68: End
69: Solver 1
70: Equation = Stat Elec Solver
71: Variable = Potential
72: Variable DOFs = 1
73: Procedure = "StatElecSolve" "StatElecSolver"
74: Calculate Electric Field = False
75: Calculate Electric Flux = False
76: Linear System Solver = Iterative
77: Linear System Iterative Method = BiCGStab
78: Linear System Max Iterations = 1000
79: Linear System Abort Not Converged = True
80: Linear System Convergence Tolerance = 1.0e-10
81: Linear System Preconditioning = ILU1
82: Steady State Convergence Tolerance = 5.0e-7
83: End
See the ElmerSolver manual [8] for more detailed information about the above commands. We note
that in lines 30-39, the “body” numbers correspond to those of the defined physical volumes, and
in lines 52-61, the numbers specified as Target Boundaries correspond to those of the defined
physical surfaces.
The field maps can be imported into Garfield++ using the methods of section 2.4. A contour plot of
the potential is shown in figure 2.
17
1
z [cm]
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
x [cm]
18
3 Simulation of LEM/GEM Devices
The gas electron multiplier was introduced in [12] and consists of a three layers of material, two
metallic surfaces with dielectric between them, with a pattern of holes drilled through these lay-
ers. Since then this concept has been modified to create similar devices such as the thick GEM
(THGEM) [13]. Simulations of such devices have been performed in the past, for example in
[14, 15, 16], and were consulted in the preparation of this document. Here we present an ex-
ample of thick GEM (or as we will call, large electron multiplier - LEM) simulation. The code used
in constructing the LEM, calculating the fields, importing the fields into Garfield++, and avalanching
an electron should accompany this document.
In this example, many of the geometrical parameters used in the construction of the LEM are similar
to those of THGEM #9 in [16]. These parameters are listed in table 2.
In addition to the LEM itself one must also be concerned with the fields in the regions above and
below it, as these are the fields electrons will encounter in drifting towards and away from the LEM.
Following the naming conventions of [16], the drift field, Edrift , is the electric field in region traversed
by incoming electrons, and the transfer field, Etransfer , is the electric field in the region into which
electrons are expelled after passing through the LEM. In the geometry, we create these regions by
creating a long box encompassing the LEM. The inner volume of this box will be part of the same
volume as the center of the LEM hole, and this volume will contain gas. The boundaries of this box
will be assigned potentials, meaning they will have to be made physical surfaces. These potentials,
assigned relative to the top and bottom plates of the LEM, dictate the drift and transfer fields.
The fields of the LEM can be imported into Garfield as described in section 2. For example, the
following lines of code will create a gas medium, an Elmer component for the LEM with a weighting
field for the lower electrode, and a sensor containing this component set up to calculate the induced
signal on the electrode.
19
Figure 3: LEM/THGEM cell geometry from Gmsh. The electrodes used to produce the drift and
transfer fields are not shown. Note that in the field calculation, the two ends of the cell perpendicular
to the x-axis are matched with periodic boundary conditions. The ends perpendicular to the y-axis
are divided in half by a plane parallel to the yz plane; the half on the front end located at lesser
(greater) x is matched with the half on the back end located at greater (lesser) x.
Note that to repeat this cell properly in Garfield, one must request x-perodicity and y mirror periodic-
20
ity as done above. This causes the cell to be tiled in the x-y plane by repeating the entire cell down
the x-axis with no rotation or flipping, moving one cell x-width each time. This pattern is repeated
every y-length along the y-axis, except the cell is also flipped upside-down once along the y-axis
for each increment. Periodic boundary conditions must be assigned so that the fields are solved
assuming a complete LEM hole (see figure 3). We have also set the gas medium we have created
to be present in all elements with dielectric index 0. Note that once imported into Garfield++, the
dielectrics are numbered starting from 0 rather than starting from 1. We can then perform simula-
tions using the imported field map using the sensor to provide information about the fields to other
objects. For example, we can visualize the fields and then draw the finite element map on top of
the field plot:
// Set up the object for field visualization.
ViewField * vf = new ViewField();
vf->SetSensor(sensor);
vf->SetCanvas(c1);
vf->SetArea(-1*axis_x,-1*axis_y,axis_x,axis_y);
vf->SetNumberOfContours(40);
vf->SetNumberOfSamples2d(30,30);
vf->SetPlane(0,-1,0,0,0,0);
// Create plots.
vFE->SetArea(-1*axis_x,-1*zi,-1*zi,axis_x,zi+0.02,zi);
vf->PlotContour("v");
vFE->Plot();
vSignal->PlotSignal("wtlel");
This produces a plot similar to that shown in figure 4. Note that the format of the plot will depend
on the Draw options set in the PlotContour method of ViewField.cc.
21
0.08
z [cm]
0.06
0.04
0.02
-0.02
-0.04
-0.06
-0.08
-0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08
x [cm]
Figure 4: Contours of the potential for a LEM, plotted in Garfield++ using a field map created with
Gmsh/Elmer.
The first line above creates a new instance of the object that will be used to initiate and track the
avalanche. The second line passes the sensor object we created previously to the avalanche object
for use in determining the fields at different locations. The third line sets the maximum number of
Monte Carlo steps for which a single electron can be tracked before updating the other electrons
in the avalanche, and the fourth line enables the calculation of signals on the electrodes that have
been registered with sensor object induced by the drifting charges in the avalanche. We can
use additional Garfield classes to visualize the results of the avalanche by adding an instance of
ViewDrift to the ViewFEMesh object we constructed in section 3.1 and creating a ViewSignal class
to view the induced signals on an electrode. Calling EnableAxes enables a default set of axes to be
drawn, as in this case we are not creating a contour plot that would establish a set of axes.
vFE->EnableAxes();
22
vFE->SetXaxisTitle("x (cm)");
vFE->SetYaxisTitle("z (cm)");
vFE->SetViewDrift(viewDrift);
A plot of the avalanche similar to that of figure 5 can be produced by calling vFE->Plot(); and a plot
of the induced signal similar to figure 6 can be produced with vSignal->PlotSignal("wtlel");
z (cm)
0.2
0.1
-0.1
-0.2
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
x (cm)
Figure 5: Electron avalanche in a LEM, simulated with Garfield++. The lower readout electrode is
invisible in the rendered geometry, but it is located in the horizontal plane at which the drift lines of
all of the electrons escaping the LEM terminate.
23
-3
×10
signal [fC / ns]
-0.01
-0.02
-0.03
-0.04
-0.05
-0.06
-0.07
Figure 6: Electron induced signal produced on the lower readout electrode by the avalanche shown
in figure 5.
24
4 Potential Issues/Errors
if (rc == 0 &&
t1 >= 0 && t1 <= +1 &&
t2 >= 0 && t2 <= +1 &&
t3 >= 0 && t3 <= +1 &&
t4 >= 0 && t4 <= +1) {
if (rc == 0 &&
t1 >= -1e-10 && t1 <= +1+1e-10 &&
t2 >= -1e-10 && t2 <= +1+1e-10 &&
t3 >= -1e-10 && t3 <= +1+1e-10 &&
t4 >= -1e-10 && t4 <= +1+1e-10) {
25
Acknowledgements
The author of this document acknowledges support from a U.S. Department of Energy National Nu-
clear Security Administration Stewardship Science Graduate Fellowship, grant number DE-FC52-08NA28752.
The author would like to thank Adam Rubin (Weizmann Institute of Science) for fixing an error in
the LEM avalanche example.
References
[1] H. Schindler, R. Veenhof, et al., Garfield++. http://garfieldpp.web.cern.ch/garfieldpp.
[2] C. I. C. for Science, Elmer: Open Source Finite Element Software for Multiphysical Problems,
http://www.csc.fi/english/pages/elmer.
[3] C. Geuzaine and J.-F. Remacle, “Gmsh: a three-dimensional finite element mesh generator
with built-in pre- and post-processing facilities,” International Journal for Numerical Methods in
Engineering, vol. 79, pp. 1309–1331, 2009.
[4] J. D. Jackson, Classical Electrodynamics. Wiley, 1999.
[5] N. Ida and J. Bastos, Electromagnetic Calculation of Fields. Springer, 1997.
[12] F. Sauli, “GEM: A new concept for electron amplification in gas detectors,” Nucl. Instr. Meth. A,
vol. 386, pp. 531–534, 1997.
[13] R. Chechik, A. Breskin, C. Shalem, and D. Mōrmann, “Thick GEM-like hole multipliers: prop-
erties and possible applications,” Nucl. Instr. Meth. A, vol. 535, pp. 303–308, 2004.
[14] A. Sharma, “3D simulation of charge transfer in a Gas Electron Multiplier, (GEM) and compar-
ison to experiment,” Nucl. Instr. Meth. A, vol. 454, pp. 267–271, 2000.
[15] V. Tikhonov and R. Veenhof, “GEM simulation methods development,” Nucl. Instr. Meth. A,
vol. 478, pp. 452–459, 2002.
[16] C. Shalem, R. Chechik, A. Breskin, and K. Michaeli, “Advances in Thick GEM-like gaseous
electron multipliers - Part I: atmospheric pressure operation,” Nucl. Instr. Meth. A, vol. 558,
pp. 475–489, 2006.
[17] A. Sharma, “A How-to Approach for a 3d Simulation of Charge Transfer, Characteristics in a
Gas Electron Multiplier (GEM),” (CERN Preprint).
26
[18] O. Bouianov, M. Bouianov, R. Orava, P. Semenov, and V. Tikhonov, “Progress in GEM simula-
tion,” Nucl. Instr. Meth. A, vol. 450, pp. 277–287, 2000.
[19] A. Hammoud, E. Baumann, E. Overton, J. Suthar, and W. Khachen, “High Temperature Dielec-
tric Properties of Apical, Kapton, Peek, Teflon AF, and Upilex Polymers,” IEEE Conference on
Electrical Insulation and Dielectric Phenomena, pp. 549–554, 1992.
27