Unit Casting

In some cases, you may need to turn a dimensioned value into a dimensionless value in order to use it in an expression. This is necessary, for example, if you need to use an empirical equation (which by definition may be dimensionally inconsistent), or if you need to raise a value to a power, where the power itself  has dimensions, such as X**Time.

GoldSim allows you to do this by casting a dimensioned value or expression to a dimensionless value. For example, the expression

A |ft|

would evaluate A (which, in this case, must have dimensions of length), convert it to a value in feet, and cast it (output it) as a dimensionless value. That is, | | removes dimensions from a preceding dimensioned value and produces a dimensionless value.

The following are all valid expressions using unit casting:

A |m3| + 5     

OK if and only if A has dimensions of volume

(A*B) |ft|     

OK if and only if (A*B) has dimensions of length

Ctime |yr|     

OK if and only if Ctime has dimensions of time

 

A simple example file illustrating casting units (Units.gsm) can be found in the General Examples folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).

Related Topics…