diff --git a/.gitattributes b/.gitattributes index c0e7769..86fb66c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Notebooks are not application code: keep them out of the language statistics. -tutorial*/** linguist-vendored=true +tutorials/** linguist-vendored=true # Data files are binary, not text. *.pt binary diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f61fc66..9da3eb6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,22 +1,22 @@ # CODEOWNERS file for PINA-Tutorials # Default owners for everything in the repo -* @mathLab/pina-developers +* @PINA-org/pina-maintainers # Tutorial content -tutorial*/ @mathLab/pina-developers -static/ @mathLab/pina-developers +tutorials/ @PINA-org/pina-maintainers +static/ @PINA-org/pina-maintainers # Project-wide config -pyproject.toml @mathLab/pina-developers @ndem0 -.gitignore @ndem0 @dario-coscia -.gitattributes @ndem0 @dario-coscia +pyproject.toml @PINA-org/pina-committee @ndem0 +.gitignore @PINA-org/pina-committee +.gitattributes @PINA-org/pina-committee # Workflows -.github/ @ndem0 @dario-coscia +.github/ @PINA-org/pina-committee # Security & policy files -LICENSE @FilippoOlivo @GiovanniCanali @ndem0 @dario-coscia -SECURITY.md @FilippoOlivo @GiovanniCanali @ndem0 @dario-coscia -CODE_OF_CONDUCT.md @FilippoOlivo @GiovanniCanali @ndem0 @dario-coscia -MAINTAINERS.md @FilippoOlivo @GiovanniCanali @ndem0 @dario-coscia +LICENSE @PINA-org/pina-committee +SECURITY.md @PINA-org/pina-committee +CODE_OF_CONDUCT.md @PINA-org/pina-committee +MAINTAINERS.md @PINA-org/pina-committee diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 24354a5..508065e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -13,4 +13,3 @@ This PR closes #ISSUE_NUMBER. - [ ] The entry has been added to `README.md`, in the right section - [ ] Any new dataset or image is committed, and is referenced by URL pointing at this repository -- [ ] External links were checked (no `mathLab/PINA/.../tutorials/` paths remain) diff --git a/.github/workflows/deployer.yml b/.github/workflows/deployer.yml new file mode 100644 index 0000000..0efc931 --- /dev/null +++ b/.github/workflows/deployer.yml @@ -0,0 +1,61 @@ +name: "Deployer" + +on: + pull_request: + branches: + - "main" + push: + branches: + - "main" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: deploy-tutorials-${{ github.ref }} + cancel-in-progress: false + +jobs: + docs: + name: Build documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install documentation dependencies + run: python3 -m pip install ".[docs]" + + - name: Build documentation + run: python3 -m sphinx -W --keep-going -b html docs/source docs/build/html + + - name: Upload GitHub Pages artifact + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + uses: actions/upload-pages-artifact@v3 + with: + path: docs/build/html + + deploy: + name: Deploy documentation + needs: docs + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Configure GitHub Pages + uses: actions/configure-pages@v5 + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + diff --git a/.github/workflows/exporter.yml b/.github/workflows/exporter.yml index 3a5185f..89195e6 100644 --- a/.github/workflows/exporter.yml +++ b/.github/workflows/exporter.yml @@ -4,249 +4,176 @@ on: workflow_dispatch: inputs: pina_ref: - description: "PINA ref to test the tutorials against (branch, tag or SHA)" + description: "PINA ref to run the tutorials against (branch, tag or SHA)" required: false default: "master" - full_rebuild: - description: "Re-execute every tutorial instead of only the changed ones" - type: boolean - required: false - default: false push: branches: - "main" paths: - # Notebooks live exactly one level deep: tutorial/tutorial.ipynb. - # Note that a '**/' segment would match nothing here. - - 'tutorial*/*.ipynb' + - 'tutorials/tutorial*/tutorial.ipynb' schedule: - # Nightly. Catches regressions in the PINA package that break a tutorial - # without any notebook having changed. - - cron: '30 3 * * *' + # Weekly full export to catch regressions in PINA: Mondays at 03:30 UTC. + - cron: '30 3 * * 1' concurrency: group: export-tutorials-${{ github.ref }} cancel-in-progress: false env: - # Per-notebook execution budget. - TUTORIAL_TIMEOUT: 1200 - # Slightly larger than the per-cell budget: a hard backstop for a notebook - # that wedges outside a single cell (download, data loader, ...). - NOTEBOOK_TIMEOUT: 1500 PINA_REPO: PINA-org/PINA - BUILD_DIR: build jobs: - export: - name: export notebooks - runs-on: ubuntu-latest + # run on push + export_tutorials_on_push: + if: ${{ github.event_name == 'push' }} permissions: contents: write pull-requests: write - + runs-on: ubuntu-latest + env: + TUTORIAL_TIMEOUT: 1200s steps: - uses: actions/checkout@v4 - with: - # Full history so the before/after diff of a push is available. - fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' - - name: Setup FFmpeg - uses: FedericoCarboni/setup-ffmpeg@v2 - - - name: Resolve configuration - id: config - run: | - set -euo pipefail - REF="${{ inputs.pina_ref || 'master' }}" - echo "pina_ref=$REF" >> "$GITHUB_OUTPUT" - echo "Testing tutorials against $PINA_REPO@$REF" - echo " documentation pins: https://github.com/$PINA_REPO/blob/master/docs/tutorials_ref" - - name: Install dependencies run: | set -euo pipefail python3 -m pip install --upgrade pip - # PINA comes from a git ref, not from this repository: the tutorials - # are the consumer here, so they must be exercised against a real - # PINA install rather than a local checkout. - python3 -m pip install "pina-mathlab[tutorial] @ git+https://github.com/$PINA_REPO@${{ steps.config.outputs.pina_ref }}" - # Installed directly rather than via '.[exporter]' so the workflow - # needs no build step for this repository. - python3 -m pip install nbconvert nbformat ipykernel "black[jupyter]" - python3 -m pip list 2>/dev/null | grep -Ei "pina-mathlab|torch |lightning|nbconvert|black" || true - - - name: Report tested PINA version - id: pina - run: | - set -euo pipefail - VER=$(python3 -c "import importlib.metadata as m; print(m.version('pina-mathlab'))") - echo "pina_version=$VER" >> "$GITHUB_OUTPUT" - echo "Testing against pina-mathlab $VER" + python3 -m pip install ".[tutorial,exporter]" \ + "pina-mathlab[tutorial] @ git+https://github.com/$PINA_REPO@master" - - name: Select notebooks - id: files - run: | - set -euo pipefail - ALL=$(find tutorial* -type f -name '*.ipynb' | sort) - - if [ "${{ inputs.full_rebuild }}" = "true" ]; then - FILES="$ALL" - echo "$ALL" | wc -l | xargs echo "notebooks (full rebuild):" - elif [ "${{ github.event_name }}" = "push" ]; then - BEFORE="${{ github.event.before }}" - if [ -z "$BEFORE" ] || [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then - FILES="$ALL" - else - FILES=$(git diff --name-only --diff-filter=ACMR "$BEFORE" "$GITHUB_SHA" \ - -- 'tutorial*/*.ipynb' || true) - fi - else - FILES="$ALL" - fi - - if [ -z "$FILES" ]; then - echo "No notebooks to export." - FILES="" - else - echo "$FILES" - echo "$FILES" | wc -l | xargs echo "notebooks:" - fi - echo "files<> "$GITHUB_OUTPUT" - echo "$FILES" >> "$GITHUB_OUTPUT" - echo "EOF" >> "$GITHUB_OUTPUT" + - name: Setup FFmpeg + uses: FedericoCarboni/setup-ffmpeg@v2 + + - id: files + uses: jitterbit/get-changed-files@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + format: space-delimited - name: Configure git run: | - set -euo pipefail git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Export notebooks to .py + - name: Run formatter + run: black tutorials/ + + - name: Export tutorials to .py and .html + env: + FILES: ${{ steps.files.outputs.all }} run: | set -euo pipefail - FILES="${{ steps.files.outputs.files }}" - [ -n "$FILES" ] || exit 0 for file in $FILES; do - dir=$(dirname "$file") - echo "-> $dir/tutorial.py" - python3 -Xfrozen_modules=off -m jupyter nbconvert "$file" \ - --to python --output tutorial.py --output-dir "$dir" + if [[ "$file" == tutorials/tutorial*/tutorial.ipynb ]]; then + filename=$(basename "$file") + pyfilename="${filename%.ipynb}.py" + htmlfilename="${filename%.ipynb}.html" + dir=$(dirname "$file") + htmldir="docs/source/$dir" + if [ ! -f "$file" ]; then + rm -rf "$htmldir" + continue + fi + timeout --signal=SIGKILL "$TUTORIAL_TIMEOUT" \ + python3 -Xfrozen_modules=off -m jupyter nbconvert "$file" \ + --to python --output "$pyfilename" --output-dir "$dir" + timeout --signal=SIGKILL "$TUTORIAL_TIMEOUT" \ + python3 -Xfrozen_modules=off -m jupyter nbconvert "$file" \ + --execute --to html --output "$htmlfilename" --output-dir "$htmldir" + fi done - - name: Run formatter - # Runs *after* the .py export so the generated files are formatted too. - # The whole tree is formatted, not just the exported notebooks, so the - # --check below is guaranteed to agree with what black wants. The first - # run reformats the committed .py exports; afterwards this is a no-op. - run: | - set -euo pipefail - python3 -m black . - python3 -m black --check . + - uses: benjlevesque/short-sha@v2.1 + id: short-sha - - name: Execute notebooks into ${{ env.BUILD_DIR }} + - name: Create Pull Request + uses: peter-evans/create-pull-request@v8.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: maintenance + title: "Export tutorial changed in ${{ steps.short-sha.outputs.sha }}" + branch: export-tutorial-${{ steps.short-sha.outputs.sha }} + base: ${{ github.ref_name }} + commit-message: "export tutorials changed in ${{ steps.short-sha.outputs.sha }}" + delete-branch: true + add-paths: | + tutorials/ + docs/source/tutorials/ + + # run on workflow_dispatch or the weekly schedule + export_tutorials_workflow_dispatch: + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + env: + TUTORIAL_TIMEOUT: 1200s + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + env: + PINA_REF: ${{ inputs.pina_ref || 'master' }} run: | set -euo pipefail - FILES="${{ steps.files.outputs.files }}" - [ -n "$FILES" ] || exit 0 + python3 -m pip install --upgrade pip + python3 -m pip install ".[tutorial,exporter]" \ + "pina-mathlab[tutorial] @ git+https://github.com/$PINA_REPO@$PINA_REF" - rm -rf "$BUILD_DIR" - mkdir -p "$BUILD_DIR" + - name: Setup FFmpeg + uses: FedericoCarboni/setup-ffmpeg@v2 - # Executing a *copy* keeps the committed notebooks output-free: the - # source of truth stays small and diff-friendly, while the rendered - # documentation gets a fully executed page. - for file in $FILES; do - dir=$(dirname "$file") - name=$(basename "$dir") - mkdir -p "$BUILD_DIR/$name" - cp "$file" "$BUILD_DIR/$name/tutorial.ipynb" - - echo "::group::executing $name" - set +e - timeout --signal=SIGKILL "$NOTEBOOK_TIMEOUT" \ - python3 -Xfrozen_modules=off -m jupyter nbconvert \ - "$BUILD_DIR/$name/tutorial.ipynb" \ - --to notebook --execute --inplace \ - --ExecutePreprocessor.kernel_name=python3 \ - --ExecutePreprocessor.timeout="$TUTORIAL_TIMEOUT" - status=$? - set -e - echo "::endgroup::" - - if [ $status -ne 0 ]; then - echo "::error::$name failed to execute (exit $status). The documentation build will not be updated with it." - exit $status - fi - done + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Publish executed notebooks to the built branch - if: steps.files.outputs.files != '' - env: - PINA_REF: ${{ steps.config.outputs.pina_ref }} - PINA_VERSION: ${{ steps.pina.outputs.pina_version }} + - name: Run formatter + run: black tutorials/ + + - name: Export all tutorials to .py and .html run: | set -euo pipefail + for file in $(find tutorials -type f -name tutorial.ipynb | sort); do + filename=$(basename "$file") + pyfilename="${filename%.ipynb}.py" + htmlfilename="${filename%.ipynb}.html" + dir=$(dirname "$file") + htmldir="docs/source/$dir" + timeout --signal=SIGKILL "$TUTORIAL_TIMEOUT" \ + python3 -Xfrozen_modules=off -m jupyter nbconvert "$file" \ + --to python --output "$pyfilename" --output-dir "$dir" + timeout --signal=SIGKILL "$TUTORIAL_TIMEOUT" \ + python3 -Xfrozen_modules=off -m jupyter nbconvert "$file" \ + --execute --to html --output "$htmlfilename" --output-dir "$htmldir" + done - # Record what this snapshot was built from, so the documentation - # repository can pin an immutable ref and report the version. - PINA_REF="$PINA_REF" PINA_VERSION="$PINA_VERSION" GITHUB_SHA="$GITHUB_SHA" \ - GITHUB_RUN_ID="$GITHUB_RUN_ID" \ - python3 -c ' - import datetime, json, os - meta = { - "pina_ref": os.environ["PINA_REF"], - "pina_version": os.environ["PINA_VERSION"], - "built_from": os.environ["GITHUB_SHA"], - "built_at": datetime.datetime.now(datetime.timezone.utc) - .strftime("%Y-%m-%dT%H:%M:%SZ"), - "run": os.environ["GITHUB_RUN_ID"], - } - with open(os.environ["BUILD_DIR"] + "/meta.json", "w") as fh: - json.dump(meta, fh, indent=2) - fh.write("\n") - ' - - # 'built' is an artefact branch: a self-contained snapshot, force - # pushed. Consumers pin the tag below, never the branch. - rm -rf "$BUILD_DIR/.git" - git -C "$BUILD_DIR" init -q - git -C "$BUILD_DIR" config user.name "github-actions[bot]" - git -C "$BUILD_DIR" config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git -C "$BUILD_DIR" add -A - git -C "$BUILD_DIR" commit -q -m "executed tutorials for pina-mathlab $PINA_VERSION" - git -C "$BUILD_DIR" push -f \ - "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \ - HEAD:refs/heads/built - - TAG="pina-$PINA_VERSION-${{ github.run_id }}" - git -C "$BUILD_DIR" tag -f "$TAG" - git -C "$BUILD_DIR" push -f \ - "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \ - "refs/tags/$TAG" - echo "Published snapshot as branch 'built' and tag '$TAG'" - - - name: Remove unwanted files - if: always() - run: rm -rf build/ + - uses: benjlevesque/short-sha@v2.1 + id: short-sha - name: Create Pull Request - # Commits the regenerated .py exports and any formatter changes back to - # main, so the source notebooks and their Python equivalents stay in sync. uses: peter-evans/create-pull-request@v8.1.1 with: token: ${{ secrets.GITHUB_TOKEN }} labels: maintenance - title: "Export tutorials in ${{ github.sha }}" - branch: export-tutorial-${{ github.run_id }} + title: "Export tutorial changed in ${{ steps.short-sha.outputs.sha }}" + branch: export-tutorial-${{ steps.short-sha.outputs.sha }} base: ${{ github.ref_name }} - commit-message: "export tutorials changed in ${{ github.sha }}" + commit-message: "export tutorials changed in ${{ steps.short-sha.outputs.sha }}" delete-branch: true add-paths: | - tutorial*/ - README.md + tutorials/ + docs/source/tutorials/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a82f776..47f8faa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,7 +87,7 @@ launched from the rendered documentation page. - Comment on data structure, format, and content. - Visualise key features of the dataset or simulation domain. -If the dataset is small enough to ship, put it in `tutorial/data/`. If it is +If the dataset is small enough to ship, put it in `tutorials/tutorial/data/`. If it is downloaded instead, use a `wget` guarded by `IN_COLAB` pointing at a file in this repository, rather than at a third-party host, so the link cannot rot. @@ -124,7 +124,7 @@ Congratulations on completing the ..., here are a few directions you can explore 3. **...and many more!** — Other suggestions .... -For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/). +For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/). ``` ## Writing style @@ -143,8 +143,7 @@ Every tutorial should: notebook). Long-running tutorials should reduce epochs or batch sizes. - Use only the dependencies declared in this repository's `pyproject.toml`. - Be committed with its outputs stripped. CI executes the notebook and - publishes the executed copy to the `built` branch for the documentation - build. + includes the generated HTML and Python exports in a maintenance PR. ## Contributing checklist @@ -171,4 +170,5 @@ black . |-------|------------| | Tutorial content, notebooks, datasets | **this repository** | | Library behaviour, solvers, models, bugs | [PINA-org/PINA](https://github.com/PINA-org/PINA) | -| Documentation build, rendering | [PINA-org/PINA](https://github.com/PINA-org/PINA) | +| Tutorial documentation build, rendering | **this repository** | +| Library/API documentation | [PINA-org/PINA](https://github.com/PINA-org/PINA) | diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 143706f..fdfb194 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -2,7 +2,7 @@ # Maintainers -This document lists the Maintainers of the Project. Maintainers may be added once approved by the existing maintainers as described in the [Governance document](https://github.com/mathLab/PINA/blob/master/GOVERNANCE.md). By adding your name to this list you are agreeing to abide by the Project governance documents and to abide by all of the Organization's polices, including the [code of conduct](https://github.com/mathLab/PINA/blob/master/CODE_OF_CONDUCT.md), [trademark policy](https://github.com/mathLab/PINA/blob/master/TRADEMARKS.md), and [antitrust policy](https://github.com/mathLab/PINA/blob/master/ANTITRUST.md). If you are participating because of your affiliation with another organization (designated below), you represent that you have the authority to bind that organization to these policies. +This document lists the Maintainers of the Project. Maintainers may be added once approved by the existing maintainers as described in the [Governance document](https://github.com/PINA-org/PINA/blob/master/GOVERNANCE.md). By adding your name to this list you are agreeing to abide by the Project governance documents and to abide by all of the Organization's polices, including the [code of conduct](https://github.com/PINA-org/PINA/blob/master/CODE_OF_CONDUCT.md), [trademark policy](https://github.com/PINA-org/PINA/blob/master/TRADEMARKS.md), and [antitrust policy](https://github.com/PINA-org/PINA/blob/master/ANTITRUST.md). If you are participating because of your affiliation with another organization (designated below), you represent that you have the authority to bind that organization to these policies. | **GithubID** | **Email Address** | **Organization** | diff --git a/README.md b/README.md index 4d7c304..190fa11 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ PINA repository. Every tutorial is a self-contained Jupyter notebook that runs top-to-bottom, on your laptop or in the browser. > **Rendered versions** of all tutorials are published in the -> [official PINA documentation](https://mathlab.github.io/PINA/_tutorial.html), +> [PINA Tutorials website](https://PINA-org.github.io/PINA-Tutorials/), > where they are indexed and searchable. ## Quick start @@ -24,7 +24,7 @@ cd PINA-Tutorials pip install "pina-mathlab[tutorial]" ``` -Then open, for example, `tutorial17/tutorial.ipynb` in Jupyter. Notebooks that +Then open, for example, `tutorials/tutorial17/tutorial.ipynb` in Jupyter. Notebooks that ship a `data/` folder read it from disk; notebooks that need a dataset they do not carry (Darcy flow, Kuramoto–Sivashinsky, …) download it on first run when executed in Colab. @@ -32,10 +32,11 @@ executed in Colab. ## Repository layout ``` -tutorial/ - tutorial.ipynb # the source; this is the only file you should edit - tutorial.py # nbconvert export, regenerated by CI from the notebook - data/ # dataset, when the tutorial ships one +tutorials/ + tutorial/ + tutorial.ipynb # the source; this is the only file you should edit + tutorial.py # nbconvert export, regenerated by CI from the notebook + data/ # dataset, when the tutorial ships one static/ # images embedded by the notebooks ``` @@ -56,64 +57,64 @@ A **"What's Next?"** section closing every tutorial is mandatory. | Description | Tutorial | |-------------|----------| -| Introductory Tutorial: A Beginner's Guide to PINA | [[.ipynb](tutorial17/tutorial.ipynb), [.py](tutorial17/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial17/tutorial.html)] | -| How to build a `Problem` in PINA | [[.ipynb](tutorial16/tutorial.ipynb), [.py](tutorial16/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial16/tutorial.html)] | -| Introduction to Solver classes | [[.ipynb](tutorial18/tutorial.ipynb), [.py](tutorial18/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial18/tutorial.html)] | -| Introduction to `Trainer` class | [[.ipynb](tutorial11/tutorial.ipynb), [.py](tutorial11/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial11/tutorial.html)] | -| Data structure for SciML: `Tensor`, `LabelTensor`, `Data` and `Graph` | [[.ipynb](tutorial19/tutorial.ipynb), [.py](tutorial19/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial19/tutorial.html)] | -| Building domains with PINA's `BaseDomain` class | [[.ipynb](tutorial6/tutorial.ipynb), [.py](tutorial6/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial6/tutorial.html)] | -| Introduction to PINA `Equation` class | [[.ipynb](tutorial12/tutorial.ipynb), [.py](tutorial12/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial12/tutorial.html)] | +| Introductory Tutorial: A Beginner's Guide to PINA | [[.ipynb](tutorials/tutorial17/tutorial.ipynb), [.py](tutorials/tutorial17/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial17/tutorial.html)] | +| How to build a `Problem` in PINA | [[.ipynb](tutorials/tutorial16/tutorial.ipynb), [.py](tutorials/tutorial16/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html)] | +| Introduction to Solver classes | [[.ipynb](tutorials/tutorial18/tutorial.ipynb), [.py](tutorials/tutorial18/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial18/tutorial.html)] | +| Introduction to `Trainer` class | [[.ipynb](tutorials/tutorial11/tutorial.ipynb), [.py](tutorials/tutorial11/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial11/tutorial.html)] | +| Data structure for SciML: `Tensor`, `LabelTensor`, `Data` and `Graph` | [[.ipynb](tutorials/tutorial19/tutorial.ipynb), [.py](tutorials/tutorial19/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial19/tutorial.html)] | +| Building domains with PINA's `BaseDomain` class | [[.ipynb](tutorials/tutorial6/tutorial.ipynb), [.py](tutorials/tutorial6/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial6/tutorial.html)] | +| Introduction to PINA `Equation` class | [[.ipynb](tutorials/tutorial12/tutorial.ipynb), [.py](tutorials/tutorial12/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial12/tutorial.html)] | ### Physics Informed Neural Networks | Description | Tutorial | |-------------|----------| -| Introductory Tutorial: Physics Informed Neural Networks with PINA | [[.ipynb](tutorial1/tutorial.ipynb), [.py](tutorial1/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial1/tutorial.html)] | -| Enhancing PINNs with Extra Features to solve the Poisson Problem | [[.ipynb](tutorial2/tutorial.ipynb), [.py](tutorial2/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial2/tutorial.html)] | -| Applying Hard Constraints in PINNs to solve the Wave Problem | [[.ipynb](tutorial3/tutorial.ipynb), [.py](tutorial3/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial3/tutorial.html)] | -| Applying Periodic Boundary Conditions in PINNs to solve the Helmholtz Problem | [[.ipynb](tutorial9/tutorial.ipynb), [.py](tutorial9/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial9/tutorial.html)] | -| Inverse Problem Solving with Physics-Informed Neural Network | [[.ipynb](tutorial7/tutorial.ipynb), [.py](tutorial7/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial7/tutorial.html)] | -| Learning Multiscale PDEs Using Fourier Feature Networks | [[.ipynb](tutorial13/tutorial.ipynb), [.py](tutorial13/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial13/tutorial.html)] | -| Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles | [[.ipynb](tutorial14/tutorial.ipynb), [.py](tutorial14/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial14/tutorial.html)] | +| Introductory Tutorial: Physics Informed Neural Networks with PINA | [[.ipynb](tutorials/tutorial1/tutorial.ipynb), [.py](tutorials/tutorial1/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial1/tutorial.html)] | +| Enhancing PINNs with Extra Features to solve the Poisson Problem | [[.ipynb](tutorials/tutorial2/tutorial.ipynb), [.py](tutorials/tutorial2/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial2/tutorial.html)] | +| Applying Hard Constraints in PINNs to solve the Wave Problem | [[.ipynb](tutorials/tutorial3/tutorial.ipynb), [.py](tutorials/tutorial3/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial3/tutorial.html)] | +| Applying Periodic Boundary Conditions in PINNs to solve the Helmholtz Problem | [[.ipynb](tutorials/tutorial9/tutorial.ipynb), [.py](tutorials/tutorial9/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial9/tutorial.html)] | +| Inverse Problem Solving with Physics-Informed Neural Network | [[.ipynb](tutorials/tutorial7/tutorial.ipynb), [.py](tutorials/tutorial7/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial7/tutorial.html)] | +| Learning Multiscale PDEs Using Fourier Feature Networks | [[.ipynb](tutorials/tutorial13/tutorial.ipynb), [.py](tutorials/tutorial13/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial13/tutorial.html)] | +| Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles | [[.ipynb](tutorials/tutorial14/tutorial.ipynb), [.py](tutorials/tutorial14/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial14/tutorial.html)] | ### Neural Operator Learning | Description | Tutorial | |-------------|----------| -| Introductory Tutorial: Neural Operator Learning with PINA | [[.ipynb](tutorial21/tutorial.ipynb), [.py](tutorial21/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial21/tutorial.html)] | -| Modeling 2D Darcy Flow with the Fourier Neural Operator | [[.ipynb](tutorial5/tutorial.ipynb), [.py](tutorial5/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial5/tutorial.html)] | -| Solving the Kuramoto–Sivashinsky Equation with Averaging Neural Operator | [[.ipynb](tutorial10/tutorial.ipynb), [.py](tutorial10/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial10/tutorial.html)] | -| Advection Equation with data driven DeepONet | [[.ipynb](tutorial24/tutorial.ipynb), [.py](tutorial24/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial24/tutorial.html)] | +| Introductory Tutorial: Neural Operator Learning with PINA | [[.ipynb](tutorials/tutorial21/tutorial.ipynb), [.py](tutorials/tutorial21/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial21/tutorial.html)] | +| Modeling 2D Darcy Flow with the Fourier Neural Operator | [[.ipynb](tutorials/tutorial5/tutorial.ipynb), [.py](tutorials/tutorial5/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial5/tutorial.html)] | +| Solving the Kuramoto–Sivashinsky Equation with Averaging Neural Operator | [[.ipynb](tutorials/tutorial10/tutorial.ipynb), [.py](tutorials/tutorial10/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial10/tutorial.html)] | +| Advection Equation with data driven DeepONet | [[.ipynb](tutorials/tutorial24/tutorial.ipynb), [.py](tutorials/tutorial24/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial24/tutorial.html)] | ### Supervised Learning | Description | Tutorial | |-------------|----------| -| Introductory Tutorial: Supervised Learning with PINA | [[.ipynb](tutorial20/tutorial.ipynb), [.py](tutorial20/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial20/tutorial.html)] | -| Chemical Properties Prediction with Graph Neural Networks | [[.ipynb](tutorial15/tutorial.ipynb), [.py](tutorial15/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial15/tutorial.html)] | -| Reduced Order Model with Graph Neural Networks for Unstructured Domains | [[.ipynb](tutorial22/tutorial.ipynb), [.py](tutorial22/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial22/tutorial.html)] | -| Data-driven System Identification with SINDy | [[.ipynb](tutorial23/tutorial.ipynb), [.py](tutorial23/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial23/tutorial.html)] | -| Unstructured Convolutional Autoencoders with Continuous Convolution | [[.ipynb](tutorial4/tutorial.ipynb), [.py](tutorial4/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial4/tutorial.html)] | -| Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics | [[.ipynb](tutorial8/tutorial.ipynb), [.py](tutorial8/tutorial.py), [.html](https://mathlab.github.io/PINA/tutorial8/tutorial.html)] | +| Introductory Tutorial: Supervised Learning with PINA | [[.ipynb](tutorials/tutorial20/tutorial.ipynb), [.py](tutorials/tutorial20/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial20/tutorial.html)] | +| Chemical Properties Prediction with Graph Neural Networks | [[.ipynb](tutorials/tutorial15/tutorial.ipynb), [.py](tutorials/tutorial15/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial15/tutorial.html)] | +| Reduced Order Model with Graph Neural Networks for Unstructured Domains | [[.ipynb](tutorials/tutorial22/tutorial.ipynb), [.py](tutorials/tutorial22/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial22/tutorial.html)] | +| Data-driven System Identification with SINDy | [[.ipynb](tutorials/tutorial23/tutorial.ipynb), [.py](tutorials/tutorial23/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial23/tutorial.html)] | +| Unstructured Convolutional Autoencoders with Continuous Convolution | [[.ipynb](tutorials/tutorial4/tutorial.ipynb), [.py](tutorials/tutorial4/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial4/tutorial.html)] | +| Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics | [[.ipynb](tutorials/tutorial8/tutorial.ipynb), [.py](tutorials/tutorial8/tutorial.py), [.html](https://PINA-org.github.io/PINA-Tutorials/tutorial8/tutorial.html)] | ## How the rendered tutorials are produced `.github/workflows/exporter.yml` exports each changed notebook and publishes the result: -* `tutorial/tutorial.py` — a plain-Python export, committed to this +* `tutorials/tutorial/tutorial.py` — a plain-Python export, committed to this repository through a `maintenance` pull request. -* the **executed** notebook, pushed to the `built` branch, which the PINA - documentation build fetches and renders with - [nbsphinx](https://nbsphinx.readthedocs.io/) inside the `pydata_sphinx_theme` - site. This is why notebooks here are committed with their outputs stripped. +* `docs/source/tutorials/tutorial/tutorial.html` — an HTML export of the + executed notebook, included in the same pull request for the standalone + tutorial website. Deployment is configured separately. -Because the executed notebooks are built by CI, a tutorial that no longer runs -breaks the documentation build. The workflow runs on a nightly schedule as -well as on pushes, so regressions in the PINA package are caught here. +The exporter automatically generates Python scripts and executed HTML pages when +notebooks change on `main`. Manual runs regenerate all tutorials. Notebooks run +in their own directories to access local datasets, without saving execution +outputs to the source notebooks. If execution fails, the export stops. ## See also -* [PINA documentation](https://mathlab.github.io/PINA/) +* [PINA documentation](https://PINA-org.github.io/PINA/) * [PINA package](https://github.com/PINA-org/PINA) -* [Quickstart guide](https://mathlab.github.io/PINA/_quickstart.html) +* [Quickstart guide](https://PINA-org.github.io/PINA/_quickstart.html) diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..ed2201d --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,192 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/active_subspaces.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/active_subspaces.qhc" + +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/active_subspaces" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/active_subspaces" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/source/_static/.gitkeep b/docs/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..0fb1538 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,226 @@ +# -*- coding: utf-8 -*- +# +# PINA documentation build configuration file, created by +# sphinx-quickstart on Mon Jun 22 16:09:40 2015. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import time + + +# -- Project information ----------------------------------------------------- +project = "PINA Tutorials" +copyright = f'2021-{time.strftime("%Y")}' +author = "PINA Contributors" +# Tutorial project version from pyproject.toml; building does not import PINA. +version = "0.1.0" + + +# -- General configuration ------------------------------------------------ + +# PINA's local extensions and optional UI extensions are not installed here. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.doctest", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.viewcode", + "sphinx.ext.mathjax", + "sphinx.ext.intersphinx", +] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["build", "docstrings", "nextgen", "Thumbs.db", ".DS_Store", "**/.gitkeep"] + +# The reST default role (used for this markup: `text`) to use for all documents. +default_role = "literal" + +# Generate the API documentation when building +autosummary_generate = True +numpydoc_show_class_members = False + +intersphinx_mapping = { + "python": ("http://docs.python.org/3", None), + "matplotlib": ("https://matplotlib.org/stable", None), + "torch": ("https://pytorch.org/docs/stable/", None), + "lightning.pytorch": ("https://lightning.ai/docs/pytorch/stable/", None), + "torch_geometric": ( + "https://pytorch-geometric.readthedocs.io/en/latest/", + None, + ), +} + +# Add any paths that contain templates here, relative to this directory. +templates_path = [] + +# The suffix(es) of source filenames. +source_suffix = ".rst" + +# The master toctree document. +master_doc = "index" + +# autoclass +autoclass_content = "both" + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +release = version + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = "en" + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sortins as "systems = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "pydata_sphinx_theme" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_logo = "../../static/pina_logo.png" +html_theme_options = { + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/PINA-org/PINA-Tutorials", + "icon": "fab fa-github", + "type": "fontawesome", + }, + { + "name": "Twitter", + "url": "https://x.com/pina_mathlab?s=21", + "icon": "fab fa-twitter", + "type": "fontawesome", + }, + { + "name": "Email", + "url": "mailto:pina.mathlab@gmail.com", + "icon": "fas fa-envelope", + "type": "fontawesome", + }, + ], + "show_prev_next": False, + "navbar_start": ["navbar-logo"], + "navbar_end": ["navbar-icon-links"], + "header_links_before_dropdown": 5, +} + +html_context = { + "default_mode": "light", +} + +# If not ''i, a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +html_last_updated_fmt = "%b %d, %Y" + +# If false, no index is generated. +html_use_index = True + +# If true, links to the reST sources are added to the pages. +html_show_sourcelink = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +html_show_copyright = True + +# Output file base name for HTML help builder. +htmlhelp_basename = "pinatutorialsdoc" + +# Link to external html files +html_extra_path = ["tutorials"] + +html_static_path = ["_static"] +# PINA's custom.css is not present in this repository. +html_css_files = [] + +# Avoid side bar for html files +html_sidebars = { + "index": [], +} + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + "papersize": "a4paper", + # The font size ('10pt', '11pt' or '12pt'). + "pointsize": "20pt", + # Additional stuff for the LaTeX preamble. + "preamble": "", + # Latex figure (float) alignment + "figure_align": "htbp", +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + master_doc, + "pina-tutorials.tex", + "PINA Tutorials", + "PINA contributors", + "manual", + ), +] + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [(master_doc, "pina-tutorials", "PINA Tutorials", [author], 1)] + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + master_doc, + "pina-tutorials", + "PINA Tutorials", + author, + "pina-tutorials", + "Step-by-step tutorials for the PINA library.", + "Miscellaneous", + ), +] + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False +autodoc_member_order = "bysource" + +# Do consider meth ending with _ (needed for in-place methods of torch) +strip_signature_backslash = True diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..44e6b16 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,54 @@ +Welcome to the PINA Tutorials +======================================== + +This site collects step-by-step tutorials to help you understand the principles and potential of **PINA**. +Whether you are just getting started or looking to deepen your understanding, these resources will guide you. + +For installation instructions and API documentation, visit the +`PINA documentation `_. + +Getting started with PINA +---------------------------------------- + +- `Introductory Tutorial: A Beginner's Guide to PINA `_ +- `How to build a Problem in PINA `_ +- `Introduction to Solver classes `_ +- `Introduction to Trainer class `_ +- `Data structure for SciML: Tensor, LabelTensor, Data and Graph `_ +- `Building domains with PINA's BaseDomain class `_ +- `Introduction to PINA Equation class `_ + +Physics Informed Neural Networks +-------------------------------- + +- `Introductory Tutorial: Physics Informed Neural Networks with PINA `_ +- `Enhancing PINNs with Extra Features to solve the Poisson Problem `_ +- `Applying Hard Constraints in PINNs to solve the Wave Problem `_ +- `Applying Periodic Boundary Conditions in PINNs to solve the Helmholtz Problem `_ +- `Inverse Problem Solving with Physics-Informed Neural Network `_ +- `Learning Multiscale PDEs Using Fourier Feature Networks `_ +- `Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles `_ + +Neural Operator Learning +---------------------------------------- + +- `Introductory Tutorial: Neural Operator Learning with PINA `_ +- `Modeling 2D Darcy Flow with the Fourier Neural Operator `_ +- `Solving the Kuramoto-Sivashinsky Equation with Averaging Neural Operator `_ +- `Advection Equation with data driven DeepONet `_ + +Supervised Learning +------------------- + +- `Introductory Tutorial: Supervised Learning with PINA `_ +- `Chemical Properties Prediction with Graph Neural Networks `_ +- `Reduced Order Model with Graph Neural Networks for Unstructured Domains `_ +- `Data-driven System Identification with SINDy `_ +- `Unstructured Convolutional Autoencoders with Continuous Convolution `_ +- `Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics `_ + +See Also +-------- + +- `Quickstart guide `_ +- `API Reference `_ diff --git a/docs/source/tutorials/.gitkeep b/docs/source/tutorials/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index 04f4d00..6a1259c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,8 +19,8 @@ dependencies = [ ] [project.urls] -Homepage = "https://mathlab.github.io/PINA/" -Tutorials = "https://mathlab.github.io/PINA/_tutorial.html" +Homepage = "https://PINA-org.github.io/PINA/" +Tutorials = "https://PINA-org.github.io/PINA-Tutorials/" Repository = "https://github.com/PINA-org/PINA-tutorials" "PINA (library)" = "https://github.com/PINA-org/PINA" @@ -42,6 +42,10 @@ exporter = [ "ipykernel", "black[jupyter]", ] +docs = [ + "sphinx", + "pydata-sphinx-theme", +] [tool.black] line-length = 80 diff --git a/tutorial1/tutorial.ipynb b/tutorials/tutorial1/tutorial.ipynb similarity index 90% rename from tutorial1/tutorial.ipynb rename to tutorials/tutorial1/tutorial.ipynb index 32e87e9..6542374 100644 --- a/tutorial1/tutorial.ipynb +++ b/tutorials/tutorial1/tutorial.ipynb @@ -7,10 +7,10 @@ "metadata": {}, "source": [ "# Tutorial: Introductory Tutorial: Physics Informed Neural Networks with PINA \n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial1/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial1/tutorial.ipynb)\n", "\n", "> ##### ⚠️ ***Before starting:***\n", - "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://mathlab.github.io/PINA/_tutorial.html#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n" + "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://PINA-org.github.io/PINA-Tutorials/#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n" ] }, { @@ -19,7 +19,7 @@ "id": "ef4949c9", "metadata": {}, "source": [ - "In this tutorial, we will demonstrate a typical use case of **PINA** for Physics-Informed training. We will cover the basics of training a `PhysicsInformedSingleModelSolver` with PINA, if you want to go further into Physics-Informed solvers look at our dedicated [tutorials](https://mathlab.github.io/PINA/_tutorial.html#physics-informed-neural-networks) on the topic.\n", + "In this tutorial, we will demonstrate a typical use case of **PINA** for Physics-Informed training. We will cover the basics of training a `PhysicsInformedSingleModelSolver` with PINA, if you want to go further into Physics-Informed solvers look at our dedicated [tutorials](https://PINA-org.github.io/PINA-Tutorials/#physics-informed-neural-networks) on the topic.\n", "\n", "Let's start by importing the useful modules:" ] @@ -232,13 +232,13 @@ "Once the problem is defined and the data is generated, we can move on to modeling. This process consists of three key steps:\n", "\n", "**Choosing a Model**\n", - "- Select a neural network architecture. You can use the model we provide in the `pina.model` module (see [here](https://mathlab.github.io/PINA/_rst/_code.html#models) for a full list), or define a custom PyTorch module (more on this [here](https://pytorch.org/docs/stable/notes/modules.html)).\n", + "- Select a neural network architecture. You can use the model we provide in the `pina.model` module (see [here](https://PINA-org.github.io/PINA/_rst/_code.html#models) for a full list), or define a custom PyTorch module (more on this [here](https://pytorch.org/docs/stable/notes/modules.html)).\n", "\n", "**Choosing a Physics-Informed Solver & Defining the Trainer**\n", - "* Use a Physics-Informed solver from `pina.solver` module to solve the problem using the specified model. We have already implemented most State-Of-The-Arte solvers for you, [have a look](https://mathlab.github.io/PINA/_rst/_code.html#solvers) if interested. Today we will use the standard `PhysicsInformedSingleModelSolver` solver.\n", + "* Use a Physics-Informed solver from `pina.solver` module to solve the problem using the specified model. We have already implemented most State-Of-The-Arte solvers for you, [have a look](https://PINA-org.github.io/PINA/_rst/_code.html#solvers) if interested. Today we will use the standard `PhysicsInformedSingleModelSolver` solver.\n", "\n", "**Training**\n", - "* Train the model with the [`Trainer`](https://mathlab.github.io/PINA/_rst/trainer.html) class. The Trainer class provides powerful features to enhance model accuracy, optimize training time and memory, and simplify logging and visualization, thanks to PyTorch Lightning's excellent work, see [our dedicated tutorial](https://mathlab.github.io/PINA/tutorial11/tutorial.html) for further details. By default, training metrics (e.g., MSE error) are logged using a lightning logger (CSVLogger). If you prefer manual tracking, use `pina.callback.MetricTracker`.\n", + "* Train the model with the [`Trainer`](https://PINA-org.github.io/PINA/_rst/trainer.html) class. The Trainer class provides powerful features to enhance model accuracy, optimize training time and memory, and simplify logging and visualization, thanks to PyTorch Lightning's excellent work, see [our dedicated tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial11/tutorial.html) for further details. By default, training metrics (e.g., MSE error) are logged using a lightning logger (CSVLogger). If you prefer manual tracking, use `pina.callback.MetricTracker`.\n", "\n", "Let's cover all steps one by one!\n", "\n", @@ -269,7 +269,7 @@ "Then we build the solver. The `PhysicsInformedSingleModelSolver` class needs to be initialized with a `model` and a specific `problem` to be solved. They also take extra arguments, as the optimizer, scheduler, loss type and weighting for the different conditions which are all set to their default values.\n", "\n", ">##### 💡***Bonus tip:***\n", - "> All physics solvers in PINA can handle both forward and inverse problems without requiring any changes to the model or solver structure! See [our tutorial](https://mathlab.github.io/PINA/tutorial7/tutorial.html) of inverse problems for more infos." + "> All physics solvers in PINA can handle both forward and inverse problems without requiring any changes to the model or solver structure! See [our tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial7/tutorial.html) of inverse problems for more infos." ] }, { @@ -411,7 +411,7 @@ "\n", "5. **... and many more!**: The possibilities are vast! Continue experimenting with advanced configurations, solvers, and other features in PINA.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial1/tutorial.py b/tutorials/tutorial1/tutorial.py similarity index 100% rename from tutorial1/tutorial.py rename to tutorials/tutorial1/tutorial.py diff --git a/tutorial10/data/Data_KS.mat b/tutorials/tutorial10/data/Data_KS.mat similarity index 100% rename from tutorial10/data/Data_KS.mat rename to tutorials/tutorial10/data/Data_KS.mat diff --git a/tutorial10/data/Data_KS2.mat b/tutorials/tutorial10/data/Data_KS2.mat similarity index 100% rename from tutorial10/data/Data_KS2.mat rename to tutorials/tutorial10/data/Data_KS2.mat diff --git a/tutorial10/tutorial.ipynb b/tutorials/tutorial10/tutorial.ipynb similarity index 88% rename from tutorial10/tutorial.ipynb rename to tutorials/tutorial10/tutorial.ipynb index b5a7b67..1ccdee5 100644 --- a/tutorial10/tutorial.ipynb +++ b/tutorials/tutorial10/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Solving the Kuramoto–Sivashinsky Equation with Averaging Neural Operator\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial10/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial10/tutorial.ipynb)\n", "\n", "\n", "In this tutorial, we will build a Neural Operator using the **`AveragingNeuralOperator`** model and the **`SupervisedSingleModelSolver`**. By the end of this tutorial, you will be able to train a Neural Operator to learn the operator for time-dependent PDEs.\n", @@ -33,8 +33,8 @@ " !pip install \"pina-mathlab[tutorial]\"\n", " # get the data\n", " !mkdir \"data\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial10/data/Data_KS.mat\" -O \"data/Data_KS.mat\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial10/data/Data_KS2.mat\" -O \"data/Data_KS2.mat\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial10/data/Data_KS.mat\" -O \"data/Data_KS.mat\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial10/data/Data_KS2.mat\" -O \"data/Data_KS2.mat\"\n", "\n", "import torch\n", "import matplotlib.pyplot as plt\n", @@ -215,7 +215,7 @@ "\\texttt{NO}_\\theta[u(t=0)](x, t) \\rightarrow u(x, t).\n", "$$\n", "\n", - "There are many ways to approximate the following operator, for example, by using a 2D [FNO](https://mathlab.github.io/PINA/_rst/model/fourier_neural_operator.html) (for regular meshes), a [DeepOnet](https://mathlab.github.io/PINA/_rst/model/deeponet.html), [Continuous Convolutional Neural Operator](https://mathlab.github.io/PINA/_rst/model/block/convolution.html), or [MIONet](https://mathlab.github.io/PINA/_rst/model/mionet.html). In this tutorial, we will use the *Averaging Neural Operator* presented in [*The Nonlocal Neural Operator: Universal Approximation*](https://arxiv.org/abs/2304.13221), which is a [Kernel Neural Operator](https://mathlab.github.io/PINA/_rst/model/kernel_neural_operator.html) with an integral kernel:\n", + "There are many ways to approximate the following operator, for example, by using a 2D [FNO](https://PINA-org.github.io/PINA/_rst/model/fourier_neural_operator.html) (for regular meshes), a [DeepOnet](https://PINA-org.github.io/PINA/_rst/model/deeponet.html), [Continuous Convolutional Neural Operator](https://PINA-org.github.io/PINA/_rst/model/block/convolution.html), or [MIONet](https://PINA-org.github.io/PINA/_rst/model/mionet.html). In this tutorial, we will use the *Averaging Neural Operator* presented in [*The Nonlocal Neural Operator: Universal Approximation*](https://arxiv.org/abs/2304.13221), which is a [Kernel Neural Operator](https://PINA-org.github.io/PINA/_rst/model/kernel_neural_operator.html) with an integral kernel:\n", "\n", "$$\n", "K(v) = \\sigma\\left(Wv(x) + b + \\frac{1}{|\\Omega|}\\int_\\Omega v(y)dy\\right)\n", @@ -228,9 +228,9 @@ "* $W \\in \\mathbb{R}^{\\rm{emb} \\times \\rm{emb}}$ is a tunable matrix.\n", "* $b \\in \\mathbb{R}^{\\rm{emb}}$ is a tunable bias.\n", "\n", - "In PINA, many Kernel Neural Operators are already implemented. The modular components of the [Kernel Neural Operator](https://mathlab.github.io/PINA/_rst/model/kernel_neural_operator.html) class allow you to create new ones by composing base kernel layers.\n", + "In PINA, many Kernel Neural Operators are already implemented. The modular components of the [Kernel Neural Operator](https://PINA-org.github.io/PINA/_rst/model/kernel_neural_operator.html) class allow you to create new ones by composing base kernel layers.\n", "\n", - "**Note:** We will use the already built class `AveragingNeuralOperator`. As a constructive exercise, try to use the [KernelNeuralOperator](https://mathlab.github.io/PINA/_rst/model/kernel_neural_operator.html) class to build a kernel neural operator from scratch. You might employ the different layers that we have in PINA, such as [FeedForward](https://mathlab.github.io/PINA/_rst/model/feed_forward.html) and [AveragingNeuralOperator](https://mathlab.github.io/PINA/_rst/model/average_neural_operator.html) layers." + "**Note:** We will use the already built class `AveragingNeuralOperator`. As a constructive exercise, try to use the [KernelNeuralOperator](https://PINA-org.github.io/PINA/_rst/model/kernel_neural_operator.html) class to build a kernel neural operator from scratch. You might employ the different layers that we have in PINA, such as [FeedForward](https://PINA-org.github.io/PINA/_rst/model/feed_forward.html) and [AveragingNeuralOperator](https://PINA-org.github.io/PINA/_rst/model/average_neural_operator.html) layers." ] }, { @@ -269,7 +269,7 @@ "\n", "## Solving the KS problem\n", "\n", - "We will now focus on solving the KS equation using the `SupervisedSingleModelSolver` class and the `AveragingNeuralOperator` model. As done in the [FNO tutorial](https://github.com/PINA-org/PINA-tutorials/blob/main/tutorial5/tutorial.ipynb), we now create the Neural Operator problem class with `SupervisedProblem`." + "We will now focus on solving the KS equation using the `SupervisedSingleModelSolver` class and the `AveragingNeuralOperator` model. As done in the [FNO tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial5/tutorial.html), we now create the Neural Operator problem class with `SupervisedProblem`." ] }, { @@ -380,9 +380,9 @@ "\n", "2. **Use a more challenging dataset**: Try using the more complex dataset [Data_KS2.mat](dat/Data_KS2.mat) where $A_k \\in [-0.5, 0.5]$, $\\ell_k \\in [1, 2, 3]$, and $\\phi_k \\in [0, 2\\pi]$ for a more difficult task. This dataset may require longer training and testing.\n", "\n", - "3. **... and many more...**: Explore other models, such as the [FNO](https://mathlab.github.io/PINA/_rst/models/fno.html), [DeepOnet](https://mathlab.github.io/PINA/_rst/models/deeponet.html), or implement your own operator using the [KernelNeuralOperator](https://mathlab.github.io/PINA/_rst/models/base_no.html) class to compare performance and find the best model for your task.\n", + "3. **... and many more...**: Explore other models, such as the [FNO](https://PINA-org.github.io/PINA/_rst/models/fno.html), [DeepOnet](https://PINA-org.github.io/PINA/_rst/models/deeponet.html), or implement your own operator using the [KernelNeuralOperator](https://PINA-org.github.io/PINA/_rst/models/base_no.html) class to compare performance and find the best model for your task.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial10/tutorial.py b/tutorials/tutorial10/tutorial.py similarity index 100% rename from tutorial10/tutorial.py rename to tutorials/tutorial10/tutorial.py diff --git a/tutorial11/tutorial.ipynb b/tutorials/tutorial11/tutorial.ipynb similarity index 98% rename from tutorial11/tutorial.ipynb rename to tutorials/tutorial11/tutorial.ipynb index 5571498..ca11da6 100644 --- a/tutorial11/tutorial.ipynb +++ b/tutorials/tutorial11/tutorial.ipynb @@ -6,9 +6,9 @@ "metadata": {}, "source": [ "# Tutorial: Introduction to `Trainer` class\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial11/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial11/tutorial.ipynb)\n", "\n", - "In this tutorial, we will delve deeper into the functionality of the `Trainer` class, which serves as the cornerstone for training **PINA** [Solvers](https://mathlab.github.io/PINA/_rst/_code.html#solvers). \n", + "In this tutorial, we will delve deeper into the functionality of the `Trainer` class, which serves as the cornerstone for training **PINA** [Solvers](https://PINA-org.github.io/PINA/_rst/_code.html#solvers). \n", "\n", "The `Trainer` class offers a plethora of features aimed at improving model accuracy, reducing training time and memory usage, facilitating logging visualization, and more thanks to the amazing job done by the PyTorch Lightning team!\n", "\n", @@ -142,7 +142,7 @@ "source": [ "## Trainer Logging\n", "\n", - "In **PINA** you can log metrics in different ways. The simplest approach is to use the `MetricTracker` class from `pina.callback`, as seen in the [*Introduction to Physics Informed Neural Networks training*](https://github.com/PINA-org/PINA-tutorials/blob/main/tutorial1/tutorial.ipynb) tutorial.\n", + "In **PINA** you can log metrics in different ways. The simplest approach is to use the `MetricTracker` class from `pina.callback`, as seen in the [*Introduction to Physics Informed Neural Networks training*](https://PINA-org.github.io/PINA-Tutorials/tutorial1/tutorial.html) tutorial.\n", "\n", "However, especially when we need to train multiple times to get an average of the loss across multiple runs, `lightning.pytorch.loggers` might be useful. Here we will use `TensorBoardLogger` (more on [logging](https://lightning.ai/docs/pytorch/stable/extensions/logging.html) here), but you can choose the one you prefer (or make your own one).\n", "\n", @@ -502,7 +502,7 @@ "\n", "4. **...and many more!**: Consider expanding to **multi-GPU** setups or other advanced configurations for large-scale training.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/).\n" + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/).\n" ] } ], diff --git a/tutorial11/tutorial.py b/tutorials/tutorial11/tutorial.py similarity index 100% rename from tutorial11/tutorial.py rename to tutorials/tutorial11/tutorial.py diff --git a/tutorial12/tutorial.ipynb b/tutorials/tutorial12/tutorial.ipynb similarity index 97% rename from tutorial12/tutorial.ipynb rename to tutorials/tutorial12/tutorial.ipynb index cd8d14e..39ced2c 100644 --- a/tutorial12/tutorial.ipynb +++ b/tutorials/tutorial12/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Introduction to PINA `Equation` class\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial12/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial12/tutorial.ipynb)\n", "\n", "\n", "In this tutorial, we will explore how to use the `Equation` class in **PINA**. We will focus on how to leverage this class, along with its inherited subclasses, to enforce residual minimization in **Physics-Informed Solvers**.\n", @@ -104,7 +104,7 @@ "\n", "Let's define now the problem!\n", "\n", - "> **👉 Do you want to learn more on Problems? Check the dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) to learn how to build a Problem from scratch.**" + "> **👉 Do you want to learn more on Problems? Check the dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) to learn how to build a Problem from scratch.**" ] }, { @@ -254,7 +254,7 @@ "- **Integrate Custom Equations and Operators**: Combine your custom equations and operators into larger systems for more complex simulations.\n", "- **and many more!**: Explore for example different residual minimization techniques to improve the performance and accuracy of your models.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial12/tutorial.py b/tutorials/tutorial12/tutorial.py similarity index 100% rename from tutorial12/tutorial.py rename to tutorials/tutorial12/tutorial.py diff --git a/tutorial13/tutorial.ipynb b/tutorials/tutorial13/tutorial.ipynb similarity index 94% rename from tutorial13/tutorial.ipynb rename to tutorials/tutorial13/tutorial.ipynb index 2239745..59229e3 100644 --- a/tutorial13/tutorial.ipynb +++ b/tutorials/tutorial13/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Learning Multiscale PDEs Using Fourier Feature Networks\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial13/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial13/tutorial.ipynb)\n", "\n", "This tutorial demonstrates how to solve a PDE with multiscale behavior using Physics-Informed Neural Networks (PINNs), as discussed in [*On the Eigenvector Bias of Fourier Feature Networks: From Regression to Solving Multi-Scale PDEs with Physics-Informed Neural Networks*](https://doi.org/10.1016/j.cma.2021.113938).\n", "\n", @@ -81,7 +81,7 @@ "While this example is simple and pedagogical, it's important to note that the solution exhibits low-frequency behavior in the macro-scale and high-frequency behavior in the micro-scale. This characteristic is common in many practical scenarios.\n", "\n", "Below is the implementation of the `Poisson` problem as described mathematically above.\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**" + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**" ] }, { @@ -136,7 +136,7 @@ "\n", "However, solving high-frequency or multi-scale problems presents significant challenges to PINNs, especially when the number of data points is insufficient to capture the different scales effectively.\n", "\n", - "Below, we run a simulation using both the `PhysicsInformedSingleModelSolver` solver and the `SelfAdaptivePhysicsInformedSolver` solver, employing a [`FeedForward`](https://mathlab.github.io/PINA/_modules/pina/model/feed_forward.html#FeedForward) model.\n" + "Below, we run a simulation using both the `PhysicsInformedSingleModelSolver` solver and the `SelfAdaptivePhysicsInformedSolver` solver, employing a [`FeedForward`](https://PINA-org.github.io/PINA/_modules/pina/model/feed_forward.html#FeedForward) model.\n" ] }, { @@ -259,7 +259,7 @@ "\n", "where $\\mathbf{B}_{ij} \\sim \\mathcal{N}(0, \\sigma^2)$. This simple operation allows the network to learn across multiple scales!\n", "\n", - "In **PINA**, we have already implemented this feature as a `layer` called [`FourierFeatureEmbedding`](https://mathlab.github.io/PINA/_rst/layers/fourier_embedding.html). Below, we will build the *Multi-scale Fourier Feature Architecture*. In this architecture, multiple Fourier feature embeddings (initialized with different $\\sigma$ values) are applied to the input coordinates. These embeddings are then passed through the same fully-connected neural network, and the outputs are concatenated with a final linear layer.\n" + "In **PINA**, we have already implemented this feature as a `layer` called [`FourierFeatureEmbedding`](https://PINA-org.github.io/PINA/_rst/layers/fourier_embedding.html). Below, we will build the *Multi-scale Fourier Feature Architecture*. In this architecture, multiple Fourier feature embeddings (initialized with different $\\sigma$ values) are applied to the input coordinates. These embeddings are then passed through the same fully-connected neural network, and the outputs are concatenated with a final linear layer.\n" ] }, { @@ -364,7 +364,7 @@ "\n", "4. **...and many more!**: There are countless directions to further explore, from testing on different problems to refining the model architecture.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial13/tutorial.py b/tutorials/tutorial13/tutorial.py similarity index 100% rename from tutorial13/tutorial.py rename to tutorials/tutorial13/tutorial.py diff --git a/tutorial14/tutorial.ipynb b/tutorials/tutorial14/tutorial.ipynb similarity index 96% rename from tutorial14/tutorial.ipynb rename to tutorials/tutorial14/tutorial.ipynb index 71d26a3..d8b1f48 100644 --- a/tutorial14/tutorial.ipynb +++ b/tutorials/tutorial14/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial14/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial14/tutorial.ipynb)\n", "\n", "This tutorial demonstrates how to use the Deep Ensemble Physics Informed Network (DeepEnsemblePINN) to learn PDEs exhibiting bifurcating behavior, as discussed in [*Learning and Discovering Multiple Solutions Using Physics-Informed Neural Networks with Random Initialization and Deep Ensemble*](https://arxiv.org/abs/2503.06320).\n", "\n", @@ -109,9 +109,9 @@ "\n", "We first write the problem class, we do not write the boundary conditions as we will hard impose them.\n", "\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) to teach how to build a Problem — have a look if you're interested!**\n", + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) to teach how to build a Problem — have a look if you're interested!**\n", "\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial3/tutorial.html) to teach how to impose hard constraints — have a look if you're interested!**" + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial3/tutorial.html) to teach how to impose hard constraints — have a look if you're interested!**" ] }, { @@ -361,7 +361,7 @@ "\n", "3. **...and many more!**: There are countless directions to further explore, for example, what does it happen when you vary the network initialization hyperparameters?\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial14/tutorial.py b/tutorials/tutorial14/tutorial.py similarity index 100% rename from tutorial14/tutorial.py rename to tutorials/tutorial14/tutorial.py diff --git a/tutorial15/tutorial.ipynb b/tutorials/tutorial15/tutorial.ipynb similarity index 95% rename from tutorial15/tutorial.ipynb rename to tutorials/tutorial15/tutorial.ipynb index 8db146a..cbaa4e6 100644 --- a/tutorial15/tutorial.ipynb +++ b/tutorials/tutorial15/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Chemical Properties Prediction with Graph Neural Networks\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial15/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial15/tutorial.ipynb)\n", "\n", "In this tutorial we will use **Graph Neural Networks** (GNNs) for chemical properties prediction. Chemical properties prediction involves estimating or determining the physical, chemical, or biological characteristics of molecules based on their structure. \n", "\n", @@ -112,7 +112,7 @@ "id": "dd928023", "metadata": {}, "source": [ - "Great! Once the data are downloaded, building the problem is straightforward by using the [`SupervisedProblem`](https://mathlab.github.io/PINA/_rst/problem/zoo/supervised_problem.html) class." + "Great! Once the data are downloaded, building the problem is straightforward by using the [`SupervisedProblem`](https://PINA-org.github.io/PINA/_rst/problem/zoo/supervised_problem.html) class." ] }, { @@ -169,7 +169,7 @@ "source": [ "## Train the Model\n", "\n", - "Now that the problem is created and the model is built, we can train the model using the [`SupervisedSingleModelSolver`](https://mathlab.github.io/PINA/_rst/solver/supervised.html), which is the solver for standard supervised learning task. We will optimize the Maximum Absolute Error and test on the same metric. In the [`Trainer`](https://mathlab.github.io/PINA/_rst/trainer.html) class we specify the optimization hyperparameters." + "Now that the problem is created and the model is built, we can train the model using the [`SupervisedSingleModelSolver`](https://PINA-org.github.io/PINA/_rst/solver/supervised.html), which is the solver for standard supervised learning task. We will optimize the Maximum Absolute Error and test on the same metric. In the [`Trainer`](https://PINA-org.github.io/PINA/_rst/trainer.html) class we specify the optimization hyperparameters." ] }, { @@ -224,7 +224,7 @@ "source": [ "We observe that the model achieves an average error of approximately 0.4 MAE across all property predictions. This error is an average, but we can also inspect the error for each individual property prediction.\n", "\n", - "To do this, we need access to the test dataset, which can be retrieved from the trainer's datamodule. Each datamodule contains both the dataloader and dataset objects. For the dataset, we can use the [`get_all_data()`](https://mathlab.github.io/PINA/_rst/data/dataset.html#pina.data.dataset.PinaDataset.get_all_data) method. This function returns the entire dataset as a dictionary, where the keys represent the Condition names, and the values are dictionaries containing input and target tensors." + "To do this, we need access to the test dataset, which can be retrieved from the trainer's datamodule. Each datamodule contains both the dataloader and dataset objects. For the dataset, we can use the [`get_all_data()`](https://PINA-org.github.io/PINA/_rst/data/dataset.html#pina.data.dataset.PinaDataset.get_all_data) method. This function returns the entire dataset as a dictionary, where the keys represent the Condition names, and the values are dictionaries containing input and target tensors." ] }, { @@ -431,7 +431,7 @@ "\n", "4. **...and many more!**: The possibilities are vast, including exploring new architectures, working with larger datasets, and applying this framework to more complex systems.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial15/tutorial.py b/tutorials/tutorial15/tutorial.py similarity index 100% rename from tutorial15/tutorial.py rename to tutorials/tutorial15/tutorial.py diff --git a/tutorial16/tutorial.ipynb b/tutorials/tutorial16/tutorial.ipynb similarity index 89% rename from tutorial16/tutorial.ipynb rename to tutorials/tutorial16/tutorial.ipynb index 3b88e0e..efb31ce 100644 --- a/tutorial16/tutorial.ipynb +++ b/tutorials/tutorial16/tutorial.ipynb @@ -8,7 +8,7 @@ "source": [ "# Tutorial: How to build a Problem in PINA\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial16/tutorial.ipynb)\n" + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial16/tutorial.ipynb)\n" ] }, { @@ -88,9 +88,9 @@ "\n", " # other stuff ...\n", "```\n", - "Observe that we define `input_variables` and `output_variables` as lists of symbols. This is because, in PINA, `torch.Tensors` can be labeled (see [`LabelTensor`](https://mathlab.github.io/PINA/_rst/label_tensor.html)), providing maximum flexibility for tensor manipulation. If you prefer to use regular tensors, you can simply set these to ``None``.\n", + "Observe that we define `input_variables` and `output_variables` as lists of symbols. This is because, in PINA, `torch.Tensors` can be labeled (see [`LabelTensor`](https://PINA-org.github.io/PINA/_rst/label_tensor.html)), providing maximum flexibility for tensor manipulation. If you prefer to use regular tensors, you can simply set these to ``None``.\n", "\n", - "To specify the input and target data, you need to use the [`Condition`](https://mathlab.github.io/PINA/_rst/condition/condition.html) interface. A condition defines the constraints (such as physical equations, boundary conditions, etc.) that must be satisfied within the problem. Once the condition is applied, the full problem is outlined below:" + "To specify the input and target data, you need to use the [`Condition`](https://PINA-org.github.io/PINA/_rst/condition/condition.html) interface. A condition defines the constraints (such as physical equations, boundary conditions, etc.) that must be satisfied within the problem. Once the condition is applied, the full problem is outlined below:" ] }, { @@ -150,7 +150,7 @@ "id": "59d80694", "metadata": {}, "source": [ - ">👉 **You can use multiple data structures in PINA conditions, including `Graph` or `Data` from `PyG`. To explore the different data structures available in PINA, check out [this tutorial](), and for more information on input-target conditions, visit the conditions factory classes [here](https://mathlab.github.io/PINA/_rst/condition/input_target_condition.html)**." + ">👉 **You can use multiple data structures in PINA conditions, including `Graph` or `Data` from `PyG`. To explore the different data structures available in PINA, check out [this tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial19/tutorial.html), and for more information on input-target conditions, visit the conditions factory classes [here](https://PINA-org.github.io/PINA/_rst/condition/input_target_condition.html)**." ] }, { @@ -175,7 +175,7 @@ "* `SpatialProblem` $\\rightarrow$ a differential equation with spatial variable(s)\n", "* `TimeDependentProblem` $\\rightarrow$ a time-dependent differential equation with temporal variable(s)\n", "* `ParametricProblem` $\\rightarrow$ a parametrized differential equation with parametric variable(s)\n", - "* `InverseProblem` $\\rightarrow$ this is a more advanced topic, see [this tutorial](https://mathlab.github.io/PINA/tutorial7/tutorial.html) for more details.\n", + "* `InverseProblem` $\\rightarrow$ this is a more advanced topic, see [this tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial7/tutorial.html) for more details.\n", "\n", "In our case, the physical ODE inherits from the `SpatialProblem` class, since only spatial variables define the ODE.\n", "\n", @@ -201,7 +201,7 @@ " # other stuff ...\n", "```\n", "\n", - "Differently from data-driven problems, differential-problems need to specify the domain type. If you look at our ODE definition, the spatial varibale $x$ is defined in the interval $(0,1)$, and accordingly the `spatial_domain` is a `CartesianDomain` with the input variable `x` in `[0,1]`. To know more about the Domain class see the [related tutorial](https://mathlab.github.io/PINA/tutorial6/tutorial.html). Different problems require different domain, here below we summarize the relevant ones:\n", + "Differently from data-driven problems, differential-problems need to specify the domain type. If you look at our ODE definition, the spatial varibale $x$ is defined in the interval $(0,1)$, and accordingly the `spatial_domain` is a `CartesianDomain` with the input variable `x` in `[0,1]`. To know more about the Domain class see the [related tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial6/tutorial.html). Different problems require different domain, here below we summarize the relevant ones:\n", "\n", "| Problem Type | Required Domain |\n", "|-------------------------|--------------------------------|\n", @@ -274,17 +274,17 @@ "id": "7cf64d01", "metadata": {}, "source": [ - "As you can see, we implemented the `ode_equation` function which given the model ouput and input returns the equation residual. These residuals are the ones minimized during PINN optimization (for more on PINN see [the related tutorials](https://mathlab.github.io/PINA/_tutorial.html#physics-informed-neural-networks)). \n", + "As you can see, we implemented the `ode_equation` function which given the model ouput and input returns the equation residual. These residuals are the ones minimized during PINN optimization (for more on PINN see [the related tutorials](https://PINA-org.github.io/PINA-Tutorials/#physics-informed-neural-networks)). \n", "\n", "How are the residuals computed?\n", - "Given the output we perform differential operation using the [operator modulus](https://mathlab.github.io/PINA/_rst/operator.html). It is pretty intuitive, each differential operator takes the following inputs: \n", + "Given the output we perform differential operation using the [operator modulus](https://PINA-org.github.io/PINA/_rst/operator.html). It is pretty intuitive, each differential operator takes the following inputs: \n", "- A tensor on which the operator is applied. \n", "- A tensor with respect to which the operator is computed. \n", "- The names of the output variables for which the operator is evaluated. \n", "- The names of the variables with respect to which the operator is computed.\n", "We also have a `fast` version of differential operators, where no checks are performed. This can be used to boost performances, once you know the standard ones are doing their job. \n", "\n", - "Notice that we do not pass directly a `python` function, but an `Equation` object, which is initialized with the `python` function. This is done so that all the computations and internal checks are done inside **PINA**, see [the related tutorials](https://mathlab.github.io/PINA/tutorial12/tutorial.html) for more.\n", + "Notice that we do not pass directly a `python` function, but an `Equation` object, which is initialized with the `python` function. This is done so that all the computations and internal checks are done inside **PINA**, see [the related tutorials](https://PINA-org.github.io/PINA-Tutorials/tutorial12/tutorial.html) for more.\n", "\n", "Once we have defined the function, we need to tell the neural network where these methods are to be applied. To do so, we use again the `Condition` class. In the `Condition` class, we pass the location points and the equation we want minimized on those points.\n", "\n", @@ -428,7 +428,7 @@ "source": [ "## The Problem Zoo module\n", "\n", - "In PINA many problems are already implemented for you in the [Problem Zoo module](https://mathlab.github.io/PINA/_rst/_code.html#problems-zoo). For example, the supervised problem at the beginning of the tutorial is implemented in [`SupervisedProblem`](https://mathlab.github.io/PINA/_rst/problem/zoo/supervised_problem.html)!\n", + "In PINA many problems are already implemented for you in the [Problem Zoo module](https://PINA-org.github.io/PINA/_rst/_code.html#problems-zoo). For example, the supervised problem at the beginning of the tutorial is implemented in [`SupervisedProblem`](https://PINA-org.github.io/PINA/_rst/problem/zoo/supervised_problem.html)!\n", "\n", "Let's see now a physics based example, the advection equation" ] @@ -466,11 +466,11 @@ "\n", "1. **Create Custom Problems**: Try building your own problems using the PINA framework, experiment with different PDEs, initial/boundary conditions, and data structures.\n", "\n", - "2. **Explore the Problem Zoo**: Dive into the [`problem.zoo` module](https://mathlab.github.io/PINA/_rst/_code.html#problems-zoo) to find a variety of predefined problem setups and use them as a starting point or inspiration for your own.\n", + "2. **Explore the Problem Zoo**: Dive into the [`problem.zoo` module](https://PINA-org.github.io/PINA/_rst/_code.html#problems-zoo) to find a variety of predefined problem setups and use them as a starting point or inspiration for your own.\n", "\n", "3. **...and many more!**: The possibilities are vast! Consider experimenting with different solver strategies, model architectures, or even implementing your own physical constraints.\n", "\n", - "For more examples and in-depth guides, be sure to check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more examples and in-depth guides, be sure to check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial16/tutorial.py b/tutorials/tutorial16/tutorial.py similarity index 100% rename from tutorial16/tutorial.py rename to tutorials/tutorial16/tutorial.py diff --git a/tutorial17/tutorial.ipynb b/tutorials/tutorial17/tutorial.ipynb similarity index 95% rename from tutorial17/tutorial.ipynb rename to tutorials/tutorial17/tutorial.ipynb index e37b992..3e3ea68 100644 --- a/tutorial17/tutorial.ipynb +++ b/tutorials/tutorial17/tutorial.ipynb @@ -8,7 +8,7 @@ "source": [ "# Tutorial: Introductory Tutorial: A Beginner’s Guide to PINA\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial17/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial17/tutorial.ipynb)\n", "\n", "

\n", " \"PINA\n", @@ -53,7 +53,7 @@ "\n", " Then prepare inputs by discretizing the domain or importing numerical data. PINA provides essential tools like the `Condition` class and the `pina.domain` module to facilitate domain sampling and ensure that the input data aligns with the problem's requirements.\n", "\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**\n", + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**\n", "\n", "2. ***Model Design*** \n", " Build neural network models as **PyTorch modules**. For graph-structured data, use **PyTorch Geometric** to build Graph Neural Networks. You can also import models from `pina.model` module!\n", @@ -213,7 +213,7 @@ "#### ***Model Design***\n", "\n", "We will now solve the problem using a **simple PyTorch Neural Network** with **Dropout**, which we will implement from scratch following [2]. \n", - "It's important to note that PINA provides a wide range of **state-of-the-art (SOTA)** architectures in the `pina.model` module, which you can explore further [here](https://mathlab.github.io/PINA/_rst/_code.html#models).\n", + "It's important to note that PINA provides a wide range of **state-of-the-art (SOTA)** architectures in the `pina.model` module, which you can explore further [here](https://PINA-org.github.io/PINA/_rst/_code.html#models).\n", "\n", "#### ***Solver Selection***\n", "\n", @@ -339,7 +339,7 @@ "\n", "### Solving a 2D Poisson Problem\n", "\n", - "In this section, we will solve a **2D Poisson problem** with **Dirichlet boundary conditions** on an **hourglass-shaped domain** using a simple `PhysicsInformedSingleModelSolver` [4]. You can explore other PINN variants, e.g. [5] or [6] in PINA by visiting the [PINA solvers documentation](https://mathlab.github.io/PINA/_rst/_code.html#solvers). We aim to solve the following 2D Poisson problem:\n", + "In this section, we will solve a **2D Poisson problem** with **Dirichlet boundary conditions** on an **hourglass-shaped domain** using a simple `PhysicsInformedSingleModelSolver` [4]. You can explore other PINN variants, e.g. [5] or [6] in PINA by visiting the [PINA solvers documentation](https://PINA-org.github.io/PINA/_rst/_code.html#solvers). We aim to solve the following 2D Poisson problem:\n", "\n", "$$\n", "\\begin{cases}\n", @@ -354,7 +354,7 @@ "\n", "PINA allows you to build complex geometries easily. It provides many built-in domain shapes and Boolean operators for combining them. For this problem, we will define the hourglass-shaped domain using the existing `CartesianDomain` and `EllipsoidDomain` classes, with Boolean operators like `Difference` and `Union`.\n", "\n", - "> **👉 If you are interested in exploring the `domain` module in more detail, check out [this tutorial](https://mathlab.github.io/PINA/tutorial6/tutorial.html).**\n" + "> **👉 If you are interested in exploring the `domain` module in more detail, check out [this tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial6/tutorial.html).**\n" ] }, { @@ -493,7 +493,7 @@ "- We inherit from **`SpatialProblem`** instead of `BaseProblem` to account for spatial variables.\n", "- We use **`domain`** and **`equation`** inside the `Condition` to define the problem.\n", "\n", - "The `Equation` class can be very useful for creating modular problem classes. If you're interested, check out [this tutorial](https://mathlab.github.io/PINA/tutorial12/tutorial.html) for more details. There's also a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) for building custom problems!\n", + "The `Equation` class can be very useful for creating modular problem classes. If you're interested, check out [this tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial12/tutorial.html) for more details. There's also a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) for building custom problems!\n", "\n", "Once the problem class is set, we need to **sample the domain** to obtain the data. PINA will automatically handle this, and if you forget to sample, an error will be raised before training begins 😉." ] @@ -522,7 +522,7 @@ "\n", "After setting the problem and sampling the domain, the next step is to **build the model** $\\mathcal{M}_{\\theta}$.\n", "\n", - "For this, we will use the custom PINA models available [here](https://mathlab.github.io/PINA/_rst/_code.html#models). Specifically, we will use a **feed-forward neural network** by importing the `FeedForward` class.\n", + "For this, we will use the custom PINA models available [here](https://PINA-org.github.io/PINA/_rst/_code.html#models). Specifically, we will use a **feed-forward neural network** by importing the `FeedForward` class.\n", "\n", "This neural network takes the **coordinates** (in this case `['x', 'y']`) as input and outputs the unknown field of the Poisson problem. \n", "\n", @@ -572,11 +572,11 @@ "\n", "### Training\n", "\n", - "For the last part of the pipeline we need a `Trainer`. We will train the model for **1500 epochs** using the default optimizer parameters. These parameters can be adjusted as needed. For more details, check the solvers documentation [here](https://mathlab.github.io/PINA/_rst/_code.html#solvers).\n", + "For the last part of the pipeline we need a `Trainer`. We will train the model for **1500 epochs** using the default optimizer parameters. These parameters can be adjusted as needed. For more details, check the solvers documentation [here](https://PINA-org.github.io/PINA/_rst/_code.html#solvers).\n", "\n", "To track metrics during training, we use the **`MetricTracker`** class.\n", "\n", - "> **👉 Want to know more about `Trainer` and how to boost PINA performance? Check out [this tutorial](https://mathlab.github.io/PINA/tutorial11/tutorial.html).**" + "> **👉 Want to know more about `Trainer` and how to boost PINA performance? Check out [this tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial11/tutorial.html).**" ] }, { @@ -664,7 +664,7 @@ "\n", "4. **...and many more!** — There are countless directions to further explore, from testing on different problems to refining the model architecture!\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/).\n", + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/).\n", "\n", "\n", "### References\n", diff --git a/tutorial17/tutorial.py b/tutorials/tutorial17/tutorial.py similarity index 100% rename from tutorial17/tutorial.py rename to tutorials/tutorial17/tutorial.py diff --git a/tutorial18/tutorial.ipynb b/tutorials/tutorial18/tutorial.ipynb similarity index 85% rename from tutorial18/tutorial.ipynb rename to tutorials/tutorial18/tutorial.ipynb index 0c445b0..4d59db8 100644 --- a/tutorial18/tutorial.ipynb +++ b/tutorials/tutorial18/tutorial.ipynb @@ -8,13 +8,13 @@ "source": [ "# Tutorial: Introduction to Solver classes\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial18/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial18/tutorial.ipynb)\n", "\n", "In this tutorial, we will explore the Solver classes in PINA, that are the core components for optimizing models. Solvers are designed to manage and execute the optimization process, providing the flexibility to work with various types of neural networks and loss functions. We will show how to use this class to select and implement different solvers, such as Supervised or Physics-Informed solvers. By the end of this tutorial, you'll be equipped to easily choose and customize solvers for your own tasks, streamlining the model training process.\n", "\n", "## Introduction to Solvers\n", "\n", - "[`Solvers`](https://mathlab.github.io/PINA/_rst/_code.html#solvers) are versatile objects in PINA designed to manage the training and optimization of machine learning models. They handle key components of the learning process, including:\n", + "[`Solvers`](https://PINA-org.github.io/PINA/_rst/_code.html#solvers) are versatile objects in PINA designed to manage the training and optimization of machine learning models. They handle key components of the learning process, including:\n", "\n", "- Loss function minimization \n", "- Model optimization (optimizer, schedulers)\n", @@ -26,7 +26,7 @@ "\n", "PINA provides three main base solver classes, designed respectively for training a single model, multiple distinct models, or an ensemble of models. These interfaces define the core functionality inherited by all specific solver implementations.\n", "\n", - "### 1. [`SingleModelSolver`](https://mathlab.github.io/PINA/_rst/solver/single_model_solver.html)\n", + "### 1. [`SingleModelSolver`](https://PINA-org.github.io/PINA/_rst/solver/single_model_solver.html)\n", "\n", "This is the base class for solvers that train **a single model**, such as in standard supervised learning or physics-informed training.\n", "\n", @@ -35,13 +35,13 @@ "- `model` – The neural network model.\n", "- `optimizer` – Defaults to `torch.optim.Adam` if not provided.\n", "- `scheduler` – Defaults to `torch.optim.lr_scheduler.ConstantLR`.\n", - "- `weighting` – Optional loss weighting schema., see [here](https://mathlab.github.io/PINA/_rst/_code.html#losses-and-weightings).\n", + "- `weighting` – Optional loss weighting schema., see [here](https://PINA-org.github.io/PINA/_rst/_code.html#losses-and-weightings).\n", "- `loss` - Defaults to `torch.nn.MSELoss`.\n", "- `use_lt` – Whether to use LabelTensors as input.\n", "\n", "---\n", "\n", - "### 2. [`MultiModelSolver`](https://mathlab.github.io/PINA/_rst/solver/multi_model_solver.html)\n", + "### 2. [`MultiModelSolver`](https://PINA-org.github.io/PINA/_rst/solver/multi_model_solver.html)\n", "\n", "This is the base class for solvers involving **multiple models** with distinct behaviours, such as in `SelfAdaptivePhysicsInformedSolver`.\n", "\n", @@ -50,13 +50,13 @@ "- `models` – The models used for training.\n", "- `optimizers` – Defaults to `torch.optim.Adam`.\n", "- `schedulers` – Defaults to `torch.optim.lr_scheduler.ConstantLR`.\n", - "- `weighting` – Optional loss weighting schema, see [here](https://mathlab.github.io/PINA/_rst/_code.html#losses-and-weightings).\n", + "- `weighting` – Optional loss weighting schema, see [here](https://PINA-org.github.io/PINA/_rst/_code.html#losses-and-weightings).\n", "- `loss` - Defaults to `torch.nn.MSELoss`.\n", "- `use_lt` – Whether to use LabelTensors as input.\n", "\n", "---\n", "\n", - "### 3. [`EnsembleSolver`](https://mathlab.github.io/PINA/_rst/solver/ensemble_solver.html)\n", + "### 3. [`EnsembleSolver`](https://PINA-org.github.io/PINA/_rst/solver/ensemble_solver.html)\n", "\n", "This is the base class for solvers that train **an ensemble of models** with the same behaviour, such as in `SupervisedEnsembleSolver`.\n", "\n", @@ -65,7 +65,7 @@ "- `models` – The models used for training.\n", "- `optimizers` – Defaults to `torch.optim.Adam`.\n", "- `schedulers` – Defaults to `torch.optim.lr_scheduler.ConstantLR`.\n", - "- `weighting` – Optional loss weighting schema, see [here](https://mathlab.github.io/PINA/_rst/_code.html#losses-and-weightings).\n", + "- `weighting` – Optional loss weighting schema, see [here](https://PINA-org.github.io/PINA/_rst/_code.html#losses-and-weightings).\n", "- `loss` - Defaults to `torch.nn.MSELoss`.\n", "- `use_lt` – Whether to use LabelTensors as input.\n", "\n", @@ -75,19 +75,19 @@ "\n", "## Structure a Solver with Multiple Inheritance:\n", "\n", - "Thanks to PINA’s modular design, custom solvers can be easily built through **multiple inheritance**. By combining a chosen base solver class with one or more [`Mixins`](https://mathlab.github.io/PINA/_rst/_code.html#mixins), users can define flexible and specialized optimization logic. Each mixin encapsulates an isolated component of the solver behavior, making it possible to assemble reusable building blocks into a fully functional custom solver. Examples include:\n", + "Thanks to PINA’s modular design, custom solvers can be easily built through **multiple inheritance**. By combining a chosen base solver class with one or more [`Mixins`](https://PINA-org.github.io/PINA/_rst/_code.html#mixins), users can define flexible and specialized optimization logic. Each mixin encapsulates an isolated component of the solver behavior, making it possible to assemble reusable building blocks into a fully functional custom solver. Examples include:\n", "\n", "- **`PhysicsInformedSingleModelSolver`**\n", " - Inherits from:\n", "\n", - " - [`PhysicsInformedMixin`](https://mathlab.github.io/PINA/_rst/solver/mixin/physics_informed_mixin.html) → enables gradient computation for validation and test phases\n", - " - [`SingleModelSolver`](https://mathlab.github.io/PINA/_rst/solver/single_model_solver.html) → manages training of a single model\n", + " - [`PhysicsInformedMixin`](https://PINA-org.github.io/PINA/_rst/solver/mixin/physics_informed_mixin.html) → enables gradient computation for validation and test phases\n", + " - [`SingleModelSolver`](https://PINA-org.github.io/PINA/_rst/solver/single_model_solver.html) → manages training of a single model\n", "\n", "- **`AutoregressiveEnsembleSolver`**\n", " - Inherits from: \n", "\n", - " - [`AutoregressiveMixin`](https://mathlab.github.io/PINA/_rst/solver/mixin/autoregressive_mixin.html) → implements autoregressive logic\n", - " - [`EnsembleSolver`](https://mathlab.github.io/PINA/_rst/solver/ensemble_solver.html) → manages training of an ensemble model\n", + " - [`AutoregressiveMixin`](https://PINA-org.github.io/PINA/_rst/solver/mixin/autoregressive_mixin.html) → implements autoregressive logic\n", + " - [`EnsembleSolver`](https://PINA-org.github.io/PINA/_rst/solver/ensemble_solver.html) → manages training of an ensemble model\n", "\n", "This structure promotes **code reuse** and **extensibility**, allowing you to quickly prototype new solver strategies by reusing core training and optimization logic.\n", "\n", @@ -259,7 +259,7 @@ "\n", "3. **...and many more!**: There are countless directions to further explore, try to look at our `solver` for example!\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial18/tutorial.py b/tutorials/tutorial18/tutorial.py similarity index 100% rename from tutorial18/tutorial.py rename to tutorials/tutorial18/tutorial.py diff --git a/tutorial19/tutorial.ipynb b/tutorials/tutorial19/tutorial.ipynb similarity index 97% rename from tutorial19/tutorial.ipynb rename to tutorials/tutorial19/tutorial.ipynb index 1e951e1..11e279c 100644 --- a/tutorial19/tutorial.ipynb +++ b/tutorials/tutorial19/tutorial.ipynb @@ -8,7 +8,7 @@ "source": [ "# Tutorial: Data structure for SciML: `Tensor`, `LabelTensor`, `Data` and `Graph`\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial19/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial19/tutorial.ipynb)\n", "\n", "In this tutorial, we’ll quickly go through the basics of Data Structures for Scientific Machine Learning, convering:\n", "1. **PyTorch Tensors** / **PINA LabelTensors**\n", @@ -449,13 +449,13 @@ "\n", "Congratulations on completing the tutorials on the **PINA Data Structures**! You now have a solid foundation in using the different data structures within PINA, such as **Tensors**, **Label Tensors**, and **Graphs**. Here are some exciting next steps you can take to continue your learning journey:\n", "\n", - "1. **Deep Dive into Label Tensors**: Check the documentation of [`LabelTensor`](https://mathlab.github.io/PINA/_rst/label_tensor.html) to learn more about the available methods.\n", + "1. **Deep Dive into Label Tensors**: Check the documentation of [`LabelTensor`](https://PINA-org.github.io/PINA/_rst/label_tensor.html) to learn more about the available methods.\n", "\n", - "2. **Working with Graphs in PINA**: In PINA we implement many graph structures, e.g. `KNNGraph`, `RadiusGraph`, .... see [here](https://mathlab.github.io/PINA/_rst/_code.html#graphs-structures) for further details.\n", + "2. **Working with Graphs in PINA**: In PINA we implement many graph structures, e.g. `KNNGraph`, `RadiusGraph`, .... see [here](https://PINA-org.github.io/PINA/_rst/_code.html#graphs-structures) for further details.\n", "\n", "3. **...and many more!**: Consider exploring `LabelTensor` for Physics-Informed Solvers!\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial19/tutorial.py b/tutorials/tutorial19/tutorial.py similarity index 100% rename from tutorial19/tutorial.py rename to tutorials/tutorial19/tutorial.py diff --git a/tutorial2/tutorial.ipynb b/tutorials/tutorial2/tutorial.ipynb similarity index 99% rename from tutorial2/tutorial.ipynb rename to tutorials/tutorial2/tutorial.ipynb index 1a8c5b2..14355e0 100644 --- a/tutorial2/tutorial.ipynb +++ b/tutorials/tutorial2/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Enhancing PINNs with Extra Features to solve the Poisson Problem\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial2/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial2/tutorial.ipynb)\n", "\n", "This tutorial presents how to solve with Physics-Informed Neural Networks (PINNs) a 2D Poisson problem with Dirichlet boundary conditions. We will train with standard PINN's training, and with extrafeatures. For more insights on extrafeature learning please read [*An extended physics informed neural network for preliminary analysis of parametric optimal control problems*](https://www.sciencedirect.com/science/article/abs/pii/S0898122123002018).\n", "\n", @@ -66,7 +66,7 @@ "where $D$ is a square domain $[0,1]^2$, and $\\Gamma_i$, with $i=1,...,4$, are the boundaries of the square.\n", "\n", "The Poisson problem is written in **PINA** code as a class. The equations are written as *conditions* that should be satisfied in the corresponding domains. The *solution*\n", - "is the exact solution which will be compared with the predicted one. If interested in how to write problems see [this tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html).\n", + "is the exact solution which will be compared with the predicted one. If interested in how to write problems see [this tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html).\n", "\n", "We will directly import the problem from `pina.problem.zoo`, which contains a vast list of PINN problems and more." ] @@ -498,7 +498,7 @@ "\n", "4. **... and many more!.**: There are endless possibilities! Continue exploring and experimenting with new ideas.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial2/tutorial.py b/tutorials/tutorial2/tutorial.py similarity index 100% rename from tutorial2/tutorial.py rename to tutorials/tutorial2/tutorial.py diff --git a/tutorial20/tutorial.ipynb b/tutorials/tutorial20/tutorial.ipynb similarity index 95% rename from tutorial20/tutorial.ipynb rename to tutorials/tutorial20/tutorial.ipynb index 409f108..edcdf9c 100644 --- a/tutorial20/tutorial.ipynb +++ b/tutorials/tutorial20/tutorial.ipynb @@ -8,13 +8,13 @@ "source": [ "# Tutorial: Introductory Tutorial: Supervised Learning with PINA\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial20/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial20/tutorial.ipynb)\n", "\n", "\n", "> ##### ⚠️ ***Before starting:***\n", - "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://mathlab.github.io/PINA/_tutorial.html#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", + "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://PINA-org.github.io/PINA-Tutorials/#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", "\n", - "In this tutorial, we will demonstrate a typical use case of **PINA** for Supervised Learning training. We will cover the basics of training a Supervised Solver with PINA, if you want to go further into PINNs look at our dedicated [tutorials](https://mathlab.github.io/PINA/_tutorial.html#supervised-learning) on the topic.\n", + "In this tutorial, we will demonstrate a typical use case of **PINA** for Supervised Learning training. We will cover the basics of training a Supervised Solver with PINA, if you want to go further into PINNs look at our dedicated [tutorials](https://PINA-org.github.io/PINA-Tutorials/#supervised-learning) on the topic.\n", "\n", "Let's start by importing the useful modules:" ] @@ -151,7 +151,7 @@ "\n", "The problem we will define is a basic `SupervisedProblem`, where the inputs are the coordinates and the outputs are the corresponding Signed Distance Function (SDF) values.\n", "\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**" + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**" ] }, { @@ -344,7 +344,7 @@ "\n", "3. **... and many more!**: The possibilities are vast! Continue experimenting with advanced configurations, solvers, and other features in PINA.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial20/tutorial.py b/tutorials/tutorial20/tutorial.py similarity index 100% rename from tutorial20/tutorial.py rename to tutorials/tutorial20/tutorial.py diff --git a/tutorial21/tutorial.ipynb b/tutorials/tutorial21/tutorial.ipynb similarity index 92% rename from tutorial21/tutorial.ipynb rename to tutorials/tutorial21/tutorial.ipynb index 4cf89d4..98f11f5 100644 --- a/tutorial21/tutorial.ipynb +++ b/tutorials/tutorial21/tutorial.ipynb @@ -8,13 +8,13 @@ "source": [ "# Tutorial: Introductory Tutorial: Neural Operator Learning with PINA\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial21/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial21/tutorial.ipynb)\n", "\n", "\n", "> ##### ⚠️ ***Before starting:***\n", - "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://mathlab.github.io/PINA/_tutorial.html#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", + "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://PINA-org.github.io/PINA-Tutorials/#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", "\n", - "In this tutorial, we will demonstrate a typical use case of **PINA** for Neural Operator learning. We will cover the basics of training a Neural Operator with PINA, if you want to go further into the topic look at our dedicated [tutorials](https://mathlab.github.io/PINA/_tutorial.html#neural-operator-learning) on the topic.\n", + "In this tutorial, we will demonstrate a typical use case of **PINA** for Neural Operator learning. We will cover the basics of training a Neural Operator with PINA, if you want to go further into the topic look at our dedicated [tutorials](https://PINA-org.github.io/PINA-Tutorials/#neural-operator-learning) on the topic.\n", "\n", "Let's start by importing the useful modules:" ] @@ -169,11 +169,11 @@ "\n", "- **Fourier Neural Operator (FNO)**: \n", " The **Fourier Neural Operator** utilizes the **Fourier transform** in the processor to perform global convolutions. This enables the operator to capture long-range dependencies efficiently. FNOs are particularly useful for problems with periodic data or problems where global patterns and interactions are important. \n", - " ➤ [Learn more about FNO](https://mathlab.github.io/PINA/_rst/model/fourier_neural_operator.html).\n", + " ➤ [Learn more about FNO](https://PINA-org.github.io/PINA/_rst/model/fourier_neural_operator.html).\n", "\n", "- **Graph Neural Operator (GNO)**: \n", " The **Graph Neural Operator** leverages **Graph Neural Networks (GNNs)** to exchange information between nodes, enabling the operator to perform convolutions on unstructured domains, such as graphs or meshes. GNOs are especially useful for problems that naturally involve irregular data, such as graph-based datasets or data on non-Euclidean spaces. \n", - " ➤ [Learn more about GNO](https://mathlab.github.io/PINA/_rst/model/graph_neural_operator.html).\n", + " ➤ [Learn more about GNO](https://PINA-org.github.io/PINA/_rst/model/graph_neural_operator.html).\n", "\n", "- **Deep Operator Network (DeepONet)**: \n", " **DeepONet** is a variant of Neural Operators designed to solve operator equations by learning mappings between input and output functions. Unlike other Neural Operators, **DeepONet** does not use the typical encoder-processor-decoder structure. Instead, it uses two distinct neural networks:\n", @@ -182,7 +182,7 @@ " 2. **Trunk Network**: Takes the **spatial locations** (e.g., $x$) and maps them to the output space.\n", " \n", " The output of **DeepONet** is the combination of these two networks' outputs, which together provide the mapping from the input function to the output function. \n", - " ➤ [Learn more about DeepONet](https://mathlab.github.io/PINA/_rst/model/deeponet.html).\n", + " ➤ [Learn more about DeepONet](https://PINA-org.github.io/PINA/_rst/model/deeponet.html).\n", "\n", "In this tutorial we will focus on Neural Operator which follow the Encoder - Processor - Decoder structure, which we call *Kernel* Neural Operator. Implementing kernel neural Operators in PINA is very simple, you just need to use the `KernelNeuralOperator` API.\n", "\n", @@ -195,7 +195,7 @@ "\n", "3. `projection_operator`: a `torch.nn.Module` representing the hidden representation to the output function.\n", "\n", - "To construct the kernel, you can use the Neural Operator Blocks available in PINA (see [here](https://mathlab.github.io/PINA/_rst/_code.html#blocks)) or implement you own one! Let's build a simple FNO using the `FourierBlock1D`. In particular we will:\n", + "To construct the kernel, you can use the Neural Operator Blocks available in PINA (see [here](https://PINA-org.github.io/PINA/_rst/_code.html#blocks)) or implement you own one! Let's build a simple FNO using the `FourierBlock1D`. In particular we will:\n", "\n", "1. Define the encoder, a simple linear layer mapping the input dimension to the hidden dimension\n", "2. Define the decoder, two linear layers mapping the hidden dimension to 128 and back to the input dimension\n", @@ -272,9 +272,9 @@ "source": [ "Done! Let's now solve the Neural Operator problem. The problem we will define is a basic `SupervisedProblem`, and we will use the `SupervisedSingleModelSolver` to train the Neural Operator.\n", "\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**\n", + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial16/tutorial.html) to teach how to build a Problem from scratch — have a look if you're interested!**\n", "\n", - "> **👉 We have a dedicated [tutorial](https://mathlab.github.io/PINA/tutorial18/tutorial.html) for an overview of Solvers in PINA — have a look if you're interested!**" + "> **👉 We have a dedicated [tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial18/tutorial.html) for an overview of Solvers in PINA — have a look if you're interested!**" ] }, { @@ -355,7 +355,7 @@ "\n", "3. **...and many more!** — The possibilities are vast! Continue experimenting with advanced configurations, solvers, and features in PINA. For example, consider incorporating physics-informed terms during training to enhance model generalization.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial21/tutorial.py b/tutorials/tutorial21/tutorial.py similarity index 100% rename from tutorial21/tutorial.py rename to tutorials/tutorial21/tutorial.py diff --git a/tutorial22/holed_poisson.pt b/tutorials/tutorial22/holed_poisson.pt similarity index 100% rename from tutorial22/holed_poisson.pt rename to tutorials/tutorial22/holed_poisson.pt diff --git a/tutorial22/tutorial.ipynb b/tutorials/tutorial22/tutorial.ipynb similarity index 97% rename from tutorial22/tutorial.ipynb rename to tutorials/tutorial22/tutorial.ipynb index 5f92122..8f7afde 100644 --- a/tutorial22/tutorial.ipynb +++ b/tutorials/tutorial22/tutorial.ipynb @@ -8,11 +8,11 @@ "source": [ "# Tutorial: Reduced Order Model with Graph Neural Networks\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial22/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial22/tutorial.ipynb)\n", "\n", "\n", "> ##### ⚠️ ***Before starting:***\n", - "> We assume you are already familiar with the concepts covered in the [Data Structure for SciML](https://mathlab.github.io/PINA/tutorial19/tutorial.html) tutorial. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", + "> We assume you are already familiar with the concepts covered in the [Data Structure for SciML](https://PINA-org.github.io/PINA-Tutorials/tutorial19/tutorial.html) tutorial. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", "\n", "In this tutorial, we use **PINA** to construct a graph-based reduced-order model for a parametrized partial differential equation. The workflow is largely inspired by [*A graph convolutional autoencoder approach to model order reduction for parametrized PDEs*](https://www.sciencedirect.com/science/article/pii/S0021999124000111).\n", "\n", @@ -42,7 +42,7 @@ " IN_COLAB = False\n", "if IN_COLAB:\n", " !pip install \"pina-mathlab[tutorial]\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial22/holed_poisson.pt\" -O \"holed_poisson.pt\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial22/holed_poisson.pt\" -O \"holed_poisson.pt\"\n", "\n", "import torch\n", "from torch_geometric.nn import GMMConv\n", @@ -318,7 +318,7 @@ "\n", "We now train the autoencoder with PINA's supervised-learning workflow.\n", "\n", - "First, we define a [`SupervisedProblem`](https://mathlab.github.io/PINA/_rst/problem/zoo/supervised_problem.html#module-pina.problem.zoo.supervised_problem):\n", + "First, we define a [`SupervisedProblem`](https://PINA-org.github.io/PINA/_rst/problem/zoo/supervised_problem.html#module-pina.problem.zoo.supervised_problem):\n", "\n", "- **input:** graph objects containing the solution fields and mesh information;\n", "- **target:** the original node-wise solution values that the autoencoder must reconstruct.\n", @@ -683,7 +683,7 @@ "\n", "3. **...and many more!** — The possibilities are vast! Continue experimenting with advanced configurations, solvers, and features in PINA.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial22/tutorial.py b/tutorials/tutorial22/tutorial.py similarity index 100% rename from tutorial22/tutorial.py rename to tutorials/tutorial22/tutorial.py diff --git a/tutorial23/tutorial.ipynb b/tutorials/tutorial23/tutorial.ipynb similarity index 97% rename from tutorial23/tutorial.ipynb rename to tutorials/tutorial23/tutorial.ipynb index fa765cc..4352344 100644 --- a/tutorial23/tutorial.ipynb +++ b/tutorials/tutorial23/tutorial.ipynb @@ -7,11 +7,11 @@ "source": [ "# Tutorial: Data-driven System Identification with SINDy\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial23/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial23/tutorial.ipynb)\n", "\n", "\n", "> ##### ⚠️ ***Before starting:***\n", - "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://mathlab.github.io/PINA/_tutorial.html#getting-started-with-pina) tutorial. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", + "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://PINA-org.github.io/PINA-Tutorials/#getting-started-with-pina) tutorial. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", "\n", "In this tutorial, we will demonstrate a typical use case of **PINA** for Data-driven system identification using SINDy. The tutorial is largely inspired by the paper [Discovering governing equations from data by sparse identification of nonlinear dynamical systems](dx.doi.org/10.1073/pnas.1517384113).\n", "\n", @@ -249,7 +249,7 @@ "source": [ "## Training with PINA\n", "We are now ready to train our model! We can use **PINA** to train the model, following the workflow from previous tutorials.\n", - "First, we need to define the problem. In this case, we will use the [`SupervisedProblem`](https://mathlab.github.io/PINA/_rst/problem/zoo/supervised_problem.html#module-pina.problem.zoo.supervised_problem), which expects: \n", + "First, we need to define the problem. In this case, we will use the [`SupervisedProblem`](https://PINA-org.github.io/PINA/_rst/problem/zoo/supervised_problem.html#module-pina.problem.zoo.supervised_problem), which expects: \n", "\n", "- **Input**: the state variables tensor $\\boldsymbol{X}$ containing all the collected snapshots. \n", "- **Output**: the corresponding time derivatives $\\dot{\\boldsymbol{X}}$." @@ -442,7 +442,7 @@ "\n", "3. **...and many more!** — The possibilities are vast! Continue experimenting with advanced configurations, solvers, and features in PINA.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial23/tutorial.py b/tutorials/tutorial23/tutorial.py similarity index 100% rename from tutorial23/tutorial.py rename to tutorials/tutorial23/tutorial.py diff --git a/tutorial24/data/advection_input_testing.pt b/tutorials/tutorial24/data/advection_input_testing.pt similarity index 100% rename from tutorial24/data/advection_input_testing.pt rename to tutorials/tutorial24/data/advection_input_testing.pt diff --git a/tutorial24/data/advection_input_training.pt b/tutorials/tutorial24/data/advection_input_training.pt similarity index 100% rename from tutorial24/data/advection_input_training.pt rename to tutorials/tutorial24/data/advection_input_training.pt diff --git a/tutorial24/data/advection_output_testing.pt b/tutorials/tutorial24/data/advection_output_testing.pt similarity index 100% rename from tutorial24/data/advection_output_testing.pt rename to tutorials/tutorial24/data/advection_output_testing.pt diff --git a/tutorial24/data/advection_output_training.pt b/tutorials/tutorial24/data/advection_output_training.pt similarity index 100% rename from tutorial24/data/advection_output_training.pt rename to tutorials/tutorial24/data/advection_output_training.pt diff --git a/tutorial24/tutorial.ipynb b/tutorials/tutorial24/tutorial.ipynb similarity index 95% rename from tutorial24/tutorial.ipynb rename to tutorials/tutorial24/tutorial.ipynb index 0a61ca9..907467b 100644 --- a/tutorial24/tutorial.ipynb +++ b/tutorials/tutorial24/tutorial.ipynb @@ -8,11 +8,11 @@ "source": [ "# Tutorial: Advection Equation with data driven DeepONet\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial24/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial24/tutorial.ipynb)\n", "\n", "\n", "> ##### ⚠️ ***Before starting:***\n", - "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://mathlab.github.io/PINA/_tutorial.html#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", + "> We assume you are already familiar with the concepts covered in the [Getting started with PINA](https://PINA-org.github.io/PINA-Tutorials/#getting-started-with-pina) tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.\n", "\n", "In this tutorial, we demonstrate how to solve the advection operator learning problem using `DeepONet`. We follow the original formulation of Lu *et al.* in [*DeepONet: Learning nonlinear operators for identifying differential equations based on the universal approximation theorem of operator*](https://arxiv.org/abs/1910.03193).\n", "\n", @@ -37,10 +37,10 @@ " !pip install \"pina-mathlab[tutorial]\"\n", " # get the data\n", " !mkdir \"data\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial24/data/advection_input_testing.pt\" -O \"data/advection_input_testing.pt\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial24/data/advection_input_training.pt\" -O \"data/advection_input_training.pt\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial24/data/advection_output_testing.pt\" -O \"data/advection_output_testing.pt\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial24/data/advection_output_training.pt\" -O \"data/advection_output_training.pt\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial24/data/advection_input_testing.pt\" -O \"data/advection_input_testing.pt\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial24/data/advection_input_training.pt\" -O \"data/advection_input_training.pt\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial24/data/advection_output_testing.pt\" -O \"data/advection_output_testing.pt\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial24/data/advection_output_training.pt\" -O \"data/advection_output_training.pt\"\n", "\n", "import matplotlib.pyplot as plt\n", "import torch\n", @@ -408,7 +408,7 @@ "\n", "5. **...and much more!**: From adding noise robustness to testing on real scientific datasets, the space of possibilities is wide open.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial24/tutorial.py b/tutorials/tutorial24/tutorial.py similarity index 100% rename from tutorial24/tutorial.py rename to tutorials/tutorial24/tutorial.py diff --git a/tutorial3/tutorial.ipynb b/tutorials/tutorial3/tutorial.ipynb similarity index 99% rename from tutorial3/tutorial.ipynb rename to tutorials/tutorial3/tutorial.ipynb index 03ad68b..385bc7a 100644 --- a/tutorial3/tutorial.ipynb +++ b/tutorials/tutorial3/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Applying Hard Constraints in PINNs to solve the Wave Problem\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial3/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial3/tutorial.ipynb)\n", "\n", "In this tutorial, we will present how to solve the wave equation using **hard constraint Physics-Informed Neural Networks (PINNs)**. To achieve this, we will build a custom `torch` model and pass it to the **PINN solver**.\n", "\n", @@ -446,7 +446,7 @@ "\n", "4. **...and many more!**: The possibilities are endless! Keep experimenting and pushing the boundaries.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial3/tutorial.py b/tutorials/tutorial3/tutorial.py similarity index 100% rename from tutorial3/tutorial.py rename to tutorials/tutorial3/tutorial.py diff --git a/tutorial4/tutorial.ipynb b/tutorials/tutorial4/tutorial.ipynb similarity index 99% rename from tutorial4/tutorial.ipynb rename to tutorials/tutorial4/tutorial.ipynb index c79d169..29b9ead 100644 --- a/tutorial4/tutorial.ipynb +++ b/tutorials/tutorial4/tutorial.ipynb @@ -6,7 +6,7 @@ "metadata": {}, "source": [ "# Tutorial: Unstructured Convolutional Autoencoders with Continuous Convolution\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial4/tutorial.ipynb)" + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial4/tutorial.ipynb)" ] }, { @@ -877,7 +877,7 @@ "\n", "4. **...and many more!**: There are endless possibilities, from improving model architecture to testing with more complex datasets.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial4/tutorial.py b/tutorials/tutorial4/tutorial.py similarity index 100% rename from tutorial4/tutorial.py rename to tutorials/tutorial4/tutorial.py diff --git a/tutorial5/Data_Darcy.mat b/tutorials/tutorial5/Data_Darcy.mat similarity index 100% rename from tutorial5/Data_Darcy.mat rename to tutorials/tutorial5/Data_Darcy.mat diff --git a/tutorial5/tutorial.ipynb b/tutorials/tutorial5/tutorial.ipynb similarity index 98% rename from tutorial5/tutorial.ipynb rename to tutorials/tutorial5/tutorial.ipynb index 3f4edd3..c9729b7 100644 --- a/tutorial5/tutorial.ipynb +++ b/tutorials/tutorial5/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Modeling 2D Darcy Flow with the Fourier Neural Operator\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial5/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial5/tutorial.ipynb)\n", "\n", "In this tutorial, we are going to solve the **Darcy flow problem** in two dimensions, as presented in the paper [*Fourier Neural Operator for Parametric Partial Differential Equations*](https://openreview.net/pdf?id=c8P9NQVtmnO).\n", "\n", @@ -37,7 +37,7 @@ " !pip install \"pina-mathlab[tutorial]\"\n", " !pip install scipy\n", " # get the data\n", - " !wget https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial5/Data_Darcy.mat\n", + " !wget https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial5/Data_Darcy.mat\n", "\n", "import torch\n", "import matplotlib.pyplot as plt\n", @@ -346,7 +346,7 @@ "\n", "3. **...and many more!**: There are countless directions to further explore. For instance, you could try to add physics informed learning!\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial5/tutorial.py b/tutorials/tutorial5/tutorial.py similarity index 100% rename from tutorial5/tutorial.py rename to tutorials/tutorial5/tutorial.py diff --git a/tutorial6/tutorial.ipynb b/tutorials/tutorial6/tutorial.ipynb similarity index 99% rename from tutorial6/tutorial.ipynb rename to tutorials/tutorial6/tutorial.ipynb index bdd85d6..1a57e96 100644 --- a/tutorial6/tutorial.ipynb +++ b/tutorials/tutorial6/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Building domains with PINA's `BaseDomain` class\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial6/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial6/tutorial.ipynb)\n", "\n", "In this tutorial, we explore how to use and visualize PINA’s built-in geometric domains and how to construct custom ones. We will cover:\n", "- Creating domains using `CartesianDomain`, `EllipsoidDomain`, and `SimplexDomain`\n", @@ -547,7 +547,7 @@ "\n", "3. **...and many more!**: Implement new geometries using DomainInterface and push PINA’s capabilities further.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial6/tutorial.py b/tutorials/tutorial6/tutorial.py similarity index 100% rename from tutorial6/tutorial.py rename to tutorials/tutorial6/tutorial.py diff --git a/tutorial7/data/pinn_solution_0.5_0.5 b/tutorials/tutorial7/data/pinn_solution_0.5_0.5 similarity index 100% rename from tutorial7/data/pinn_solution_0.5_0.5 rename to tutorials/tutorial7/data/pinn_solution_0.5_0.5 diff --git a/tutorial7/data/pts_0.5_0.5 b/tutorials/tutorial7/data/pts_0.5_0.5 similarity index 100% rename from tutorial7/data/pts_0.5_0.5 rename to tutorials/tutorial7/data/pts_0.5_0.5 diff --git a/tutorial7/tutorial.ipynb b/tutorials/tutorial7/tutorial.ipynb similarity index 97% rename from tutorial7/tutorial.ipynb rename to tutorials/tutorial7/tutorial.ipynb index 793c094..f3a0be3 100644 --- a/tutorial7/tutorial.ipynb +++ b/tutorials/tutorial7/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Inverse Problem Solving with Physics-Informed Neural Network\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial7/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial7/tutorial.ipynb)\n", "\n", "## Introduction to the Inverse Problem\n", "\n", @@ -53,8 +53,8 @@ " !pip install \"pina-mathlab[tutorial]\"\n", " # get the data\n", " !mkdir \"data\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial7/data/pinn_solution_0.5_0.5\" -O \"data/pinn_solution_0.5_0.5\"\n", - " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorial7/data/pts_0.5_0.5\" -O \"data/pts_0.5_0.5\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial7/data/pinn_solution_0.5_0.5\" -O \"data/pinn_solution_0.5_0.5\"\n", + " !wget \"https://github.com/PINA-org/PINA-tutorials/raw/refs/heads/main/tutorials/tutorial7/data/pts_0.5_0.5\" -O \"data/pts_0.5_0.5\"\n", "\n", "import matplotlib.pyplot as plt\n", "import torch\n", @@ -201,7 +201,7 @@ "id": "6b264569-57b3-458d-bb69-8e94fe89017d", "metadata": {}, "source": [ - "Next, we define the neural network model that will be used for solving the inverse problem. In this case, we use a simple FeedForeard model, but you could build one that imposes *hard constraints* on the boundary conditions, similar to the approach used in the [Wave tutorial](https://mathlab.github.io/PINA/tutorial3/tutorial.html) to have better performances!" + "Next, we define the neural network model that will be used for solving the inverse problem. In this case, we use a simple FeedForeard model, but you could build one that imposes *hard constraints* on the boundary conditions, similar to the approach used in the [Wave tutorial](https://PINA-org.github.io/PINA-Tutorials/tutorial3/tutorial.html) to have better performances!" ] }, { @@ -358,7 +358,7 @@ "\n", "3. **...and many more!**: The possibilities are endless, from integrating additional physical constraints to testing on real-world datasets.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial7/tutorial.py b/tutorials/tutorial7/tutorial.py similarity index 100% rename from tutorial7/tutorial.py rename to tutorials/tutorial7/tutorial.py diff --git a/tutorial8/tutorial.ipynb b/tutorials/tutorial8/tutorial.ipynb similarity index 99% rename from tutorial8/tutorial.ipynb rename to tutorials/tutorial8/tutorial.ipynb index ee07fd1..f2c970f 100644 --- a/tutorial8/tutorial.ipynb +++ b/tutorials/tutorial8/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial8/tutorial.ipynb)" + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial8/tutorial.ipynb)" ] }, { @@ -409,7 +409,7 @@ "\n", "5. **...and many more!**: The potential applications of reduced order models are vast, ranging from material science simulations to real-time predictions in engineering applications.\n", "\n", - "For more information and advanced tutorials, refer to the [PINA Documentation](https://mathlab.github.io/PINA/).\n", + "For more information and advanced tutorials, refer to the [PINA Documentation](https://PINA-org.github.io/PINA/).\n", "\n", "### References\n", "1. Rozza G., Stabile G., Ballarin F. (2022). Advanced Reduced Order Methods and Applications in Computational Fluid Dynamics, Society for Industrial and Applied Mathematics. \n", diff --git a/tutorial8/tutorial.py b/tutorials/tutorial8/tutorial.py similarity index 100% rename from tutorial8/tutorial.py rename to tutorials/tutorial8/tutorial.py diff --git a/tutorial9/tutorial.ipynb b/tutorials/tutorial9/tutorial.ipynb similarity index 99% rename from tutorial9/tutorial.ipynb rename to tutorials/tutorial9/tutorial.ipynb index 9922286..bf1d4f5 100644 --- a/tutorial9/tutorial.ipynb +++ b/tutorials/tutorial9/tutorial.ipynb @@ -7,7 +7,7 @@ "source": [ "# Tutorial: Applying Periodic Boundary Conditions in PINNs to solve the Helmholtz Problem\n", "\n", - "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorial9/tutorial.ipynb)\n", + "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/PINA-org/PINA-tutorials/blob/main/tutorials/tutorial9/tutorial.ipynb)\n", "\n", "This tutorial demonstrates how to solve a one-dimensional Helmholtz equation with periodic boundary conditions (PBC) using Physics-Informed Neural Networks (PINNs). \n", "We will use standard Physics-Informed training, augmented with a periodic input expansion as introduced in [*An Expert’s Guide to Training Physics-Informed Neural Networks*](https://arxiv.org/abs/2308.08468).\n", @@ -315,7 +315,7 @@ "\n", "4. **...and many more!**: Extend to higher dimensions, test on other PDEs, or even develop custom embeddings tailored to your problem.\n", "\n", - "For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/)." + "For more resources and tutorials, check out the [PINA Documentation](https://PINA-org.github.io/PINA/)." ] } ], diff --git a/tutorial9/tutorial.py b/tutorials/tutorial9/tutorial.py similarity index 100% rename from tutorial9/tutorial.py rename to tutorials/tutorial9/tutorial.py