Giter Site home page Giter Site logo

disouzam / thermodynamicsgnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quercushernandez/thermodynamicsgnn

1.0 0.0 0.0 175.64 MB

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

Home Page: http://amb.unizar.es/people/quercus-hernandez/

License: GNU General Public License v3.0

Shell 2.69% Python 97.31%

thermodynamicsgnn's Introduction

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}
}

thermodynamicsgnn's People

Contributors

quercushernandez avatar

Stargazers

jotatx 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.