cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Using roots for fluid flow problem

ChrisMacnair-di
1-Visitor

Using roots for fluid flow problem

I'm a chem eng student on a summer internship.

I am performing an iterative calculation in order to do a Non-Newtonian fluid flow calculation, unfortunately I'm fairly inexperienced with this sort of function in Mathcad.

I've used a previous template to put together this sheet, but the equations have changed significantly as I'm doing a Non-Newtonian multi-phase calc whereas before there were a lot of simplifications.

when I try to find the root of the solution, it tells me "these values cannot be compared". I've tried everything I can think of, from changing the guess value to constructing a graph. Unfortunately I'm not making any leeway.

I will attach my mathcad file so far, I hope there is someone who can/will help!

Cheers
23 REPLIES 23

Use please Trace Error Command on red operator and see your error!
Val
http://twt.mpei.ac.ru/ochkov/v_ochkov.htm

Thanks for your reply,

I've used the trace to locate a problem... apparently where I've defined the conditions for the Reynold's number is the source of my woe!

"if Re < 2000" - I now get the same message here: "these values cannot be compared".

Again I've had a play around, what I've come up with so far is attached. But I still can't quite sort it...

Same problem. When you call f(Re) you attempt to compare Re to 2000. You can't do that. Comparing a vector to a scalar is meaningless.

Richard

In both of your sheets the unerlying problem is the same -- you are looping on i and you need to be looking at Rei, the current element, and not the entire vector.

However you shouldn't be doing that at all. Don't set up the calculations using vectors for different cases. Rather use function definitions and keep the calculations scalar -- one set of parameters at a time. Only after you have the final function defined do you apply that function to the different values representing the cases of interest.
__________________
� � � � Tom Gutman

In your AllDrop program you create a vector Re. You attempt to compare that to a scalar, which is not possible.

Richard

Richard, thanks for your reply. I see what you mean, but I'm struggling to sort it.

As I say, I'm a little inexperienced with this sort of function, as I've only spent roughly half a semester learning the programme where it was primarily based around solve blocks, interpolation and graph production etc!

Sorry if I'm missing something very simple, but when I try and define the Reynold's number as a vector, as you say, it doesn't work. I change one thing, the error trace tells me "this value must be a scalar", I change another and something else "must be a vector". I'm guessing my definition somewhere is a little shoddy...

On 7/1/2009 5:42:11 AM, ChrisMacnair wrote:

>Sorry if I'm missing something
>very simple, but when I try
>and define the Reynold's
>number as a vector, as you
>say, it doesn't work. I change
>one thing, the error trace
>tells me "this value must be a
>scalar", I change another and
>something else "must be a
>vector".

Because you are trying to compare a vector to a scalar. Which error message you get just depends on which variable it looks at first. Then it decides the other one is incompatible. Without analyzing what you are trying to do in any real way, it looks to me like you should be comparing the current value of Re to 0 and 2000. That means Re[i.

Richard

You've also got multiple values for your plastic viscosity. Stick to one while you sort out your Re probem. If you do then want multiple viscosities, use a column vector, not a row vector (Mathcad doesn't really like these!), and include an explicit j loop in your program.

stv

On 7/1/2009 6:06:57 AM, stv wrote:

>You've also got multiple

>values for your plastic

>viscosity. Stick to one while

>you sort out your Re probem.

>If you do then want multiple

>viscosities, use a column

>vector, not a row vector

>(Mathcad doesn't really like

>these!), and include an

>explicit j loop in your

>program.

>

>stv







Aha. I think that was possibly the factor behind the issues with the Reynold's number.



I've removed the variable plastic viscosities for now (I'll have to consider them later as I'm going to be producing a graph of flowrate vs viscosity).



And I realise its a non-newtonian calc and I havent accounted for this yet, but that'll come later when I'm tidying up the sheet.



Unfortunately "sorting" the Reynold's number considerations has unearthed a new issue, but I'll attempt to soldier on for a little while until I get stuck again.



Thanks to all who have contributed thus far.

Ok, I've been attempting to distinguish between the vector Rey (as I'll have a range of different Reynolds numbers for different q values) and the scalar Re.



I have a working calculation that I was using as a template (different equations but similar principle). I have been comparing my current one to the working calculation, and am again struggling to see why one works but the other doesnt.

You have several other problems. They are all related to dimensions of arrays (all the ones I found, anyway). You are dividing 64 by Re. Since Re is a vector, the result will be a vector. Is that really what you want? On the next line down you have Re[i,j, which implies a Re is a matrix. j is not defined in your program, but outside the program it's a range variable. Re is just a vector, so get rid of the j. You have the plastic viscosity as a row vector. Don't do that. A row vector is not handled the same way as a column vector, and it's probably not what you want anyway. Make it a scalar. Lower in the program you are also indexing f.S as i,j. Get rid of the j. In the expression for areaout your index is i+1. That's not possible, because you are trying to access a value of PipeArea you haven't calculated yet.

That will do for now, but I suspect there's more.

Richard
RichardJ
19-Tanzanite
(To:RichardJ)

Where you have (Re[i,j)^0.25 the expression is not assigned to lambda.

Richard

Richard,

I have (since the first post) deleted the j in Re[i,j because on closer analysis it was out of place. That was a remnant of something I was trying to achieve earlier, but I had failed to delete thus far.

The row vector I think has been unearthed as the main mistake, I am now attempting to tackle the Area[i+1 problem.

Again the thing confusing me is that in the "working calculation" it seems ok but not in the "PF-FR" calculation. I'll analyse the differences between the sheets a little more closely and attempt to rectify that particular issue.

Because Area is a predefined vector passed as an argument to the function. You calculate it element by element inside the function, and try to access a value you have not yet calculated. Create another loop before the existing one and calculate all the elements of PipeArea in that loop.

Richard

Ok, I have now (provisionally at least) sorted the Reynold's number and Area considerations, but am confronted with the error message

"This value must be a matrix of scalar elements."

I have posted my calculation thus far and again I will be trying to compare my calc to the already working calc.

DeltaP is not indexed with i. So AllDrop will just return the last value calculated, not a vector of results. Since AllDrop returns a scalar you can't perform a vector sum on the result.

Richard

Fantastic, that has yielded a result!

Cheers for all your help, and thanks especially Richard for taking an extended interest in this particular case.

I'm unfortunately now going to have to go and work out why oh why I have a negative flowrate, but hopefully some number manipulation will see the day won on that front.

If you can spot anything, please do point it out.

Again I'm attempting to investigate the results here...

For a reason I'm not entirely sure of, when i change the viscosity to a value outwith the range of 0.04-0.1 Pa.s (which in themselves are higher than desirable values for this calculation), I get the error message I started off with:

"These values cannot be compared" when Ive defined my guess value for q and tried to find an actual value. Tracing the error takes it back to the "Re < 2000" with the same message.

Surely if it works for some values but not for others, it cant be a scalar/vector issue? Also, I'm not entirely sure why the flowrate is negative over a pressure drop. Again, something I might have defined wrongly.

Something that has occurred to me as strange- Re hasn't been explicitly defined on the sheet that I've previously posted as "working calculation". Rey has been defined but not Re. Isnt Re by default an entirely different function on Mathcad?

On 7/1/2009 7:14:58 AM, ChrisMacnair wrote:

>For a reason I'm not entirely
>sure of, when i change the
>viscosity to a value outwith
>the range of 0.04-0.1 Pa.s
>(which in themselves are
>higher than desirable values
>for this calculation), I get
>the error message I started
>off with:

MC14 has really crap error messages sometimes. The correct one is that a solution can't be found. Just look at the graph: match q is never equal to zero.

>Surely if it works for some
>values but not for others, it
>cant be a scalar/vector issue?
>Also, I'm not entirely sure
>why the flowrate is negative
>over a pressure drop.

Your math is wrong somewhere. I don't have time to figure out where though.

>Something that has occurred to
>me as strange- Re hasn't been
>explicitly defined on the
>sheet that I've previously
>posted as "working
>calculation". Rey has been
>defined but not Re. Isnt Re by
>default an entirely different
>function on Mathcad?

Re is a parameter in the function f. That parameter is just a name that tells Mathcad what to do with the argument when the function is called, and has nothing to do with the built in function Re (which takes the real part). You can make the name anything you want: it has no bearing on any other variable or function definitions (either before or after the function definition).

Richard

Ok,



It occurred to me that the flowrate is negative as the pipe inclination is 90 degrees, i.e. vertical. By convention, the flow will be negative through gravity.



There are still a few odd shapes being produced by manipulating the figures, but that's something that I suppose is more the input than mathcad itself!



I should hopefully be fine from here on in.

>I hope there is someone who can/will help ! <<br> _____________________

If you wish, "Save as 11" , I will look at it.
For non-Newtonian fluids, i.e: where the ISO-5167 does not apply directly, the Control Engineer uses metering devices insensitive to Reynolds. For valve sizing on multiphases fluid flow we calculate each required Cv separately. I'm very short of time, but can have a look after 20 unsuccessful attempts.

jmG

jmG,

Thanks very much for your offer, but I think I have reached a solution. I will let you know if I'm having any more trouble.

unless the following procedure is wrong for a Bingham plastic?

-Calculated effective viscosity
-Plugged it into Reynold's number
-Used Re to find friction factor
-Used friction factor to find pressure drop
-use pressure drop to find flowrate

Of course iteratively because reynold's number changes with flowrate...

On 7/1/2009 9:27:40 AM, ChrisMacnair wrote:
>jmG,
>
>Thanks very much for your
>offer, but I think I have
>reached a solution. I will let
>you know if I'm having any
>more trouble.
>
>unless the following procedure
>is wrong for a Bingham
>plastic?
>
>-Calculated effective
>viscosity
>-Plugged it into Reynold's
>number
>-Used Re to find friction
>factor
>-Used friction factor to find
>pressure drop
>-use pressure drop to find
>flowrate
>
>Of course iteratively because
>reynold's number changes with
>flowrate...
______________________________

I guess I won't bet my bottom $ on the overall procedure. The point where you could benefit is "Of course iteratively because Reynold's number changes with flowrate...". Colebrook has been posted many times in this collab. If you find the sheet, open it but scroll down in one shot and wait it has finished (few seconds). This work sheet has tendency to crash Mathcad on progressive scrolling.

Read more:

http://books.google.ca/books?id=MgzUK0vM0PkC&pg=PA24&lpg=PA24&dq=non+Newtonian+fluid+flow+measurement&source=bl&ots=T0I-6GOvcI&sig=9mDBGcaCZyFzTPZ9Kv9rar7xogI&hl=fr&ei=e2BLSpfgHoX7tgek4PWbDQ&sa=X&oi=book_result&ct=result&resnum=6

http://books.google.ca/books?id=lxd_Fcv7mHAC&pg=PT211&lpg=PT211&dq=non+Newtonian+fluid+flow+measurement&source=bl&ots=Sj_NaTa00G&sig=ERVqsVT0Lluqn1zfq0bHi6qomug&hl=fr&ei=IGtLSvP3HISEtwej3-ybDQ&sa=X&oi=book_result&ct=result&resnum=8

jmG




Announcements

Top Tags