YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
π₯ PINN Heat Equation Solver
Physics-Informed Neural Network (PINN) for solving the 2D Transient Heat Equation
Built for CV/Portfolio β B.Tech Computer Engineering | AI/ML/DL Track
π Project Overview
This project implements a Physics-Informed Neural Network (PINN) to solve the 2D transient heat diffusion PDE without requiring any labeled simulation data. The neural network learns to satisfy both the governing PDE and the boundary/initial conditions simultaneously, using automatic differentiation (via PyTorch autograd) to compute spatial and temporal derivatives.
Problem Statement
βu/βt = Ξ± (βΒ²u/βxΒ² + βΒ²u/βyΒ²) on Ξ© = [0,1]Β² Γ [0,1]
IC: u(x, y, 0) = sin(Οx)Β·sin(Οy)
BC: u = 0 on all boundaries (Dirichlet)
Exact: u(x,y,t) = e^(β2ΟΒ²Ξ±t) Β· sin(Οx) Β· sin(Οy)
π§ Architecture
Input: (x, y, t) β 3 neurons
[Linear(3β64) β Tanh] β [Linear(64β128) β Tanh]
[Linear(128β128) β Tanh] β [Linear(128β64) β Tanh]
Output: u(x, y, t) β 1 neuron
Loss Function:
L_total = L_pde + Ξ»_bc Β· L_bc + Ξ»_ic Β· L_ic
π Full Repository Structure
PINN-Heat-Equation-Solver/
βββ README.md
βββ requirements.txt
β
βββ pinn_heat_equation.py # Core: HeatPINN model + autograd PDE residual
βββ train.py # Two-phase training: Adam β L-BFGS
βββ evaluate.py # Error metrics (global + per time-slice)
βββ visualize.py # Prediction vs. analytical plots
βββ inverse_problem.py # β
Identify unknown Ξ± from noisy sensor data
βββ benchmark.py # β
PINN vs. Finite Difference Method (FDM)
β
βββ configs/
β βββ config.yaml # All hyperparameters (centralized)
β
βββ utils/
β βββ __init__.py
β βββ losses.py # Modular PDE / BC / IC loss functions
β βββ collocation.py # Uniform collocation point samplers
β βββ adaptive_sampling.py # β
Residual-adaptive refinement (RAR)
β βββ schedulers.py # β
Warmup-cosine & cyclic LR schedulers
β
βββ experiments/
β βββ ablation_study.py # β
Depth Γ Width Γ Activation Γ N_col study
β βββ uncertainty_estimation.py # β
MC-Dropout uncertainty quantification
β
βββ notebooks/
βββ PINN_Heat_Equation.ipynb # Full interactive walkthrough
β = modules added beyond baseline; these are what make this project stand out.
π Quick Start
git clone https://huggingface.co/sarvesh74/PINN-Heat-Equation-Solver
cd PINN-Heat-Equation-Solver
pip install -r requirements.txt
# Forward problem
python train.py --config configs/config.yaml
python evaluate.py --checkpoint results/pinn_best.pth
python visualize.py
# Inverse problem (identify unknown Ξ± from sensor data)
python inverse_problem.py --alpha_true 0.01 --alpha_init 0.05 --n_obs 200
# Benchmark vs. classical FDM
python benchmark.py --checkpoint results/pinn_best.pth
# Ablation study
python experiments/ablation_study.py
# Uncertainty quantification
python experiments/uncertainty_estimation.py
π Results
| Metric | Value |
|---|---|
| Relative L2 Error | < 1.5% |
| Inverse problem (Ξ± recovery) | < 2% error from 200 noisy observations |
| Training: Adam | 3,000 epochs |
| Training: L-BFGS | 2,000 epochs |
| Collocation points | 10,000 (+ adaptive refinement) |
π¬ Key Concepts Demonstrated
| Concept | Where |
|---|---|
| Automatic differentiation for PDEs | pinn_heat_equation.py |
| Multi-objective loss (PDE + BC + IC) | utils/losses.py |
| Residual-adaptive sampling (RAR) | utils/adaptive_sampling.py |
| Two-phase optimization (Adam + L-BFGS) | train.py |
| Inverse problem (learn unknown PDE param) | inverse_problem.py |
| PINN vs FDM benchmark | benchmark.py |
| MC-Dropout uncertainty quantification | experiments/uncertainty_estimation.py |
| Ablation study (arch + hyperparams) | experiments/ablation_study.py |
| LR scheduling (warmup-cosine, cyclic) | utils/schedulers.py |
π Academic Context
Course: Deep Learning / Neural Computation (CE 401)
Institution: Pillai College of Engineering, New Panvel
Degree: B.Tech Computer Engineering
Domain: Scientific Machine Learning / Computational Physics
π References
- Raissi et al. (2019). Physics-informed neural networks. Journal of Computational Physics, 378, 686β707.
- Karniadakis et al. (2021). Physics-informed machine learning. Nature Reviews Physics, 3(6), 422β440.
- Lu et al. (2021). DeepXDE: A deep learning library for solving differential equations. SIAM Review, 63(1), 208β228.
- Gal & Ghahramani (2016). Dropout as a Bayesian approximation. ICML.
π License
MIT License β free to use, modify, and distribute with attribution.
Made with β€οΈ by Sarvesh β B.Tech CSE (AI/ML/DL)