Most fieldsolvers in Warp use common mesh variables that are overviewed here primarily in the context of the 3D code. In the rz code, the xmesh defines radial mesh positions. In the transverse xy slice code the zmesh is largely irrelevant. For a 3D mesh, mesh extents
and sizes are defined as follows: # Mesh extents
w3d.xmmin = 10.*mm # xmesh min w3d.xmmax = 10.*mm # xmesh max w3d.ymmin = 10.*mm # ymesh min w3d.ymmax = 10.*mm # ymesh max w3d.zmmin = 250.*mm # zmesh min w3d.zmmax = 250.*mm # zmesh max
# Mesh sizes
w3d.nx = 200 # size of xmesh, mesh points are 0,...,nx w3d.ny = 200 # size of ymesh, mesh points are 0,...,ny w3d.nz = 1000
# size of zmesh, 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 xcoordinates of mesh w3d.ymesh # array ycoordinates of mesh w3d.zmesh # array zcoordinates of mesh
Various meshedge boundary conditions can be set from
w3d.bound0 # lower zmesh w3d.boundnz # upper zmesh w3d.boundxy # transverse xy
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 meshedge settings.
Various transverse symmetry options work with many of the fieldsolvers. These include
w3d.l2symtry # 2fold (updown in y) transverse symmetry w3d.l4symtry # 4fold (map to upper xy quadrant) transverse symmetry
which
can be set to "True" or "False" to turn on and off, e.g.,
w3d.l4symtry = True
to apply transverse 4fold 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.
