# 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.

Example:

```
zone gridpoint fix force-applied (5.0,1.0,2.0) range group 'South'
zone gridpoint fix force-applied (1.0,2.0,3.0) add range group 'South'
```

The first line sets the applied force for each gridpoint in the group South to a value of \(\small{(5.0,1.0,2.0)}\). The second line adds a vector value of \(\small{(1.0,2.0,3.0)}\) for a total value of \(\small{(6.0,3.0,5.0)}\).

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.

Example:

```
zone gridpoint fix force-applied (5.0,1.0,2.0) range group 'South'
zone gridpoint fix force-applied (1.0,2.0,3.0) multiply range group 'South'
```

The first line sets the applied force for each gridpoint in the group South to a value of \(\small{(5.0,1.0,2.0)}\). The second line multiplies the applied force by a vector value of \(\small{(1.0,2.0,3.0)}\) for a resulting value of \(\small{(5.0,2.0,6.0)}\).

Gradient

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

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 plus4 times the zone’s \(y\)-component minus 2 plus3 times the zone’s \(z\)-component minus 3.

The value varies according to the relation:

When using gradient, \(value\) is supplied *before* the gradient keyword (that is, it is the “pre-modified” value supplied for the command); \(p(p_x,p_y,p_z)\) is the position of the object; \(o(o_x,o_y,o_z)\) is the origin of the calculation, and \(v(v_x,v_y,v_z)\) 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

where \(l(l_x,l_y,l_z)\) is the vector lower bound of the extent, \(u(u_x,u_y,u_z)\) is the vector upper bound of the extent, \(v(v_x,v_y,u_z)\) is the vary vector, and \(p(p_x,p_y,p_z)\) 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.

Was this helpful? ... | 3DEC © 2019, Itasca | Updated: Feb 25, 2024 |