# The Three Lakes Problem

**SourceForge**and GitHub (spot the file "

**three_lakes.adb**" in the

**diff_eq/ode/**directory)...

The problem is to predict the evolution of levels of three lakes connected by two channels, given some knowledge of the inflows and outflows.

Thanks to the magic of differential equations, it is possible!

The variation of each level is a function of the in- and out-flows, and of the flow from / to neighboring lakes.

If lake X is connected to Y, there is a flow from X to Y if X's level is higher than Y's.

When X's level is lower than Y's, the flow reverses.

Obvious, isn't it?

So, the program solves a vectorial differential equation, with the famous Runge-Kutta method.

The unknown

**x**is a vector containing the levels of three lakes (Bienne, Neuchâtel, Morat in Switzerland).

The lakes are connected by two channels (marked with "in out" on the map).

Boundary conditions take the form of natural inflows (marked "in") into the lakes,

and a single, controlled outflow (marked "out") out of one of the lakes (Bienne).

The variation of all levels is

**x'**, a function of

**x**and of the boundary conditions.

Even with static boundary conditions, we can have situations where one of the lakes' level goes up, then down, then up again. Finally (due to the artificial static conditions) the flows find an equilibrium.

Click to enlarge |

A change in level direction (up/down) of one of the lakes (Neuchâtel) happens at the moment when two connected lakes have the same level, and the connecting channel changes its direction (points marked with arrows). You see also a change of direction of lake of Bienne's level, a bit later.

Of course in reality, the boundary conditions vary all the time, so we can have much more complex situations if these conditions are injected into the simulation.

Related publication:

**Évolution simulée des niveaux dans le système des Trois-Lacs**,

F. & G. de Montmollin,

Bulletin de la Société vaudoise des sciences naturelles.

88.2: 121-129, ISSN 0037-9603, 2002

Here is a wonderful picture of the lake of Bienne taken a few days ago (courtesy of Stéphane Perret).

Click to enlarge |