Changes in UserFunc syntax from 6.0 to 6.2

Vorpal 6.2 introduced changes in the experimental UserFunc framework, to bring UserFunc input more inline with other Vorpal input. The manual describes UserFuncs in detail, along with the current options.

These changes are not backwards compatible; input files that previously used UserFuncs and related objects (such as Tensor Histories) may have to be converted. This process involves several kinds of small changes.

Expression blocks are now used instead of UserFunc blocks in cases where the function signature is known/determined. Expression’s are otherwise very similar to UserFunc’s of kind = expression. The documentation for the surrounding block will state whether a UserFunc or an Expression is required.

For example, inside a FieldUpdater of kind = userFuncUpdater, the <UserFunc updateFunction> becomes an <Expression updateFunction> (with no kind attribute).

For example,

<UserFunc applySteps>
   kind = expression
   expression = (n == 1)
</UserFunc>

becomes

<Expression applySteps>
   expression = (n == 1)
</Expression>

and

<UserFunc updateFunction>
  kind = expression
  <SpaceFunc F>
    kind = fieldFunc
    result = fieldValue
    field = F
    component = 2
    interpolationOrder = 4
  </SpaceFunc>
  expression = F(posz)
</UserFunc>

becomes

<Expression updateFunction>
  <UserFunc F>
    kind = fieldFunc
    result = fieldValue
    field = F
    component = 2
    interpolationOrder = 4
  </UserFunc>
  expression = F(posz)
</Expression>

Blocks SpaceFunc, HistoryFunc, CellFunc should be changed to blocks of type UserFunc (with kind = spaceFunc, historyFunc, gridBoundaryFunc, etc.). See above example.

UserFunc blocks must specify the function signature; this is often done by specifying the kind—however, the signature must be explicitly given for kind = expression.

  • varOrder is replaced by inputOrder (where varOrder was previously optional, inputOrder is now required)
  • An Input block should be specified for each element of inputOrder.
  • Variable blocks should be replaced by Term blocks.

For example,

<Variable i>
  kind = expression
  varOrder = [cellPos]
  cellPos = [integer integer integer]
  expression = select(cellPos,0)
</Variable>

becomes

<Term i>
  kind = expression
  inputOrder = [cellPos]
  <Input cellPos>
    kind = uniformVector
    type = integer
    length = 3
  </Input>
  expression = select(cellPos,0)
</Term>

Some specific cases where changes will be needed are:

  • In FieldUpdaters of kind = userfuncUpdater, <Expression upadateFunction> replaces <UserFunc updateFunction>.
  • UserFunc’s applySteps and applyTimes are replaced with Expression’s.

Other effects of these changes:

  • In Tensor Histories, the funcLookupScope attribute is no longer valid.
  • The checkForUnaccessedAttribs is no longer useful in most cases.