Keywords:
stairstep boundary, coordinateGrid, Klystron cavity
This example demonstrates how to set up a complex geometry
structure in VSim that uses the coordinateGrid system for
a varying mesh size. There are two benefits of constructing
a grid of kind coordProdGrid
via coordinateGrid
blocks. The first is a flexible choice of either Cartesian
\((x,y,z)\) or cylindrical \((z,r,\phi)\) coordinate
systems to construct the grid. The second is that it enables
one to vary the cell size along each axis of the grid.
For example, a fine grid resolution can be used in a region
of the domain consisting of complicated geometry,
while a coarse resolution can be used in a different region
of the domain where the geometry is simple.
This method reduces the memory
requirement for large multiscale simulations.
The gridBoundary
block (implemented in this example through
the geometry
macro) is used by VSim to represent complex
geometrical surfaces with boundary conditions.
This example simulates a klystron cavity using a non-uniform Cartesian mesh generated by VSim’s coordinateGrid system. Klystron cavities have wide applications as RF power sources by amplifying an RF input with electron beams. The simulated cavity is defined by a set of VSim geometry macros. Grid cell size is varied in the longitudinal direction so that a fine mesh exists at the round nose surface connecting the center drifting tube and outer ring cavity. Larger cell sizes are used at both ends of the drifting tube. The fundamental transverse magnetic (TM) mode is excited by a Gaussian current pulse.
This simulation can be performed with either a VSimEM, VSimMD, or VSimPD license.
The emCavityCoordProdT example is accessed from within VSimComposer by the following actions:
The basic variables of this problem should now be alterable via the text boxes in the left pane of the Setup Window, as shown in Fig. 331.
The first important feature of this input file is the setup of the non-uniform simulation grid. Scroll to the Grid
block on line 262
(Fig. 332). The variable spacing in \(x\) in the non-uniform grid is specified in the definitions of
sectionBreaks
and deltaAtBreaks
in the coordinateGrid dir0
block. The deltaAtBreaks
field specifies the grid cell spacing at each of the sectionBreaks
positions, and the grid is generated such that the cell spacing transitions gradually between these positions. In this specific example, on lines 266
and 267
, from \(x=\) XBGN
to \(x=\) CAV_START
the cell spacing transitions from \(\Delta x=\) DX
to \(\Delta x=\) DX/3.0
, then from \(x=\) CAV_START
to \(x=\) CAV_END
the cell spacing stays at a constant value of \(\Delta x=\) DX/3.0
, and finally from \(x=\) CAV_END
to \(x=\) XEND
the cell spacing transitions from \(\Delta x=\) DX/3.0
back to \(\Delta x=\) DX
.
The second important feature of this input file is
the electromagnetic solver for this type of grid. Both the Faraday and Ampere
updaters are set to kind curlUpdaterCoordProd
.
By setting interiorness = cellcenter
in both updaters, the curl operation is performed with a stair-stepped gridBoundary
.
Because the cells are not uniformly spaced, the number of cells in the simulation is unknown until calculated by VSim’s Vorpal engine. However, the number of cells in each dimension is required for VSim to preprocess the input file. To correctly set the number of cells NX
in the input file, take the following steps:
NX0
(the default is 72). This specifies the grid spacing (DX
) at the ends of the simulation domain as NX0
/LX
.numPhys
in the first row of Global grid
, as circled in Fig. 333.NX
. For the default values of this example, this number should be 162.The simulation is now ready to run. Return to the Run Window, enter the desired values for Number of Steps and Dump Periodicity and click Run once again. The run has completed when you see the output, “Engine completed successfully” as shown in Fig. 334. This will require approximately two hours of computation time when run in parallel on four processors on a modern CPU.
After performing the above actions, continue as follows:
To create the plot as shown in Fig. 335:
The coordinateGrid system is also capable of creating non-uniform grids in cylindrical coordinates, by setting coordinateSystem = Cylindrical
in the Grid
block. The curlUpdaterCoordProd
updater also works with the same settings in cylindrical coordinates.