- fieldFunc
fieldFunc¶
A UserFunc that returns the value of a <Field> at the given position.
A kind=fieldFunc
UserFunc takes a single argument, a spatial
position (a vector of floats with as many components as spatial
dimensions).
fieldFunc parameters¶
- field (required string)
The name of a <Field> to query for information (It may be necessary to qualify the field name; for example, if <Field yeeE> appears within <MultiField emField>, then
field=emField.yeeE
should be specified.)
- result (string, required)
Specifies what information about the <Field> the function will return; two results are currently available,
fieldValue
andzeroFieldValue
. Depending on the result, different attributes apply.Following is a list of results, the length and type of the vector returned, and the extra attributes (if any) that pertain to each specific result.
- zeroFieldValue
result = zeroFieldValue
returns a vector of zeros with the same length as the number of components in the field. This can be useful in anif-statement. For example, it would be useful for a function that does the following–if a cell is interior to a boundary, then return the (vector) field value in that cell, otherwise return all zeros.
- fieldValue
result = fieldValue
returns the (vector) value of a field at the given point in space. See below for more detail. Returns as many floats as components in the field; or 1 float ifcomponent
is specified.- component (integer, optional)
The desired component of the field to be returned (if not specified, all components of the field are returned in a vector)
- interpolationOrder (non-negative integer, default = 1)
The order of interpolation used to find the field value at a point; e.g., 1 means linear interpolation, which has second-order error in the length of a grid cell. N.B. the higher interpolationOrder is, the more field values from surrounding cells will be needed to perform the interpolation. E.g., when interpolating a field value to a point in cell [5] (in a 1D simulation), interpolationOrder=0 requires only the field value in one cell (probably cell [5]), whereas interpolationOrder = 6 might require field values from cells [2] through [8].
- gridBoundary (string, optional)
The name of a <GridBoundary>; the field will be interpolated or extrapolated avoiding cells near the gridBoundary; that is, the gridded field values used to interpolate/extrapolate to the given point will be taken from cells far (enough) away from the boundary.
- polation (string)
Required when
gridBoundary
is specified, with choicesfromInOrOutside, fromInside, fromOutside
. Whether field values will be interpolated/extrapolated from cells inside or inside the boundary (if fromInOrOutside, cells will be used on the same side of the boundary as the position at which the field value is desired).
- boundaryCondition (string, optional)
Choices:
none, dirichlet, neumann, electricAtPEC, magneticAtPEC
with default =none
. Exceptnone
, these options are not generally recommended, because they tend not to do exactly what one wishes. This attribute specifies a boundary condition to be used to extrapolate field values (near) to the given gridBoundary surface. The choicenone
is the same as specifying no boundaryCondition. Choicesdirichlet
orneumann
assume that all field components, or the normal-derivatives of all field components, vanish at the boundary. For 3-vector fields (intended for electric and magnetic fields), the choiceelectricAtPEC
assumes boundary conditions appropriate for an electric field at a perfectly conducting metal boundary (or for a magnetic field at a magnetically-conducting boundary); the choicemagneticAtPEC
is appropriate for a magnetic field at a perfectly-conducting metal boundary (or for an electric field at perfect magnetic conductor). The latter choices are appropriate for divergenceless fields only.