Skip to content

quercushernandez/ThermodynamicsGNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thermodynamics-informed graph neural networks

Project page Paper IEEE TAI

Abstract

In this paper we present a deep learning method to predict the temporal evolution of dissipative dynamic systems. We propose using both geometric and thermodynamic inductive biases to improve accuracy and generalization of the resulting integration scheme. The first is achieved with Graph Neural Networks, which induces a non-Euclidean geometrical prior with permutation invariant node and edge update functions. The second bias is forced by learning the GENERIC structure of the problem, an extension of the Hamiltonian formalism, to model more general non-conservative dynamics. Several examples are provided in both Eulerian and Lagrangian description in the context of fluid and solid mechanics respectively, achieving relative mean errors of less than 3% in all the tested examples. Two ablation studies are provided based on recent works in both physics-informed and geometric deep learning.

For more information, please refer to the following:

Setting it up

First, clone the project.

# clone project
git clone https://github.com/quercushernandez/ThermodynamicsGNN.git
cd ThermodynamicsGNN

Then, install the needed dependencies. The code is implemented in Pytorch. Note that this has been tested using Python 3.9.

# install dependencies
pip install numpy scipy matplotlib torch torch-geometric torch-scatter

How to run the code

Test pretrained nets

The results of the paper (Couette flow, bending beam and flow past a cylinder) can be reproduced with the following scripts, found in the executables/ folder.

python main.py --sys_name couette --train False --n_hidden 2 --dim_hidden 10 --passes 10
python main.py --sys_name beam --train False --n_hidden 2 --dim_hidden 50 --passes 10
python main.py --sys_name cylinder --train False --n_hidden 2 --dim_hidden 128 --passes 10

The data/ folder includes the database and the pretrained parameters of the networks. The resulting time evolution of the state variables is plotted and saved in .gif format in a generated outputs/ folder.

Couette Flow Bending Beam Flow past a Cylinder

Train a custom net

You can also run your own experiments for the implemented datasets by setting custom parameters manually. Several training examples can be found in the executables/ folder. The manually trained parameters and output plots are saved in the outputs/ folder.

e.g.
python main.py --sys_name beam --train True --lr 1e-3 ...

General Arguments:

Argument Description Options
--sys_name Study case couette, beam, cylinder
--train Train mode True, False
--gpu Enable GPU acceleration True, False
--output_dir Output data directory Default: output
--plot_sim Plot a test simulation True, False

Training Arguments:

Argument Description Options
--n_hidden Number of MLP hidden layers Default: 2
--dim_hidden Dimension of hidden layers Default: 10
--passes Number of message passing blocks Default: 10
--lr Learning rate Default: 1e-3
--lambda_d Data loss weight Default: 1e2
--noise_var Variance of the training noise Default: 1e-2
--batch_size Training batch size Default: 2
--max_epoch Maximum number of training epochs Default: 6000
--miles Learning rate scheduler milestones Default: 2000 4000
--gamma Learning rate scheduler decay Default: 1e-1

Citation

If you found this code useful please cite our work as:

@article{hernandez2022thermodynamics,
  title={Thermodynamics-informed Graph Neural Networks},
  author={Hernandez, Quercus and Badias, Alberto and Chinesta, Francisco and Cueto, Elias},
  journal={IEEE Transactions on Artificial Intelligence},
  year={2022},
  publisher={IEEE}
}

About

Code for the paper "Thermodynamics-informed graph neural networks" published in IEEE Transactions on Artificial Intelligence (TAI).

Topics

Resources

License

Stars

Watchers

Forks