Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/TomF98/torchphysics into main
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Freudenberg <[email protected]>
  • Loading branch information
Tom Freudenberg committed Mar 1, 2024
2 parents ba06977 + 750e06b commit 3b99722
Show file tree
Hide file tree
Showing 49 changed files with 6,150 additions and 997 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docs-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: documentation

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false


jobs:
build-docs:
runs-on: [ubuntu-latest]
container: python:3.10-bookworm
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get update
apt-get -y install xvfb pandoc
python -m pip install --upgrade pip setuptools setuptools_scm wheel
pip install -e .[docs]
pip install -r docs/requirements.txt
- name: Build documentation
run: |
sphinx-build -b html docs/ _site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.ref_name == 'main'
needs: build-docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
80 changes: 80 additions & 0 deletions .github/workflows/pypi-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and upload to PyPI

on:
release:
type: [published]

env:
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-*
CIBW_BEFORE_BUILD: pip install cython
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014

jobs:
build_wheels:
name: Build wheels on [ ubuntu-latest ]
runs-on: [ ubuntu-latest ]
strategy:
matrix:
os: [ubuntu-latest] #, windows-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.10'

- name: Install cibuildwheel
run: |
# python -m pip install cibuildwheel
pip install -U setuptools setuptools_scm wheel
- name: Build wheels
run: |
# python -m cibuildwheel --output-dir wheelhouse
python setup.py bdist_wheel
- uses: actions/upload-artifact@v2
with:
path: ./dist/*.whl


build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.10'

- name: Install setuptools
run: |
pip install -U setuptools setuptools_scm wheel
- name: Build sdist
run: python setup.py sdist

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.upload_pypi }}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: Unit tests

on:
push:
branches: '**'
branches: [ main ]
pull_request:
branches: [ main ]

Expand All @@ -16,17 +16,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel
python -m pip install flake8 pytest pytest-cov
python -m pip install -e .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ Version 1.0.1
=============
- Updated documentation and error messages
- Simplyfied creation/definition of DeepONets
- Add more evalution types for the DeepONet
- Add more evalution types for the DeepONet

Version 1.0.2
=============
- Test for python versions up to 3.10
17 changes: 17 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,23 @@ since we aim to develop a reliable code basis and extend the library to include

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

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

.. code-block:: latex

@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.
Expand Down
23 changes: 4 additions & 19 deletions batch_scripts/environment.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
name: vib-acc
name: torchphyics
dependencies:
- python
- numpy>=1.20.2
- pytest
- pytest-cov
- flake8
- scipy
- pandas
- jupyter
- shapely
- pip
- pip:
- pylife
- tsfresh
- spyder
- spyder-unittest
- torch>=1.7.1
- pytorch-lightning>=1.3.0
- trimesh>=3.9.19
- rtree>=0.9.7
- networkx>=2.5.1
- matplotlib>=3.4.2
- scipy
- pandas
- shapely
2 changes: 1 addition & 1 deletion batch_scripts/start_Jupyter_notebook.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
call conda activate ../_venv
call jupyter notebook --notebook-dir ../use_cases
call jupyter notebook --notebook-dir ../examples

2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
"sphinx.ext.ifconfig",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"nbsphinx",
"nbsphinx_link",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
9 changes: 8 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ trimesh>=3.9.19
shapely>=1.7.1
rtree>=0.9.7
scipy>=1.6.3
networkx>=2.5.1
networkx>=2.5.1
jupyter
nbsphinx
nbsphinx-link
sphinx_rtd_theme>=1.0
ipywidgets
ipython<8.17.0 # https://github.com/ipython/ipython/issues/14235
ipykernel
3 changes: 3 additions & 0 deletions docs/tutorial/Introduction_Tutorial_PINNs.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "../../examples/tutorial/Introduction_Tutorial_PINNs.ipynb"
}
41 changes: 18 additions & 23 deletions docs/tutorial/main_page.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,43 @@
=========================
The TorchPhysics Tutorial
=========================
Here one can find all important information and knowledge to get started with the
Here one can find all important information and knowledge to get started with the
software library TorchPhysics.

In order to make it as easy and user-friendly as possible for all users,
In order to make it as easy and user-friendly as possible for all users,
both complete novices and professionals in Machine Learning and PDEs, to get started, the tutorial
starts with some basics regarding differential equations and neural networks. For more
experienced users, these points can be skipped.

Afterward, we give a rough overview of different Deep Learning approaches for solving
Afterward, we give a rough overview of different Deep Learning approaches for solving
differential equations, with a focus on PINNs and DeepONet.

The main and final topic is the use of TorchPhysics. Here we split the tutorial into two parts.
The first part, guides you along some implementations of different small examples, while showing
The first part, guides you along some implementations of different small examples, while showing
all the important aspects and steps to solve a differential equation in TorchPhysics. This tutorial
series is aimed at an audience which is more interested on the direct utilization of the library
series is aimed at an audience which is more interested on the direct utilization of the library
and for getting a fast and small overview of the possibilities.

To get a deeper understanding of the library, we show in the second part how the library is
To get a deeper understanding of the library, we show in the second part how the library is
internally structured. This series is more aimed for users who plan to add or change functionalities.


Basics of Deep Learning and Differential Equations
=====================================================
Will be added in the future.
.. toctree::
:maxdepth: 1
:caption: Basics tutorial

Introduction_Tutorial_PINNs

Overview of Deep Learning Methods for Differential Equations
============================================================
Will be added in the future.

.. toctree::
:maxdepth: 1
:caption: Applied tutorial

Usage of TorchPhysics
=====================
Like mentioned at the beginning, here we explain the aspects of TorchPhysics in more
detail. We split the tutorial into two categories:
applied_tutorial_start

1) A more applied tutorial to learn TorchPhysics by implementing some examples.
All basics features will be explained. The start can be found here_.

2) A more in depth tutorial that focuses more on the library architecture. This
tutorial begins on this page_.
.. toctree::
:maxdepth: 1
:caption: In depth tutorial


.. _here : applied_tutorial_start.html
.. _page : tutorial_start.html
tutorial_start
Loading

0 comments on commit 3b99722

Please sign in to comment.