Hi, I'm trying to model a simple hydraulic system using python programming language and have difficulty with math. It's basically 3 tanks interconnected with pipes (see attached picture). Tanks are filled with some kind of fluid and are under different pressures (initial pressures P1, P2, P3). We assume that initially pipes are closed and at some point we open them and the system will reach equilibrium after a while. I've just derived following formulas for the tank pressures (let's call them node values) and flow rates (let's call them branch currents). P1 = (1/B) * (V1'/V1) P2 = (1/B) * (V2'/V2) P3 = (1/b) * (V3'/V3) where B is compressibility and V[n]' is additional volume inside the tank due to compressibility and pressure. F1 = k1 * sign(P2-P1) * √abs(P2-P1) F2 = k2 * sign(P3-P2) * √abs(P3-P2) where k[n] is some constant coefficient. sign(X) is simple operator to find the sign of the operand and returns -1 or 1. abs(x) gives absolute value of operand. V1' = V1' - (F1 * t) V2' = V2' - (F1 * t) - (F2 * t) V3' = V3' - (F2 * t) t is time. At this stage physically realistic modeling of the system is not important. I'm just trying to make sure that model's behaviour will match formulas given above. My first approach was to first find V1', V2', V3' from initial pressures, then find flowaretes F1, F2, then recalculate V1', V2', V3' with time passed taken into account, recalculate P1, P2, P3 and then repeat the steps. Of course this gives me wrong results because no matter how small steps of t you take you end up increasing error in calculations due to neglecting the fact that flowrates themselves are based on pressures and vice versa. In summart this is too simple approach to solve the problem. I'm not very good on calculus side so want to ask you guidance on topics I need to study to get and idea about proper solution. Thanks!