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

Python PyTorch License: MIT HuggingFace


πŸ“Œ 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

  1. Raissi et al. (2019). Physics-informed neural networks. Journal of Computational Physics, 378, 686–707.
  2. Karniadakis et al. (2021). Physics-informed machine learning. Nature Reviews Physics, 3(6), 422–440.
  3. Lu et al. (2021). DeepXDE: A deep learning library for solving differential equations. SIAM Review, 63(1), 208–228.
  4. 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)

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support