Skip to main content

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

  • learn function operators mapping functional parameters to solutions

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

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

  • The Deep Ritz method [2]

  • DeepONets [3] and physics-informed DeepONets [4]

  • Fourier Neural Operators (FNO) [6] and physics-informed FNO

  • Model order reduction networks (PCANN) [7]

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 [5] 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 requires the following dependencies to be installed:

To install TorchPhysics you can run the following code in any Python environment where pip is installed

pip install torchphysics

Or by

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

if you want to modify the code.

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

Cite TorchPhysics

If TorchPhysics has been helpful for your research, please cite:

@article{TorchPhysics,
    author = {Derick Nganyu Tanyu and Jianfeng Ning and Tom Freudenberg and Nick Heilenkötter and Andreas Rademacher and Uwe Iben and Peter Maass},
    title = {Deep learning methods for partial differential equations and related parameter identification problems},
    journal = {Inverse Problems},
    doi = {10.1088/1361-6420/ace9d4},
    year = {2023},
    publisher = {IOP Publishing},
    volume = {39},
    number = {10},
    pages = {103001}}

License

TorchPhysics uses an Apache License, see the LICENSE file.

Bibliography

Release files for torchphysics 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torchphysics 1.1.2
File Size Uploaded
torchphysics-1.1.2.tar.gz 101.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for torchphysics 1.1.2
File Interpreter ABI Platform
torchphysics-1.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 101.2 MB

Release files / torchphysics-1.1.2.tar.gz

Download URL torchphysics-1.1.2.tar.gz
Size 101.0 MB
Tags Source
SHA-256 checksum
How to use checksums
33939533cb9933d34894802840f2e1152875fccc081835869cfadbb5732709af
BLAKE2b-256 checksum
How to use checksums
b5bf755867ede8b646f3aee0c90b8ea7b139a6bffd8b3df0fc3e0516681d06bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 12, 2026.

Transparency log

Release files / torchphysics-1.1.2-py2.py3-none-any.whl

Download URL torchphysics-1.1.2-py2.py3-none-any.whl
Size 154.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5bd70215760762194ab14f58d52d080b147815e66d45bc0b3370dd3e80f25f36
BLAKE2b-256 checksum
How to use checksums
355c2618832fbc2411ff241f1d6c4f28c2650a62ecaecfcff8e7f030efc97716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page