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 to compare 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 filed but not the gradients of the field that were used to calculate that gradient. In ML toolkits accessing this information is often easy; may of them supply an API to access adjoints.
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.
Classic PDE solvers which combine gradient-based inference and ML outputs do exist. Differentiable solvers for PDEs combine a high fidelity to the supposed laws of physics governing the system under investigation with the potential to do some kind of inference through them. Obviously they involve various approximations to the “ground truth” in practice; reality must be discretized and simplified to fit in the machine. However, the kinds of simplications that these solvers make are by convention unthreatening; we generally are not too concerned about the discretisation implied by a finite-element method mesh, or the cells in a finite difference, or the waves in a spectral method, which we can often prove are “not too far” from what we would find in a physical system which truly followed the laws we hope it does. On the other hand, we might be suspicious that the laws of physics we do know are truly a complete characterisation of the system (pro tip: they are not) so these solvers might give us undue confidence that their idealized fidelity guarantees that they will be accurate to solve the real world, not mathematical idealisations of it. Further, these solvers often buy fidelity at the price of speed. Empirically, we discover that we can get nearly-as-good a result from an ML method but far faster than a classic PDE solver.
There is a role for both kinds of approaches; in fact there is a burgeoning industry in stitching them together, and playing of relative strengths of each.
Good. For now, some alternatives.
I use this a lot, so it has its own notebook.
Unremarkable name, looks handy though. Implements both projection methods and spectral methods, and different variations of Crank-Nicholson for fluid-dynamical models. Seems to imply periodic boundary conditions?
DPFEHM is a Julia module that includes differentiable numerical models with a focus on fluid flow and transport in the Earth’s subsurface. Currently it supports the groundwater flow equations (single phase flow), Richards equation (air/water), the advection-dispersion equation, and the 2d wave equation.
Trixi.jl is a numerical simulation framework for hyperbolic conservation laws written in Julia. A key objective for the framework is to be useful to both scientists and students. Therefore, next to having an extensible design with a fast implementation, Trixi is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures. Its features include:
- 1D, 2D, and 3D simulations on line/quad/hex/simplex meshes
- Cartesian and curvilinear meshes
- Conforming and non-conforming meshes
- Structured and unstructured meshes
- Hierarchical quadtree/octree grid with adaptive mesh refinement
- Forests of quadtrees/octrees with p4est via P4est.jl
- High-order accuracy in space in time
- Discontinuous Galerkin methods
- Kinetic energy-preserving and entropy-stable methods based on flux differencing
- Entropy-stable shock capturing
- Positivity-preserving limiting
- Finite difference summation by parts (SBP) methods
- Compatible with the SciML ecosystem for ordinary differential equations
- Explicit low-storage Runge-Kutta time integration
- Strong stability preserving methods
- CFL-based and error-based time step control
- Native support for differentiable programming
- Forward mode automatic differentiation via ForwardDiff.jl
- Periodic and weakly-enforced boundary conditions
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
Much NN automation in this library but the NN part is bare-bones FEM stuff.
ADCME is suitable for conducting inverse modeling in scientific computing; specifically, ADCME targets physics informed machine learning, which leverages machine learning techniques to solve challenging scientific computing problems. The purpose of the package is to:
- provide differentiable programming framework for scientific computing based on TensorFlow automatic differentiation (AD) backend;
- adapt syntax to facilitate implementing scientific computing, particularly for numerical PDE discretization schemes;
- supply missing functionalities in the backend (TensorFlow) that are important for engineering, such as sparse linear algebra, constrained optimization, etc.
- physics informed machine learning (a.k.a., scientific machine learning, physics informed learning, etc.)
- coupled hydrological and full waveform inversion
- constitutive modeling in solid mechanics
- learning hidden geophysical dynamics
- parameter estimation in stochastic processes
The package inherits the scalability and efficiency from the well-optimized backend TensorFlow. Meanwhile, it provides access to incorporate existing C/C++ codes via the custom operators. For example, some functionalities for sparse matrices are implemented in this way and serve as extendable “plugins” for ADCME.
Julaifem is an umbrella organisation supporting julia-backed FEM solvers. The documentation is tricksy, but check out the examples, Supported solvers listed here. I assume these are all differentiable, since that is a selling point of the SciML.jl ecosystem they spring from, but I have not checked. The emphasis seems to be upon cluster-distributed solutions at scale.
These adjoint and tangent linear models are key ingredients in many important algorithms, such as data assimilation, optimal control, sensitivity analysis, design optimisation, and error estimation. Such models have made an enormous impact in fields such as meteorology and oceanography, but their use in other scientific fields has been hampered by the great practical difficulty of their derivation and implementation. In his recent book Naumann (2011) states that
[T]he automatic generation of optimal (in terms of robustness and efficiency) adjoint versions of large-scale simulation code is one of the great open challenges in the field of High-Performance Scientific Computing.
The dolfin-adjoint project aims to solve this problem for the case where the model is implemented in the Python interface to FEniCS/Firedrake.
mantaflow is an open-source framework targeted at fluid simulation research in Computer Graphics and Machine Learning. Its parallelized C++ solver core, python scene definition interface and plugin system allow for quickly prototyping and testing new algorithms. A wide range of Navier-Stokes solver variants are included. It’s very versatile, and allows coupling and import/export with deep learning frameworks (e.g., tensorflow via numpy) or standalone compilation as matlab plugin. Mantaflow also serves as the simulation engine in Blender.
The framework can be used with or without GUI on Linux, MacOS and Windows. Here is an incomplete list of features implemented so far:
- Eulerian simulation using MAC Grids, PCG pressure solver and MacCormack advection
- Flexible particle systems
- FLIP simulations for liquids
- Surface mesh tracking
- Free surface simulations with levelsets, fast marching
- Wavelet and surface turbulence
- K-epsilon turbulence modeling and synthesis
- Maya and Blender export for rendering
Mantaflow’s particular selling point is producing stunning 3d animations as an output. It is not widely used for inference in practice; people, including the authors, seem to prefer Phiflow for that end.
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.