Skip to main content

PyTorch implementation of Deep Learning methods to solve differential equations

Project description

TorchPhysics is a Python library of (mesh-free) deep learning methods to solve differential equations. You can use TorchPhysics e.g. to

  • solve ordinary and partial differential equations

  • train a neural network to approximate solutions for different parameters

  • solve inverse problems and interpolate external data

The following approaches are implemented using high-level concepts to make their usage as easy as possible:

  • physics-informed neural networks (PINN) [1]

  • QRes [2]

  • the Deep Ritz method [3]

  • DeepONets [4] and Physics-Informed DeepONets [5]

We aim to also include further implementations in the future.

TorchPhysics is build upon the machine learning library PyTorch.

Features

The Goal of this library is to create a basic framework that can be used in many different applications and with different deep learning methods. To this end, TorchPhysics aims at a:

  • modular and expandable structure

  • easy to understand code and clean documentation

  • intuitive and compact way to transfer the mathematical problem into code

  • reliable and well tested code basis

Some built-in features are:

  • mesh free domain generation. With pre implemented domain types: Point, Interval, Parallelogram, Circle, Triangle and Sphere

  • loading external created objects, thanks to a soft dependency on Trimesh and Shapely

  • creating complex domains with the boolean operators Union, Cut and Intersection and higher dimensional objects over the Cartesian product

  • allowing interdependence of different domains, e.g. creating moving domains

  • different point sampling methods for every domain: RandomUniform, Grid, Gaussian, Latin hypercube, Adaptive and some more for specific domains

  • different operators to easily define a differential equation

  • pre implemented fully connected neural network and easy implementation of additional model structures

  • sequentially or parallel evaluation/training of different neural networks

  • normalization layers and adaptive weights [6] to speed up the training process

  • powerful and versatile training thanks to PyTorch Lightning

    • many options for optimizers and learning rate control

    • monitoring the loss of individual conditions while training

Getting Started

To learn the functionality and usage of TorchPhysics we recommend to have a look at the following sections:

Installation

TorchPhysics reqiueres the follwing dependencies to be installed:

Installing TorchPhysics with pip, automatically downloads everything that is needed:

pip install torchphysics

Additionally, to use the Shapely and Trimesh functionalities, install the library with the option all:

pip install torchphysics[all]

If you want to add functionalities or modify the code. We recommend copying the repository and installing it locally:

git clone https://github.com/boschresearch/torchphysics
cd path_to_torchphysics_folder
pip install .[all]

About

TorchPhysics was originally developed by Nick Heilenkötter and Tom Freudenberg, as part of a seminar project at the University of Bremen, in cooperation with the Robert Bosch GmbH. Special thanks belong to Felix Hildebrand, Uwe Iben, Daniel Christopher Kreuter and Johannes Mueller, at the Robert Bosch GmbH, for support and supervision while creating this library.

Contribute

If you are missing a feature or detect a bug or unexpected behaviour while using this library, feel free to open an issue or a pull request in GitHub or contact the authors. Since we developed the code as a student project during a seminar, we cannot guarantee every feature to work properly. However, we are happy about all contributions since we aim to develop a reliable code basis and extend the library to include other approaches.

License

TorchPhysics uses an Apache License, see the LICENSE file.

Bibliography

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchphysics-1.0.1.tar.gz (7.5 MB view details)

Uploaded Source

Built Distribution

torchphysics-1.0.1-py2.py3-none-any.whl (126.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file torchphysics-1.0.1.tar.gz.

File metadata

  • Download URL: torchphysics-1.0.1.tar.gz
  • Upload date:
  • Size: 7.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for torchphysics-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b8c9b6b5d2ab9dccd07d3b25beb126dd25d00dfe090301594431be6f5f81aebd
MD5 002372d118b2886dcbd5d9ab21619a7c
BLAKE2b-256 d1df8d775bd20572cc480ef66666724006043090ac43c3eb6f8e93980fcba9a8

See more details on using hashes here.

File details

Details for the file torchphysics-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for torchphysics-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2ac6a54023b83a801ff99f9f0c27f5d9eaabbe3f05f488e768bb264db9d7f856
MD5 c4fd03819ebf3123f7de1237370138aa
BLAKE2b-256 87a242f634b13016e1214ee4e13702c7a329ab568ae633ac15add8a167054db7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page