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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

An ODE a function and pass back a particular value to the ODE solver

MarkBuckton
4-Participant

An ODE a function and pass back a particular value to the ODE solver

Hi

The MathCad worksheet and ODE that Werner helped me solve is attached to my previous post see http://communities.ptc.com/message/236394#236394 so if you need test your answer download the file attached in that link.

What I am now trying to do solve, by way of this new post, is to find the depth of water in the tank for a particular / prescribed outflow. To do this I made the ODE variable function and then tried to pass back the particular value to the ODE solver in order to find the depth of water for a particular user prescribed outflow (POF). I have done this previously with an ODE and to my surprise it worked. This time however it seems to want to work but then results in the see jpeg error attached. The ODE is more complicated than my previous one because the function is nested but it would be interesting to see if it can be done by the brains trust.

Kind regards, Mark

1 ACCEPTED SOLUTION

Accepted Solutions

If you define a function like f(x):=x+5, then it doesn't matter if x is assigned a value before and which, because x is just a formal parameter here, "connecting" LHS and RHS of the definition. In usnig this function you don't need a variable x whatsoever. You may use this function like f(3)=... or a:=12 f(a)=.....

So with MaxWL(POF):=... you just define a function with a single argument. This argument is useless because you don't use it on the RHS!!

You tried to turn th eode solvebock into a function with parameter Q.out. In this solve block Q.out is used as a function! So if you call h() you would have to pass the name of that kind of function as argument - guess you are not intending to dothis.

You assign MaxWL(POF):=h(Q.out). This formally is ok, but useless. Q.out is a function defined above and the result of h(Q.out( is is a function of time which is assigned to MaxWL(POF). When you evaluate MaxWL(POF) in the last line of the pic (please post worksheets, not pics) this is what Prime tries to tell you in its cranky way. The whole thing would only make sense if your intent is to use different functions Q.out, which you are not going to do.

You could use your newly created function like MaxWL(POF, 2min)=.... and you get the height after 2 minutes, POF has no effect as you didn't use it in your definition of MaxWL().

You already have a function which shows the relation between outflow rate and height - Q.out(h):=.... (the one I still doubt the correctnes of). What you are after seems to be simply the inverse of this function and that has nothing to do with the odesolve block and it also has nothing to do with your intitial data (at least on first sight it looks to me like Q.out does not depend much on that data). You may simply use a solve block with h:=0.m (or any other guess value) and QQ=Q.out(h) in it and close it with height(QQ):=Find(h). Then use height(POF)=... to see the height associated with an outflow of 6.4 L/s. Not sure why you want to call that a maximum.

View solution in original post

1 REPLY 1

If you define a function like f(x):=x+5, then it doesn't matter if x is assigned a value before and which, because x is just a formal parameter here, "connecting" LHS and RHS of the definition. In usnig this function you don't need a variable x whatsoever. You may use this function like f(3)=... or a:=12 f(a)=.....

So with MaxWL(POF):=... you just define a function with a single argument. This argument is useless because you don't use it on the RHS!!

You tried to turn th eode solvebock into a function with parameter Q.out. In this solve block Q.out is used as a function! So if you call h() you would have to pass the name of that kind of function as argument - guess you are not intending to dothis.

You assign MaxWL(POF):=h(Q.out). This formally is ok, but useless. Q.out is a function defined above and the result of h(Q.out( is is a function of time which is assigned to MaxWL(POF). When you evaluate MaxWL(POF) in the last line of the pic (please post worksheets, not pics) this is what Prime tries to tell you in its cranky way. The whole thing would only make sense if your intent is to use different functions Q.out, which you are not going to do.

You could use your newly created function like MaxWL(POF, 2min)=.... and you get the height after 2 minutes, POF has no effect as you didn't use it in your definition of MaxWL().

You already have a function which shows the relation between outflow rate and height - Q.out(h):=.... (the one I still doubt the correctnes of). What you are after seems to be simply the inverse of this function and that has nothing to do with the odesolve block and it also has nothing to do with your intitial data (at least on first sight it looks to me like Q.out does not depend much on that data). You may simply use a solve block with h:=0.m (or any other guess value) and QQ=Q.out(h) in it and close it with height(QQ):=Find(h). Then use height(POF)=... to see the height associated with an outflow of 6.4 L/s. Not sure why you want to call that a maximum.

Top Tags