×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# 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

### RE: Sometimes the units get in the way

Mathcad has the unitsof() function, but there are operational context issues with that.

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.

### RE: Sometimes the units get in the way

(OP)
I agree ln(a/b) would work for my example but I have had this problem with other functions.  What I will try tomorrow is dividing a/unitsof(a) to remove the units.  Hopefully, I can use units with other functions.

### RE: Sometimes the units get in the way

Be forewarned that UnitsOf is finicky; most Collab members recommend not using it.

### RE: Sometimes the units get in the way

You can just divide by the units and add them to the outside of the equation so that you get the correct units in your answer.

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

If you are using MC13 or 14, you should use SIUnitsOf(), UnitsOf is being depreciated.

Peter

### RE: Sometimes the units get in the way

This is something that I regularly do since so many of the Oil & Gas equations are empirical.  The beauty of this is that if you divide by the units it converts.  For example:

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

(OP)
I think that UcfSE's suggestion is the easiest but it is still a pain doing the divide and then the mulitply by the units.  At least it is automatic.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!