MIT License

项目介绍

314arhaam/heat-pinn 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 187 个 Star、28 次 Fork。

仓库全名
314arhaam/heat-pinn
开源许可证
MIT License
Star 数
187
Fork 数
28
未关闭 Issue
2

README 摘要

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 Results 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

heat-pinn 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 187 个 Star。

heat-pinn 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 heat-pinn 的源码?

可以直接克隆仓库:git clone https://github.com/314arhaam/heat-pinn.git,默认分支为 main;安装与运行步骤见仓库 README。

heat-pinn 最近还在维护吗?

仓库最近一次更新为 5月31日,当前有 2 个未关闭 Issue;Star 数为 187,可作为社区活跃度的参考。

关于

A Physics-Informed Neural Network to solve 2D steady-state heat equations.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

语言占比

Dockerfile
Jupyter Notebook
Python
Shell

Release

贡献者

README

CI

Validation-CPU

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

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.

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:

Results

Doughnut geometry

Screw

Connecting Rod

Gear geometry

Performance Comparison

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

Note

This implementation is based on Tensorflow 2.0 package and made possible by Google Colabratory GPU.

评论

暂无评论