Ask your own question, for FREE!
Differential Equations 21 Online
OpenStudy (anonymous):

dh/dt=f(h)

OpenStudy (anonymous):

I have been tasked with creating a game in Visual Basic, using Visual Studio It revolves around a dynamic model of the liquid level in a tank. The game periodically decides upon a flow rate into the tank, then the user must react to this by opening or closing the valve on the exit pipe to keep the level in the tank relatively constant. The flow rate out of the tank can be described as \[F_{out} = \alpha \kappa \sqrt{h} \] where h is the height of the liquid in the tank. Kappa and alpha are constant values (kappa is the fraction opening of the valve, set by the user) The governing equation (mass balance) whereupon this system relies is: \[\text{rate of accumulation}=\text{rate in} -\text{rate out} \\ \Rightarrow \frac{dh}{dt}=\frac{F_{in}}{\rho A}-\frac{F_{out} }{\rho A}\\\\ F_{in} \text{, } \rho \text{ and A are constants}\] Which mathematical technique can I use to get a *value* for h to display on-screen for the user? (i.e. Simpson numerical integration, Euler, Runge Kutta, etc.). Could you please give an example, because I'm struggling to get my head wrapped around this - I'm used to doing this on with Simulink. The fact that dh/dt=f(h) makes me unsure of how to program this.

ganeshie8 (ganeshie8):

*

OpenStudy (anonymous):

@ganeshie8 * :-P

OpenStudy (anonymous):

It's a differential equation then?

OpenStudy (anonymous):

It is, yes... How should I tackle this?

OpenStudy (anonymous):

\[ \int \frac{1}{F_{in} - F_{out}}\frac{dh}{dt}dt = \int\frac{1}{pA}dt \]

OpenStudy (anonymous):

\[ \frac{dh}{dt}dt = dh \]

OpenStudy (anonymous):

This method is called separation of variables.

OpenStudy (anonymous):

Using your general equation: \[ \frac{dh}{dt} =f(h) \\ \int \frac{1}{f(h)} dh = t+C \]

OpenStudy (anonymous):

I suppose the hard part is: \[ \int \frac{1}{F_{in}-\alpha\kappa \sqrt h}dh \]Maybe you would use Simpson numerical integration in order to do this integration step.

OpenStudy (anonymous):

Yip, now I don't now how to solve this. See, it is easy when using Simulink - you use a "integrator" block to integrate dh/dt, giving you h; you just then loop back the h, which is needed to build up the dh/dt term. I will quickly take a look at your link, thanks

ganeshie8 (ganeshie8):

the equation has been solved already

ganeshie8 (ganeshie8):

you can work the function `h` in implicit form right ?

OpenStudy (anonymous):

Are you asking if I know how to do it?

ganeshie8 (ganeshie8):

the solution will be of form \[\large f(h,t) = 0\] isolating \(\large h\) may be tough but I feel you can use this solution for your game

ganeshie8 (ganeshie8):

or may not be possible, not sure

OpenStudy (anonymous):

Normally, you would ignore time all together. You'd only keep track of \(h\) and periodically update with: \[ h_{n} \approx h_{n-1} + \frac{dh}{dt} \]

OpenStudy (anonymous):

I'm afraid I don't know how to solve for h...

OpenStudy (anonymous):

Since \(\Delta h \approx \frac{dh}{dt}dt \)

OpenStudy (anonymous):

You want to find: \[ h= g(t) \]Is that it?

OpenStudy (anonymous):

@wio I guess I can do that and then program a timer and use that value as t?

OpenStudy (anonymous):

Yeah

OpenStudy (anonymous):

\[ h_{f} = h_i + \Delta h \approx h_i +\frac{dh}{dt}(t_f-t_i) \]

OpenStudy (anonymous):

In that case, g(t) = http://m.wolframalpha.com/input/?i=Solve+for+h+%28F%2Fp-a*sqrt%28h%29%2Fp%3Ddh%2Fdt%29+&x=0&y=0 But I don't know what that means

OpenStudy (anonymous):

I have to go now, unfortunately. Will check back in a few hours. I will keep the question open, so it is easy to find. Thanks for the help, guys!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!