# Field Solvers

Warp has a broad variety of highly developed field solvers both for electrostatic, magnetostatic, and full EM fields. Often several different field solvers can be applied to the same problem. For example, for simulations of an axisymmetric (invariant under rotations about z-axis) beam and focusing system, one can simulate in 3D or r-z and the same results should be obtained up to differences in statistical noise. Cross-checks of different types of runs can provide valuable insights on numerical approximations made. Warp also includes several field solvers that have effectively been superseded by newer field solvers offering improved efficiency and flexibility. The older fieldsolvers will still work with the code and may, in some cases, be used for legacy or efficiency in specific applications. Here we cover primarily electrostatic fieldsolvers presently preferred.

Setting up a field solver within a Warp run script follows this schematic procedure in the simplest manifestation:

# Setup mesh for field solver

w3d.xmmax = 10.*mm

w3d.xmmin = -10.*mm

w3d.nx = 100

... similar for y and z directions

# Register or setup field solver, for example to register the 3D Multi-Grid solver

solver = MultiGrid3D()

registersolver(solver)

# Add any conducting objects to the mesh, for example a 10 kV bias cylinder here

zz = ZCylinder(...,voltage=10.*kV)

installconductor(zz)

### Details on the mesh setup, fieldsolver registration/setup, and loading conducting objects on the mesh are given in the sections below:

Multigrid fieldsolvers also work with mesh refinement which is described in:

Mesh refinement allows one to increase resolution (adaptively or not) in regions where it is needed.