Teaching physics to the simulation

October 25, 2024

Simulating the flow of gases or liquids can be challenging across different size and time scales—from the small scale features of turbulence on a wing to their effects on the entire aircraft. SimTech researchers combine machine learning and physical principles to overcome scale-bridging challenges and achieve unprecedented simulation detail.

true" ? copyright : '' }

The flow of gases and liquids is omnipresent. Whether around airplanes, fans, wind power generators, or even our breath, flows affect the environment—a fact highlighted during the coronavirus pandemic. Most flows in nature and in technical applications are turbulent (i.e. irregular, chaotic, and difficult to predict). In order to understand these flows, they must be mathematically described and the resulting model must be simulated. One challenge is bridging time and length scales to connect microscale effects with macroscale flows. For an airplane, the microscale refers to a tiny turbulent vortex on a wing, whereas the macroscale encompasses the entire aircraft or major components such as the turbine.

This is where Andrea Beck’s basic research comes in. She is Professor of Numerical Methods in Fluid Mechanics at the Institute of Aerodynamics and Gas Dynamics at the University of Stuttgart. “With modern numerical methods, it is now possible to simulate the effects of flows up to a certain degree of detail without modeling,” she says. Without modeling, no further assumptions or simplifications are made; instead, only the equations that describe the underlying flow physics in detail are solved. “We resolve the physics on the computer down to a certain level of detail.” In the case of an airplane, this would be a tiny section of the surface of a wing.

The small flow on the tiny section of the wing (yellow-orange, at the end of the video) is the size that can be simulated today without modelling. The researchers used modern numerical methods on a supercomputer. This required 1.5 billion numerical grid points and about 3.5 million processor (CPU) hours. Modelling is needed to simulate the flow around the entire aircraft or in the entire turbine.

00:37

She and her research group have now investigated the extent to which ML methods can be used to incorporate information from the microscale (i.e. the laws of detailed physics) into the models for the macroscale. Bridging these scales requires “closure models”.

A closure model combines different descriptions of the same physical process, often simplifying highly complex processes for better understanding. These are often simplified equations that can also be quickly solved. The closure model simplifies complex physics by incorporating it into a more manageable framework.

Bridging knowledge gaps with reinforcement learning

“In this equation, physics is described at a rough level. You leave a lot out. But what you leave out naturally has an effect. That’s physics. You can’t ignore it because it would be so fine that you wouldn’t be able to calculate it. And you have to somehow ensure that the effect of what is left out is reflected in the equation – this is the role of the closure model,” explains Beck. The scientists used a ML method known as reinforcement learning to achieve this. 

Beck explains with a classic example: “When learning to ride a bike, you don’t know how to position your knees, balance, or use your hands. Parents can’t give exact instructions—it’s more intuitive. So you don’t learn to ride a bike by following precise instructions but rather by repeatedly trying things out, observing the results of the current strategy, and gradually improving what has worked up to this point. That’s why it is also called reinforcement learning.”

Reinforcement learning is learning in a dynamic system through experience.

Once you have learned a successful strategy (e.g., how to move forward without tipping over), you will continue to pursue it. This is also what the algorithm does when it comes to modeling turbulence. The reinforcement learning methods involve trying out different strategies and pursuing the one that gets them the furthest in solving the problem.

Riding a bike requires intuition and a lot of practice. You learn it through repeated trial and error, through reinforcement learning.

In a “proof of concept” demonstration, the scientists then tested whether the reinforcement learning method is suitable for developing closure models that can predict or describe behavior. The answer is clear: Yes. The models were at least as good or even better than existing models without reinforcement learning. “But we examined things at only a very basic level. Figuratively speaking, we can show that it works in a glass of water. But we can’t yet show that it works in an ocean, a river, or a dam,” explains Beck. 

Incorporate physical laws to guide the algorithm

In the next step, Beck and her team now want to link the closure models with physical laws, to teach them physics, so to speak. “To stay with the cycling example: If you want to teach someone how to ride a bike, the naive machine learning approach would be to show them lots of pictures, videos of someone riding a bike. The person looks at it and perhaps learns from it. That would be purely data-driven. However, we have found this approach to be ineffective,” says Beck. “That’s why we don’t just show the videos but instead provide the laws of physics—for example, that gravity always points downwards or that you are guaranteed to fall over if you lean more than 45 degrees in the curve. Because the algorithm has no idea about the world,” says Beck. It must extract all the information from the data, and that is extremely cost and labor intensive. 

Bicycle lays down on the street
The algorithm learns faster if it knows that a bike will tip over at a certain angle of inclination.

If these physical or mathematical boundary conditions are incorporated during the learning process, the algorithm learns much faster and more efficiently. “It can also more effectively handle situations that were previously unknown. This requires combining physical knowledge of the system with data-driven methods,” explains Beck. The way this works is that more mathematical equations are built into the model as constraints. However, the computing power required for the simulation remains high and can be handled only by high-performance computers—or supercomputers.

Unique simulation software worldwide

Because these high-performance computers require tailored algorithms, Beck has developed the open source software FLEXI, a fully reproducible code for complex flow simulations. It was identified as one of the best codes in Europe and is now being further developed by her in a research group at the European Center of Excellence for Exascale CFD (CEEC).

A flow solver is specialized software used to simulate flow.

With this code, it is possible to efficiently simulate complex flow problems and greatly improve the accuracy of the simulations. “With the coupling of our flow solver and the methods of reinforcement learning, we have an internationally unique software.” Beck hopes that in a few years, she will be able to simulate the flow not only on one detail of an aircraft but also on the entire aircraft.

Thorough documentation strengthens confidence in simulations

The simulation results and meta-data are stored in a database, thereby allowing other scientists to access and build on the data and models. Because when large simulations are developed, assessing, understanding, and replicating them can be challenging for others. A simulation includes not only the software and settings but also many preparatory steps and the subsequent evaluation.

Mistakes can occur during evaluation because there are multiple ways to analyze and interpret the data. An evaluation of the simulation data is itself a mathematical operation in which various models are used. “The reproducible documentation of the entire workflow helps assess whether a simulation and the data I have used are reliable. Only in this way can simulation results be trustworthy,” says Beck. This not only advances science but also makes real-life applications safer.

Manuela Mild | SimTech Science Communication

Read more

Kurz, Ph. Offenhäuser, D. Viola, O. Shcherbakov, M. Resch, A. Beck (2022), Deep reinforcement learning for computational fluid dynamics on HPC systems, Journal of Computational Science, 65, 101884, https://doi.org/10.1016/j.jocs.2022.101884

Kurz, Marius, Philipp Offenhäuser, and Andrea Beck. "Deep reinforcement learning for turbulence modeling in large eddy simulations." International journal of heat and fluid flow 99 (2023): 109094. https://doi.org/10.1016/j.ijheatfluidflow.2022.109094

Beck, Andrea, David Flad, and Claus-Dieter Munz. "Deep neural networks for data-driven LES closure models." Journal of Computational Physics 398 (2019): 108910. https://doi.org/10.1016/j.jcp.2019.108910

Kempf, Daniel, et al. "GAL {\AE} XI: Solving complex compressible flows with high-order discontinuous Galerkin methods on accelerator-based systems." arXiv preprint arXiv:2404.12703 (2024). https://arxiv.org/abs/2404.12703

About the scientist

Even at seven years old, Andrea Beck was fascinated by the idea that people were able to build airplanes and spaceships, a curiosity sparked by watching the Challenger space shuttle explosion on television. Her enthusiasm for technology and computers, physics, and mathematics continued throughout school and during her studies at the University of Stuttgart and the Georgia Institute of Technology in the USA. She chose fluid mechanics because it combines many things that she likes: Applications in aerospace, mathematics, computer science, and supercomputers are all part of her work and allow her to freely explore new ideas.

Since 2022, she has been Professor of Numerical Methods in Fluid Mechanics and Deputy Director of the Institute of Aerodynamics and Gas Dynamics at the University of Stuttgart. At SimTech, she coordinates the project network 1 (PN 1) “Data-Integrated Models and Methods for Multiphase Fluid Dynamics”. In addition, she is developing codes for numerical fluid dynamics that can be used in exascale supercomputer systems as part of a research group at the European Center of Excellence for Exascale CFD (CEEC).

To the top of the page