Simulation Mesh

Most fieldsolvers in Warp use common mesh variables that are overviewed here primarily in the context of the 3D code. In the r-z code, the x-mesh defines radial mesh positions. In the transverse x-y slice code the z-mesh is largely irrelevant. For a 3D mesh, mesh extents and sizes are defined as follows:

# Mesh extents

w3d.xmmin = -10.*mm # x-mesh min

w3d.xmmax = 10.*mm # x-mesh max

w3d.ymmin = -10.*mm # y-mesh min

w3d.ymmax = 10.*mm # y-mesh max

w3d.zmmin = -250.*mm # z-mesh min

w3d.zmmax = 250.*mm # z-mesh max

# Mesh sizes

w3d.nx = 200 # size of x-mesh, mesh points are 0,...,nx

w3d.ny = 200 # size of y-mesh, mesh points are 0,...,ny

w3d.nz = 1000 # size of z-mesh, mesh points are 0,...,nz

For multigrid fieldsolvers commonly used there are no restrictions on values on the mesh sizes nx, ny, nz other than then are positive integers. For some fieldsolvers such as the FFT, the mesh sizes need to be restricted to a power of 2 for efficient operation. When the call to generate() is made, the mesh increments will be set as (no need to include in script)

w3d.dx = (w3d.xmmax - w3d.xmmin)/w3d.nx # x mesh spacing

w3d.dy = (w3d.ymmax - w3d.ymmin)/w3d.ny # y mesh spacing

w3d.dz = (w3d.zmmax - w3d.zmmin)/w3d.nz # z mesh spacing

in the case where no mesh symmetry options (described below) are given which might override the input mesh bounds. On the call to generate(), the code also calculates mesh arrays that are convenient to use for calculating user defined diagnostics (binning distribution measures etc):

w3d.xmesh # array x-coordinates of mesh

w3d.ymesh # array y-coordinates of mesh

w3d.zmesh # array z-coordinates of mesh

Various mesh-edge boundary conditions can be set from

w3d.bound0 # lower z-mesh

w3d.boundnz # upper z-mesh

w3d.boundxy # transverse x-y

and work with most field solvers. Valid setting include "dirichlet" (zero potential, default), "neumann" (zero normal derivative potential), or "periodic", and are set as, for example:

w3d.boundxy = neumann

Neumann boundary conditions may be less computationally efficient for the field solver. Mixed boundary conditions (as might be desired for free space continuations beyond the mesh) are not implemented at present in Warp. Conducting object can be loaded coincident with mesh boundaries. In that case, the boundary conditions set by loading the objects on the mesh supersede the mesh-edge settings.

Various transverse symmetry options work with many of the fieldsolvers. These include

w3d.l2symtry # 2-fold (up-down in y) transverse symmetry

w3d.l4symtry # 4-fold (map to upper x-y quadrant) transverse symmetry

which can be set to "True" or "False" to turn on and off, e.g.,

w3d.l4symtry = True

to apply transverse 4-fold symmetry. When symmetry options are set, on the call to generate(), any transverse lower mesh settings specified in w3d.xmmin and w3d.ymmin will be consistently reset to zero as needed and appropriate field boundary conditions are taken on the mesh bounds of the symmetry planes. Care should be taken that such automatic resets of mesh ranges do not result in different mesh increment values in w3d.dx and w3d.dy than the user intends. Generally speaking, solution times of fieldsolvers scale with the number of mesh zones N = (w3d.nx +1)*(w3d.ny +1)*(w3d.nz +1). Use of transverse symmetries in 3D can significantly reduce mesh sizes leading to faster fieldsolve times and less memory requirements. Symmetry also improves particle statistics for less simulation noise since particles simulated will be deposited in the symmetry region when fieldsolves are carried out.