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.
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.
The governing equation:
in the following domain:
With the following boundary conditions:
When normalized:
.-----------------------------------------------------------------------.
|.##.....#.#######....###...#######........########.###.##....#.##....##|
|.##.....#.##........##.##.....##..........##.....#..##.###...#.###...##|
|.##.....#.##.......##...##....##..........##.....#..##.####..#.####..##|
|.########.######..##.....#....##...######.########..##.##.##.#.##.##.##|
|.##.....#.##......########....##..........##........##.##..###.##..####|
|.##.....#.##......##.....#....##..........##........##.##...##.##...###|
|.##.....#.#######.##.....#....##..........##.......###.##....#.##....##|
'-----------------------------------------------------------------------'
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.
.-----------------------------------------------------------------------.
|.##.....#.#######....###...#######........########.###.##....#.##....##|
|.##.....#.##........##.##.....##..........##.....#..##.###...#.###...##|
|.##.....#.##.......##...##....##..........##.....#..##.####..#.####..##|
|.########.######..##.....#....##...######.########..##.##.##.#.##.##.##|
|.##.....#.##......########....##..........##........##.##..###.##..####|
|.##.....#.##......##.....#....##..........##........##.##...##.##...###|
|.##.....#.#######.##.....#....##..........##.......###.##....#.##....##|
'-----------------------------------------------------------------------'
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
.-----------------------------------------------------------------------.
|.##.....#.#######....###...#######........########.###.##....#.##....##|
|.##.....#.##........##.##.....##..........##.....#..##.###...#.###...##|
|.##.....#.##.......##...##....##..........##.....#..##.####..#.####..##|
|.########.######..##.....#....##...######.########..##.##.##.#.##.##.##|
|.##.....#.##......########....##..........##........##.##..###.##..####|
|.##.....#.##......##.....#....##..........##........##.##...##.##...###|
|.##.....#.#######.##.....#....##..........##.......###.##....#.##....##|
'-----------------------------------------------------------------------'
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
Temperature profiles:
Results obtained from a 9 layered DNN (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 |
This implementation is based on Tensorflow 2.0 package and made possible by Google Colabratory GPU.