I'm working on a Unity project to simulate water flow over a grid with varying elevation. I'm trying to accurately reflect how water would spill over from one cell to the next.
For example, cell A in the image below is holding $100$ $m^3$ of water (10 x 10 x 1).
https://i.stack.imgur.com/iNM0A.png
This water in cell A would spill over into cell B over some period of time. I want to update the board once per simulated second, so all I really need to determine is the water volume of cell A each second after it starts spilling.
This answerer cited a helpful formula to calculate the flow rate over a weir given the dimensions of the water body:
$$ Q=\frac{2}{3}C_d b \sqrt{2g}\, h^\frac{3}{2} $$
Sub out height for volume, and make negative to express water volume being lost from cell A:
$$ \require{cancel} Q(V)=-\frac{2}{3}C_d b \sqrt{2g}\, (\frac{V}{bâ„“})^\frac{3}{2} $$ where $Q$ is the rate of discharge from cell A, $V$ is the volume of water in cell A, $C_d$ is an empirical discharge coefficient, $b$ is the width of the water body, â„“ is the length of the water body, $g$ is gravitational acceleration.
For my use case, this simplifies down by subbing in values:
$$C_d = 1,\;b = 10m,\;â„“ = 10m,\;g=9.8\frac{m}{s^2}$$ $$ Q(V)=-\frac{19.6^{\frac{1}{2}}V^{\frac{3}{2}}}{150} $$
So I have the initial volume $V_0=100m^3$, and discharge rate as a function of volume $Q(V)$. But I need volume as a function of time $V(t)$.
I looked to this answer for guidance, since the math seems similar to what I'm trying to do. But I haven't quite figured out how to apply it correctly. Pretty sure I need to reformulate it somehow, then integrate over time. Just not sure what those steps would be.