Skip to content

Commit 29b14ee

Browse files
committed
Update Tutorials (#544)
* update tutorials * tutorial guidelines * doc
1 parent 7e403ac commit 29b14ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6242
-6689
lines changed

docs/source/_tutorial.rst

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
PINA Tutorials
2-
======================
1+
🚀 Welcome to the PINA Tutorials!
2+
==================================
33

44

5-
In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**.
5+
In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**.
6+
Whether you're just getting started or looking to deepen your understanding, these resources are here to guide you.
67

78
Getting started with PINA
89
-------------------------
910

10-
- `Introduction to PINA for Physics Informed Neural Networks training <tutorial1/tutorial.html>`_
11+
- `Introductory Tutorial: A Beginner's Guide to PINA <tutorial17/tutorial.html>`_
12+
- `How to build a Problem in PINA <tutorial16/tutorial.html>`_
13+
- `Introduction to Solver classes <tutorial18/tutorial.html>`_
14+
- `Introduction to Trainer class <tutorial11/tutorial.html>`_
15+
- `Data structure for SciML: Tensor, LabelTensor, Data and Graph <tutorial19/tutorial.html>`_
16+
- `Building geometries with DomainInterface class <tutorial6/tutorial.html>`_
1117
- `Introduction to PINA Equation class <tutorial12/tutorial.html>`_
12-
- `PINA and PyTorch Lightning, training tips and visualizations <tutorial11/tutorial.html>`_
13-
- `Building custom geometries with PINA Location class <tutorial6/tutorial.html>`_
14-
1518

1619
Physics Informed Neural Networks
1720
--------------------------------
1821

19-
- `Two dimensional Poisson problem using Extra Features Learning <tutorial2/tutorial.html>`_
20-
- `Two dimensional Wave problem with hard constraint <tutorial3/tutorial.html>`_
21-
- `Resolution of a 2D Poisson inverse problem <tutorial7/tutorial.html>`_
22-
- `Periodic Boundary Conditions for Helmotz Equation <tutorial9/tutorial.html>`_
23-
- `Multiscale PDE learning with Fourier Feature Network <tutorial13/tutorial.html>`_
22+
- `Introductory Tutorial: Physics Informed Neural Networks with PINA <tutorial1/tutorial.html>`_
23+
- `Enhancing PINNs with Extra Features to solve the Poisson Problem <tutorial2/tutorial.html>`_
24+
- `Applying Hard Constraints in PINNs to solve the Wave Problem <tutorial3/tutorial.html>`_
25+
- `Applying Periodic Boundary Conditions in PINNs to solve the Helmotz Problem <tutorial9/tutorial.html>`_
26+
- `Inverse Problem Solving with Physics-Informed Neural Network <tutorial7/tutorial.html>`_
27+
- `Learning Multiscale PDEs Using Fourier Feature Networks <tutorial13/tutorial.html>`_
28+
- `Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles <tutorial14/tutorial.html>`_
2429

2530
Neural Operator Learning
2631
------------------------
2732

28-
- `Two dimensional Darcy flow using the Fourier Neural Operator <tutorial5/tutorial.html>`_
29-
- `Time dependent Kuramoto Sivashinsky equation using the Averaging Neural Operator <tutorial10/tutorial.html>`_
33+
- `Introductory Tutorial: Neural Operator Learning with PINA <tutorial21/tutorial.html>`_
34+
- `Modeling 2D Darcy Flow with the Fourier Neural Operator <tutorial5/tutorial.html>`_
35+
- `Solving the Kuramoto-Sivashinsky Equation with Averaging Neural Operator <tutorial10/tutorial.html>`_
3036

3137
Supervised Learning
3238
-------------------
3339

34-
- `Unstructured convolutional autoencoder via continuous convolution <tutorial4/tutorial.html>`_
35-
- `POD-RBF and POD-NN for reduced order modeling <tutorial8/tutorial.html>`_
40+
- `Introductory Tutorial: Supervised Learning with PINA <tutorial20/tutorial.html>`_
41+
- `Chemical Properties Prediction with Graph Neural Networks <tutorial25/tutorial.html>`_
42+
- `Unstructured Convolutional Autoencoders with Continuous Convolution <tutorial4/tutorial.html>`_
43+
- `Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics <tutorial8/tutorial.html>`_

tutorials/README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
1-
# PINA Tutorials
1+
# 🚀 Welcome to the PINA Tutorials!
2+
3+
In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**. Whether you're just getting started or looking to deepen your understanding, these resources are here to guide you.
4+
5+
The table below provides an overview of each tutorial. All tutorials are also available in HTML in the official [PINA documentation](http://mathlab.github.io/PINA/).
26

3-
In this folder we collect useful tutorials in order to understand the principles and the potential of **PINA**. Please read the following table for details about the tutorials. The HTML version of all the tutorials is available also within the [documentation](http://mathlab.github.io/PINA/).
47

58
## Getting started with PINA
69

710
| Description | Tutorial |
811
|---------------|-----------|
9-
Introduction to PINA for Physics Informed Neural Networks training|[[.ipynb](tutorial1/tutorial.ipynb),&#160;[.py](tutorial1/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial1/tutorial.html)]|
10-
Introduction to PINA `Equation` class|[[.ipynb](tutorial12/tutorial.ipynb),&#160;[.py](tutorial12/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial12/tutorial.html)]|
11-
PINA and PyTorch Lightning, training tips and visualizations|[[.ipynb](tutorial11/tutorial.ipynb),&#160;[.py](tutorial11/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial11/tutorial.html)]|
12-
Building custom geometries with PINA `Location` class|[[.ipynb](tutorial6/tutorial.ipynb),&#160;[.py](tutorial6/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial6/tutorial.html)]|
12+
Introductory Tutorial: A Beginner’s Guide to PINA|[[.ipynb](tutorial17/tutorial.ipynb),[.py](tutorial17/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial17/tutorial.html)]|
13+
How to build a `Problem` in PINA|[[.ipynb](tutorial16/tutorial.ipynb),[.py](tutorial16/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial16/tutorial.html)]|
14+
Introduction to Solver classes|[[.ipynb](tutorial18/tutorial.ipynb),[.py](tutorial18/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial18/tutorial.html)]|
15+
Introduction to `Trainer` class|[[.ipynb](tutorial11/tutorial.ipynb),[.py](tutorial11/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial11/tutorial.html)]|
16+
Data structure for SciML: `Tensor`, `LabelTensor`, `Data` and `Graph` |[[.ipynb](tutorial19/tutorial.ipynb),[.py](tutorial19/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial19/tutorial.html)]|
17+
Building geometries with `DomainInterface` class|[[.ipynb](tutorial6/tutorial.ipynb),[.py](tutorial6/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial6/tutorial.html)]|
18+
Introduction to PINA `Equation` class|[[.ipynb](tutorial12/tutorial.ipynb),[.py](tutorial12/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial12/tutorial.html)]|
1319

1420

1521
## Physics Informed Neural Networks
1622
| Description | Tutorial |
1723
|---------------|-----------|
18-
Two dimensional Poisson problem using Extra Features Learning &nbsp; &nbsp; |[[.ipynb](tutorial2/tutorial.ipynb),&#160;[.py](tutorial2/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial2/tutorial.html)]|
19-
Two dimensional Wave problem with hard constraint |[[.ipynb](tutorial3/tutorial.ipynb),&#160;[.py](tutorial3/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial3/tutorial.html)]|
20-
Resolution of a 2D Poisson inverse problem |[[.ipynb](tutorial7/tutorial.ipynb),&#160;[.py](tutorial7/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial7/tutorial.html)]|
21-
Periodic Boundary Conditions for Helmotz Equation |[[.ipynb](tutorial9/tutorial.ipynb),&#160;[.py](tutorial9/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial9/tutorial.html)]|
22-
Multiscale PDE learning with Fourier Feature Network |[[.ipynb](tutorial13/tutorial.ipynb),&#160;[.py](tutorial13/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial13/tutorial.html)]|
24+
Introductory Tutorial: Physics Informed Neural Networks with PINA |[[.ipynb](tutorial1/tutorial.ipynb),[.py](tutorial1/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial1/tutorial.html)]|
25+
Enhancing PINNs with Extra Features to solve the Poisson Problem |[[.ipynb](tutorial2/tutorial.ipynb),[.py](tutorial2/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial2/tutorial.html)]|
26+
Applying Hard Constraints in PINNs to solve the Wave Problem |[[.ipynb](tutorial3/tutorial.ipynb),[.py](tutorial3/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial3/tutorial.html)]|
27+
Applying Periodic Boundary Conditions in PINNs to solve the Helmotz Problem |[[.ipynb](tutorial9/tutorial.ipynb),[.py](tutorial9/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial9/tutorial.html)]|
28+
Inverse Problem Solving with Physics-Informed Neural Network |[[.ipynb](tutorial7/tutorial.ipynb),[.py](tutorial7/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial7/tutorial.html)]|
29+
Learning Multiscale PDEs Using Fourier Feature Networks|[[.ipynb](tutorial13/tutorial.ipynb),[.py](tutorial13/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial13/tutorial.html)]|
30+
Learning Bifurcating PDE Solutions with Physics-Informed Deep Ensembles|[[.ipynb](tutorial14/tutorial.ipynb),[.py](tutorial14/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial14/tutorial.html)]|
2331

2432

2533
## Neural Operator Learning
2634
| Description | Tutorial |
2735
|---------------|-----------|
28-
Two dimensional Darcy flow using the Fourier Neural Operator &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;|[[.ipynb](tutorial5/tutorial.ipynb),&#160;[.py](tutorial5/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial5/tutorial.html)]|
29-
Time dependent Kuramoto Sivashinsky equation using the Averaging Neural Operator &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;|[[.ipynb](tutorial10/tutorial.ipynb),&#160;[.py](tutorial10/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial10/tutorial.html)]|
36+
Introductory Tutorial: Neural Operator Learning with PINA |[[.ipynb](tutorial21/tutorial.ipynb),[.py](tutorial21/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial21/tutorial.html)]|
37+
Modeling 2D Darcy Flow with the Fourier Neural Operator |[[.ipynb](tutorial5/tutorial.ipynb),[.py](tutorial5/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial5/tutorial.html)]|
38+
Solving the Kuramoto–Sivashinsky Equation with Averaging Neural Operator |[[.ipynb](tutorial10/tutorial.ipynb),[.py](tutorial10/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial10/tutorial.html)]|
3039

3140
## Supervised Learning
3241
| Description | Tutorial |
3342
|---------------|-----------|
34-
Unstructured convolutional autoencoder via continuous convolution |[[.ipynb](tutorial4/tutorial.ipynb),&#160;[.py](tutorial4/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial4/tutorial.html)]|
35-
POD-RBF and POD-NN for reduced order modeling| [[.ipynb](tutorial8/tutorial.ipynb),&#160;[.py](tutorial8/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial8/tutorial.html)]|
36-
POD-RBF for modelling Lid Cavity| [[.ipynb](tutorial14/tutorial.ipynb),&#160;[.py](tutorial14/tutorial.py),&#160;[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial14/tutorial.html)]|
43+
Introductory Tutorial: Supervised Learning with PINA |[[.ipynb](tutorial20/tutorial.ipynb),[.py](tutorial20/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial20/tutorial.html)]|
44+
Chemical Properties Prediction with Graph Neural Networks |[[.ipynb](tutorial15/tutorial.ipynb),[.py](tutorial15/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial15/tutorial.html)]|
45+
Unstructured Convolutional Autoencoders with Continuous Convolution |[[.ipynb](tutorial4/tutorial.ipynb),[.py](tutorial4/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial4/tutorial.html)]|
46+
Reduced Order Modeling with POD-RBF and POD-NN Approaches for Fluid Dynamics| [[.ipynb](tutorial8/tutorial.ipynb),[.py](tutorial8/tutorial.py),[.html](http://mathlab.github.io/PINA/_rst/tutorials/tutorial8/tutorial.html)]|
47+

tutorials/TUTORIAL_GUIDELINES.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# PINA Tutorial Guidelines
2+
3+
Welcome to the **PINA Tutorial Guidelines** — a guiding document that defines the structure, style, and pedagogical philosophy for all tutorials in the **PINA** package. The goal of this guideline is to ensure that all learning materials are **clear, consistent, pedagogically sound, and beginner-friendly**, while remaining powerful enough to support advanced use cases.
4+
5+
6+
## Purpose
7+
8+
The purpose of the PINA tutorials is to help users:
9+
10+
- Gaining a solid understanding of the PINA library and its core functionalities.
11+
- Learning how to work with the PINA modules.
12+
- Explore practical and advanced applications using consistent, hands-on code examples.
13+
14+
15+
## Guiding Principles
16+
17+
1. **Clarity Over Cleverness**
18+
Tutorials should aim to teach, not impress. Prioritize readable and understandable code and explanations.
19+
20+
2. **Progressive Disclosure of Complexity**
21+
Start simple and gradually introduce complexity. Avoid overwhelming users early on.
22+
23+
3. **Consistency is Key**
24+
All tutorials should follow a common structure (see below), use the same markdown and code formatting, and have a predictable flow.
25+
26+
4. **Real Applications, Real Problems**
27+
Ground tutorials in real Scientific Applications or datasets, wherever possible. Bridge theory and implementation.
28+
29+
30+
## Tutorial Structure
31+
32+
To ensure clarity, consistency, and accessibility, all PINA tutorials should follow the same standardized format.
33+
34+
### 1. Title
35+
36+
Each tutorial must begin with a clear and descriptive title in the following format: **Tutorial: TUTORIAL_TITLE**. The title should succinctly communicate the focus and objective of the tutorial.
37+
38+
### 2. Introducing the Topic
39+
40+
Immediately after the title, include a short introduction that outlines the tutorial's purpose and scope.
41+
42+
- Briefly explain what the tutorial covers and why it’s useful.
43+
- Link to relevant research papers, publications, or external resources if applicable.
44+
- List the core PINA components or modules that will be utilized.
45+
46+
### 3. Imports and Setup
47+
48+
Include a Python code cell with the necessary setup. This ensures that the tutorial runs both locally and on platforms like Google Colab.
49+
50+
```python
51+
## Routine needed to run the notebook on Google Colab
52+
try:
53+
import google.colab
54+
IN_COLAB = True
55+
except:
56+
IN_COLAB = False
57+
58+
if IN_COLAB:
59+
!pip install "pina-mathlab[tutorial]"
60+
61+
import torch # if used
62+
import matplotlib.pyplot as plt # if used
63+
import warnings # if needed
64+
65+
warnings.filterwarnings("ignore")
66+
67+
# Additional PINA and problem-specific imports
68+
...
69+
```
70+
71+
### 3. Data Generation or Loading
72+
* Describe how the data is generated or loaded.
73+
* Include commentary on data structure, format, and content.
74+
* If applicable, visualize key features of the dataset or simulation domain.
75+
76+
### 4. Main Body
77+
The core section of the tutorial should present the problem-solving process in a clear, structured, and pedagogical way. This is where the tutorial delivers the key learning objectives.
78+
79+
- Guide the user step-by-step through the PINA workflow.
80+
- Introduce relevant PINA components as they are used.
81+
- Provide context and explain the rationale behind modeling decisions.
82+
- Break down complex sections with inline comments and markdown explanations.
83+
- Emphasize the relevance of each step to the broader goal of the tutorial.
84+
85+
### 5. Results, Visualization and Error Analysis
86+
- Show relevant plots of results (e.g., predicted vs. ground truth).
87+
- Quantify performance using metrics like loss or relative error.
88+
- Discuss the outcomes: strengths, limitations, and any unexpected behavior
89+
90+
### 6. What's Next?
91+
All the tutorials are concluded with the **What's Next?** section,giving suggestions for further exploration. For this use the following format:
92+
```markdown
93+
## What's Next?
94+
95+
Congratulations on completing the ..., here are a few directions you can explore:
96+
97+
1. **Direction 1** — Suggestion ....
98+
99+
2. **Direction 2** — Suggestion ....
100+
101+
3. **...and many more!** — Other suggestions ....
102+
103+
For more resources and tutorials, check out the [PINA Documentation](https://mathlab.github.io/PINA/).
104+
```
105+
106+
## Writing Style
107+
108+
- Use **clear markdown headers** to segment sections.
109+
- Include **inline math** with `$...$` and display math with `$$...$$`.
110+
- Keep paragraphs short and focused.
111+
- Use **bold** and *italic* for emphasis and structure.
112+
- Include comments in code for clarity.
113+
114+
115+
## Testing Tutorials
116+
117+
Every tutorial should:
118+
- Be executable from top to bottom.
119+
- Use the `tutorial` requirements in the [`pyproject.toml`](https://github.com/mathLab/PINA/blob/6ed3ca04fee3ae3673d53ea384437ce270f008da/pyproject.toml#L40) file.
120+
121+
122+
## Contributing Checklist
123+
124+
We welcome contributions! If you’re writing a tutorial:
125+
1. The tutorial follows this guidelines for structure and tone.
126+
2. The tutorial is simple and modular — one tutorial per concept.
127+
3. The tutorial PRs contains only the `.ipynb` file, and the updated `README.md` file.
128+

tutorials/static/API_color.png

121 KB
Loading

tutorials/static/deep_ensemble.png

128 KB
Loading

tutorials/static/logging.png

231 KB
Loading

tutorials/static/neural_operator.png

34.9 KB
Loading

tutorials/static/pina_logo.png

51.3 KB
Loading

tutorials/static/pina_wokflow.png

442 KB
Loading

0 commit comments

Comments
 (0)