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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Undefined variable in Mathcad ODE solve block

ptc-5376358
1-Visitor

Undefined variable in Mathcad ODE solve block

Hey guys, I am a Chemical Engineering Grad Student taking a programming class, which has never been one of my strongest subjects.

I am currently trying to solve a system of differential equations governing an emergency shut down in a water reservoir system using the ODE Solve Block in Mathcad and I am trying to monitor the affect of the diameter of my tank (Di) from 5ft to 10ft, and the value of the downstream head (hstar) from 0 to hstart in the program attached. However, I keep getting that my variable Di is undefined since it is what I am inputing into the builtin Odesolve function. If I define Di as having units of ft, the Odesolve function tells me I have too many initial conditions.

Please help me figure out how to have Di as a changing input variable while having it defined in the preliminary equations!!!!

Thank you!

Emilia

ACCEPTED SOLUTION

Accepted Solutions

Units aren't such a problem here as the ODEs are formulated in such a way that the dimensions cancel out. The real problem is that in the equation for eta there is an eta under the square root sign that should be eta(tau). See attached.

Alan

View solution in original post

6 REPLIES 6
Werner_E
25-Diamond I
(To:ptc-5376358)

Make Qv0 a function of Di (Qv0(Di):=...) and hstart as well, that way hstart(Di):=.....Qv0(Di)^2/...

You would call the block with Soln(5ft,hstart(5ft)). Better just with Soln(5ft) and replace hstar by hstart(Di) inside the block.

But it still will not work because the really bad news are that solving differential equations does not work with units in Mathcad 15 and below. So try it without units please.

Your first equation is missing a closing paranthesis. In your second equation: (tau<1) ? Is it on purpose or should it be tau-1?

Units aren't such a problem here as the ODEs are formulated in such a way that the dimensions cancel out. The real problem is that in the equation for eta there is an eta under the square root sign that should be eta(tau). See attached.

Alan

Werner_E
25-Diamond I
(To:ptc-5376358)

An additional error was that in the second equation you wrote eta instead of eta(tau).

See attached

ODE1.png

Thank you so much for the help. I didn't notice I forgot a Tao so I will put that in there. And I will also make my equations functions of DI and hopefully that will solve my issue. Thank you again!!!

Werner_E
25-Diamond I
(To:ptc-5376358)

Emilia Golebiowska wrote:

Thank you so much for the help. I didn't notice I forgot a Tao so I will put that in there. And I will also make my equations functions of DI and hopefully that will solve my issue. Thank you again!!!

You have noticed that Alan (and a few minutes later I) had posted and also attached files with the changes already done?

Alan's file will let you keep the units, which is possible in your case, as he explained.

As your goal is to monitor the effect the change of Di in the range from 5 to 10 has, maybe an animation would help to visualize. See attached.

I haven't been able to open your attached attached files as I have been in class all day do I did not notice. I was just processing and organizing it in my head how I would fix the programs which made sense thanks to both you and Alan, but having files with the changes already made has made things easier. And I see the changes now as I open them.

And thank you for the animation as well.

Announcements

Top Tags