gradBndryUpdater

gradBndryUpdater

Works with VSimPD license.

The FieldUpdater of kind=gradBndryUpdater is a MultiField, FieldUpdater that calculates the gradient of a field (only) on fractional cell edges (i.e., on cell edges that are cut by a GridBoundary surface) – taking into account the fractional edge lengths.

It can be used, for example, to find the static electric field (on cut cell edges) from a scalar electric potential (on cell nodes). Most commonly, the potential comes from a cutCellPoisson updater, which solves for the potential taking into account fractional edge lengths.

Another updater must be used to calculate the gradient on full (uncut) edges: cf. gradVecUpdater or gradVecUpdaterCoordProd.

gradBndryUpdater Parameters

The gradBndryUpdater kind takes the lowerBounds and upperBounds parameters of FieldUpdater, as well as the following parameters:

writeFields (required string vector: [E])

A list containing a single 3-component vector Field, i.e., the electric field at cell edges. This updater will update all 3 components.

readFields (required string vector: [phi])

A list containing a single scalar Field, i.e., the electric potential at cell nodes.

cutCellPoissonUpdater (optional string)

the name of a cutCellPoisson updater. The fractional edge lengths used to calculate the gradient will be identical to those used by the cutCellPoissonUpdater updater, ensuring consistency. NOTE: gradBndryUpdater must be placed after cutCellPoissonUpdater in the input file.

If this option is not specified, then metalGridBoundaries must be specified.

metalGridBoundaries (optional string vector)

a list of GridBoundary names; each GridBoundary represents an shape outside of which is all metal. The fraction edge lengths will be obtained from the GridBoundaries. For calculating the electric field, it is recommended to specify the cutCellPoissonUpdater instead of metalGridboundaries.

Each edge length will be the GridBoundary-interior fraction of the edge (not the exterior fraction). If two or more of the metalGridBoundaries cut the same edge, the result will be one of the two – it is strongly recommended that the metalGridBoundaries be separated by at least a full cell to avoid this situation.

factor (optional float, default: 1)

An arbitrary factor by which to multiply the field gradient. For calculating the electric field from a potential, this should be set to -1 (negative one).

differencing (optional string, default: forward)

Currently, only forward differencing is allowed for this updater. (gradVecUpdater and gradVecUpdaterCoordProd updaters allow the backward option as well.) This is appropriate for calculating the gradient of a field located at cell nodes (with the gradient located at cell edges), as when calculating the electric field.

gradBndryUpdater Advanced Parameters

printMatrices (optional boolean, default: false)

If true, the elements of the sparse matrix representing this updater will be printed out.

Example gradBndryUpdater Blocks

The gradBndryUpdater sets the field value only on cut edges; another update (gradVecUpdater or gradVecUpdaterCoordProd) must be used to set field values on full edges.

Unless the interiorness option is used (wisely) for the full-edge grad updater, the full-edge updater must perform its update before the gradBndryUpdater so that the latter can overwrite the gradient on cut edges (cf. UpdateStep and InitialUpdateStep).

<FieldUpdater setBulkE> # set E everywhere, ignoring the cut/exterior edges
  kind = gradVecUpdater
  lowerBounds = [  0   0   0]
  upperBounds = [NX NY NZ]
  readFields = [phi]
  writeFields = [E]
  differencing = forward
  factor = -1.
</FieldUpdater>
<FieldUpdater setBndryE>
  kind = gradBndryUpdater
  lowerBounds = [  0   0   0]
  upperBounds = [NX NY NZ]
  readFields = [phi]
  writeFields = [E]
  differencing = forward
  factor = -1.
  cutCellPoissonUpdater = poissonUpdater
</FieldUpdater>

<FieldUpdateStep step4>
  toDtFrac = 1.
  updaters = [poissonUpdater]
  messageFields = [phi]
</FieldUpdateStep>
<FieldUpdateStep step5>
  toDtFrac = 1.
  updaters = [setBulkE setBndryE] # setBndryE must be done after setBulkE
  messageFields = [E]
</FieldUpdateStep>