The canonical PINN gallery

Part 1 — The PINN formulation

Learning objectives

  • See the same PINN machinery solve four canonical PDEs by changing only the residual function
  • Recognise that PINNs are problem-agnostic; the architecture, optimiser, and AD machinery do not change
  • Identify which problems are 1D ODEs vs 2D PDEs, and how that changes the visualisation — not the training algorithm
  • Be ready for Part 4, which scales the same machinery up to the multi-dimensional wave PDEs of seismology

Part 1 has built a complete PINN toolkit:

  • Forward and inverse problem formulations (§1.2, §1.6).
  • Soft and hard boundary-condition enforcement (§1.4, §1.5).
  • Input-derivative AD up to second order (the runtime extension at the start of Part 1).
  • Multi-component loss functions with per-term weighting.

The reveal of this last section is that none of these pieces depend on the specific PDE. Switch the residual function and the same machinery solves a different problem. We close Part 1 with a four-problem gallery to make this completely concrete.

Four canonical problems, one PINN

The widget below solves four very different PDEs:

  • Logistic ODE u(t)=u(1u)u'(t) = u(1-u). A nonlinear first-order growth model. Solution: a sigmoid curve from 0.1 toward 1. Residual R=uu(1u)R = u' - u(1-u) — the only thing the PINN sees.
  • Simple harmonic oscillator u+ω2u=0u'' + \omega^2 u = 0. A linear second-order conservative system. Solution: cos(ωt)\cos(\omega t). Residual R=u+ω2uR = u'' + \omega^2 u.
  • Damped oscillator u+2γu+ω2u=0u'' + 2\gamma u' + \omega^2 u = 0. Linear, second-order, dissipative. Solution: an exponentially decaying cosine. Residual R=u+2γu+ω2uR = u'' + 2\gamma u' + \omega^2 u.
  • 1D heat ut=αuxxu_t = \alpha u_{xx}. A 2D PDE in (x,t)(x, t). Linear, first-order in time, second-order in space. Solution: an exponentially decaying sine wave that satisfies u(0,t)=u(1,t)=0u(0,t) = u(1,t) = 0. Residual R=utαuxxR = u_t - \alpha u_{xx}.

Try it

Pinn GalleryInteractive figure — enable JavaScript to interact.

Pick a problem from the dropdown. The current equation is shown in the blue strip below the controls. Press Play. The simpler problems (logistic, heat) reach sub-1% relative error within 1–2 thousand epochs; the oscillatory ones (harmonic, damped) reach a few-percent error in the same time and continue to descend with more training. Notice that the architecture is the same in every case: a 1- or 2-input Tanh MLP with two hidden layers of 32 neurons. The only thing that changes between problems is which residual is plugged into the loss.

References

  • Raissi, M., Perdikaris, P., Karniadakis, G.E. (2019). Physics-informed neural networks. J. Comput. Phys. 378, 686–707.
  • Karniadakis, G.E., Kevrekidis, I.G., Lu, L., Perdikaris, P., Wang, S., Yang, L. (2021). Physics-informed machine learning. Nat. Rev. Phys. 3, 422–440.
  • Lu, L., Meng, X., Mao, Z., Karniadakis, G.E. (2021). DeepXDE: A deep learning library for solving differential equations. SIAM Review 63(1), 208–228.
  • Cuomo, S., Di Cola, V.S., Giampaolo, F., et al. (2022). Scientific machine learning through physics-informed neural networks: Where we are and what is next. J. Sci. Comput. 92(3), 88.

What scales up, what does not

The four problems above all share three properties that make them tractable in the browser:

  • Low-dimensional input (1D or 2D).
  • Small numbers of collocation points (≤80 in 1D; ≤100 in 2D).
  • Smooth solutions — no shocks, no high-frequency content beyond what the network can comfortably represent.

Real seismic PINN problems break some or all of these comforts. A 2D acoustic wave equation has a wavefield that oscillates many cycles within the domain (high-frequency content). A 3D acoustic problem has the curse of dimensionality. Multi-parameter inversion adds output dimensions. The same residual-loss recipe handles them all — but with extra care: spectral-bias-resistant architectures (§0.9), causality-aware loss schedules (Part 3 §3.5), domain decomposition (Part 3 §3.8), uncertainty quantification (Part 9 §9.5). Part 1 has just put the recipe into your hands; Parts 3–9 add the engineering that makes it scale.

Expertise checkpoint - end of Part 1

If you have understood Part 1, you should now be able to:

  • Write down the PINN loss function for any PDE plus its initial and boundary conditions, including the appropriate residual term.
  • Distinguish forward and inverse problems and adjust the loss accordingly.
  • Choose between soft and hard constraint enforcement and justify the choice.
  • Recognise the loss-balance crisis when training stalls, and identify the corrective tools that Part 3 provides.
  • Read a multi-component loss curve and identify which term is bottlenecking convergence.
  • Set up a simple inverse problem where an unknown PDE coefficient is recovered via gradient descent jointly with the network.

If any of those is shaky, the relevant section is in the sidebar. If all are solid, you are ready for Part 2, which surveys the architecture choices that make these PINNs more (or less) suitable for the problems Parts 3–9 will throw at them: vanilla MLPs, Fourier-feature embeddings, SIREN, hard-constrained nets, multi-scale architectures.

Pause-and-check. (1) For each of the four gallery problems, what is the input dimension of the network? (2) The damped-oscillator residual involves uu'. Does the same training algorithm need higher-order AD than the harmonic-oscillator case? Why or why not? (3) The 1D heat equation's solution decays exponentially fast. What does this tell you about why the PINN converges quickly on this problem despite needing 2D inputs?

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.