# Solving set of time varying functions

I'm trying to find a general solution to a seemingly simple problem but can't work out where to start. Let's say we have nodes and branches as in the picture. Nodes correspond to pressure at certain points in the system and branches correspond to the flow rate. Without pretending to be correct I've derived following formulas.

$$P_{n} = A_{n} * V'_{n}$$ $P_{n}$ is pressure at node $N$, $A_{n}$ is a constant, $V'_{n}$ is extra volume due to fluid compressibility $$F_{n} = B_{n} * \sqrt{P_{n}-P_{n-1}}$$ $F_{n}$ is instantaneous flow rate in branch between two nodes, $B_{n}$ is a constant

I'm not very good at Calculus so I don't even know how to correctly declare mathematically last function so I just write it as I would write in a computer program, i.e. current value depends on previous value and change by time.

$$V'_{n} = V'_{n} - F_{n} * t - F_{n-1} * t$$

What I want to say by this formula is that instantaneous value of extra volume at node $N$ changes by time by amount of incoming or outgoing flow from connected branches.

Below I've tried to visualize the simplest setup with 3 nodes and 2 branches but amount of branches and nodes will be unlimited so I need to find a general solution.

We're given initial node pressures which might be different. Then we work out flowrates at branches at any given time then recursively find out pressures and so on. Gradually pressures at nodes will equalize. I have to find out exact pressure at each node at any given time so I can graph it.

I've tried to solve the problem by taking very small steps of t and repeat iterations above. But obviously it will not give me correct picture because flowrate and pressure depend on each other and I can't assume one is constant while we're calculating the other. At this point I'm lost and don't know how to attack the problem. Any hint, link, example etc is greatly appreciated.

Thanks!

-