Pipes with Pressure
Math 272  Prof. Leise

Email completed labs to tleise@amherst.edu by 4pm Monday.

Consider a simple network of pipes with 4 junctions, as shown in the handout.  By balancing the inflow and outflow at each junction, we can find equations relating the external flow rates f1, f2, f3, and f4 with the internal flow rates q1, q2, q3, q4, and q5.  The positive flow rates mean water is flowing in the direction of the arrows in the diagram, which negative flow rates mean the water is flowing in the opposite direction. 

For example, the upper left junction has inflow f1+q4 and outflow q1, so we get the equation q1-q4=f1.
The upper right junction has inflow q1+f2+q5 and outflow q2, so we get the equation -q1+q2-q5=f2.

Exercise 1.  Complete the system of flow equations by balancing the flow for the lower two junctions.  Put the system in matrix form Aq=f and type in the matrix A.

Exercise 2.  Solve the system Aq=f by using Gaussian elimination (should require just 3 simple steps--don't use RowReduce as it will eliminate the f's).   What must be true about the external flow rates f1, f2, f3, and f4 for the system to be consistent?

Exercise 3.  Write the general solution in vector form: q=(particular solution involving f1,f2,f3)+(solution to homogeneous system).

Exercise 4.  The solution to homogeneous system is a linear combination of two vectors.  Interpret each of these vectors in terms of closed loops in the pipe network.

We would like to have a unique solution for flow through the pipes.  The extra ingredient we need is pressure.  If the water pressure is relatively low, then it is reasonable to assume that the flow through a pipe is proportional to the pressure drop across the pipe.  That is, if the pressure at one end is much higher than the pressure at the other end of the pipe, then a strong flow from high to low pressure will result.  If the pressure is equal at both ends, then no water will flow through the pipe.

For the top pipe, this leads to a pressure-flow equation q1=k(p1-p2), where k is the proportionality constant.  If p1>p2, then we get a positive flow q1.  If p1=p2, we get no flow, and if p1<p2, then we get a negative flow.

For the rightmost pipe, we get q2=k(p2-p3).

Exercise 5.  Find the system of 5 pressure-flow equations and put this system into matrix form Mp=q.  Write down the matrix M. Let k=1 for simplicity (it actually disappears from the final solution, so we can ignore k without loss of generality).

Since Aq=f, the total resulting system is AMp=f.  To multiply matrices in Mathematica, use a period: A.M

Exercise 6.  
(a) Find a particular solution to the system AMp=f for the pressures p1,p2,p3,p4 using LinearSolve[A.M,f].  To ensure a consistent system, solve the consistency condition for f4 in terms of the other f's and use this expression in place of f4 in the f={f1,f2,f3,f4} vector.
(b) Find the general solution to the homogeneous system by using the NullSpace[A.M] command.  This gives the vector(s) whose linear combinations form the null space of the matrix.
(c) Put these answers together to form the general solution p to the system AMp=f.

This solution involves a free variable, but we aren't done yet!  We want the flows, and what we have now are the pressures.

Exercise 7.  Multiply the pressures found in Exercise 6 by the matrix M: q=Mp.  What happens to the free variable?

Exercise 8. Let's end by looking at a concrete example.  Suppose f1=80cfs (putting water into the system), f2=-32cfs (perhaps a house taking water out of the system), and f3=-24cfs.  
(a) What must f4 equal?  
(b) What are the resulting flows in the pipes?