This repository contains experiments with Physics-Informed Neural Networks (PINNs) for solving partial differential equations by incorporating governing physics directly into the training objective.
Currently, the repository includes:
- Burgers Equation (Standard vs Fourier PINN)
- Electrostatic Potential via Laplace Equation
We solve the 1D viscous Burgers equation:
Domain:
$x \in [-1,1]$ $t \in [0,1]$
Initial condition:
Boundary conditions:
This setup is a standard PINN benchmark due to the formation of steep gradients (shock-like behavior).
A fully connected neural network approximates
- PDE residual loss
- Initial condition loss
- Boundary condition loss
Residual:
Training strategy:
- Adam (initial convergence)
- L-BFGS (refinement)
To mitigate spectral bias, inputs are mapped using Fourier features:
This improves the model’s ability to represent high-frequency components, particularly near the shock region.
- The standard PINN captures global dynamics but shows higher residuals near
$x \approx 0$ . - The Fourier PINN improves resolution of steep gradients and yields more uniform residuals.
Link: https://github.com/mhtjsh/PINN/blob/Primary/PINN_w_electorstatic_potential_through_Laplace_eqn.ipynb
We solve the 2D Laplace equation:
or equivalently,
This governs electrostatic potential in regions with no charge.
A neural network approximates
The loss consists of:
- PDE residual:
- Boundary condition loss
Second-order derivatives are computed using automatic differentiation.
- The model learns smooth potential fields consistent with Laplace dynamics.
- Results are strongly influenced by boundary conditions, as expected for elliptic PDEs.
- Compared to Burgers, convergence is more stable due to the absence of nonlinear advection.
- Burgers Equation highlights challenges in PINNs for nonlinear PDEs with sharp gradients and demonstrates the benefit of Fourier feature embeddings.
- Laplace Equation provides a stable setting illustrating PINNs for elliptic PDEs governed primarily by boundary conditions.
Overall, these notebooks illustrate both the strengths and limitations of PINNs, particularly the role of representation and optimization in solving different classes of PDEs.