This might be more of an algorithm question, but I'm writing it in Python.
I have a set of data on a pipeline that gains and loses altitude as it progresses. My data is two columns, the measure along the pipeline, and the elevation at that measure. There are tens of thousands of rows in my dataset. (these would be columns instead of rows)
Measure: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Elevation: 5, 7, 9, 15, 12, 13, 18, 14, 23, 9
In this script, the pipe would be assume to be capped at both ends. The goal is to calculate the total volume of liquid that would drain from a leak at any point in the pipe. Pressure/flow rate don't matter. The main part I'm trying to account for would be all of the catches/valleys (like in a bathroom sink) that liquid would remain in even while the rest of the pipe drains, like this:
https://www.youtube.com/watch?v=o82yNzLIKYo
The pipe radius, and location of the leak would be user-set parameters.
I'm really looking for a push in the right direction, I want to figure this out on my own as much as possible. I'm fine with the programming, but any advice on the actual logic would be helpful, thank you in advanced. enter image description here
Let's say in this graph that a leak appears at point 9 on the x-axis, and the pipe has a known radius r. I'm trying to figure out how to get my script to output the total quantity of liquid in terms of r will be emptied out, regardless of time. And if through damage a leak developed in a pipe, air would come in and water would come out, but not all of the water because of the various catches and different elevations of the pipeline.