How a Complex Hydromechanical Simulation can be brought onto a Laptop

Florian Held
omi-uulm
Published in
5 min readJan 12, 2021
Photo by Harry Dona on Unsplash

Last year in may, I was asked in connection with my work, if I can prepare a simulation for the ecosystem of Lake Constance amid forthcoming challenges of climate change.
The simulation should be constructed in such a way, that it

  • had a rather pedagogical and not necessarily an exact scientific value.
  • was possible to conduct a significant run on an average performant laptop within five minutes.
  • could be visualized during the run in a graphical interface.
  • was comprehensible for pupils visiting 11th grade in a technical grammar school in Germany.

Given these boundary conditions, I was completely baffled at first: Lake Constance is a highly complex system, unifying different fields in biology, chemistry and physics, like different fish populations, drinking water quality, mixing of water layers, hydromechanical coupled differential equations, … And on top of this, there was also the question, which parameters of that system were negatively impacted by climate change. Taking all this into account, which was clear from the beginning was that some complexity had to be taken out off the models and there had to be a significant amount of abstraction at several points.

Approach

So how could a systematic approach look like? A good starting point could be a discussion with an expert from the LUBW, whose main job is the hydromechanical modelling of Lake Constance. So I was asking, what exactly he was doing and how that could be simplified for my use case. He told me that they were conducting hydromechanical simulations with the help of proprietary software, which needs a lot of computing resources and which basically helps solving a set of coupled differential equations based on the Navier-Stokes equation.
So, it became obvious quite fast that something derived from this would not be a feasible option for my use case. So I was trying to set out my situation and asked if he could think of a “laptop simulation” scenario which would take into account negative effects derived from climate change. After a short reflection, he came up with a simple scenario that basically works like follows.
Due to climate change, winters in the upcoming decades will on average be warmer. The surface water layer on Lake Constance will in consequence have a higher temperature as well and because of that also a lower density and oxygen content. This leads to a lower potential of mixing of water layers and eventually to less available oxygen at the ground level. This could lead to various problems including lower quality of drinking water.
This sounded reasonable to me, because with that I could think of the usage of easy physics and a nice visualization. Using the “Archimedean Principle” as the basic physical model and the mixture of water blocks for visualization could be viable building blocks for a tailor-made simulation for pupils. To summarize, my basic modelling idea was to present Lake Constance with the help of water layers with different temperatures, densities and oxygen levels and use simple fluid physics to calculate sink dynamics.

However, the question remained how could I use these models to quantify a decrease in drinking water quality? In my literature research, I could not come up with a reasonable source respectively biological model that used decreasing oxygen quantities at sea ground to estimate a decline in drinking water quality. Further research however led me to this source, in which there is a direct relationship made between available oxygen content on sea ground (measured in mg/L) and spawnable fish eggs. In particular it was looked at the example of “Bodenseefelchen”, which is a popular food fish in Southern Germany, and whose fish egg decline was approximated with a sigmoid curve. With the help of this last building block, I could eventually draw a bow between a highly complex biological/physical system towards a strongly
abstracted system, in which a negative aspect of climate change could be simulated and visualized.

Software Selection

The next question was if I should build my own customized simulation software from scratch or if I could use an already existing solution. So I first searched for a simulation tool particularly developed for fluid dynamics and stumbled upon SPlishSplash, which is open-source software developed by the group of Prof. Bender at RWTH Aachen. On the homepage it is described as an open-source library for the physically-based simulation of fluids. Furthermore it was developed for a fine-grained simulation of individual fluid particles, which meant that it wasn’t the perfect match for my rather coarse-grained
scenario. However because of a straight installation procedure (on my Fujitsu LIFEBOOK U747, running openSUSE Leap 15.1, I only had to additionally install some OpenGL related graphics libraries), a rather easy operability and a good visualization, I went for this solution. To fully map this software to my needs I had to fork and customize it to, for example, consider different accelerations due to density differences.

Snapshot of the UI containing the running simulation

Simulation Model: Status Quo

So far, the simulation makes following abstractions:

  • Consider only the 8 “cold” months (September-April) in which the mixing takes place.
  • Temperature decrease between start of September and end of January, which leads to increasing densities and more potential for a mixing of oxygen rich surface layers with ground layers. Increase between start of February and start of April (last month considered in the simulation),
    which leads to decreasing densities and less potential for a mixing of oxygen rich surface layers with ground layers.
  • One surface fluid block per month with O_2 amount dependent on temperature.
  • So far only a simplified dynamic is considered:
    - The surface fluid blocks posses a certain temperature.
    - The surface fluid blocks posses a certain initial velocity.
    - The surface fluid blocks sink and become, dependent on surface temperature, weaker (i.e. lower surface temperature) or stronger (i.e. higher surface temperature) slowed down.
    - If |v| < delta, then the fluid block stands still in the simulation.
    - If two fluid blocks posses the same height, then both blocks take over the velocity of the block with the higher velocity.
    - At the moment, the simulation is not fully backed up by the two mathematical models:
    1. The ground formula: h(t)=1/2⋅(ρ_layer,bot/ρ_layer,top -1)⋅g⋅t² should be used to calculate dynamics of a fluid block.
    2. The formula T_m = (m_1⋅T_1 + m_2⋅T_2)/(m_1 + m_2) should be used as a basis for estimating mixing temperature.
  • Moreover phenomenons like horizontal water inflow (e.g. from near the coast due to strong surface winds), which could additionally deliver oxygen, are not modeled yet.
  • However with the help of empirical data for bound oxygen dependent on temperature: O(T) in mg/L, it is at the moment already possible to estimate how much consumable oxygen is available at a certain height at a certain time in the sea.

Outlook

For the future, it is planned to more tightly integrate the physical models into the simulation and to deliver this simulation tool as a web-application respectively as a SaaS tool for interested pupils and teachers as part of the simulierte-welten project.

--

--

Florian Held
omi-uulm
Writer for

Researcher with interests in: Energy-Efficient Computing, Middlewares in the IoT