Metadata-Version: 2.1
Name: torchphysics
Version: 1.0.1
Summary: PyTorch implementation of Deep Learning methods to solve differential equations
Home-page: https://github.com/boschresearch/torchphysics
Author: Nick Heilenkötter, Tom Freudenberg
Author-email: nick7@uni-bremen.de, tomfre@uni-bremen.de
License: Apache-2.0
Project-URL: Documentation, https://torchphysics.readthedocs.io/en/latest/
Project-URL: Source, https://github.com/boschresearch/torchphysics
Project-URL: Changelog, https://github.com/boschresearch/torchphysics/blob/main/CHANGELOG.rst
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Description-Content-Type: text/x-rst; charset=UTF-8
License-File: LICENSE.txt
License-File: NOTICE
License-File: AUTHORS.rst
Requires-Dist: torch (<2.0.0,>=1.7.1)
Requires-Dist: pytorch-lightning (<2.0.0,>=1.3.4)
Requires-Dist: numpy (>=1.20.2)
Requires-Dist: matplotlib (>=3.0.0)
Requires-Dist: scipy (>=1.6.3)
Requires-Dist: importlib-metadata ; python_version < "3.8"
Provides-Extra: all
Requires-Dist: trimesh (>=3.9.19) ; extra == 'all'
Requires-Dist: shapely (>=1.7.1) ; extra == 'all'
Requires-Dist: rtree (>=0.9.7) ; extra == 'all'
Requires-Dist: networkx (>=2.5.1) ; extra == 'all'
Provides-Extra: testing
Requires-Dist: setuptools ; extra == 'testing'
Requires-Dist: pytest ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'

==============
TorchPhysics
==============

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

.. _PyTorch: https://pytorch.org/

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 


.. _Trimesh: https://github.com/mikedh/trimesh
.. _Shapely: https://github.com/shapely/shapely
.. _`PyTorch Lightning`: https://www.pytorchlightning.ai/


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

- `Tutorial: Understanding the structure of TorchPhysics`_
- `Examples: Different applications with detailed explanations`_
- Documentation_

.. _`Tutorial: Understanding the structure of TorchPhysics`: https://torchphysics.readthedocs.io/en/latest/tutorial/tutorial_start.html
.. _`Examples: Different applications with detailed explanations`: https://github.com/boschresearch/torchphysics/tree/main/examples
.. _Documentation: https://torchphysics.readthedocs.io/en/latest/api/modules.html


Installation
============
TorchPhysics reqiueres the follwing dependencies to be installed: 

- PyTorch_ >= 1.7.1, < 2.0.0
- `PyTorch Lightning`_ >= 1.3.4, < 2.0.0
- Numpy_ >= 1.20.2
- Matplotlib_ >= 3.0.0
- Scipy_ >= 1.6.3

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

.. code-block:: python

  pip install torchphysics

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

.. code-block:: python

  pip install torchphysics[all]


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

.. code-block:: python

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

.. _Numpy: https://numpy.org/
.. _Matplotlib: https://matplotlib.org/
.. _Scipy: https://scipy.org/

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.

.. _`seminar project`: http://www.math.uni-bremen.de/zetem/cms/detail.php?template=modellierungsseminar
.. _`University of Bremen`: https://www.uni-bremen.de/en/
.. _`Robert Bosch GmbH`: https://www.bosch.de/en/

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.

.. _GitHub: https://github.com/boschresearch/torchphysics

License
=======
TorchPhysics uses an Apache License, see the LICENSE_ file.

.. _LICENSE: https://github.com/boschresearch/torchphysics/blob/main/LICENSE.txt


Bibliography
============
.. [1] Raissi, Perdikaris und Karniadakis, “Physics-informed neuralnetworks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations”, 2019.
.. [2] Bu and Karpatne, “Quadratic Residual Networks: A New Class of Neural Networks for Solving Forward and Inverse Problems in Physics Involving PDEs”, 2021
.. [3] E and Yu, "The Deep Ritz method: A deep learning-based numerical algorithm for solving variational problems", 2017
.. [4] Lu, Jin and Karniadakis, “DeepONet: Learning nonlinear operators for identifying differential equations based on the universal approximation theorem of operators”, 2020
.. [5] Wang, Wang and Perdikaris, “Learning the solution operator of parametric partial differential equations with physics-informed DeepOnets”, 2021
.. [6] McClenny und Braga-Neto, “Self-Adaptive Physics-Informed NeuralNetworks using a Soft Attention Mechanism”, 2020
