## Sometimes the units get in the way

## Sometimes the units get in the way

(OP)

I would like to use units but Mathcad is not very good at handling them.

For instance, I am trying to calculate the change in pressure when a volume of oil is compressed. The formula is

delta Pressure = Bulk Modulus of Oil * delta volume / volume. If I make this continuous it is dp/dv=-B/v. I can solve for delta p = B*(ln(a)-ln(b)) where

delta p is the change pressure

B is the bulk modulus of oil

a is the initial volume of oil

b is the compressed volume of oil

The problem is that I have units for a and b and Mathcad will not take the natural log unless a and b are unit less. Does anybody know how to temporarily strip the units from a variable and only within an equation?

I want to keep the units for normal dimensional analysis.

Peter Nachtwey

For instance, I am trying to calculate the change in pressure when a volume of oil is compressed. The formula is

delta Pressure = Bulk Modulus of Oil * delta volume / volume. If I make this continuous it is dp/dv=-B/v. I can solve for delta p = B*(ln(a)-ln(b)) where

delta p is the change pressure

B is the bulk modulus of oil

a is the initial volume of oil

b is the compressed volume of oil

The problem is that I have units for a and b and Mathcad will not take the natural log unless a and b are unit less. Does anybody know how to temporarily strip the units from a variable and only within an equation?

I want to keep the units for normal dimensional analysis.

Peter Nachtwey

## RE: Sometimes the units get in the way

## RE: Sometimes the units get in the way

Seems to me that the simplest solution, assuming that what you wrote is mathematically correct, is to use B*ln(a/b). Your first equation doesn't seem to be consistent with that, but that's neither here nor there.

Since your equation doesn't appear to be one of those "empirical" equations, there should always be a formulation which has unitless arguments for ln and exp.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

## RE: Sometimes the units get in the way

## RE: Sometimes the units get in the way

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

## RE: Sometimes the units get in the way

As an example, if I need the shear strength of concrete in units of psi but my equation is 2*(f'

_{c})^0.5 where f'_{c}is in psi, I either have to have strange units on the coefficient of 2, or divide the units out of what's under the radical and put them back in outside the radical: 2*psi*(f'_{c}/psi)^0.5.It may not be the most elegant solution but it works for me. In your case I would try dividing out the units and adjusting your equation accordingly.

## RE: Sometimes the units get in the way

Peter

## RE: Sometimes the units get in the way

Len:= 10,560 ft

Width:=6 km

cumquats:=(len/mi)^2.5 * ln(width/mi)

in this case the equation really equals

cumquats:=(2)^2.5 * ln(3.728)

Pretty cool. It really helps in equations like the AGA fluid-flow equation where length must be in miles, diameter in inches, etc. I can define a diameter in mm, a length in ft, etc. and the equation has an explicit conversion.

Instead of having to remember the units (sometimes years later), you only have to remember that each term must have units and it is pretty self documenting.

David

David Simpson, PE

MuleShoe Engineering

www.muleshoe-eng.com

Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips Fora.

The harder I work, the luckier I seem

## RE: Sometimes the units get in the way