### Dynamic Liquid Flow Between Coupled Tanks

This Excel spreadsheet models the transient flow of liquid between two tanks connected by a pipe.  Because of the momentum of the liquid, the height of liquid in each tank oscillates to an equilibrium.  Flow is opposed by pipe friction, and eventually the liquid level in each tank stabilises.

The dynamics are defined by the following differential equations, which are derived from a mass balance and momentum balance (ref: "Chemical Engineering Dynamics: An Introduction to Modelling and Computer Simulation" by John Ingham et al).

• H1(t) and H2(t) are the height of liquid in each tank
• A1 and A2 are the cross-sectional area of each tank
• Q is the flowrate in the pipe (m3 s-1
• ρ is the liquid density (kg m-3)
• μ is the liquid viscosity (Pa s)
• g is the gravitational constant (9.81 m s-2)
• L is the length of the pipe (m)
• D is the pipe diameter (m)
• e is the pipe roughness (m)
• Re is the Reynolds number
• f is the friction factor (for Re < 2000, f is given by 64/Re, while for Re ≥ 2000 f is given by the Haaland equation)
The differential equations are solved in Excel with a simple finite difference Euler scheme, as described by these equations

The spreadsheet is straightforward to use.  Simply enter your parameters.

The spreadsheet will then calculate the flowrate in the pipe, and the change in liquid height in each tank over time. Note that the first row of the results (at t=0) contain the initial conditions.  These can be changed.

The spreadsheet also plots the liquid height in each tank over time.  As you can see, the level of each tank oscillates over time, with the flow being damped by friction.  Eventually,  the height of liquid in each tank reaches an equilibrium level.