- Beam Physics Code Repository
- Projects

## Projects

Our projects involve algorithm and code development for high-fidelity modeling, simulation and optimization of charged particle beams and systems based on them. We emphasize state-of-the art algorithms for force computation, time propagation, structure preservation and capabilities for handling large-scale systems employing high-performance computing resources efficiently.

Most of our codes are based on COSY Infinity, the general purpose, nonlinear dynamics code with an underlying arbitrary order differential algebraic (DA) engine. Any application developed in COSY can be retrofitted with a Java-based, custom GUI from within the code with only a few additional commands.

PHAD is a COSYScript written for COSY Infinity. PHAD is an efficient method for solving equations of motion of a large number of charged particles in beams interacting through Coulomb forces. PHAD combines the adaptive, multilevel fast multipole method with our Simo integrator via Strang splitting. Therefore, its main features include implementation of algorithms of optimal complexity for force computations, provable best efficiency for time propagation, combined with an attractive method to reduce the number of FMM calls while preserving symplecticity.

Currently, we offer an example of beamlets simulation for detailed observation of space charge dynamics in cold beams.

#### Downloads

#### Documentation

#### Examples

PHAD Example (ZIP). (file includes beamlets example with documentation.)

#### Applications

- Ph.D. Dissertation (2021) - Collisional methods with applications to charged particle beams.
- IPAC '21 - Transverse density pileup and pattern formation in dense ultracold electron beamlets under coulomb expansion.
- Phys Rev Accel Beams (2021) - Efficient algorithm for high fidelity collisional charged particle beam dynamics.
- PhD Diss (2016) - New computational approaches to the N-body problem with applications to the electron cooling of heavy ion beams.
- NA-PAC '16 - The First Particle-Based Proof of Principle Numerical Simulation of Electron Cooling.
- COOL '15 - N-body code to demonstrate electron cooling.
- HB '14 - A novel code with high-order adaptive dynamics to solve the n-body problem.

#### Updates

##### September 29, 2021

- Efficiency updates for the mpi Simo integrator.
- Replaced procedure parseline with the more general parse text.
- Updated the beamlets example to work with the latest version of PHAD.
- Updated the documentation for PHAD and the example.
- Included a Mathematica notebook for estimating the memory usage with PHAD.

##### January 10, 2020

- Within the Simo integrator: Improved accuracy by recomputing optimal time stepsize at some high orders for particles that reach those orders.
- Incorporated a tracking window and modified particle tracking indices.
- Implemented relaunch capability.
- Updated documentation.

##### May 9, 2019

Fixed bug in initial relg scaling of z-coordinate passed to FMM.##### February 22, 2019

- Updated PHAD for FMM that takes cosy binary input.
- Fixed output of particle betas.

##### November 14, 2018

- Improved particle index storage.
- Minor timer improvement.

##### October 10, 2018

- Updated PHAD description.
- Added beamlets example.

##### October 4, 2018

- Updated PHAD to new FMM.
- Added Simo integrator to PHAD.

##### October 28, 2017

Added PHAD documentation.##### June 5, 2017

- Uploaded PHAD code.
- Updated publications using PHAD.
- Added PHAD description.

##### Apr. 7, 2015

Uploaded publications using PHAD.The Poisson integral solver with curved surfaces (PISCS) is a package written in COSYScript for MSU COSY Infinity v10.1. PISCS is a 3D Poisson boundary value problem-solver accelerated by the fast multipole method (FMM). In this case, the Poisson BVP represents the electrostatic interactions within a charged particle distribution within specified boundaries. High accuracy solutions are feasible for realistic enclosures and boundary conditions.

#### Downloads

PISCS files (ZIP)#### Documentation

PISCS documentation (PDF)#### Examples

PISCS example (ZIP)#### Applications

- Phys Rev Accel Beams (2021) - The Differential Algebraic Fast Multipole Accelerated Boundary Element Method for Nonlinear Beam Dynamics in Arbitrary Enclosures.
- PhD Diss (2018) - Intense beam dynamics in arbitrary structures.
- NA-PAC '16 - Implementing the Fast Multipole Boundary Element Method With High-Order Elements.
- IPAC '16 - A Differential Algebraic Framework for the Fast Indirect Boundary Element Method.

#### Updates

##### June 1, 2021

Fixed bug in SVDCMP algorithm when inverting sparse matrices##### December 16, 2020

- Improved efficiency and parallelization of GMRES algorithm
- Fixed minor bug and optimized SVDCMP algorithm
- Implemented an adaptive QBX procedure
- Updated documentation

##### October 2, 2018

- Formatting PISCS to be robust to different COSY versions.
- Fixed a sign error in the calculation of the fields for near evaluation.
- Implemented a refinement procedure to deal with near boundary instabilities.
- Fixed a minor inconsistency in the boundary condition file for 1st order structures.
- Updated documentation.

##### July 20, 2017

- Added 'targets' keyword
- Added PISCS manual and example

One of the oldest problems to remain analytically unsolvable, except in specific cases or by practically useless series solutions, is the calculation of gravitational or electrostatic interactions between N bodies. Many numerical methods have been developed over the last century to address this problem. This is our take on the computational N-body problem.

The simulation code uses COSY Infinity. There are two variants that differ with respect to the numerical integrator used internally. The earlier version is a Picard iteration-based integrator, and the newer version implements a more sophisticated integrator, which we termed the Simo integrator. The basic N-body simulation code has a fixed time step and order. The Simo N-body simulation code is adaptive and has a variable order with optimized time step size and order. The MPI Simo N-body simulation code is a parallelized version of the Simo N-body simulation code that can be run using the MPI COSY.

#### Downloads

#### Documentation

#### Examples

- Simo Example 1.zip.
- Simo Example 2.zip.
- Simo MPI Example.zip.
- Basic Example 1.zip.
- Basic Example 2.zip.

#### Applications

##### Simo N Body Simulation

- SIAM J Sci Comput (2018) - Collisional
*N*-body numerical integrator with applications to charged particle dynamics. - PAC'16 - An accurate and efficient numerical integrator for pair-wise interaction.

##### Basic N Body Simulation

- Numerical Algorithms (2019) - Picard iteration-based variable-order integrator with dense output employing algorithmic differentiation.
- PAC'13 - Numerical integrator for Coulomb collisions.
- PAC'13 - A Picard iteration based integrator.

#### Updates

##### September 1, 2021

- Minor modifications and bug fixes for the mpi code.
- Updated documentation.

##### January 10, 2020

- The mpi code: Improved accuracy by recomputing optimal time stepsize at some high orders for particles that reach those orders.

##### September 19, 2019

- The mpi code:
- Improved memory usage to be almost independent of the number of processors.
- Added boundaries to eliminate particles outside specific limits in the xy-plane.
- Bug fixes.

- Added an example for the mpi code.

##### October 15, 2018

- Added mpi version of Simo integrator.
- Added manual for mpi version of Simo integrator.
- Updated serial Simo integrator (Minor modifications).

##### February 19, 2018

Added application "Picard iteration-based variable-order integrator with dense output employing algorithmic differentiation."##### June 5, 2017

Added application "An accurate and efficient numerical integrator for pair-wise interactions."##### June 2, 2017

- Added Simo integrator, documentation and example.
- Corrected equations in Basic integrator documentation.
- Corrected permittivity constant.

##### April 7, 2015

Uploaded documentation and examples.##### March 6, 2015

Fixed bugs related to the treatment of relativistic cases.##### November 25, 2014

Modified to account for the relativistic factor, γ.##### Oct. 22, 2014

- Reduced the number of variables used in the code.
- The iterations are done in one loop instead of two.
- Changed the memory of the DA vectors from being fixed to be dependent on the number of particles.
- All these changes should improve the efficiency and the speed of the code.
- Note that this version does not take into account the radius of convergence error as we are trying to find a better method for that.

##### Mar 20, 2014

Uploaded V1.0.This is a reasonably well-optimized code for our differential algebraic multilevel fully adaptive 3D fast multipole method for the Laplace kernel of point particles in Cartesian basis. The data structures are coded in standard, portable C++ to allow dynamic memory management and bit-level operations, in addition to speed and easier parallelization. The expansions and translations are done in a compact COSYScript code to take advantage of the following:

- DA data types that allow automatic high-order truncated Taylor expansions with machine precision.
- Efficient function composition.
- Fast polynomial evaluation.

More details and examples can be found in the documentation.

#### Downloads

#### Documentation

#### Examples

Example files. (Instructions for examples may be found in the 3D FMM manual.)#### Applications

- Commun Nonlinear Sci (2019) - An Adaptive fast multipole method in cartesian basis, enabled by algorithmic differentiation.
- COOL'15 - N-body code to demonstrate electron cooling.
- PAC'13 - Optimization of the multipole to local translation operator in the adaptive fast multipole method.
- IPAC'13 - A novel differential algebraic adaptive fast multipole method.
- IPAC'12 - Optimal fast multipole method data structures.
- AIP Conf. Proc (2012) - The fast multipole method for N-body problems.

#### Updates

##### February 6, 2019

- Added additional cosy binary input option.
- Added initialization of .status and .output files.
- Improved forward compatibility with COSY data types.

##### October 9, 2018

Minor bug fix in summary file.##### June 5, 2017

- New, more flexible options for input distribution specification and formatting.
- Optimized multipole to local operator.
- Shared memory parallelization with Cilk+.
- Distributed memory parallelization with MPI.
- Minimization of number and size of messages passed using MPI.
- Platform independence (options in the make file).
- GPU-ready.

##### November 12, 2015

Minor bug fix.##### June 23, 2015

- Changed the format of the
*fmm.input file.* - Data files are in the subfolder named data.
- Data files: charges_1k.dat, N_1k.ssv.
- main.cpp: preprocessor directive, #include
, is added.

##### May 13, 2015

- Two new source files are included: getopt.h and getopt.cpp
- In main.cpp
- FindElement() is replaced with binary_search()
- A bug fixed in topTomiddleandBottomTrees()

##### March 9, 2015

- particles.cpp: Changed the dZero value.
- main.cpp: Fixed a bug in findElement().

##### August 18, 2014

Efficiency improvements.

COMFY is a COSY Infinity plug-in written in COSYScript for v9.1 to extend its capabilities to include transverse space charge in beam dynamics. It allows for self-consistent space charge calculations, as well as space charge transfer map extractions using truncated Taylor expansions. The modes include transverse mean field estimation (fast, with low-medium accuracy) and discrete open N-body Poisson solver (slower, with high accuracy).

COMFY can calculate charged particle interactions through two different methods. The method of statistical moments (MoM) is used to calculate the space charge transfer map in the mean field sense. The transfer map is then used for particle advancement. The fast multipole method (2D single-layer-FMM) solves the N-body Poisson problem with open boundary conditions for particle tracking. A hybrid mode may also be used, where the moment method calculates the space charge map and the fast multipole method advances the particles.

You will need to install COSY first. You can run COMFY in parallel or serially. To run COMFY in parallel, you will need an MPI package such as OpenMPI or Intel MPI. To use COMFY, you will need the customized cosy.fox and comfy.fox files and the COMFYFILES folder included in the comfy.zip download. Please read the COMFY manual for more details on installation and use.

#### Downloads

#### Documentation

#### Examples

#### Application

- Comm Comp Phys (2015) - A Differential Algebraic Method for the Solution of the Poisson Equation for Charged Particle Beams.
- HB'14 - Space charge map extraction and analysis in a differential algebraic framework.
- PAC'13 - Study and comparison of the method of moments and the single level fast multipole method for 2D space charge tracking.
- IPAC'12 - A self consistent multiprocessor space charge algorithm that is almost embarrassingly parallel.
- IPAC'12 - Charge density estimations with orthogonal polynomials.
- PAC'11 - An implementation of the fast multipole method for high accuracy particle tracking of intense beams.
- HB'10 - A new paradigm for modeling simulations and analysis of intense beams.
- IPAC'10 - Method to extract transfer maps in the presence of space charge in charged particle beams.

#### Updates

##### May 19, 2017

- Merged serial and parallel versions.
- Added stability fixes related to parallelization.
- Added utilities related to parallelization.
- Added utilities for vector and arrays.
- Added utilities for strings.
- Removed OS dependence.
- FMM will run in serial in parallel environment.
- FMM mixes particle ordering.

##### April 24, 2015

Fixes for efficient smoothing.##### April 7, 2015

- Uploaded new publication using COMFY.
- Bug fixes related to space charge kicks.
- Included procedures to change smoothing parameters, PPSOFT and MULTSOFT.
- Updated manual to include smoothing.

##### October 15, 2014

Bug fixes##### Sept. 10, 2014

Bug fixes##### Aug. 29, 2014

- Uploaded V1.03.
- Modified FMM procedures to use DA vectors.
- Minor bug fixes.
- Slight efficiency improvement.
- Added softening capability to FMM. Can set softening separately with COMFYSOFTD for near interactions and COMFYSOFTM for multipole expansion.

This first order system of ordinary differential equations (ODEs) integrator is based on Picard iterations implemented with differential algebraic methods. This results in an efficient, highly accurate variable order integrator with a dense output. There are two independent parameters to optimize, order and time step. This makes it possible to choose optimal values that make the integrator the fastest possible for a given level of accuracy.

The implementation also uses COSY Infinity. The documentation explains how to adapt the supplied example to different systems of ODEs.

#### Downloads

#### Documentation

#### Examples

Picard Integrator example data.

#### Applications

- Numerical Algorithms (2019) - Picard iteration-based variable-order integrator with dense output employing algorithmic differentiation.
- PAC'13 - Numerical integrator for Coulomb Collisions.
- PAC'13 - A Picard iteration based integrator.

#### Updates

##### February 19, 2018

Added application "Picard iteration-based variable-order integrator with dense output employing algorithmic differentiation."##### March 20, 2014

Uploaded V1.0 with documentation/examples.This section includes reference material and resources that may be helpful in running the simulations included on this site and visualizing the resulting data.

#### NIU COSY User Guide

The COSY user guide describes the process of setting up and running the COSY executable on the NIU compute cluster GAEA (much of the information will be applicable to other compute clusters).

COSY User Guide#### Mathematica Plotting Tutorial

This Mathematica notebook walks through a variety of plotting options (including advanced features) for visualizing data with Mathematica.

Mathematica Notebook