×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Students Click Here

Solving for Pressure at Depth
3

Solving for Pressure at Depth

Solving for Pressure at Depth

(OP)
I've got a series of a dozen equations (MathCad V11) that are needed to compute the pressure at the bottom of a column that has a mixture of gases and liquids.  Of course the pressure at each point in the column is a function of the pressure at the next higher point and the pressure gradient (the gradient changes continiously and is not a linear function of depth).

I've gone through and written all the equations for each depth and it is just horrible to find where you are (calcs at every 100 ft down to 3,000 ft).  Also, the file needs to be able change ultimate depth that is just too hard with this technique.

When I backed up and said this is just an array and I should be able to do this in one iteration with subscripts I had to define my pressure array first (since many of the equations need pressure and MathCad reads top to bottom)  with arbitrary values.  When I got through the 12th equation and had enough information to actually solve for pressure, it sorta worked (the arbitrary values were replaced with pressures calculated from the arbitraty values), but every cell had the calcs based on the arbitraty value and they all were the same.

Then I tried a solve block with all 12 equations defined in the "Given" section and then repeated all 12 equations(with CNTL =) in the "Guess" section.  This gave me [2.32] in every element of the array (the square brakets are in the cells).

I'm sure that something this vanilla is simply operator error on my part, but I've gotten so close to it that I just can't see a way to solve it.

David

RE: Solving for Pressure at Depth

Is the result at 100 ft affected by the solution at 200 ft?

If so then you will need an iterative approach. I haven't used v11, and am not at all confident with the looping construct, but that would be one way to do it. Another would be to do it in Excel, which is quite happy with iterative solutions, if you switch it on.

I don't understand why your solve block is a bust, but can't say I'm especially surprised.

"When I backed up and said this is just an array and I should be able to do this in one iteration with subscripts"

This is an approach that is very likely to work

" I had to define my pressure array first (since many of the equations need pressure and MathCad reads top to bottom)  with arbitrary values.  When I got through the 12th equation and had enough information to actually solve for pressure, it sorta worked (the arbitrary values were replaced with pressures calculated from the arbitraty values), but every cell had the calcs based on the arbitraty value and they all were the same.
"

Sadly you need to be a bit cleverer than that. If you think about it Mathcad solves each vector in turn, so if you have 12 equations it'll solve eqn 1 for all depths, then equn 2, then equn 3.

You need to turn this on its head, either by using the loop, which will let you solve all 12 equations for each depth in turn or, and this is very horrible indeed, only use 1 vector to store all your data.

i:0;11
depth:0;30
bigvector[depth*12+i:0
depth:0
bigvector[depth*12+i:if(i=0,equn1,if(i=1,eqn2......))
"set up your surface conditions here
depth:1;30
bigvector[depth*12+i:if(i=0,equn1,if(i=1,eqn2......))

where eqn 1 etc are defined in terms of bigvector[(depth-1)*12+i-whatever as variables

like I said, horrible.

I'd use a loop

Cheers

Greg Locock

RE: Solving for Pressure at Depth

(OP)
Thanks Greg,
The pressure at 100 ft doesn't know (there I go anthropormorphising again) about what is happening below it, but the pressure at 200 is a function of the pressure at 100 ft and the pressure gradient between the two points.

I'm a pretty old dog to be learning new tricks.  I learned Fortran (actually WatFOR) in school (yes, with punch cards), so I was thinking of the problem in a Loop construct already, but I didn't think MathCad had that construct (and therefore I didn't look).  I just tried the loop construct and got exactly the answer I was looking for.

David

RE: Solving for Pressure at Depth

not much as changed w.r.t. loops and solve blocks for this type.

Your result is simlpy telling you that each array element contains a 2x32 array, for whatever reason...

A loop is one way to do it, another is to make the solve block a function of depth and then run an array of depths at it, something like:

given
   blah, blah
func(d):find(pressure)

depth[i:=i*100

func(depth)


Not sure which is easier, but since you've already gotten the equations into a solve-block...

btw... you can also get help in the Mathcad Collab:

http://collab.mathsoft.com/~Mathcad2000

plus, you can post your file, if you're willing...

If you do, it would help to have a sample of the correct answers as well.

TTFN

RE: Solving for Pressure at Depth

(OP)
IRstuff,
There was slightly more to the problem than I posted.  I wanted to solve the entire mess for two different surface pressures for the 32 points (which is why it was 2X32).

My solve block looked much like yours, but for some reason I got the sub-matrixes.

I go to the MathCad Collab on occasion, but I don't feel like I have much to add there so I'm reluctant to ask for help there (here I can sometimes help in fluids).

The Loop idea worked very well and ran much faster than the solve block.

Thanks for the ideas.

David

RE: Solving for Pressure at Depth

OK, I got it now.  Mathcad doesn't much like 3-D matrices.

You could try the expand nested matrices option in the Format|Results|Display Options tab.  It'll be messy, but should all display.

TTFN

RE: Solving for Pressure at Depth

How about this, with all subscripts using [

step      s:=0;32
depth     d0:=0
          ds+1:=ds+100
pressure  p0:=p0
          ps+1:=function(ps,ds+1)

RE: Solving for Pressure at Depth

(OP)
jghrist,
This doesn't work if you step forward.  The pressure gradiant at 200 ft is dependent on the pressure and density at 100 ft not the pressure and density at 300 ft.

David

RE: Solving for Pressure at Depth

I'm not sure why it wouldn't work.  

d1=100
d2=200
p2=function(p1,d2)
or pressure at 200' = function of pressure at 100' and the depth (200')

Let's say the function is something simple like

ps+1=ps+2·ds+1
and p0=100

Then I get the following array using a simple iterative formula in Mathcad:

p=100,300,700,1300,2100,...,99300,105700

RE: Solving for Pressure at Depth

(OP)
I see it now, I was trying to use "s" and "s-1" instead of "s+1" and "s" (trying to look at the last itteration instead of the next).  Pretty clever, thanks for perservering.

The loop method is still VERY susinct and worked really well for this mess.

David

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.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close