Kassiopeia Logo
  • Welcome to Kassiopeia's documentation!

General information

  • Contact, Meeting and References
  • License
  • Authors

Getting Started

  • Introduction
  • Setup with container
  • Manual installation
  • Directory structure & environmental variables

Usage

  • Running Kassiopeia
  • Example configurations
  • Configuring your own simulation
  • KGeoBag (geometry) - <geometry>
  • KEMField (fields) - <kemfield>
  • Kassiopeia (particles) - <kassiopeia>
    • Chapter overview
    • Conceptual overview
    • Generation & Termination
    • Propagation & Interactions
    • Output
    • Navigation
      • Surfaces navigation
      • Space navigation
      • Meshed space navigation
        • Commands
    • Simulation
    • Visualization
    • Tools

Further Information

  • Understanding Simulation Output
  • XML Bindings
Kassiopeia
  • Kassiopeia (particles) - <kassiopeia>
  • Navigation
  • Edit on GitHub

Navigation

Surfaces navigation

The navigation of a particle is split into two components, surface navigation and space navigation. Surface navigation is very simple and only takes place when a particle has intersected an active surface. The surface navigator determines whether the state of the particle is modified on the surface and whether it is reflected or transmitted. It can be made available for use with the declaration:

<ksnav_surface name="nav_surface" transmission_split="false" reflection_split="false"/>

As this navigator is very simple, it does not take many additional parameters. The parameters transmission_split and reflection_split determine whether or not a track is split in two (for the purposes of output/saving data) upon transmission through or reflection off a geometric surface.

Space navigation

The space navigator is more complex since it is responsible for determining the location of the particle and any possible intersections it may have with real or virtual boundaries. It is also responsible for ensuring that the current simulation state matches the configuration specified by the user. The spaces that the navigator considers may be real objects (such as a vacuum chamber wall) or virtual (which only modify the state of the simulation, e.g. exchanging a trajectory method). The latter case allows to dynamically reconfigure the simulation over a track.

For space navigation there are two options. The first is the default ksnav_space navigator which can be specified as below:

<ksnav_space name="nav_space" enter_split="false" exit_split="false"/>

As this navigator is also very simple, it does not take many additional parameters. The parameters enter_split and exit_split determine whether or not a track is split in two upon entrance or exit of a geometric space.

Meshed space navigation

Reference: <ksnav_meshed_space>

A more complex behavior is achieved by the ksnav_meshed_space navigator, which is intended to be used in highly detailed three-dimensional geometries where it has better performance over the default navigator. An example of this is shown in the PhotoMultiplierTubeSimulation.xml file. Its configuration is more complicated as it performs the navigations on the meshed boundaries of spaces and surfaces. It requires the construction of an octree spatial partition (which may be cached for later re-use). The user must specify the depth of the octree (max_octree_depth) and the number of elements allowed in a octree node before a subdivision is required (n_allowed_elements). In addition, the root of the geometry tree must also be specified with the parameter root_space, which is typically the world volume:

<ksnav_meshed_space name="nav_meshed_space" root_space="space_world" max_octree_depth="9" n_allowed_elements="1"/>

Though they are not shown here (they default to false), the exit and entrance split parameters may also be set for the ksnav_meshed_space navigator. Because the ksnav_meshed_space navigator requires a boundary mesh in order to operate, all geometric objects (spaces, surfaces) which have navigation commands attached to them must also have a mesh extension in the geometry specification. Furthermore, since ksnav_meshed_space requires access to the root space space_world and all of the navigation commands associated with the shapes it contains, it must be declared after the definition of the simulation command structure element <ksgeo_space>.

The mesh navigator can also be used together with geometry from external files, as shown in the MeshSimulation.xml example.

XML element: <ksnav_meshed_space>
C++ type: KSNavMeshedSpace
Defined in: KSNavMeshedSpaceBuilder.h:35
Attributes

Attribute

Type

Description

absolute_tolerance

double

enter_split

bool

exit_split

bool

fail_check

bool

max_octree_depth

unsigned int

n_allowed_elements

unsigned int

name

string

octree_file

string

path

string

relative_tolerance

double

root_space

string

Refers to the name of one of: <ksgeo_space>.

spatial_resolution

double

Used as:

  • <ksnav_meshed_space> in <kassiopeia>

Can be referenced by:

  • set_space_navigator of <ks_root_space_navigator>

  • space_navigator of <ks_simulation>

Commands

For dynamic configuration, Kassiopeia allows certain commands to be used during the calculation of a particle trajectory. The commands are associated with particular surfaces and spaces and are what effectively governs the state of the simulation as a particle is tracked. They are declared through the specification of a ksgeo_space. A very simple example of the declaration of the command structure can be seen in the DipoleTrapSimulation.xml as shown below:

<ksgeo_space name="space_world" spaces="world">
    <add_terminator parent="root_terminator" child="term_max_steps"/>
    <remove_terminator parent="root_terminator" child="term_world"/>
    <add_track_output parent="write_root" child="component_track_world"/>
    <add_step_output parent="write_root" child="component_step_world"/>

    <geo_surface name="surface_upstream_target" surfaces="world/dipole_trap/upstream_target">
        <add_terminator parent="root_terminator" child="term_upstream_target"/>
    </geo_surface>

    <geo_surface name="surface_downstream_target" surfaces="world/dipole_trap/downstream_target">
        <add_terminator parent="root_terminator" child="term_downstream_target"/>
    </geo_surface>

    <geo_surface name="surface_center" surfaces="world/dipole_trap/center"/>
</ksgeo_space>

Note that in some configuration files, you may find alternative declarations such as:

<command parent="root_terminator" field="add_terminator" child="term_max_steps"/>
<command parent="root_terminator" field="add_terminator" child="term_upstream_target"/>

which are equivalent to the commands shown above.

For commands that act on one of the root objects (terminators, electric and magnetic fields, space and surface interactions, step modifiers and the trajectory), the parent attribute may be omitted; the corresponding root object is then used as parent, e.g. root_terminator for add_terminator. All other commands require an explicit parent.

Again, let us break down this example:

  • First we create a ksgeo_space navigation space using the world volume (a geometric object holding all other elements.) Inside of this world volume we declare a series of command which will be executed any time a particle enters or is initialized within the world volume.

  • The first two commands add and remove specific terminators, while the next two declare what sort of output should be written to disk while the particle is inside the world volume.

  • Following that, there are commands which are attached to specific surfaces which are present in the geometry, and handled by the navigator. For example in the first block, attaching the terminator term_upstream_target ensures that a particle impinging on the surface surface_upstream_target will be terminated immediately.

  • The last surface does not have any associated commands, but will still be considered for navigation. For example, if transmission_split was set in the navigator, the track will be split if the particle crosses the surface.

Commands can be used to change the active field calculation method, swap trajectory types, or add/remove terms and interactions, define terminators, etc. Various spaces and their associated commands can be nested within each other allowing for a very flexible and dynamic simulation configuration. For best results, it is important that the structure of the geo_space and geo_surface elements follows the structure of the KGeoBag geometry tree, i.e. nesting of the navigation elements should follow the same order as the underlying geometry.

Previous Next

© Copyright 2016-2023, The Kassiopeia developers..

Built with Sphinx using a theme provided by Read the Docs.