2021-01-04 09:36:09 +01:00
Overview
============================
2021-05-06 13:38:11 +02:00
The name of this book, _Physics-Based Deep Learning_ ,
2021-06-28 17:49:03 +02:00
denotes combinations of physical modeling and numerical simulations with
2021-01-12 04:50:42 +01:00
methods based on artificial neural networks.
The general direction of Physics-Based Deep Learning represents a very
2021-07-10 10:11:53 +02:00
active, quickly growing and exciting field of research. The following chapter will
give a more thorough introduction to the topic and establish the basics
2021-05-06 13:38:11 +02:00
for following chapters.
2021-01-31 05:13:00 +01:00
2021-01-26 06:04:57 +01:00
```{figure} resources/overview-pano.jpg
---
height: 240px
name: overview-pano
---
Understanding our environment, and predicting how it will evolve is one of the key challenges of humankind.
2021-08-13 16:27:35 +02:00
A key tool for achieving these goals are simulations, and next-gen simulations
could strongly profit from integrating deep learning components to make even
more accurate predictions about our world.
2021-01-26 06:04:57 +01:00
```
2021-01-04 09:36:09 +01:00
## Motivation
2021-05-06 13:38:11 +02:00
From weather and climate forecasts {cite}`stocker2014climate` (see the picture above),
2021-01-26 06:04:57 +01:00
over quantum physics {cite}`o2016scalable`,
to the control of plasma fusion {cite}`maingi2019fesreport`,
2021-01-04 12:34:34 +01:00
using numerical analysis to obtain solutions for physical models has
2021-06-28 17:49:03 +02:00
become an integral part of science.
2021-01-04 12:34:34 +01:00
2021-08-13 16:27:35 +02:00
In recent years, machine learning technologies and _deep neural networks_ in particular,
2021-01-26 06:04:57 +01:00
have led to impressive achievements in a variety of fields:
from image classification {cite}`krizhevsky2012` over
natural language processing {cite}`radford2019language`,
and more recently also for protein folding {cite}`alquraishi2019alphafold`.
2021-07-10 10:11:53 +02:00
The field is very vibrant and quickly developing, with the promise of vast possibilities.
2021-01-26 06:04:57 +01:00
2021-09-06 12:01:56 +02:00
### Replacing traditional simulations?
2021-08-13 16:27:35 +02:00
These success stories of deep learning (DL) approaches
2021-07-10 10:11:53 +02:00
have given rise to concerns that this technology has
2021-08-13 16:27:35 +02:00
the potential to replace the traditional, simulation-driven approach to science.
E.g., recent works show that NN-based surrogate models achieve accuracies required
for real-world, industrial applications such as airfoil flows {cite}`chen2021highacc`, while at the
same time outperforming traditional solvers by orders of magnitude in terms of runtime.
Instead of relying on models that are carefully crafted
2021-01-04 12:34:34 +01:00
from first principles, can data collections of sufficient size
2021-07-10 10:11:53 +02:00
be processed to provide the correct answers?
2021-08-13 16:27:35 +02:00
As we'll show in the next chapters, this concern is unfounded.
Rather, it is crucial for the next generation of simulation systems
to bridge both worlds: to
combine _classical numerical_ techniques with _deep learning_ methods.
2021-01-26 06:04:57 +01:00
One central reason for the importance of this combination is
2021-08-13 16:27:35 +02:00
that DL approaches are powerful, but at the same time strongly profit
from domain knowledge in the form of physical models.
DL techniques and NNs are novel, sometimes difficult to apply, and
it is admittedly often non-trivial to properly integrate our understanding
of physical processes into the learning algorithms.
2021-01-04 12:34:34 +01:00
2021-08-30 19:39:02 +02:00
Over the last decades,
2021-01-04 12:34:34 +01:00
highly specialized and accurate discretization schemes have
been developed to solve fundamental model equations such
2021-08-17 21:10:55 +02:00
as the Navier-Stokes, Maxwell's, or Schroedinger's equations.
2021-01-04 12:34:34 +01:00
Seemingly trivial changes to the discretization can determine
whether key phenomena are visible in the solutions or not.
2021-01-26 06:04:57 +01:00
Rather than discarding the powerful methods that have been
2021-09-09 10:34:36 +02:00
developed in the field of numerical mathematics, this book will
show that it is highly beneficial to use them as much as possible
when applying DL.
2021-01-04 12:34:34 +01:00
2021-09-06 12:01:56 +02:00
### Black boxes and magic?
2021-09-09 10:34:36 +02:00
People who are unfamiliar with DL methods often associate neural networks
2021-09-06 12:01:56 +02:00
with _black boxes_ , and see the training processes as something that is beyond the grasp
of human understanding. However, these viewpoints typically stem from
relying on hearsay and not dealing with the topic enough.
Rather, the situation is a very common one in science: we are facing a new class of methods,
2022-01-02 10:07:20 +01:00
and "all the gritty details" are not yet fully worked out. This is pretty common
for all kinds of scientific advances.
2021-09-06 12:01:56 +02:00
Numerical methods themselves are a good example. Around 1950, numerical approximations
and solvers had a tough standing. E.g., to cite H. Goldstine,
2022-01-02 10:07:20 +01:00
numerical instabilities were considered to be a
"constant source of anxiety in the future" {cite}`goldstine1990history`.
2021-09-06 12:01:56 +02:00
By now we have a pretty good grasp of these instabilities, and numerical methods
2021-09-09 10:34:36 +02:00
are ubiquitous and well established.
2021-09-06 12:01:56 +02:00
Thus, it is important to be aware of the fact that -- in a way -- there is nothing
magical or otherworldly to deep learning methods. They're simply another set of
numerical tools. That being said, they're clearly fairly new, and right now
definitely the most powerful set of tools we have for non-linear problems.
Just because all the details aren't fully worked out and nicely written up,
that shouldn't stop us from including these powerful methods in our numerical toolbox.
### Reconciling DL and simulations
Taking a step back, the aim of this book is to build on all the powerful techniques that we have
at our disposal for numerical simulations, and use them wherever we can in conjunction
with deep learning.
As such, a central goal is to _reconcile_ the data-centered viewpoint with physical simulations.
2021-01-26 06:04:57 +01:00
```{admonition} Goals of this document
2021-01-04 12:34:34 +01:00
:class: tip
2021-08-30 19:39:02 +02:00
The key aspects that we will address in the following are:
2021-08-13 16:27:35 +02:00
- explain how to use deep learning techniques to solve PDE problems,
2021-03-15 14:05:20 +01:00
- how to combine them with **existing knowledge** of physics,
2021-08-13 16:27:35 +02:00
- without **discarding** our knowledge about numerical methods.
2022-04-24 13:59:09 +02:00
At the same time, it's worth noting what we won't be covering:
- introductions to deep learning and numerical simulations,
- we're neither aiming for a broad survey of research articles in this area.
2021-01-04 12:34:34 +01:00
```
2021-03-02 14:42:27 +01:00
The resulting methods have a huge potential to improve
2021-07-10 10:11:53 +02:00
what can be done with numerical methods: in scenarios
2021-05-06 13:38:11 +02:00
where a solver targets cases from a certain well-defined problem
2021-07-10 10:11:53 +02:00
domain repeatedly, it can for instance make a lot of sense to once invest
2021-03-02 14:42:27 +01:00
significant resources to train
2021-06-22 09:49:57 +02:00
a neural network that supports the repeated solves. Based on the
2021-03-02 14:42:27 +01:00
domain-specific specialization of this network, such a hybrid
could vastly outperform traditional, generic solvers. And despite
the many open questions, first publications have demonstrated
2021-08-21 20:45:58 +02:00
that this goal is not overly far away {cite}`um2020sol,kochkov2021`.
2021-01-04 12:34:34 +01:00
2021-05-06 13:38:11 +02:00
Another way to look at it is that all mathematical models of our nature
are idealized approximations and contain errors. A lot of effort has been
2021-08-30 19:39:02 +02:00
made to obtain very good model equations, but to make the next
2021-05-06 13:38:11 +02:00
big step forward, DL methods offer a very powerful tool to close the
2021-08-21 20:45:58 +02:00
remaining gap towards reality {cite}`akkaya2019solving`.
2021-01-04 09:36:09 +01:00
## Categorization
Within the area of _physics-based deep learning_ ,
we can distinguish a variety of different
2021-05-06 13:38:11 +02:00
approaches, from targeting constraints, combined methods, and
2021-01-04 09:36:09 +01:00
optimizations to applications. More specifically, all approaches either target
_forward_ simulations (predicting state or temporal evolution) or _inverse_
problems (e.g., obtaining a parametrization for a physical system from
observations).

2021-07-10 10:11:53 +02:00
No matter whether we're considering forward or inverse problems,
2021-01-04 09:36:09 +01:00
the most crucial differentiation for the following topics lies in the
nature of the integration between DL techniques
2021-05-09 10:45:10 +02:00
and the domain knowledge, typically in the form of model equations
via partial differential equations (PDEs).
2021-09-09 10:34:36 +02:00
The following three categories can be
identified to roughly categorize _physics-based deep learning_ (PBDL)
2021-01-04 09:36:09 +01:00
techniques:
2021-05-06 13:38:11 +02:00
- _Supervised_: the data is produced by a physical system (real or simulated),
but no further interaction exists. This is the classic machine learning approach.
2021-01-04 09:36:09 +01:00
- _Loss-terms_: the physical dynamics (or parts thereof) are encoded in the
loss function, typically in the form of differentiable operations. The
learning process can repeatedly evaluate the loss, and usually receives
2022-02-23 10:56:53 +01:00
gradients from a PDE-based formulation. These soft constraints sometimes also go
2021-05-06 13:38:11 +02:00
under the name "physics-informed" training.
2021-01-04 09:36:09 +01:00
- _Interleaved_: the full physical simulation is interleaved and combined with
an output from a deep neural network; this requires a fully differentiable
simulator and represents the tightest coupling between the physical system and
2021-05-06 13:38:11 +02:00
the learning process. Interleaved differentiable physics approaches are especially important for
2021-08-30 19:39:02 +02:00
temporal evolutions, where they can yield an estimate of the future behavior of the
2021-01-04 09:36:09 +01:00
dynamics.
2021-09-09 10:34:36 +02:00
Thus, methods can be categorized in terms of forward versus inverse
2021-01-04 09:36:09 +01:00
solve, and how tightly the physical model is integrated into the
2021-05-06 13:38:11 +02:00
optimization loop that trains the deep neural network. Here, especially
2021-09-09 10:34:36 +02:00
interleaved approaches that leverage _differentiable physics_ allow for
very tight integration of deep learning and numerical simulation methods.
2021-01-04 09:36:09 +01:00
2021-01-31 05:13:00 +01:00
2022-01-02 10:07:20 +01:00
### Naming
It's worth pointing out that what we'll call "differentiable physics"
in the following appears under a variety of different names in other resources
and research papers. The differentiable physics name is motivated by the differentiable
programming paradigm in deep learning. Here we, e.g., also have "differentiable rendering
approaches", which deal with simulating how light leads forms the images we see as humans.
In contrast, we'll focus on _physical_ simulations from now on, hence the name.
When coming from other backgrounds, other names are more common however. E.g., the differentiable
physics approach is equivalent to using the adjoint method, and coupling it with a deep learning
procedure. Effectively, it is also equivalent to apply backpropagation / reverse-mode differentiation
to a numerical simulation. However, as mentioned above, motivated by the deep learning viewpoint,
we'll refer to all these as "differentiable physics" approaches from now on.
---
2021-09-06 12:01:56 +02:00
## Looking ahead
2021-01-31 05:13:00 +01:00
2021-09-06 12:01:56 +02:00
_Physical simulations_ are a huge field, and we won't be able to cover all possible types of physical models and simulations.
2021-01-31 05:13:00 +01:00
2021-05-09 08:19:34 +02:00
```{note} Rather, the focus of this book lies on:
2021-02-15 09:04:09 +01:00
- _Field-based simulations_ (no Lagrangian methods)
2021-09-09 10:34:36 +02:00
- Combinations with _deep learning_ (plenty of other interesting ML techniques exist, but won't be discussed here)
- Experiments are left as an _outlook_ (i.e., replacing synthetic data with real-world observations)
2021-01-31 05:13:00 +01:00
```
It's also worth noting that we're starting to build the methods from some very
2021-05-09 08:19:34 +02:00
fundamental building blocks. Here are some considerations for skipping ahead to the later chapters.
2021-01-31 05:13:00 +01:00
2021-02-15 09:04:09 +01:00
```{admonition} Hint: You can skip ahead if...
2021-01-10 14:15:50 +01:00
:class: tip
2021-05-06 13:38:11 +02:00
- you're very familiar with numerical methods and PDE solvers, and want to get started with DL topics right away. The {doc}`supervised` chapter is a good starting point then.
2021-01-10 14:15:50 +01:00
2021-05-06 13:38:11 +02:00
- On the other hand, if you're already deep into NNs& Co, and you'd like to skip ahead to the research related topics, we recommend starting in the {doc}`physicalloss` chapter, which lays the foundations for the next chapters.
2021-01-10 14:15:50 +01:00
2021-02-27 07:07:42 +01:00
A brief look at our _notation_ in the {doc}`notation` chapter won't hurt in both cases, though!
2021-01-10 14:15:50 +01:00
```
2021-03-08 04:15:00 +01:00
## Implementations
This text also represents an introduction to a wide range of deep learning and simulation APIs.
2021-05-09 08:19:34 +02:00
We'll use popular deep learning APIs such as _pytorch_ [https://pytorch.org ](https://pytorch.org ) and _tensorflow_ [https://www.tensorflow.org ](https://www.tensorflow.org ), and additionally
2021-05-09 10:45:10 +02:00
give introductions into the differentiable simulation framework _Φ<sub>Flow</sub> (phiflow)_ [https://github.com/tum-pbs/PhiFlow ](https://github.com/tum-pbs/PhiFlow ). Some examples also use _JAX_ [https://github.com/google/jax ](https://github.com/google/jax ). Thus after going through
2021-03-08 04:15:00 +01:00
these examples, you should have a good overview of what's available in current APIs, such that
the best one can be selected for new tasks.
2021-08-30 19:39:02 +02:00
As we're (in most Jupyter notebook examples) dealing with stochastic optimizations, many of the following code examples will produce slightly different results each time they're run. This is fairly common with NN training, but it's important to keep in mind when executing the code. It also means that the numbers discussed in the text might not exactly match the numbers you'll see after re-running the examples.
2021-05-17 10:48:35 +02:00
2021-01-10 14:15:50 +01:00
2021-01-26 06:04:57 +01:00
<!-- ## A brief history of PBDL in the context of Fluids
2021-01-07 02:39:57 +01:00
First:
Tompson, seminal...
Chu, descriptors, early but not used
Ling et al. isotropic turb, small FC, unused?
2021-01-26 06:04:57 +01:00
PINNs ... and more ... -->
2021-01-07 02:39:57 +01:00