Some examples of using PINN to solve PDEs numerically.
PINN official implementation: https://github.com/maziarraissi/PINNs
SA-PINN official implementation: https://github.com/levimcclenny/SA-PINNs
Update:
- Add SA-PINN implementation for below examples:
- Poisson 2D
- Diffusion equation
- Burgers equation
- In SA-PINN implementation, I provide "save model" and "load model" function. Also, I add my trained models to the repo.
Poisson 1D with boundary condition:
where
The exact solution is:
PINN solution and the exact solution:
Poisson 2D with boundary condition:
where
The exact solution is:
(Example from Juan Diego Toscano's Leaning PIML in Python, example 4: diffusion equation)
Diffusion equation with initial condition and boundary conditions:
The exact solution is:
PINN solution v.s. the exact solution:
Poisson 1D (Inverse Problem) with boundary condition:
PDE: $$\left{\begin{array}{l} -\lambda u^{''}(x) = f(x) \quad x \in (-1, 1) \ u(-1) = u(1) = 0 \end{array}\right.$$
where
Exact solution(for generating training set) is:
We're going to train a DNN to approximate
PINN solution:
I learned how to use PINN to solve burgers equation from omniscientoctopus' code. Much of my code is same as omniscientoctopus' code, but I add some comments and my ideas in my code.
Here's omniscientoctopus' GitHub repo: https://github.com/omniscientoctopus/Physics-Informed-Neural-Networks
The data I used is also from omniscientoctopus' GitHub repo.
Burgers equation: $$\left{ \begin{array}{l} u_t + uu_x = \nu u_{xx} \quad x \in [-1, 1], t \in [0, 1] \newline u(x, 0) = u_0(x) \newline u(-1, t) = u(1, t) = 0 \end{array} \right.$$
where
PINN results:
SA-PINN results:
(Example from https://youtu.be/UTC6cccEEnM?t=267)
Allen-Cahn equation for two-phase microstructrue evolution:
SA-PINN results: