# Machine learning for partial differential equations $$\newcommand{\solop}{\mathcal{G}^{\dagger}}$$

Using statistical or machine learning approaches to solve PDEs, and maybe even to perform inference through them. There are many approaches to ML learning of PDEs and I will document on an ad hoc basis as I need them. No claim is made to completeness.

TODO: To reduce proliferation of unclear symbols by introducing a specific example; which neural nets represent operators, which represent specific functions, between which spaces etc.

TODO: Harmonise the notation used in this section with subsections below; right now they match the papers’ notation but not each other.

TODO: should the intro section actually be filed under PDEs?

TODO: introduce a consistent notation for coordinate space, output spaces, and function space?

TODO: this is mostly Eulerian fluid flow models right now. Can we mention Lagrangian models at least?

## Background

⚠️ this section is a mess and I hate it now ⚠️

Suppose we have a PDE defined over some input domain, which we presume is a time dimension, and some number of spatial dimensions. The PDE is specified by some differential operator $$\mathcal{D}$$ and some forcing or boundary condition $$u\in \mathscr{U},$$ as $\mathcal{D}[f]=u.$ These functions map from some coordinate space $$C$$ to some output space $$O$$. }The first coordinate of the input space often has the special interpretation as time $$t\in \mathbb{R}$$ and the subsequent coordinates are then spatial coordinate $$x\in D\subseteq \mathbb{R}^{d_{D}}$$ where $$d_{D}=d_{C}-1.$$ Sometimes we make this explicit by writing the time coordinate separately as $$f(t,x).$$ A common case, concretely, is $$C=\mathbb{R} \times \mathbb{R}^2=\mathbb{R} \times D$$ and $$O=\mathbb{R}.$$ For each time $$t\in \mathbb{R}$$ we assume the instantaneous solution $$f(t, \cdot)$$ to be an element of some Banach space $$f\in \mathscr{A}$$ of functions $$f(t, \cdot): D\to O.$$ The overall solutions $$f: C\to O$$ have their own Banach space $$\mathscr{F}$$. More particularly, we might consider solutions a restricted time domain $$t\in [0,T]$$ and some spatial domain $$D\subseteq \mathbb{R}^2$$ where a solution is a function $$f$$ that maps $$[0,T] \times D \to \mathbb{R}.$$ This would naturally model, say, a 2D height-field evolving over time.

We have thrown the term Banach space about without making it clear which one we mean. There are usually some implied smoothness properties and of course we would want to include some kind of metric to fully specify these spaces, but we gloss over that for now.

We have introduced one operator, the defining operator $$\mathcal{D}$$ . Another that we think about a lot is the PDE propagator or forward operator $$\mathcal{P}_s,$$ which produces a representation of the entire solution surface at some future moment, given current and boundary conditions. $\mathcal{P}_s[f(t, \cdot)]=f( t+s, \cdot).$ We might also discuss a solution operator $\solop:\begin{array}{l}\mathscr{U}\to\mathscr{F}\\ u\mapsto f\end{array}$ such that $\mathcal{D}\left[\solop[u]\right]=u.$

Handling all these weird, and presumably infinite-dimensional, function spaces $$\mathscr{A},\mathscr{U},\mathscr{F},\dots$$ on a finite computer requires use to introduce a notion of discretisation. We need to find some finite-dimensional representations of these functions so that they can be computed in a finite machine. PDE solvers use various tricks to do that, and each one is its own research field. Finite difference approximations treat all the solutions as values on a grid, effectively approximating $$\mathscr{F}$$ with some new space of functions $$\mathbb{Z}^2 \times \mathbb{Z} \to \mathbb{R},$$ or, if you’d like, in terms of “bar chart” basis functions. Finite element methods define the PDE over a more complicated indexing system of compactly-supported basis functions which form a mesh. Particle systems approximate PDEs with moving particle who define their own adaptive basis. If there is some other natural (preferably orthogonal) basis of functions on the solution surface we might use those, for example with the right structure the eigenfunctions of the defining operator might give us such a basis. Fourier bases are famous in this case.

A classic for neural nets is to learn a finite-difference approximation of the PDE on a grid of values and treat it as a convnet regression, and indeed the dynamical treatment of neural nets is based on that. For various practical reasons I would like to avoid requiring a grid on my input values as much as possible. For one thing, grid systems are memory intensive and need expensive GPUs. For another, it is hard to integrate observations at multiple resolutions into a gridded data system. For a third, the research field of image prediction is too crowded for easy publications. Thus, that will not be treated further.

A grid-free approach is graph networks that learn a topology and interaction system. This seems to naturally map on to PDEs of the kind that we usually solve by particle systems, e.g. fluid dynamics with immiscible substances. Nothing wrong with this idea per se, but it does not seem to be the most compelling approach to me for my domain of spatiotemporal prediction where we already know the topology and can avoid all the complicated bits of graph networks. So this I will also ignore for now.

There are a few options. For an overview of many other techniques see Physics-based Deep Learning by Philipp Holl, Maximilian Mueller, Patrick Schnell, Felix Trost, Nils Thuerey, Kiwon Um . Also, see Brunton and Kutz, Data-Driven Science and Engineering. covers related material; both go farther than mere PDEs and consider general scientific settings. Also, the seminar series by the authors of that latter book is a moving feast of the latest results in this area.

Here we look in depth mainly at two important ones.

One approach learns a network $$\hat{f}\in \mathscr{F}, \hat{f}: C \to O$$ such that $$\hat{f}\approx f$$ . This is the annoyingly-named implicit representation trick. Another approach is used in networks like Li, Kovachki, Azizzadenesheli, Liu, Bhattacharya, et al. (2020b) which learn the forward operator $$\mathcal{P}_1: \mathscr{A}\to\mathscr{A}.$$ When the papers mentioned talk about operator learning, this is the operator that they seem to mean per default. Physics-informed approximation of dynamics

This entire idea might seem weird if you are used to typical ML research. Unlike the usual neural network setting, we start by not trying to solve a statistical inference problem, where we have to learn an unknown prediction function from data, but we have a partially or completely known function (PDE solver) that we are trying to approximate with a more convenient substitute (a neural approximation to that PDE solver).

That approximant is not necessarily exciting as a PDE solver, in itself. Probably we could have implemented the reference PDE solver on the GPU, or tweaked it a little, and got a faster PDE solver. Identifying when we have a non-trivial speed benefit from training a Neuyral net to do a thing is a whole project in itself.

However, I would like it if the reference solvers were easier to differentiate through, and to construct posteriors with - what you might call tomography, or inverse problems. But note that we still do not need to use ML methods to day that. In fact, if I already know the PDE operator and am implementing it in any case, I could avoid the learning step and simply implement the PDE using an off-the-shelf differentiable solver, which would allow us to perform this inference.

Nonetheless, we might wish to learn to approximate a PDE, for whatever reason. Perhaps we do not know the governing equations precisely, or something like that. In my case it is that am required to match an industry-standard black-box solver that is not flexible, which is a common reason. YMMV.

There are several approaches to learning the dynamics of a PDE solver for given parameters.

## Neural operator

Learning to predict the next step given this step. Think image-to-image regression. A whole topic in itself. See Neural operators.

## The PINN lineage

This body of literature encompasses both DeepONet (‘operator learning’) and PINN (‘physics informed neural nets’) approaches. Distinctions TBD.

See PINNs.

## Neural operator

Learning to predict the next step given this step. Think image-to-image regression. A whole topic in itself. See Neural operators.

TBD

## DeepONet

One approach I am less familiar with advocates (conditional) GAN models to simulate (conditional) latent distributions. I’m curious about these but they look more computationally expensive and specific than I need at the moment, so I’m filing for later .

A recent examples from fluid-flow dynamics has particularly beautiful animations:

F. Sigrist, Künsch, and Stahel (2015b) finds a nice spectral representation of certain classes of stochastic PDE. These are extended in Liu, Yeo, and Lu (2020) to non-stationary operators. By being less generic, these come out with computationally convenient spectral representations.

## Inverse problems

Tomography through PDEs.

## As implicit representations

Many of these PDE methods effectively use the “implicit representation” trick, i.e. they produce networks that map from input coordinates to values of solutions at those coordinates. This means we share some interesting tools with those networks, such as position encodings. TBD.

## Differentiable solvers

Suppose we are keen to devise yet another method that will do clever things to augment PDE solvers with ML somehow. To that end it would be nice to have a PDE solver that was not a completely black box but which we could interrogate for useful gradients. Obviously all PDE solvers use gradient information, but only some of them expose that to us as users; e.g. MODFLOW will give me a solution field but not the gradients of the field that were used to calculate that solution, neither spatial gradients nor the sensitivity of the parameters. In ML toolkits, accessing this information is easy.

OTOH, there is a lot of sophisticated work done by PDE solvers that is hard for ML toolkits to recreate. That is why PDE solvers are a thing.

Tools which combine both worlds, PDE solutions and ML optimisations, do exist; there are adjoint method systems for mainstream PDE solvers just as there are PDE solvers for ML frameworks. Let us list some of the options under differentiable PDE solvers.

Fits here?

## Datasets and training harnesses

As with more typical nerual net applications, PDE emulators can be trained from datasets. Here are some

But if we have a simulator, we can run it live and generate data on the fly. Here is a tool to facilitate that.

Inria’s Melissa

Melissa is a file avoiding, fault tolerant and elastic framework, to run large scale sensitivity analysis (Melissa-SA) and large scale deep surrogate training (Melissa-DL) on supercomputers. With Melissa-SA, largest runs so far involved up to 30k core, executed 80 000 parallel simulations, and generated 288 TB of intermediate data that did not need to be stored on the file system …

Classical sensitivity analysis and deep surrogate training consist in running different instances of a simulation with different set of input parameters, store the results to disk to later read them back to train a Neural Network or to compute the required statistics. The amount of storage needed can quickly become overwhelming, with the associated long read time that makes data processing time consuming. To avoid this pitfall, scientists reduce their study size by running low resolution simulations or down-sampling output data in space and time.

Melissa (Fig. 1) bypasses this limitation by avoiding intermediate file storage. Melissa processes the data online (in transit) enabling very large scale data processing:

## Tooling

### Torchphysics

TorchPhysics is a Python library of (mesh-free) deep learning methods to solve differential equations. You can use TorchPhysics e.g. to

• solve ordinary and partial differential equations
• train a neural network to approximate solutions for different parameters
• solve inverse problems and interpolate external data

The following approaches are implemented using high-level concepts to make their usage as easy as possible:

• physics-informed neural networks (PINN)
• QRes
• the Deep Ritz method
• DeepONets and Physics-Informed DeepONets

### DeepXDE

DeepXDE is a reference solver implementation for PINN and DeepONet .

Use DeepXDE if you need a deep learning library that

• solves forward and inverse partial differential equations (PDEs) via physics-informed neural network (PINN),
• solves forward and inverse integro-differential equations (IDEs) via PINN,
• solves forward and inverse fractional partial differential equations (fPDEs) via fractional PINN (fPINN),
• approximates functions from multi-fidelity data via multi-fidelity NN (MFNN),
• approximates nonlinear operators via deep operator network (DeepONet),
• approximates functions from a dataset with/without constraints.

You might need to moderate your expectations a little. I did, after that bold description. This is an impressive library, but as covered above, some of the types of problems that it can solve are more limited than one might hope upon reading the description. Think of it as a neural network library that handles certain PDE calculations and you will not go too far astray.

### NeuralOperator

neuraloperator is a comprehensive library for learning neural operators in PyTorch. It is the official implementation for Fourier Neural Operators and Tensorized Neural Operators.

### Modulus

NVIDIA’s MODULUS (formerly SimNet) has the full marketing muscle of NVIDIA behind it.

Not currently recommended, due to comically clunky distribution system and onerous licensing.

1. LIMITATIONS. Your license to use the Modulus Deliverables is restricted as follows:
1. The Modulus Deliverables are licensed for you to develop services and applications only for their use in systems with NVIDIA GPUs.
2. You may not reverse engineer, decompile or disassemble, or remove copyright or other proprietary notices from any portion of the Modulus Deliverables or copies of the Modulus Deliverables.
3. Except as expressly provided in this license, you may not copy, sell, rent, sublicense, transfer, distribute, modify, or create derivative works of any portion of the Modulus Deliverables. For clarity, you may not distribute or sublicense the Modulus Deliverables as a stand-alone product.

They run just fine on google colab, but I am not sure if that is legal.

### CliffordLayers

Surprising twist: Clifford algebras are useful for ML+PDEs.

We propose Geometric Clifford Algebra Networks (GCANs) that are based on symmetry group transformations using geometric (Clifford) algebras. GCANs are particularly well-suited for representing and manipulating geometric transformations, often found in dynamical systems. We first review the quintessence of modern (plane-based) geometric algebra, which builds on isometries encoded as elements of the Pin(p,q,r) group. We then propose the concept of group action layers, which linearly combine object transformations using pre-specified group actions. Together with a new activation and normalization scheme, these layers serve as adjustable geometric templates that can be refined via gradient descent. Theoretical advantages are strongly reflected in the modeling of three-dimensional rigid body transformations as well as large-scale fluid dynamics simulations, showing significantly improved performance over traditional methods.

### 1 comment As a geophysicist working with 3D and lots of data with coupled PDEs, a fast solver is nice, but often intractably slow. Even with modern solvers. Even with GPU. Replacing the solver with a NN approximant is potentially much faster, even if the speed is merely amortized. That has so many benefits for real-world modeling work.