Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
/ tracy-3.5 Public archive
forked from jbengtsson/tracy-3.5

Self-Consistent charged particle beam dynamics model based on a Symplectic Integrator.

Notifications You must be signed in to change notification settings

PierreSchnizer/tracy-3.5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thor

Author: Johan Bengtsson

Self-Consistent Symplectic Integrator for Charged Particle Beam Dynamics

The symplectic integrator for realistic modeling of magnetic lattices for ring-based synchrotrons was initially implemented in Pascal as a beam dynamics library, by the author, 1990; with care taken for the software architecture & resulting records/modules – akin to objects although not explicitly supported by the grammar – to reflect the structure of the mathematical objects describing the underlying beam dynamics model.

The resulting C code, see below, has now been re-factored by introducing a C++ "beam line class"; i.e., to recover the transparency & simplicity of the original beam dynamics model.

Nota Bene: Although the beam dynamics model had to be replaced & the model/code re-architectured & structured – for a reusable approach – as a Pascal beam dynamics libary, the code was named Tracy-2, i.e., after the demo/prototype Tracy:

H. Nishimura "TRACY, A Tool for Accelerator Design and Analysis" EPAC 1988.

for which the beam dynamics model was based on the linearized quadratic Hamiltonian:

for linear optics design. In particular, because the prototype was implemented by extending the standard procedures & functions for the Pascal-S compiler/interpreter by N. Wirth:

N. Wirth PASCAL-S:: A Subset and its Implementation Institut für Informatik (1975).

The CERN Classic collaboration -> Thor

Contributions

  • The symplectic integrator for RADIA kick maps:

    P. Elleaume A New Approach to the Electron Beam Dynamics in Undulators and Wigglers” EPAC 1992.

    was implemented by Laurent Nadolski, SOLEIL, 2002.

  • The original Pascal library/code was machine translated to C and re-used to implement a model server for the SLS commissioning:

    M. Böge Update on TRACY-2 Documentation SLS Tech Note SLS-TME-TA-1999-0002 (1999).

    M. Böge, J. Chrin A CORBA Based Client-Server Model for Beam Dynamics Applications ICALEPS 1999.

    with p2c.

  • Similarly, James Rowland re-used the C version to implement a Virtual Accelerator interfaced to EPICS as a Virtual Input Output Controller (VIOC):

    M. Heron, J. Rowland, et al Progress on the Implementation of the DIAMOND Control System ICALEPCS 2005.

  • Besides, the internal numerical engine was manually translated to C and re-used for:

    A. Terebilo Accelerator Toolbox for MATLAB `SLAC-PUB-8732 (2001).`_

  • Python interface:

    Initial demo/prototype & guidelines by Jan Chrin, PSI, 2017.

    J. Chrin Channel Access from Cython (and other Cython use cases) EPICS Collaboration Meeting 2017.

    Guidelines & automated regression testing bootstrapped by Pierre Schnizer.

Requirements

The library uses the range checking inmplementation of e.g. std::vector as provided by GNU C++; thus its dependency on the GNU compiler collections.

To install

Setup of repository

Dowload the repository and checkout the proper branch. Here it's assumed you will use the directoy git_repos/tracy-3.5 in your home directory for the tracy code tree.

For this use the following commands to create the directoy git_repos and to clone the tree into the tracy-3.5 directory.

mkdir git_repos
cd git_repos
git clone git@github.com:jbengtsson/tracy-3.5.git
cd tracy-3.5

Then select the proper tree by

git checkout tracy-3.5_scsi

C++ library

First create environment variable $TRACY_LIB. This will be the prefix where the built library and include files will be installed later on e.g:

export TRACY_LIB=$HOME/git_repos/tracy-3.5

To build the library use:

cd tracy-3.5
libtoolize
./bootstrap
./configure --prefix=$TRACY_LIB
make
make install

Please note: using the dynamic library in non standard location will require proper set up of the environment later on (e.g. adding the directory where the library is located to LD_LIBRARY_PATH environment variable).

Python interface

The python interface is based on https://github.com/pybind/pybind11. Building this interface requires to select the proper directory

cd git_repos
cd tracy-3.5/python

Install proper dependencies

pip3 install -r requirements.txt

And build the extension e.g.

python3 setup.py build
python3 setup.py install

For further details of the build system see https://pypi.org/project/setuptools/

To run the regression tests

All regression tests can be run using

pip3 install nose
python3 setup.py nosetests

To run the demo/test program

python3 examples/tst.py

About

Self-Consistent charged particle beam dynamics model based on a Symplectic Integrator.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 75.8%
  • Fortran 11.4%
  • Shell 5.1%
  • Gnuplot 3.2%
  • Python 2.2%
  • C 1.8%
  • Other 0.5%