Giter Site home page Giter Site logo

evansoong517 / pdes-pinn-examples-using-tensorflow2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from huangboming/pdes-pinn-examples-using-tensorflow2

0.0 0.0 0.0 4 MB

Some examples of using PINN to solve PDEs numerically

Python 0.41% Jupyter Notebook 99.59%

pdes-pinn-examples-using-tensorflow2's Introduction

PDEs-PINN-Examples-Using-Tensorflow2

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 example

Poisson 1D with boundary condition:

$$\left{ \begin{array}{l} -u^{''}(x) = f(x) \quad \textrm{for } , x \in [-1, 1] \newline u(-1) = u(1) = 0 \end{array} \right.$$

where $f(x) = \pi^2 \sin(\pi x)$.

The exact solution is: $u(x) = \sin(\pi x)$

PINN solution and the exact solution: PINN_Poisson_1D


Poisson 2D example

Poisson 2D with boundary condition:

$$ \left{ \begin{array}{l} -\Delta u(x, y) = f(x, y) \quad \textrm{for } , (x, y) \in \Omega = [-1, 1] \times [-1, 1] \newline u|_{\partial \Omega} = 0 \end{array} \right. $$

where $f(x, y) = 2\pi^2 \sin(\pi x)\sin(\pi y)$.

The exact solution is: $u(x, y) = \sin(\pi x) \sin(\pi y)$

PINN solution: PINN_Poisson_2D

The exact solution: Exact_Poisson_2D


Diffusion Equation example

(Example from Juan Diego Toscano's Leaning PIML in Python, example 4: diffusion equation)

Diffusion equation with initial condition and boundary conditions:

$$ \left{ \begin{array}{l} u_t = u_{xx} - e^{-t}(\sin(\pi x) - \pi^2\sin(\pi x)) \quad x \in [-1, 1], t\in [0, 1] \newline u(x, 0) = \sin(\pi x) \newline u(-1, t) = u(1, t) = 0 \end{array} \right. $$

The exact solution is: $u(x, t) = e^{-t}\sin(\pi x)$.

PINN solution v.s. the exact solution: pinn solution 2d real solution 2d

pinn solution 3d real solution 3d


Poisson 1D (Inverse Problem) example

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 $f(x) = \pi^2 \sin(\pi x)$.

Exact solution(for generating training set) is: $u(x) = \sin(\pi x)$.

We're going to train a DNN to approximate $\lambda$. (The exact result is $\lambda = 1$)

PINN solution:

Poisson 1D results Poisson 1D lambda history


Burgers Equation example

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 $u_0(x) = -\sin(\pi x)$, $\nu = \frac{0.01}{\pi}$

PINN results:

real and pinn solution

SA-PINN results:

real solution sa-pinn solution real v.s sa-pinn solution


Allen-Cahn Equation(2D) example

(Example from https://youtu.be/UTC6cccEEnM?t=267)

Allen-Cahn equation for two-phase microstructrue evolution:

$$\left{\begin{array}{l}u_t - 0.00001u_{xx} + 5u^3 - 5u = 0 \quad x\in[-1,1], t \in [0,1] \newline u(x, 0) = x^2 \cos(\pi x) \newline u(-1, t) = u(1, t) \newline u_x(-1, t) = u_x(1, t) \end{array} \right.$$

SA-PINN results:

real solution 2d sapinn solution 2d

real solution 3d sapinn solution 3d

t=0s t=0.25s t=0.50s t=0.75s

pdes-pinn-examples-using-tensorflow2's People

Contributors

huangboming avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.