IRK-PINNs#

A framework for high-order Runge-Kutta time-discrete Physics-Informed Neural Networks (IRK-PINNs).#

pre-commit Ruff

Documentation#

The code of this repository belongs to the manuscript Learning phase-space flows using time-discrete implicit Runge-Kutta PINNs {add full reference to proceedings and arXiv}; when using the code, this manuscript should be referenced. Please see the full documentation at https://cmi.pages.desy.de/CMI-public/runge-kutta-pinn.

The necessary code for creation and training of the high-order PINNs is stored in /IRK_PINNs/runge_kutta.py. It can be installed following the installation guide.

To use IRK-PINNs, the order q of the implicit Runge-Kutta method needs to be defined. The error of the method scales as $O(\Delta t ^{2q})$, where $\Delta t$ is the time step. The Butcher’s tableau for the q={30, 100, 499} is provided in the folder /IRK_weights, as obtained from https://github.com/maziarraissi/PINNs. These coefficients were computed using Gauss-Legendre Runge-Kutta method, which is A-stable for all orders. Any other order/method could also be used by adding the coefficients with the same format.

Examples#

We provide a notebook for each of the examples shown in the manuscript and add some other examples that were not included in it.

We divide the examples, following the paper’s convention, into phase_space_trajectories and, for completion, functional.

In phase_space_trajectories, we provide the solution of the two examples provided in the paper: The mass particle in a Gaussian central potential and the charged particle under the action of a periodic laser field. In addition, an extra example for a charged particle in an inhomogeneous electric field is added.

In functional, the solution to the Allen-Cahn equation, the 2D heat equation, the Taylor-Green vortices solution of the Navier-Stokes equation and the non-linear Schrödinger equation are provided.

All the examples follow a similar structure: we define/load a solution to benchmark our results, then, we provide the details of the IRK and NN that we want to use. Next, we define the partial differential equation that we are solving and its boundary condition (if any). With all of this, we train the Neural Network and provide a visualization of the results.

Features#

Project based on:

  • Poetry for packaging and dependency management

  • Nox for automation of checks and other development tasks

It comes with many pre-installed modules for testing, documentation, auto-formatting and so on. For more details, please refere to Hypermodern Python Cookiecutter. It provides a solid basis for any Python project.

To get up to scratch, refer to The Good Research Code Handbook for a good introduction about software development in a scientific environment.

Installation#

You need four tools to use this installation:

  • Conda/Mamba to manage your virtual environments

  • Poetry to manage packaging and dependencies

  • Nox to automate checks and other tasks

  • nox-poetry for using Poetry in Nox sessions

Install Poetry by running:

$ conda install poetry

Installation guide#

  1. Create a new Conda environment with poetry installed if you don’t have installed as described above.

    $ conda create --name myenv poetry
    
  2. Activate the Conda environment.

    $ conda activate myenv
    
  3. Install new project in environment:

    $ poetry install
    
  4. Install pre-commit hooks

    $ pre-commit install
    
  5. Open REPL and import module

    from IRK_PINNs import runge_kutta
    
  6. Run test case

    runge_kutta.main()
    

License#

Distributed under the terms of the GPL 3.0 license, IRK-PINNs is free and open source software.

Issues#

If you encounter any problems, please file an issue along with a detailed description.

Credits#

This project was generated from @cjolowicz’s Hypermodern Python Cookiecutter template and @drivendata’s Cookiecutter Data Science.