This is an implementation of PINN(s) on TensorFlow 2 to solve 2D wave equation under Dirichlet / Neumann boundary condition without training data (data to fit initial & boundary conditions need to be provided). This is enabled by automatic differentiation, which is a generalization of back-propagation. Within this code, PINN-derived solution is compared with FDM (Finite Difference Method) approximation to show a quantitative agreement. While original work is built on TensorFlow 1.x, this repository's implementation is on TensorFlow 2.x to enable GPU acceleration. Besides, this code also implements L-LAAF for further speed-up.
Simply type
python main.py
to run the entire code (this includes FDM simulation, PINN training, inferece, and comparison). Basic parameters (e.g., network architecture, batch size, initializer, etc.) are found in
params.py
and could be modified depending on the problem setup.
By default, this code trains PINN on GPU. To run on CPU, one should refer to
main.py
and change
with tf.device("/device:GPU:0"):
to
with tf.device("/device:CPU:0"):
(found at line 76).
Tested on
python 3.8.10
with the following:
Package | Version |
---|---|
numpy | 1.22.1 |
scipy | 1.7.3 |
tensorflow | 2.8.0 |
[1] Raissi, M., Perdikaris, P., Karniadakis, G.E.: Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations, Journal of Computational Physics, Vol. 378, pp. 686-707, 2019. (paper)
[2] Baydin, A.G., Pearlmutter, B.A., Radul, A.A., Siskind, J.M.: Automatic Differentiation in Machine Learning: A Survey, Journal of Machine Learning Research, Vol. 18, No. 1, pp. 5595–5637, 2018. (paper)
[3] Rumelhart, D., Hinton, G., Williams, R.: Learning representations by back-propagating errors, Nature, Vol. 323, pp. 533–536, 1986. (paper)
[4] Jagtap, A.D., Kawaguchi, K., Karniadakis, GE.: Locally adaptive activation functions with slope recovery for deep and physics-informed neural networks, Proceedings of Royal Society A, pp. 4762020033420200334, 2020. (paper)