If you see this, something is wrong
First published on Tuesday, Jun 2, 2026 and last modified on Wednesday, Jun 10, 2026 by François Chaplais.
WebMagic
The purpose of this demonstration is to build some documentation about Physics-Informed Neural Networks, or PINNs. These are presented in the introduction below.
You can also consult the Wikipedia page on the subject.
The content of this section is directly imported from the following two documents:
Any change in the original documents will be reflected in this document after HTML export.
PINNs, or Physics-Informed Neural Networks, are neural networks trained not only on data, but also on the physical laws that govern a system.
Normally, a neural network learns from input-output examples:
A PINN does that too, but adds another requirement:
So instead of learning only from data, the model learns from:
Because the training process is “informed” by known physics.
For example, suppose you want to model temperature \( u(x,t)\) over space and time.
A regular neural network might try to fit temperature data points.
A PINN says:
For example:
The neural network outputs \( u(x,t)\) , and using automatic differentiation, we compute:
Then we penalize the network if:
A PINN usually has a loss function with several parts:
Matches known observations.
Enforces the differential equation.
where \( f(x,t)\) is the residual of the PDE.
Example:
Makes sure the solution satisfies known constraints.
Total loss:
They are useful when:
Applications include:
You know the equation and parameters, and want the solution.
Example:
You know some observations, but want to infer unknown parameters.
Example:
PINNs are especially attractive for inverse problems.
They combine:
This means they can work even with limited data because physics gives extra guidance.
PINNs are powerful, but not perfect.
Common problems:
So PINNs are not a universal replacement for traditional methods.
Think of a normal neural network as a student who memorizes examples.
A PINN is a student who:
So it gives answers that are not only close to the data, but also physically consistent.
If you want, I can also give you:
Here’s a very simple PINN example in PyTorch for the 1D ODE
The exact solution is:
This is simpler than a full PDE PINN, but it shows the main idea clearly.
We train a neural network \( u_\theta(x)\) such that:
We use automatic differentiation to compute \( du/dx\) .
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
# -----------------------------
# Neural network
# -----------------------------
class PINN(nn.Module):
def __init__(self):
super().__init__()
self.net = nn.Sequential(
nn.Linear(1, 20),
nn.Tanh(),
nn.Linear(20, 20),
nn.Tanh(),
nn.Linear(20, 1)
)
def forward(self, x):
return self.net(x)
# -----------------------------
# Create model
# -----------------------------
model = PINN()
# Optimizer
optimizer = optim.Adam(model.parameters(), lr=0.01)
# -----------------------------
# Training loop
# -----------------------------
for epoch in range(5000):
optimizer.zero_grad()
# Collocation points inside the domain [0, 1]
x_phys = torch.rand(100, 1, requires_grad=True)
# Network prediction
u = model(x_phys)
# Compute du/dx using autograd
du_dx = torch.autograd.grad(
u,
x_phys,
grad_outputs=torch.ones_like(u),
create_graph=True
)[0]
# Physics residual: u' + u = 0
physics_residual = du_dx + u
physics_loss = torch.mean(physics_residual**2)
# Boundary condition u(0) = 1
x_bc = torch.tensor([[0.0]])
u_bc = model(x_bc)
bc_loss = (u_bc - 1.0)**2
# Total loss
loss = physics_loss + bc_loss
loss.backward()
optimizer.step()
if epoch print(f"Epoch {epoch}, Loss: {loss.item():.6f}")
# -----------------------------
# Test and plot
# -----------------------------
x_test = torch.linspace(0, 1, 100).reshape(-1, 1)
u_pred = model(x_test).detach().numpy()
u_exact = torch.exp(-x_test).numpy()
plt.plot(x_test.numpy(), u_pred, label="PINN prediction")
plt.plot(x_test.numpy(), u_exact, "--", label="Exact solution")
plt.legend()
plt.xlabel("x")
plt.ylabel("u(x)")
plt.title("PINN solving u'(x) = -u(x), u(0)=1")
plt.show()
The model takes one input:
and outputs one value:
We want:
So we compute:
u = model(x_phys)
du_dx = autograd(...)
Then the residual is:
physics_residual = du_dx + uIf the network is perfect, this should be zero everywhere.
We also enforce:
with:
x_bc = torch.tensor([[0.0]])
u_bc = model(x_bc)
bc_loss = (u_bc - 1.0)**2
We combine both:
loss = physics_loss + bc_lossSo the network is trained to:
Because the network is not trained from labeled data pairs like:
Instead, it is trained from:
That is exactly the key idea of a Physics-Informed Neural Network.
After training, the prediction should look close to:
even though we never directly gave the network the true solution values as training targets.
The next simple example would be a PINN for the 1D heat equation:
That would show:
If you want, I can give you that next.
We have stored here the links to a few arXiv papers.
You can get the source of the articles by visiting the links and select "TeX source" in the upper right corner of the page.
We have already imported some.
We are going to proceed as follows.
The document will be Differentiable Chemistry in PINNs for Solving Parameterized and Stiff Reaction Systems .
Here is the BibTeX entry.
@misc{babić2026differentiablechemistrypinnssolving,
title={Differentiable Chemistry in PINNs for Solving Parameterized and Stiff Reaction Systems},
author={Miloš Babić and Franz M. Rohrhofer and Stefan Posch},
year={2026},
eprint={2605.04708},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2605.04708},
}The data comes from Kaggle . Here is what the author says about the data.
The dataset was designed to support the development, training, and validation of physics-informed graph neural network (PI-GNN) models for electrochemical CO2 reduction (eCO2R) reactors. Its primary purpose is to bridge the gap between high-fidelity multiphysics simulations, limited experimental measurements, and data-efficient machine learning, enabling accurate prediction, scale-up analysis, and optimization of electrochemical reactors under realistic operating conditions. The dataset structure explicitly reflects the graph-based representation of reactor domains, where each graph corresponds to a discretized reactor instance with variable resolution (500–5,000 nodes), accommodating differences in reactor geometry, mesh density, and operating regime.
We will upload the CSV data and insert a dynamic table built around this CSV data.