Learning goals¶
Write data and physics losses for a known ODE fragment
Explain the role of the physics weight
Contrast forward PINNs with supervised surrogates
Reading¶
Original PINN formulation Raissi et al., 2019
Three pieces¶
Neural network — usually input (and maybe known parameters / controls); output
Data loss — match measurements or labeled simulator trajectories
Physics loss — collocation residual of the ODE/DAE fragment
Total loss:
Plain words: the network is pulled toward the data and toward obeying physics. sets how hard the physics pull is.
Forward-style use¶
In a forward PINN, parameters inside the residual are known and fixed. The network learns trajectories (or a surrogate solution) consistent with physics and any available labels.
| If | If you ignore data |
|---|---|
| You may fit waveforms that violate physics | You may get a residual-minimizing curve that misses measurements |
Worked example¶
For the classical swing equations with known , place collocation points in time and write and explicitly. Train with a small labeled window plus residual.
Strengths and limits of physics losses¶
The points below follow the discussion of physical losses in Thuerey et al. (2021), rewritten for the swing equation.
| Strength | Limit |
|---|---|
| Needs no solver: only the network, AD, and the residual | Soft constraint. The residual is only penalized, so a trained still violates the swing equation by some amount. Report the residual next to trajectory error |
| Works with sparse or partial measurements (e.g. only measured) | Collocation cost. The residual is only checked at collocation points. Fault switching at and needs points concentrated around the events |
| Same code pattern for forward and inverse problems | Loss weighting. , and have different scales, so (and per-term weights) change the answer. See gradient scaling |
| Smooth, differentiable output in | Weak extrapolation. A network trained on s is not a simulator. Outside the training window, or for a new clearing time, it must be re-checked against Lab 1 |
Plain words: a PINN is a curve fitted to data and nudged toward the physics. It is not a solver that guarantees the physics.
Lab¶
Optional further practice (does not replace Lab 2): ANDES PINN surrogate gallery
Further reading¶
Thuerey et al. (2021), physical losses and discussion of physical losses (Burgers examples; same ideas); Lab 2
Common misconceptions¶
Calling every residual network an “inverse PINN”
Reporting only without trajectory metrics
Assuming a trained forward PINN is a stability certificate
- Raissi, M., Perdikaris, P., & Karniadakis, G. E. (2019). Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378, 686–707. 10.1016/j.jcp.2018.10.045
- Thuerey, N., Holzschuh, B., Holl, P., Kohl, G., Lino, M., Liu, Q., Schnell, P., & Trost, F. (2021). Physics-based Deep Learning. arXiv. 10.48550/arXiv.2109.05237