We can now calculate flow rate, but the concern raised by Dominik was the slow response to changes in supply and demand.

I tried to make plausible that this is not the case by showing the solution to the wave equation, but to be honest, this was not entirely convincing: physicists like to reason about spherically symmetrical chickens in a vacuum. Or in this case an infinitely long pipe without sources or sinks messing everything up. A closed drain opening is horrific to otherwise simple differential equations. For the intermediate pipe between source and sink, the solution would still hold... mathematically.. but only if we allow negative amounts of fluid... we don't, adding more mess to the problem...

At this point, it has thus become easier to just demonstrate that there is no problem with sudden changes in supply/demand. I present to you a simple simulation of a straight length of pipe (I had no time to implement junctions).

https://jsfiddle.net/TheYeast/ypwsbftg/

Source and sink can be turned on and off. At the top of the javascript file, constants can be tinkered with.

Note that:

* The wave front travels at exactly 6 tiles per second, as I derived in my earlier post about the wave equation.

* The throughput settles at 1200/s for n=10, as calculated in my previous post about flow rate.

* Closing the sink will send a reflected wave back to the source, stopping fluid motion as it passes through.

* Opening the sink again will rapidly restore sink throughput. Initially this is provided by the reserve in the pipe...

* ..it takes about 1.5 second for the source to 'realise' it can start supplying again.

* The sink throughput will oscillate a bit before it settles, but this is nowhere near a slow reaction speed.

Feel free to toy around by changing pipe length, the physical constants cSquared and friction, and the amount of fluid a source/sink can handle per second.

Make a 100 segment pipe and see that opening a drain on a filled pipe does

**not**need any time to react. The

**opposite**in fact: the

*local*reserve in the fully saturated pipe near the sink can provide fluid

*faster*than the source can because of all the friction between them over the long distance. The intake will decline as the pipe empties, then rise again as the new flow from the source reaches the sink. And even during the temporary decline, the sink intake is quite substantial.

For extremely long pipes, if this does become a problem, the player may want to pump the fluid up into a storage tank to have a larger local reserve for sudden, large changes in demand.

That's it for me, as I'm on vacation the coming week. I will check the thread when I return.

@ Dominik, silkroadalice, pleegwat, PacifyerGrey, just_dont, Nova, Oktokolo and others I forgot: thanks for your appreciation of my proposal and posts!

TheYeast