Registering solversThen if no field solvers are subsequently registered, no field solves will be done, and the only fields will be the applied fields of specified lattice elements.
Various field solvers can be setup and registered into Warp. For example:
before the call to generate() sets up a 3D multi-grid field solver. Similarly, for the 3-D multi-grid solver with mesh refinement:
See mesh refinement for details on setting up multigrid fieldsolvers with mesh refinement. Mesh refinement allows use of higher resolution regions in the mesh so that zones can be placed where they are most needed. This can result in substantial computational savings -- particularly in 3D field solvers.
For the multigrid solvers, there are various parameters that can be used to control the operation of the solver. These are described in the group Multigrid3d which is listed in the file f3d.v. These parameters can be set explicitly before hand or set via argument list parameters when setting up the field solver. Argument list parameters are described in the example above by doc(MultiGrid3D). If conducting objects are loaded on the mesh as described in conducting objects, this should be done after registersolver() is called and before the call to generate().
The solver instance has useful attributes and methods. For example:
prints the increment (dx), max (xmmin), and min (xmmax) values of the x-mesh used by the solver. To plot contours of the potential in the z-x plane:
Available field solvers include:
MultiGrid3D() # multi-grid Poisson solver in 3-D geometry
MultiGrid2D() # multi-grid Poisson solver in 2-D x-z or r-z geometry
MultiGridRZ() # multi-grid Poisson solver in 2-D r-z geometry
MRBlock3D() # multi-grid Poisson solver in 3-D geometry with mesh refinement
MRblock2D() # multi-grid Poisson solver in 2-D geometry with mesh refinement
MultiGridImplicit3D() # multi-grid implicit Poisson solver in 3-D geometry
MultiGridImplicit2D() # multi-grid implicit Poisson solver in 2-D geometry
MultiGrid2DDielectric() # multi-grid Poisson solver in 3-D with variable dielectric constant (does not work in parallel)
EM3D() # electro-magnetic solver in 3-D
All these solvers work with a wide variety of conducting objects loaded on the mesh. All except the MultiGrid2DDielectric() solver work in parallel. In most of these solvers conductors are placed on the mesh with subgrid resolution. Numerous parameters can be set to control the numerical convergence of the solution.
-1: No field solver
0: sine-sine-periodic FFT (default).
1: 8-fold symmetric capacity matrix in kz space.
2: Capacity matrix for quadrupoles.
3: Not used.
4: 2D sine-sine FFT + tridiag in z. This is somewhat faster than
the FFT solver but has Dirichlet boundaries in z.
5: General capacity matrix in kz space (special purpose solver -- only be used with good reason).
6: General capacity matrix (special purpose solver -- only be used with good reason).
7: Multigrid solver.
8: Parallel solver (in development, don't use).
9: Parallel solver (in development, don't use).
10: RZ multigrid solver (autoset using solvergeom).
11: Chombo AMR/multigrid solver (in development, don't use).
12: Use field solver registered in python (autoset by registersolver).
13: 3D multigrid with Boltzmann electrons (autoset when electrontemperature is set).
top.fstype = -1
In some cases, applied fields are generated by biased conducting elements placed on the mesh and it is desired to include these applied fields but not beam self fields. We now outline how to accomplish this first for fixed grid simulations as might be carried out to model an injector with biased conductors loaded on the mesh. Assuming a field solver is registered with say:then
solver = MultiGrid3D()
solver.ldosolve = False
can be set to turn off the field solver and deposition of the beam on the mesh. Any field values on the mesh when solver.ldosolve = False is set will still be applied in subsequent calls to step(). This procedure is carried out as follows. The problem is setup and biased conductors are loaded on the mesh, generate() is called with no beam present which makes an initial field solve generating the applied field values on the mesh, and then solver.ldosolve = False is set prior to generating/advancing the beam on the fixed mesh. Potentials employed will then be consistent with the biased conductors on the mesh in the absence of beam self-fields.
Simulations including applied electrostatic fields generated by conducting structures but without self fields can also be carried out using egrd or pgrd lattice elements. Follow the model that is used in the function addgriddedgap() in lattice.py, setting up a conductor geometry in a separate field solver and then saving the solution as a lattice element. Turn off the field solver and deposition.