https://github.com/314arhaam/heat-pinn
A Physics-Informed Neural Network to solve 2D steady-state heat equations.
https://github.com/314arhaam/heat-pinn
chemical-engineering deep-learning finite-difference heat-equation heat-transfer machine-learning partial-differential-equations physics physics-informed-ml physics-informed-neural-networks process-engineering python3
Last synced: 5 days ago
JSON representation
A Physics-Informed Neural Network to solve 2D steady-state heat equations.
- Host: GitHub
- URL: https://github.com/314arhaam/heat-pinn
- Owner: 314arhaam
- License: mit
- Created: 2021-11-12T16:06:33.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2026-05-25T01:56:58.000Z (19 days ago)
- Last Synced: 2026-05-25T03:25:01.740Z (19 days ago)
- Topics: chemical-engineering, deep-learning, finite-difference, heat-equation, heat-transfer, machine-learning, partial-differential-equations, physics, physics-informed-ml, physics-informed-neural-networks, process-engineering, python3
- Language: Jupyter Notebook
- Homepage:
- Size: 2.23 MB
- Stars: 182
- Watchers: 5
- Forks: 25
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/314arhaam/heat-pinn/actions/workflows/ci.yml)
[](https://github.com/314arhaam/heat-pinn/actions/workflows/validation.yml)
# Heat-PINN
A Physics-Informed Neural Network, to solve 2D steady-state heat equation based on the methodology, introduced in: Physics Informed Deep Learning (Part I): Data-driven Solutions of Nonlinear Partial Differential Equations.
## **Table of Contents**
- [Introduction](#intro)
- [Results](#res)
## Introduction
In this project, a PINN is trained to solve a 2D heat equation and the final results is compared to a solution based on FDM method.
For more detailts about the project read [this](https://github.com/314arhaam/burger-pinn).
### Problem
The governing equation:
$$
\Theta = \frac{T - T_{\textbf{min}}}{T_{\textbf{max}}-T_{\textbf{min}}}
$$
$$
\nabla^2{\Theta} = (\partial_{xx}+\partial_{yy})\Theta=0
$$
in the following domain:
$$
D = \\{ (x, y)|-1\le x \le +1 \land -1\le y \le +1 \\}
$$
With the following boundary conditions:
$$
\begin{equation}
\begin{cases}
T(-1, y) = 75.0 \degree{C}\\
T(+1, y) = 0.0 \degree{C}\\
T(x, -1) = 50.0 \degree{C}\\
T(x, +1) = 0.0 \degree{C}\\
\end{cases}
\end{equation}
$$
When normalized:
$$
\begin{equation}
\begin{cases}
\Theta(-1, y) = 1\\
\Theta(+1, y) = 0\\
\Theta(x, -1) = \frac{2}{3}\\
\Theta(x, +1) = 0\\
\end{cases}
\end{equation}
$$
## Heat-PINN CLI
### Installation
### Build
```
.-----------------------------------------------------------------------.
|.##.....#.#######....###...#######........########.###.##....#.##....##|
|.##.....#.##........##.##.....##..........##.....#..##.###...#.###...##|
|.##.....#.##.......##...##....##..........##.....#..##.####..#.####..##|
|.########.######..##.....#....##...######.########..##.##.##.#.##.##.##|
|.##.....#.##......########....##..........##........##.##..###.##..####|
|.##.....#.##......##.....#....##..........##........##.##...##.##...###|
|.##.....#.#######.##.....#....##..........##.......###.##....#.##....##|
'-----------------------------------------------------------------------'
usage: heat build [-h] [--in-shape IN_SHAPE] [--out-shape OUT_SHAPE]
[--n-hidden-layers N_HIDDEN_LAYERS]
[--neuron-per-layer NEURON_PER_LAYER] [--actfun ACTFUN]
[--name NAME]
options:
-h, --help show this help message and exit
--in-shape IN_SHAPE Shape of the input tensor to feed into NN. Equal to
the number of independent variables of PDE.
--out-shape OUT_SHAPE
Shape of the output tensor of NN. For heat transfer
it's T (equal to 1)
--n-hidden-layers N_HIDDEN_LAYERS
Number of hidden layers in the NN
--neuron-per-layer NEURON_PER_LAYER
Number of neurons in each hidden layer
--actfun ACTFUN Activation function
--name NAME Name of the model.
```
### Train
```
.-----------------------------------------------------------------------.
|.##.....#.#######....###...#######........########.###.##....#.##....##|
|.##.....#.##........##.##.....##..........##.....#..##.###...#.###...##|
|.##.....#.##.......##...##....##..........##.....#..##.####..#.####..##|
|.########.######..##.....#....##...######.########..##.##.##.#.##.##.##|
|.##.....#.##......########....##..........##........##.##..###.##..####|
|.##.....#.##......##.....#....##..........##........##.##...##.##...###|
|.##.....#.#######.##.....#....##..........##.......###.##....#.##....##|
'-----------------------------------------------------------------------'
usage: heat train [-h] [--domain DOMAIN] [--boundary BOUNDARY] [--model MODEL]
[-l LR] [--epochs EPOCHS] [--every EVERY]
options:
-h, --help show this help message and exit
--domain DOMAIN Path of domain data file
--boundary BOUNDARY Path of boundary data file
--model MODEL Path of model file
-l LR, --lr LR, --learning-rate LR
Learning rate for the optimizer
--epochs EPOCHS Number of training epochs
--every EVERY Print result for every n epochs
```
### Inference
```
.-----------------------------------------------------------------------.
|.##.....#.#######....###...#######........########.###.##....#.##....##|
|.##.....#.##........##.##.....##..........##.....#..##.###...#.###...##|
|.##.....#.##.......##...##....##..........##.....#..##.####..#.####..##|
|.########.######..##.....#....##...######.########..##.##.##.#.##.##.##|
|.##.....#.##......########....##..........##........##.##..###.##..####|
|.##.....#.##......##.....#....##..........##........##.##...##.##...###|
|.##.....#.#######.##.....#....##..........##.......###.##....#.##....##|
'-----------------------------------------------------------------------'
usage: heat infer [-h] [--data DATA] [--model MODEL] [--output OUTPUT]
options:
-h, --help show this help message and exit
--data DATA Path of data file to perform inference
--model MODEL Path of model file
--output OUTPUT Path of output data file
```
## Validation
### Square geometry
Temperature profiles:
### Doughnut geometry
### Screw
### Connecting Rod
### Gear geometry
## Performance Comparison
Results obtained from a [9 layered DNN](https://github.com/314arhaam/heat-pinn/blob/main/assets/model_plot.png) (1000 epochs) and FDM code on a 100×100 grid. The FDM code is written in Python.
|**Method**|**Computation time (s)**|
|-|-|
|PINN|66.35|
|FDM|77.60|
## Note
This implementation is based on [Tensorflow 2.0](https://www.tensorflow.org/guide/effective_tf2) package and made possible by [Google Colabratory](https://colab.research.google.com) GPU.