Fields
A number of fields can be implemented in your simulation, including different types of electromagnetic and electrostatic fields. Thus, there also exist a variety of ways to incorporate fields in VSim. In this section, we will cover general concepts surrounding fields, including:
Boundary conditions
Symmetry boundaries
Fully periodic systems
Modeling a time-dependent or space-dependent value on a boundary
Signal creation
Creating a circularly polarized pulse
Launching a wave from the x-upper boundary of a simulation
We will then look at an example of field blocks in action. We
will first look at an electrostatic field, which is created
through an EmField
block. We will then look at an
electromagnetic field that uses the MultiField
block. This
block in particular allows the user to control more parameters
for their fields, make changes pertaining to processing
efficiency, or even develop and apply their own algorithms. This
object incorporates three general sub-objects:
- Field
Specification of data.
- FieldUpdater
Update operations to be performed on the the data.
- UpdateStep
Algorithmic sequencing of the update operations.
Boundary Conditions
You can implement Dirichlet, Neumann, MAL, and other boundary conditions for your simulation, just like in visual setup.
We will provide a few examples of common boundary conditions you may want to incorporate in your simulation, including:
Symmetry boundaries
Fully periodic systems
Time-dependent or space-dependent values on a boundary
Launching a wave from the x-upper boundary
Symmetry Boundaries
A Neumann boundary can act as a symmetry boundary. For instance, placing Neumann boundaries appropriately on three faces of a cube will turn the simulation into a symmetric simulation of an 1/8th of a larger cube.
Fully Periodic Systems
You can model a system that is periodic in all directions–that is, one that has no boundaries. In a fully periodic system, however, the overall charge must be zero, as demonstrated in this equation:
where \(\left<\rho\right>\) is the average charge density
over the integration interval. Zero net charge can be enforced by
specifying the electrostatic solver parameter
enforceZeroNetCharge = true
.
For more information, see [BL04].
Modeling a Time-Dependent or Space-Dependent Value on a Boundary
An electromagnetic boundary condition may use time signals or
spatial profiles. For example, the emPlaneWave.pre
file’s xLowerWaveLauncher
boundary condition input block
uses a spatial profile, and so kind = variable
.
The function
parameter in a boundary condition input block
also may be an expression, and the expression may be any standard
function of space and time.
The emPlaneWave.pre
file uses the kind =
expression
technique.
<BoundaryCondition xLowerWaveLauncher>
# Value given by function
kind = variable
lowerBound = [0 0 0] # Lower limits
upperBound = [1 $NY+1$ $NZ+1$] # Upper limits
components = [1] # Ey polarized
<STFunc component1>
kind = expression
expression = 1.e6*sin(OMEGA*t)
</STFunc>
</BoundaryCondition>
For the complete content of the emPlaneWave.pre
file, see the example
Electromagnetic Plane Wave in VSimBase.
Signal Creation Examples
Creating a Circularly Polarized Pulse
The steps to create a circularly polarized pulse are:
In the electromagnetic boundary condition input block, change the components parameter vector to launch both a y and z component:
components = [1 2]
.Give the amplitudes parameter vector a value for each component:
amplitudes = [AMPLITUDE AMPLITUDE]
.Give the phases parameter a value for each component. To make a circularly polarized pulse, the phases for the two components should be \(\pi/2\) radians (90 degrees) apart:
phases = [0. 1.57]
.
The widths
parameter controls the spatial extent of the wave.
Launching a Wave from X-Upper Boundary of Simulation
The steps to change a wave launcher from the x-lower to the x-upper boundary follow:
Change the lower and upper bounds of the wave launcher boundary condition to the x-upper end of the grid.
Note
The lower bounds of a boundary condition at the x-upper end of the grid are in the physical domain.
Adjust the x-upper conducting boundary to zero out only the y component.
Adjust the x-lower conducting boundary to zero out both y and z components. Be sure to change both the amplitudes and components vector.
The simulation occurs in the lab frame. This means the pulse will strike the x-lower boundary and reflect back after roughly fifty steps for the given time step and simulation size. To avoid reflections, you need to include an absorbing boundary at the x-lower end.
Defining the EM Field and Boundary Conditions in VSim
Now that we’ve discussed boundary conditions, pre-conditioners, and solvers, we are ready to try adding fields to simulations.
You can implement multiple electric and magnetic fields in your
simulation. Here, we will show examples of both the EmField
and MultiField
objects being used.
Electrostatic Field Example
We will begin with EmField
, where we will define an electrostatic field
covering the entire grid.
<EmField yseField>
kind = yeeStaticEmField
# Setting potential V = 0 on left wall of simulation
<BoundaryCondition left>
kind = dirichlet
minDim = 1
lowerBounds = [0 0 0]
upperBounds = [1 NY1 NZ1]
# NY1 = NY + 1, NZ1 = NZ + 1 (these are where the guard cells are)
<STFunc voltFunc>
kind = constantFunc
amplitude = 0.
</STFunc>
</BoundaryCondition>
# Declaring our solver and preconditioner
<Solver yseSolver>
kind = gmres
precond = multigrid
smoother = GaussSiedel
nLevels = 12
threshold = 0.08
tolerance = 1e-8
</Solver>
</EmField>
Electromagnetic Field Example
The MultiField
block, in comparison, does need a number of
nested blocks that describe the fields involved, as well as their
boundary and initial conditions, field updaters, and update
steps. Below, we have written up an example with an electric and
magnetic field.
<Multifield myFields>
# The default kind for MultiField is Null, which is what we will use here.
<Field E>
kind = regular
numComponents = 3
labels = [E_x E_y E_z]
# Set E_y = 1.0 on y-lower boundary initial condition
<InitialCondition eInitial>
kind = constant
lowerBounds = [-1 0 -1]
upperBounds = [NX1 1 NZ1] # NY1 = NY + 1, NZ1 = NZ + 1 (guard cells)
indices = [1]
amplitudes = [1.0]
</InitialCondition>
# Set E_x = 0.0 (conductor) on x-lower boundary
<BoundaryCondition eBound>
kind = constant
lowerBounds = [0 -1 -1]
upperBounds = [1 NY1 NZ1]
indices = [0]
amplitudes = [0.]
</BoundaryCondition>
</Field>
# Define simple magnetic field
<Field B>
kind = regular
numComponents = 3
labels = [B_x B_y B_z]
</Field>
<FieldUpdater yeeAmpere>
kind = yeeAmpereUpdater
readFields = [B]
writeFields = [E]
</FieldUpdater>
<FieldUpdater yeeFaraday>
kind = yeeFaradayUpdater
readFields = [E]
writeFields = [B]
</FieldUpdater>
<UpdateStep firstStep>
toDtFrac = 1.0
updaters = [yeeAmpere]
</UpdateStep>
<UpdateStep secondStep>
toDtFrac = 1.0
updaters = [yeeFaraday]
</UpdateStep>
updateStepOder = [firstStep secondStep]
</MultiField>
The MultiField
we defined ended up having the same updaters
as an electromagnetic field created using EmField
. However,
this need not always be the case, as a large number of
FieldUpdater
, UpdateStep
, and other related objects exist
for describing non-conventional systems.
If using the MultiField block in an electrostatic simulation, you must incorporate the linearSolveUpdater block. For more details, visit the linearSolveUpdater sections in Reference.
EM Field in Cylindrical Coordinates
When working in cylindrical coordinates, one must use a special FieldUpdater that is designed specifically for the CoordProd grid. In the list of available updaters (found in FieldUpdater), the updaters which work with the CoordProd grid will be named ending in CoordProd.