binaryOperation

binaryOperation

Works with VSimBase, VSimEM, VSimPD, VSimPA, and VSimMD licenses.

This history does a binary operation on two other histories. The operation is performed at every time step. Resulting values are recorded by this history. Available binary operations are add, subtract, multiply and divide.

binaryOperation Parameters

The binaryOperation takes the following parameters:

histories (required string vector)

A vector of the names of the two histories for which the operation should be performed.

coeffs (required float vector)

A vector containing a two float numbers, specifying coefficients for the binary operation.

operation (required string)

Operation to apply to the histories; one of add, subtract, multiply or divide. Operations are:

add:       (coeffs[0]*histories[0]) + (coeffs[1]*histories[1])
subtract:  (coeffs[0]*histories[0]) - (coeffs[1]*histories[1])
multiply:  (coeffs[0]*histories[0]) * (coeffs[1]*histories[1])
divide:    (coeffs[0]*histories[0]) / (coeffs[1]*histories[1])

In divide operation, if coeffs[1]*histories[1] is 0, the resulted value is taken as 0.

binaryOperation History Example

<History QE>
  kind = binaryOperation
  histories = [NtransSum NseedSum]
  coeffs = [1.0 1.0]
  operation = divide
</History>