-
Notifications
You must be signed in to change notification settings - Fork 29
Basic Geometry
We will first proceed step-by-step through the configuration of the geometry. The general process of defining a geometry is to first describe the necessary shapes, and then place them in the desired arrangement.
<geometry>
<define name="trap_length" value="3.35e-3"/>
<define name="z_length" value="{[trap_length]}"/>
<define name="r_length" value="{[trap_length] / sqrt(2.)}"/>
The entire setup of the geometry is contained between <geometry> . . . </geometry>
tags. The next three lines specify some important lengths that will be used throughout this section.
Note the use of the variable trap_length
, which is first defined, and then used to specify z_length
and r_length
. To use the value of a variable, the variable name should be placed in square brackets. The curly braces perform function evaluation. Any function that can be understood by ROOT's TFormula class can be used in Kassiopeia formula evaluation.
Next we setup the electrodes, starting with the endcaps:
<tag name="electrode_tag" name="endcap_electrode_tag">
<rotated_poly_line_surface name="endcap_electrode_surface" rotated_mesh_count="128">
<poly_line>
<start_line x1="3.350e-3" y1="0.0" x2="3.636e-3" y2="2.000e-3" line_mesh_count="50" line_mesh_power="1."/>
<next_line x="4.384e-3" y="4.000e-3" line_mesh_count="50" line_mesh_power="1."/>
<next_line x="5.406e-3" y="6.000e-3" line_mesh_count="200" line_mesh_power="1."/>
</poly_line>
</rotated_poly_line_surface>
</tag>
Though we know this will be an electrode when used in the simulation, in the context of the geometry, it's just a shape defined by a particular surface. That surface, of type rotated_poly_line_surface
, is formed by drawing a line, and rotating it about its start point. The poly_line
is made up of three line segments that simulate a curved line. For the start_line
, both start- and end-points are specified. Each next_line
starts at the previous line's end-point, and specifies its own end-point. The line_mesh_count
describes how finely the line should be subdivided, and the line_mesh_power
describes to what extend the subdivision should be concentrated near the ends of the line (for improved charge distribution calculations later).
This generic endcap electrode shape will later be used to make both the top and bottom endcap electrodes.
Two "tags" have been applied to this object: electrode_tag
and endcap_electrode_tag
. These will be used to refer to groups of objects later in the configuration.
The ring electrode object is defined in a similar way to the endcap electrode:
<tag name="electrode_tag" name="ring_electrode_tag">
<rotated_poly_line_surface name="ring_electrode_surface" rotated_mesh_count="128">
<poly_line>
<start_line x1="4.000e-3" y1="7.379e-3" x2="3.000e-3" y2="6.360e-3" line_mesh_count="200" line_mesh_power="1."/>
<next_line x="2.000e-3" y="5.518e-3" line_mesh_count="100" line_mesh_power="1."/>
<next_line x="1.000e-3" y="4.944e-3" line_mesh_count="50" line_mesh_power="1."/>
<next_line x="0.000e-3" y="4.738e-3" line_mesh_count="50" line_mesh_power="1."/>
<next_line x="-1.000e-3" y="4.944e-3" line_mesh_count="50" line_mesh_power="1."/>
<next_line x="-2.000e-3" y="5.518e-3" line_mesh_count="50" line_mesh_power="1."/>
<next_line x="-3.000e-3" y="6.360e-3" line_mesh_count="100" line_mesh_power="1."/>
<next_line x="-4.000e-3" y="7.379e-3" line_mesh_count="200" line_mesh_power="1."/>
</poly_line>
</rotated_poly_line_surface>
</tag>
Next we define the cylindrical tube of the solenoid magnet:
<tag name="magnet_tag" name="solenoid_tag">
<cylinder_tube_space name="solenoid_space" z1="-50.e-3" z2="50.e-3" r1="8.000e-3" r2="9.000e-3" radial_mesh_count="30"/>
</tag>
The tube is defined by the z positions of the two ends, and the inner and outer radii. The radial mesh count specifies how finely the cylinder will be meshed around the cylinder's axis of symmetry. Two tags have been applied, so that we can refer specifically to the solenoid by solenoid_tag
, and so that the solenoid could be grouped with other magnets if there were any in the simulation.
We'll define a cylindrical space that will be used as a virtual volume representing the "cell" in which the electrons will be trapped:
<tag name="cell_tag">
<cylinder_space name="cell_space" z1="-1.5e-3" z2="1.5e-3" r="4.5e-3"/>
</tag>
Next we create three virtual surfaces, all of which are disks. The start_surface
will be used to generate the electrons; the stop_surface
will be used to stop the electrons after one pass through the trap (so that they don't continue indefinitely); the target_surface
could be used to add interesting effects to the simulation such as energy loss or scattering, but in this simple example will not be used.
<tag name="start_tag">
<disk_surface name="start_surface" r="4.4e-3" z="-2.5e-3"/>
</tag>
<tag name="target_tag">
<disk_surface name="target_surface" r="4.4e-3" z="0."/>
</tag>
<tag name="stop_tag">
<disk_surface name="stop_surface" r="4.4e-3" z="2.49e-3"/>
</tag>
The target_surface
is inside the cell, so we place it appropriately in the tree structure of the geometry. We create a new space called cell_assembly
that starts with the cell_space
created earlier. To that we add a surface called target
, which uses the target_surface
created earlier.
<space name="cell_assembly" node="cell_space">
<surface name="target" node="target_surface"/>
</space>
Finally, we want to put all of our geometry elements into a single space, quadrupole_trap_assembly
:
<space name="quadrupole_trap_assembly">
<surface name="top_endcap_electrode" node="endcap_electrode_surface"/>
<surface name="bottom_endcap_electrode" node="endcap_electrode_surface">
<transformation rotation_euler="0. 180. 0."/>
</surface>
<surface name="ring_electrode" node="ring_electrode_surface"/>
<space name="solenoid" node="solenoid_space"/>
<space name="cell" tree="cell_assembly"/>
<surface name="start" node="start_surface"/>
<surface name="stop" node="stop_surface"/>
</space>
The geometry section is completed with a close-geometry tag:
</geometry>