WARP is a multidimensional intense beam simulation program being developed and used at the Heavy Ion Fusion Virtual National Laboratory, which currently includes LBNL, LLNL, and PPPL, and at other sites, most notably NRL and the University of Maryland. It allows flexible and detailed multi-dimensional modeling of high current beams in a wide range of systems, including bent beam lines using a "warped" coordinate system (from which the code derives its name). It is being designed and optimized for heavy ion fusion accelerator physics studies. At present it incorporates a 3-D description, an axisymmetric (r, z) description, a transverse slice (x,y) description, a simple envelope model used primarily to obtain a well-matched initial state, and envelope/fluid models used for scoping and design. The flexibility and detail of WARP modeling can be seen in recent movies of HCX and merging-beamlet simulations.
The discrete-particle models in WARP combine the particle-in-cell (PIC) technique commonly used for plasma modeling with a description of the "lattice" of accelerator elements. WARP is a time-dependent plasma code - the particles are advanced in time and the self and applied fields are applied directly to update the particles' momenta. The calculation can follow the time-dependent evolution of beams, or can efficiently be used to study steady-state beam behavior in 3-D or 2-D R-Z by solving for the self-consistent field only infrequently or by using an iterative method. The transverse-slice model is s-dependent, and is effectively a steady-flow model. The beam can be initially generated from one of several general distributions or from first principles via space-charge-limited injection from an emitting surface. The self-consistent field is assumed electrostatic - Poisson's equation is solved on a Cartesian mesh that moves with the beam. In a bend, the solution is altered to include the curvature of the coordinates. Complex conductor geometry can be included in the field solution using a subgrid-scale, or cut-cell, boundary algorithm to afford a realistic description of the geometry while minimizing the required grid resolution. Regions where the physics or the geometry requires a small spatial scale can be resolved as finely as needed using Adaptive Mesh Refinement, implemented in WARP-RZ [6-9]. A 3-D implementation is under development using the Chombo package . In order to accommodate space-charge-limited injection with very fast rise time, a specialized refinement patch is implemented. Near the emitting surface, the self-fields are calculated along independent one-dimensional lines normal to the surface, with increasing refinement towards the surface [7,9].
A general set of finite-length, possibly overlapping, accelerator elements can be specified, including quadrupoles, dipoles, accelerating gaps, and elements with arbitrary multi-pole content, using a MAD-like syntax. Individuals elements can be defined and chained together into aggregate elements, which can be further combined. This is done using standard Python syntax (via Python objects), though it looks very similar to MAD syntax. A tool is provided which converts a MAD format file into a Warp readable file. The fields of the elements can be specified at one of several levels of detail. At the simplest level, the applied fields are axially uniform within hard-edged regions, and "residence corrections" are used in the particle mover so that the particles receive a correct impulse from each element independent of the number of times they "land" within the element on discrete time steps. At the next level, the fields are expressed as axially dependent multipole components. At the most detailed level, the fields are represented on three-dimensional grids. Electrostatic elements can be included from first principles via inclusion of the conductor geometry as a boundary condition in the solution of the self-fields. Another set of elements in the 3-D and slice models specifies the locations and curvatures of bends. These bends are not physical elements but are the appropriate coordinate transformations needed to follow the beam around the bends. WARP handles particle collisions with any object in the beam line, including the pipe wall, beam source components, diagnostics (Faraday cup, etc...). The particles colliding with structures are removed from the simulation and their parameters are stored into special arrays for further treatment (see section 'In development').
WARP is written primarily in standard Fortran90. It is steered through a flexible and powerful user interface that uses the scripting language Python (http://www.python.org ). A GUI (snapshot) is available which, in addition to providing a Python console, allows the user to edit, save and run WARP Python scripts (all at once or step-by-step), dump and restore runs, display and control plots, access documentation, and more. The code runs on all Unix based systems, from a variety of workstations to vector and parallel supercomputers, including the 6000-processor IBM SP supercomputer at NERSC. Parallelization is done using domain decomposition and the standard message passing interface (MPI) library. Although WARP is primarily developed on Linux, it also runs on Windows and Mac OS X.
The Python wrapper generator used to create the connection between the WARP's Fortran90 and Python will soon be released as a separate package, call Forthon. This can be used to connect other Fortran codes to Python.
A set of modules to add electron cloud and gas effects is being developed for WARP. A schematic of the planned full set is found here. The package includes calculations of halo scrape-off, ion reflection, neutral gas production and secondary electron production at walls, neutral-gas transport, ionization, and electron dynamics. Work is proceeding on all components; the implementation status in WARP as of 2/2004 is indicated in the attached figure. A key component of the electron cloud package is a hybrid mover that interpolates between drift-kinetic and full-orbit calculations as electrons move from regions of strong to weak or no magnetic field. This will enable simulations of the essential features of electron dynamics using time steps comparable to that required for the ion beam. As part of this effort, further treatment of particles absorbed at the wall will be implemented in the near future, and will include reemission and/or emission of secondary particles, using routines from POSINST (Miguel Furman). These routines are currently being wrapped into the CMEE package (Tech-X) and will ultimately be invoked by WARP in that form. The package IONPACK, also developed at Tech-X, will be used for particle-gas interaction. A package to track neutrals is currently being conceptualized by J.Verboncoeur (UC Berkeley) and will be implemented in collaboration with Tech-X.
WARP can interoperate with Miguel Furman's code Posinst through Python. Since Posinst simulates a thin slice fixed in the laboratory frame with time as the independent variable, such mode of operation has been added to WARP. This is a time-dependent with transverse 2-D X-Y or 1-D R (radial) field solver. Both codes are run in the same process and communicate through Python and share a few common key arrays (particle positions and velocities). Currently, Posinst provides mainly initial and secondary sources of electrons, beam bunches kicks, particle mover and diagnostics. WARP provides field solvers and diagnostics. Secondary emission routines are provided by the Tech-X package CMEE. In the future, more integration will be achieved and WARP particle movers will be used. Ultimately, a user will be able to use the same deck for 3-D/R-Z thick slices or X-Y/R thin slice runs with only minimal changes (ideally one flag and a few boundary conditions in Z).
 A. Friedman, D. P. Grote, and I. Haber, "Three-dimensional particle simulation of heavy-ion fusion beams," Phys. Fluids B 4, 2203 (1992).
 D. P. Grote, "Three- Dimensional Dimensional Simulations of Space Charge Dominated Heavy Ion Beams with Applications to Inertial Fusion Energy," PhD Thesis, University of California, Davis, LLNL Report UCRL-LR-119363 (1994).
 D. P. Grote, A. Friedman, I. Haber, "Three-Dimensional Simulations of High Current Beams in Induction Accelerators with WARP3d," Fus. Eng. & Des., 32-33, 193 (1996). 193-200.
 D. P. Grote, A. Friedman, I. Haber, "Methods used in WARP3d, a Three-Dimensional PIC/Accelerator Code", Proc. of the 1996 Comp. Accel. Physics Conf., AIP Conference Proceedings 391, p . 51 (1996).
 P. McCorquodale, P. Colella, D. P. Grote, J.-L. Vay, "A Node-Centered Local Refinement Algorithm for Poisson's Equation in Complex Geometries", submitted to J. Comput. Phys.
 J.-L. Vay, P. Colella, P. McCorquodale, B. Van Straalen, A. Friedman, D.P. Grote, "Mesh Refinement for Particle-In-Cell Plasmas Simulation: application - and benefits for - Heavy Ion Fusion", Laser and Particle Beams 20, p. 569 (2002)
 J.-L. Vay, A. Friedman, D.P. Grote, "Progress in the Study of Mesh Refinement for Particle-In-Cell Plasma. Simulations and its application to Heavy Ion Fusion", Proceedings of 7th International Computational Accelerator Physics Conference, East Lansing, 2002, edited by IOP Publishing
 J.-L. Vay, P. Colella, A. Friedman, D.P. Grote, P. McCorquodale, D.B. Serafini, "Implementations of Mesh Refinement schemes for Particle-In-Cell Plasma Simulations", Computer Physics Comm., in press
 J.-L. Vay, P. Colella, J.W. Kwan, P. McCorquodale, D.B. Serafini, A. Friedman, D.P. Grote, G. Westenskow, J.-C. Adam, A. Heron, I. Haber, "Application of adaptive mesh refinement to particle-in-cell simulations of plasmas and beams.", Physics of Plasmas, in press
For comments or questions contact WMSharp@lbl.gov or DPGrote@lbl.gov. Work described here was supported by the Office of Fusion Energy at the US Department of Energy under contracts DE-AC03-76SF00098 and W-7405-ENG-48. This document was last revised August, 2003.