Package: torchphysics
TorchPhysics is a Python library of (mesh-free) deep learning methods to solve differential equations.
You can use TorchPhysics e.g. tosolve ordinary and partial differential equationstrain a neural network to approximate solutions for different parameterssolve inverse problems and interpolate external dataThe 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 libraryPyTorch.FeaturesThe 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 structureeasy to understand code and clean documentationintuitive and compact way to transfer the mathematical problem into codereliable and well tested code basisSome built-in features are:mesh free domain generation. With pre implemented domain types:Point, Interval, Parallelogram, Circle, Triangle and Sphereloading external created objects, thanks to a soft dependency onTrimeshandShapelycreating complex domains with the boolean operatorsUnion,CutandIntersectionand higher dimensional objects over the Cartesian productallowing interdependence of different domains, e.g. creating moving domainsdifferent point sampling methods for every domain:RandomUniform, Grid, Gaussian, Latin hypercube, Adaptiveand some more for specific domainsdifferent operators to easily define a differential equationpre implemented fully connected neural network and easy implementation
of additional model structuressequentially or parallel evaluation/training of different neural networksnormalization layers and adaptive weights[6]to speed up the training processpowerful and versatile training thanks toPyTorch Lightningmany options for optimizers and learning rate controlmonitoring the loss of individual conditions while trainingGetting StartedTo learn the functionality and usage of TorchPhysics we recommend
to have a look at the following sections:Tutorial: Understanding the structure of TorchPhysicsExamples: Different applications with detailed explanationsDocumentationInstallationTorchPhysics reqiueres the follwing dependencies to be installed:PyTorch>= 1.7.1, < 2.0.0PyTorch Lightning>= 1.3.4, < 2.0.0Numpy>= 1.20.2Matplotlib>= 3.0.0Scipy>= 1.6.3Installing TorchPhysics withpip, automatically downloads everything that is needed:pipinstalltorchphysicsAdditionally, to use theShapelyandTrimeshfunctionalities, install the library
with the optionall:pipinstalltorchphysics[all]If you want to add functionalities or modify the code. We recommend copying the
repository and installing it locally:gitclonehttps://github.com/boschresearch/torchphysicscdpath_to_torchphysics_folderpipinstall.[all]AboutTorchPhysics was originally developed by Nick Heilenkötter and Tom Freudenberg,
as part of aseminar projectat theUniversity of Bremen, in cooperation with theRobert 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.ContributeIf 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 inGitHubor 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.LicenseTorchPhysics uses an Apache License, see theLICENSEfile.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