Downloads · 30 days
0
sarvesh74/PINN-Heat-Equation-Solver
PINN-Heat-Equation-Solver is a machine learning model from sarvesh74. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Physics-Informed Neural Network (PINN) for solving the 2D Transient Heat Equation Built for CV/Portfolio — B.Tech Computer Engineering | AI/ML/DL Track
Downloads · 30 days
0
Access
Public
Updated Sep 17, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py63.9 KB · 81%
From the Hugging Face model README
Physics-Informed Neural Network (PINN) for solving the 2D Transient Heat Equation
Built for CV/Portfolio — B.Tech Computer Engineering | AI/ML/DL Track
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.
∂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)
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
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.
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
| 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) |
| 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 |
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
MIT License — free to use, modify, and distribute with attribution.
Made with ❤️ by Sarvesh — B.Tech CSE (AI/ML/DL)