5.6 Complicated Unit Expressions

The units program is especially helpful in ensuring accuracy and dimensional consistency when converting lengthy unit expressions. For example, one form of the Darcy–Weisbach fluid-flow equation is

\Delta P = {8 \over \pi^2} \rho fL { Q^2 \over d^5}

where \({ \Delta P}\) is the pressure drop, \({\rho}\) is the mass density, \({f}\) is the (dimensionless) friction factor, \({L}\) is the length of the pipe, \({Q}\) is the volumetric flow rate, and \({d}\) is the pipe diameter. You might want to have the equation in the form

\Delta P = A_1 \rho fL {Q^2 \over d^5}

that accepted the user’s normal units; for typical units used in the US, the required conversion could be something like

You have: (8/pi^2)(lbm/ft^3)ft(ft^3/s)^2(1/in^5)
You want: psi
        * 43.533969
        / 0.022970568

The parentheses allow individual terms in the expression to be entered naturally, as they might be read from the formula. Alternatively, the multiplication could be done with the ‘*’ rather than a space; then parentheses are needed only around ‘ft^3/s’ because of its exponent:

You have: 8/pi^2 * lbm/ft^3 * ft * (ft^3/s)^2 /in^5
You want: psi
        * 43.533969
        / 0.022970568

Without parentheses, and using spaces for multiplication, the previous conversion would need to be entered as

You have: 8 lb ft ft^3 ft^3 / pi^2 ft^3 s^2 in^5
You want: psi
        * 43.533969
        / 0.022970568