Value Modifiers (add, multiply, gradient, & vary keywords)

When setting values (for instance assigning a property, an initial condition, or applying a force to zones or faces) it is possible to do a simple assignment, to perform arithmetic adjustment (add, multiply) to the existing value, and to supply a linear distribution in space (gradient, vary). Commands that set values will not necessarily supply each type of modification. However, when these modifiers are available, they will operate in the manner described here.

Add

The add keyword is simplest. It adds the supplied value to an existing value. If the gradient or vary keywords are used, they apply to the value added.

Multiply

The multiply keyword multiplies the existing value by the factor supplied with the keyword. If the gradient or vary keywords are used, they apply to the factor.

Gradient

The gradient keyword provides a method for specifying a linear variation of the value. It takes the form:

gradient v <origin v>

Consider the following command.

zone apply force-y 1.0 gradient (2,4,3) origin (1,2,3) range pos-y 1 10

For each zone in the range range y=1 to y=10, apply a gradient to the y-force in the zones as follows. Take the base value (1.0) and add to it a value that is:

2 times the zone’s \(x\)-component minus 1 plus
4 times the zone’s \(y\)-component minus 2 plus
3 times the zone’s \(z\)-component minus 3.

The value varies according to the relation:

\[\textrm{modified\_value} = \textrm{value} + v\cdot (p - o)\]

When using gradient, \(value\) is supplied before the gradient keyword (that is, it is the “pre-modified” value supplied for the command); \(p\) is the position of the object; \(o\) is the origin of the calculation, and \(v\) is the gradient factor.

The origin keyword is optional and defaults to (0,0,0).

Gradient Errors

If the vector gradient keyword is applied to a vector value (e.g., displacement 1 3 5 gradient 2 4 3), an error will occur.

Vary

The vary keyword provides a method for specifying a linear variation. This will vary a component value across the \(x\)-, \(y\)-, and \(z\)-extent of a selected range. Consider the following command.

zone apply force-y 1.0 vary (2,4,3) range pos-y 1 10

Given the zones whose centroids lie in the range between y=1 and y=10, vary the \(y\)-force applied to the zones as follows. Take the base value (1.0) and add to it a value that varies from 0-2 over the \(x\)-extent of the range, 0-4 over the \(y\)-extent, and 0-3 over the \(z\)-extent.

The value varies according to the relation

\[\textrm{modified\_value} = \textrm{value} + \left((p-l)\over(u-l)\right)v\]

where \(l\) is the vector lower bound of the extent, \(u\) is the vector upper bound of the extent, \(v\) is the vary vector, and \(p\) is the vector position of the object.

Vary Errors

If the vector vary keyword is applied to a vector value (e.g., displacement 1 3 5 vary 2 4 3), an error will occur.