Table of Contents
Fetching ...

DeepXDE: A deep learning library for solving differential equations

Lu Lu, Xuhui Meng, Zhiping Mao, George E. Karniadakis

TL;DR

DeepXDE presents physics-informed neural networks (PINNs) as a mesh-free framework for solving PDEs, including forward, inverse, and integro-differential formulations, by embedding the PDE into a loss and differentiating it with automatic differentiation. It provides a theoretical context (universal approximation and error decomposition) and a practical enhancement (Residual-based Adaptive Refinement, or RAR) to improve training efficiency and accuracy. The paper introduces DeepXDE, a Python library that supports complex geometries via constructive solid geometry, multiple network types, and extensible callbacks, demonstrated on five representative problems (Poisson, Burgers, Lorenz, diffusion-reaction, Volterra IDE). Together, these contributions highlight PINNs as a scalable, education-friendly tool for Scientific Machine Learning and multi-physics modeling, while also acknowledging current limitations and avenues for automation and extension.

Abstract

Deep learning has achieved remarkable success in diverse applications; however, its use in solving partial differential equations (PDEs) has emerged only recently. Here, we present an overview of physics-informed neural networks (PINNs), which embed a PDE into the loss of the neural network using automatic differentiation. The PINN algorithm is simple, and it can be applied to different types of PDEs, including integro-differential equations, fractional PDEs, and stochastic PDEs. Moreover, from the implementation point of view, PINNs solve inverse problems as easily as forward problems. We propose a new residual-based adaptive refinement (RAR) method to improve the training efficiency of PINNs. For pedagogical reasons, we compare the PINN algorithm to a standard finite element method. We also present a Python library for PINNs, DeepXDE, which is designed to serve both as an education tool to be used in the classroom as well as a research tool for solving problems in computational science and engineering. Specifically, DeepXDE can solve forward problems given initial and boundary conditions, as well as inverse problems given some extra measurements. DeepXDE supports complex-geometry domains based on the technique of constructive solid geometry, and enables the user code to be compact, resembling closely the mathematical formulation. We introduce the usage of DeepXDE and its customizability, and we also demonstrate the capability of PINNs and the user-friendliness of DeepXDE for five different examples. More broadly, DeepXDE contributes to the more rapid development of the emerging Scientific Machine Learning field.

DeepXDE: A deep learning library for solving differential equations

TL;DR

DeepXDE presents physics-informed neural networks (PINNs) as a mesh-free framework for solving PDEs, including forward, inverse, and integro-differential formulations, by embedding the PDE into a loss and differentiating it with automatic differentiation. It provides a theoretical context (universal approximation and error decomposition) and a practical enhancement (Residual-based Adaptive Refinement, or RAR) to improve training efficiency and accuracy. The paper introduces DeepXDE, a Python library that supports complex geometries via constructive solid geometry, multiple network types, and extensible callbacks, demonstrated on five representative problems (Poisson, Burgers, Lorenz, diffusion-reaction, Volterra IDE). Together, these contributions highlight PINNs as a scalable, education-friendly tool for Scientific Machine Learning and multi-physics modeling, while also acknowledging current limitations and avenues for automation and extension.

Abstract

Deep learning has achieved remarkable success in diverse applications; however, its use in solving partial differential equations (PDEs) has emerged only recently. Here, we present an overview of physics-informed neural networks (PINNs), which embed a PDE into the loss of the neural network using automatic differentiation. The PINN algorithm is simple, and it can be applied to different types of PDEs, including integro-differential equations, fractional PDEs, and stochastic PDEs. Moreover, from the implementation point of view, PINNs solve inverse problems as easily as forward problems. We propose a new residual-based adaptive refinement (RAR) method to improve the training efficiency of PINNs. For pedagogical reasons, we compare the PINN algorithm to a standard finite element method. We also present a Python library for PINNs, DeepXDE, which is designed to serve both as an education tool to be used in the classroom as well as a research tool for solving problems in computational science and engineering. Specifically, DeepXDE can solve forward problems given initial and boundary conditions, as well as inverse problems given some extra measurements. DeepXDE supports complex-geometry domains based on the technique of constructive solid geometry, and enables the user code to be compact, resembling closely the mathematical formulation. We introduce the usage of DeepXDE and its customizability, and we also demonstrate the capability of PINNs and the user-friendliness of DeepXDE for five different examples. More broadly, DeepXDE contributes to the more rapid development of the emerging Scientific Machine Learning field.

Paper Structure

This paper contains 23 sections, 1 theorem, 25 equations, 10 figures, 3 tables, 6 algorithms.

Key Result

Theorem 2.1

\newlabelthm:app0 Let $\mathbf{m}^i \in \mathbb{Z}_+^d$, $i=1,\dots, s$, and set $m=\max_{i=1,\dots,s} |\mathbf{m}^i|$. Assume $\sigma \in C^m(\mathbb{R})$ and $\sigma$ is not a polynomial. Then the space of single hidden layer neural nets is dense in i.e., for any $f \in C^{\mathbf{m}^1,\dots,\mathbf{m}^s}(\mathbb{R}^d)$, any compact $K \subset \mathbb{R}^d$, and any $\varepsilon > 0$, there e

Figures (10)

  • Figure 1: Schematic of a PINN for solving the diffusion equation $\frac{\partial u}{\partial t} = \lambda \frac{\partial^2 u}{\partial x^2}$ with mixed boundary conditions (BC) $u(x,t) = g_D(x,t)$ on $\Gamma_D \subset \partial \Omega$ and $\frac{\partial u}{\partial \mathbf{n}}(x,t) = g_R(u, x,t)$ on $\Gamma_R \subset \partial \Omega$. The initial condition (IC) is treated as a special type of boundary conditions. $\mathcal{T}_f$ and $\mathcal{T}_b$ denote the two sets of residual points for the equation and BC/IC.
  • Figure 1: Flowchart of DeepXDE corresponding to Procedure \ref{['alg:deepxde']}. The white boxes define the PDE problem and the training hyperparameters. The blue boxes combine the PDE problem and training hyperparameters in the white boxes. The orange boxes are the three steps (from right to left) to solve the PDE.
  • Figure 1: Example 4.1. Comparison of the PINN solution with the solution obtained by using spectral element method (SEM). (A) the SEM solution $u_{SEM}$, (B) the PINN solution $u_{NN}$, (C) the absolute error $|u_{SEM} - u_{NN}|$.
  • Figure 2: Convergence of the amplitude for each frequency during the training process. (A) A neural network is trained to approximate the function $f(x) = \sum_{k=1}^5 \sin(2kx)/(2k)$. The color represents amplitude values with the maximum amplitude for each frequency normalized to 1. (B) A PINN is used to solve the Poisson equation $- f_{xx} = \sum_{k=1}^5 2k \sin(2kx)$ with zero boundary conditions. We use a neural network of 4 hidden layers and 20 neurons per layer. The learning rate is chosen as $10^{-4}$, and 500 random points are sampled for training.
  • Figure 2: Examples of constructive solid geometry (CSG) in 2D. (left) A and B represent the rectangle and circle, respectively. The union $A|B$, difference $A-B$, and intersection $A\& B$ are constructed from A and B. (right) A complex geometry (top) is constructed from a polygon, a rectangle and two circles (bottom) through the union, difference, and intersection operations. This capability is included in the module geometry of DeepXDE.
  • ...and 5 more figures

Theorems & Definitions (1)

  • Theorem 2.1