New toy!

After discussing the options with one of my co-workers, I installed SciPy and all its associated dependencies, because it was free and had more than enough computational power to do what I wanted to play with. I don't know enough about any of the computer-math programs to make a case for work buying me one of the very expensive programs, and I couldn't rationalize buying such a program for myself at home to play with, so open source it is.

My first "project", such as it was, was both somewhat practical and relevant to my work, while still being easy enough for a first project: calculating how long it takes for the flow to reach steady state in a series of tanks with a pump at one end (step change input) and gravity flow all the way through.

This is a pretty straightforward system, with one differential equation repeated once per tank.

To calculate exit flow rate for a tank, I used the V-notch weir calculation from Perry's Chemical Engineers' Handbook because it's fairly simple to calculate and is not a bad approximation for a circular pipe overflow from a tank:

\[Q_o = {{0.31L^{2.5}\sqrt{2g}}\over{tan{\Phi}}}\]Where *Q _{o}* is the flow out, in m

^{3}/s,

*g*is gravity at 9.81m/s

^{2}, and

*L*and \(\Phi\) are shown in the diagram below:

The higher the level gets in the tank, the faster water overflows, until the flow out matches the flow in and the level in the tank stabilizes. The differential equation is: \[{dL\over dt} = {Q_i - Q_o \over A}\]

I started with no flow out (h_{0} = 0, or water level with the bottom of the weir) and then started the pump at time=0. For these test calculations, I used a flow rate in of 10m^{3}/hr and a tank diameter of 3m. The bigger the tank diameter, the more volume of flow in it takes to raise the level and the flow out, so the longer it will take to reach steady state flow. Obviously using this for work I'd use the actual values of flow and tank diameter!

This is what I got for one tank:

You can see the level rising quickly at first, because the pump is running at a constant rate but the outflow isn't very fast. As the outflow speeds up, the level rises more slowly, and it finally flattens out to indicate steady state.

For four tanks in series, I used the outflow rate of one as the inflow rate of the next, because that's what's happening in real life.

Tank 1 has the same profile as the previous graph, but tank 2 has a much flatter beginning to its level rise. As you can see, it takes a while for that last tank to reach its full outflow rate!

Then just for something to do, I grabbed the final level from this trial, and used it as the starting level of the tanks but set the flow to zero—shutting off the feed pump.

Takes a lot longer to stop than it does to start.

Eight hours later and still not quite stopped...

## No comments:

## Post a Comment