# Presentation: 936431

## ICOOL: simulation code for neutrino factory and muon collider design

- R.C. Fernow
- BNL
- Low Emittance Muon Collider Workshop
- Fermilab
- 7 February 2006

## MC Cooling Simulation History

-    ICOOL

- begin looking at possibility of muon collider (1994)
- early cooling simulations
- rms equations and other private coding
- SIMUCOOL
- MCM
- PARMELA’
- start work on ICOOL (~Spring 1996)
- FNAL meeting on cooling software (Oct. 1997)
- consolidation of coding effort (common libraries and file formats)
- continue development of generic ICOOL
- push development of DPGeant (Paul Lebrun)

## Design Philosophy

-    ICOOL

- adopt the best features of existing codes
- try to write clean, structured, modular code from scratch
- define problem in terms of ASCII input data files
- avoid code patches
- break problem into sequence of TRANSPORT-like regions
- use accurate models of particle interactions
- adapt code from Geant v3.21
- provide flexible field description
- make code portable across MC collaboration
- generic F77, character graphics
- encourage user pre- and post- processing

## Program features

-    ICOOL

- single particle, 3-D tracking in materials and electromagnetic fields
- moment equations for straight solenoidal channels  (optional)
- uses reference orbit coordinate system
- includes physics processes appropriate to <1 GeV muons
- systems described as sequence of longitudinal regions
- “pseudoregions” can be inserted for special tasks
- region looping commands for repetitive systems
- automatic initialization of rf cavity phases
- numerous built-in diagnostics
- ~27,000 lines of code

## Command file structure

-    ICOOL

- simulation control variables
- beam definition
- physics interactions
- diagnostics
- region definition

## Particle Generation

-    ICOOL

- gaussian or uniform initial distributions
- uses electrons, muons, pions, kaons and protons
- can impose correlations on initial beam, e.g.
- angular momentum in solenoid
- forward velocity vs. transverse amplitude
- rf bucket
- Twiss parameters
- or read in an external beam file

## Interactions

-    ICOOL

- appropriate for 50-1000 MeV/c muons in matter
- continuous processes
- energy loss  (e.g. Bethe-Bloch)
- straggling  (e.g. gaussian, Vavilov)
- multiple scattering  (e.g. gaussian, Moliere)
- discrete processes
- decay   (can continue tracking charged decay product)
- delta rays (correlated scattering – energy loss)
- pion absorption
- space charge guesstimate

## Space charge

-    ICOOL

-  ICOOL is not a PIC code !
-  loop order allows crude estimate of space charge
- outer loop on regions
- inner loop on particles
-  algorithm
- at start and end of region only
- transform time -> space distribution
- get space charge of bunch on each particle
- kick particle momentum vector

## Tracking

-    ICOOL

- accelerator coordinates are used in regions containing a dipole field
- the independent variable in the equations of motion is *ds*
- the dependent variables are the transverse positions, momentum, and the polarization
- exact differential equation used (no transverse expansion)
- curvature can be followed in both transverse planes
- particle stepping can be done using fixed steps or by using an adaptive stepsize algorithm
- particle stepping is done using fourth-order Runge-Kutta integration
- not symplectic

## generic region is a cylinder
fixed length along reference orbit
can be subdivided into 4 radial parts
particles can pass back and forth
no limit to number of regions
wedge geometry
used to reduce momentum spread in dispersive regions
can have flat or polynomial shaped surface

- fixed length along reference orbit
- can be subdivided into 4 radial parts
- particles can pass back and forth
- no limit to number of regions
- wedge geometry
- used to reduce momentum spread in dispersive regions
- can have flat or polynomial shaped surface

-    ICOOL

- Geometry description

- +X

- -X

- -Y

- +Y

- -Z

- +Z

- W

- H

- U

## Field description

-    ICOOL

- very flexible
- field at a point comes from superposition of
- region field
- cell field
- background field
- fields can be described by
- predefined analytic models (hard and soft edge)
- r - ø  grid from sum of coils or cylindrical current sheets
- on-axis fields or multipoles
- user-supplied grid

## Electromagnetic field models

-    ICOOL

- Bent solenoid  (4)
- Annular current loop, sheet and blocks   (11)
- Kickers  (2)
- Sector dipole  (4)
- Alternating solenoid lattice  (2)
- Accelerator  (13)
- Quadrupole, sextupole, other multipoles  (8)
- Current carrying rod, horn  (7)
- Helical (8)
- Straight solenoid  (9)

## dTANH field model

-    ICOOL

-  used to describe varying longitudinal fields and end fields
-  can be differentiated as many times as needed for higher order field expansions
-  can add fringe fields from neighbor regions

- f(s;B,C,E,λ) = B/2 [ tanh((s-E)/ λ) - tanh((s-C-E)/ λ)]

## used to describe longitudinally varying solenoid lattices
cylindrically symmetric
fields from analytic solutions using elliptic integrals
can interpolate field from grid

- used to describe longitudinally varying solenoid lattices
- cylindrically symmetric
- fields from analytic solutions using elliptic integrals
- can interpolate field from grid

-    ICOOL

- Coil and sheet model

## Off-axis field expansions

-    ICOOL

-  must supply on-axis fields
-  1) table of field components
-  2) Fourier coefficients
-  uses Maxwell equations for off-axis values
-  up to 5th order expansions available

- Example: 1st order expansion in curved region
- BX(s) = a0(s) + (a1(s)-bS’(s)/2) x + b1(s) y
- BY(s) = b0(s) + b1(s) x + t02(s) y
- BS(s) = (bS(s) +  a0’(s) x + b0’(s) y ) / ( 1 + h(s) x + g(s) y)
-    t02(s) = -a1(s) + bS’(s)/2 – h(s) a0(s) – g(s) b0(s)

## can construct from combinations of built-in fields
field built up on 3D grid
uses special pseudocommands
BACKGROUND
BFIELD
ENDB
can use special type STUS
      e.g. error fields

- field built up on 3D grid
- uses special pseudocommands
- BACKGROUND
- BFIELD
- ENDB
- can use special type STUS
-       e.g. error fields

-    ICOOL

- Background fields

##    ICOOL

-    ICOOL

- RF fields

-  acceleration and deflection fields, e.g.
- pillbox and traveling wave cavities
- induction linac
- kickers
-  uses reference particle to preset cavity phases, e.g.
-        model 2: finds 0-crossing iteratively
- model 3: constant velocity
- model 4: takes energy gain and loss into account
-  can apply additional phase shifts, if desired

## Pillbox cavity

-    ICOOL

-  cylinder
-  TM010 mode
-  fields independent of z
-  vary sinusoidally with time
-  **E** and **B** 90o out of phase

## Region definition

-    ICOOL

- region commands describe a longitudinal section
- region field
- material
- geometry
- uses 18 pre-defined materials
- uses 8 pre-defined geometry types
- pseudoregion commands accomplish tasks at given location
- e.g. generate output, rotate coordinates, impose transport matrix, etc.

## Loop structures

-    ICOOL

-  3 types of nested loop structures: REPEAT, CELL, SECTION
-  groups of commands can be repeated with REPEAT structures
-          e.g. strings of RF cavities
-  groups of REPEAT structures and individual regions can combined in CELL structures
- can be repeated as often as desired
- has associated CELL field superimposed on the region fields
- has ability to alternate polarity
- e.g. periodic cells in machine lattice
-   groups of REPEATS and CELLS can be combined in SECTION structures
-         e.g.  multiple turns in a ring

## Name substitution

-    ICOOL

-  simple built-in scripting capability
-  useful for simple optimizing studies
-  define name once at top of file
-        e.g.  &SUB  phase  30.
-  use name in many following commands
-        e.g.  ACCEL  2  201.  15.  &phase 0   0 0 0 0 0   0 0 0 0 0
-  variant assigns random value to name
-        e.g.  &RAN  phase  G  20.  40.

##    ICOOL

-    ICOOL

- Odds and ends

-  two reference particles for adiabatic bunching
-  RKICK to generate random momentum kicks
- transverse or longitudinal errors
-  ELMS routines for correlated energy loss & scattering
- liquid hydrogen only
-  can read Superfish output for cavity fields

## Diagnostics

-    ICOOL

- many levels of print out
- region summary table
- histograms
- scatter plots
- variable as function of z  (Z-history)
- mean, standard deviation at end of regions  (R-history)
- emittances, polarization, covariance matrices
- particle and field information files for post-processing

##    ICOOL

-    ICOOL

- ********************         REGION SUMMARY              ********************
-   IZ  IS  IC CTAG BTAG   SLEN                ZLO                ZHI           IR FTAG MTAG MGEOM
-    1               PRODUCTION
-    2               REF PARTICLE
-                    BEGIN SECTION LOOPING
-                     CELLS =    12
-    3    1   1 BSOL NONE  0.30000E+00  0.00000E+00  0.30000E+00 1 NONE  LH    WEDGE
-    4    1   1 BSOL NONE  0.85000E-01   0.30000E+00  0.38500E+00 1 NONE VAC  CBLOCK
-    5    1   1 BSOL NONE  0.33000E+00  0.38500E+00  0.71500E+00 1 ACCE VAC   NONE
-    6    1   1 BSOL NONE  0.33000E+00  0.71500E+00  0.10450E+01 1 ACCE VAC   NONE
-    7    1   1 BSOL NONE  0.33000E+00  0.10450E+01  0.13750E+01 1 ACCE VAC   NONE
-    8    1   1 BSOL NONE  0.33000E+00  0.13750E+01  0.17050E+01 1 ACCE VAC   NONE
-    9    1   1 BSOL NONE  0.33000E+00  0.17050E+01  0.20350E+01 1 ACCE VAC   NONE
-   10   1   1 BSOL NONE  0.33000E+00  0.20350E+01  0.23650E+01 1 ACCE VAC   NONE
-   11   1   1 BSOL NONE  0.85000E-01   0.23650E+01  0.24500E+01 1 NONE VAC  CBLOCK
-   12               OUTPUT
-   13   1   1 BSOL NONE  0.30000E+00  0.24500E+01  0.27500E+01 1 NONE LH   WEDGE

## Input files

-    ICOOL

- for001.dat	problem commands
- for003.dat	beam data (optional)
- for0xx.dat	optional input data, e.g.
- 			coil or current sheets specs
- 			induction linac pulse
- 			cavity phases
- 			field grid

##    ICOOL

-    ICOOL

- Output files

- for002.dat	log file
- for004.dat	beam output data at fixed s;
- 		enables restart (optional)
- for007.dat	region summary table (optional)
- for009.dat	particle and field data;
- 		for postprocessing (optional)
- for011.dat	beam envelope (optional)
- for0xx.dat	optional diagnostic data, e.g.
- 			field grids
- 			rf diagnostics

## Web distribution

-    ICOOL

-  Go to MC home page (http://www.cap.bnl.gov/mumu/)
-  Source code (Fortran 77)
-  Windows executable
-  User’s Guide and Reference Manual
-  Descriptive files and tutorials
-  Utility programs
-  Example problems with output

## Utility programs

-    ICOOL

-  ERRSUM2	summary table of failed tracks
-  ECALC9F	standard emittance & acceptance (G. Penn)
-  ENDOF9	extracts all tracks that finish simulation
-  NOTEND9	extracts tracks that don’t finish
-  EXTPAR9	extracts specified tracks
-  EXTREG9	extracts specified regions
-  BUNCH9	bunching analysis
-  VIEW9	shows beam distributions vs. z (Windows)

## Other related codes

-    ICOOL

-  preprocessors
- NIME (W. Fawley)
- XICOOL (S. Bracker)
- GEN, SHEET (R. Palmer)
-  postprocessors
- user specific (many)
- EMITCALC (G. Penn)
-  optimizers
- OPTICOOL, OPTICOSP (S. Bracker)
- MINCOOL (R. Palmer)

##  ICOOL has been used for very 

- complicated simulations
-  Study 2a neutrino factory front-end
- 	2124 regions
- 	5000 initial pions
- 	49 minutes on 2.2 GHz PC
-  RFOFO cooling ring
- 	1983 regions (15 turns)
- 	1000 initial pions
- 	40 minutes on 2.2 GHz PC

-    ICOOL

## Example 1: Hard-edge FODO channel

-    ICOOL

-  basic deck structure
-  Gaussian beam
-  ext. beam file
-  REPEAT
-  print out
-  statistics & moments
-  scatterplots

## Example 2: Solenoid focus into absorber

-    ICOOL

-  uniform beam
-  soft-edge field
-  material
-  region summary
-  histograms
-  scatterplots
-  Z-history

## Example 3: FS2 (2,1) cooling channel

-    ICOOL

-  reference particle
-  CELL
-  ext. beam file
-  sheet file
-  emittance
-  moment analysis

## Example 4: RFOFO cooling ring

-    ICOOL

-  NSECTIONS
-  wedges
-  postprocessor file
-  field from multipole file