-
Notifications
You must be signed in to change notification settings - Fork 107
Dario/0.3/doc #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dario-coscia
wants to merge
5
commits into
dev
Choose a base branch
from
dario/0.3/doc
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dario/0.3/doc #817
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| .. docmeta:: | ||
| :last_reviewed: 2026-06-24 | ||
|
|
||
|
|
||
| License | ||
| ============== | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| .. docmeta:: | ||
| :last_reviewed: 2026-06-24 | ||
|
|
||
|
|
||
| Cite PINA | ||
| ============== | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,70 @@ | ||
| .. docmeta:: | ||
| :last_reviewed: 2026-06-24 | ||
|
|
||
|
|
||
| Installation | ||
| ============ | ||
|
|
||
| **PINA** requires requires `torch`, `lightning`, `torch_geometric` and `matplotlib`. | ||
| **PINA** requires `torch`, `lightning`, `torch_geometric` and `matplotlib`. | ||
|
|
||
| Installing via PIP | ||
| __________________ | ||
|
|
||
| Mac and Linux users can install pre-built binary packages using pip. | ||
| To install the package just type: | ||
| Mac and Linux users can install pre-built binary packages using pip: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| $ pip install pina-mathlab | ||
| pip install pina-mathlab | ||
|
|
||
| To uninstall the package: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| $ pip uninstall pina-mathlab | ||
| pip uninstall pina-mathlab | ||
|
|
||
| Installing from source | ||
| ______________________ | ||
| The official distribution is on GitHub, and you can clone the repository using | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| $ git clone https://github.com/mathLab/PINA | ||
| The official distribution is on GitHub. Clone the repository: | ||
|
|
||
| To install the package just type: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| $ pip install -e . | ||
| git clone https://github.com/mathLab/PINA | ||
|
|
||
| Then install in editable mode: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| pip install -e . | ||
|
|
||
| Install with extra packages | ||
| ____________________________ | ||
|
|
||
| To install extra dependencies required to run tests or tutorials directories, please use the following command: | ||
| To install extra dependencies required to run tests or tutorials, use: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| $ pip install "pina-mathlab[extras]" | ||
|
|
||
| pip install "pina-mathlab[extras]" | ||
|
|
||
| Available extras include: | ||
|
|
||
| * `dev` for development purpuses, use this if you want to Contribute. | ||
| * `test` for running test locally. | ||
| * `doc` for building documentation locally. | ||
| * `tutorial` for running tutorials | ||
| * ``dev`` — development tools (use this if you want to contribute). | ||
| * ``test`` — for running tests locally. | ||
| * ``doc`` — for building the documentation locally. | ||
| * ``tutorial`` — for running tutorials. | ||
|
|
||
| Requirements | ||
| ____________ | ||
|
|
||
| PINA is built on: | ||
|
|
||
| * `PyTorch <https://pytorch.org/>`_ — deep learning framework. | ||
| * `PyTorch Lightning <https://lightning.ai/docs/pytorch/stable/>`_ — training loop orchestration. | ||
| * `PyTorch Geometric <https://pytorch-geometric.readthedocs.io/en/latest/>`_ — graph neural network support. | ||
| * `Matplotlib <https://matplotlib.org/>`_ — plotting and visualisation. | ||
|
|
||
| See Also | ||
| -------- | ||
|
|
||
| * :doc:`Quickstart guide <_quickstart>` | ||
| * :doc:`API Reference <_rst/_code>` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| .. docmeta:: | ||
| :last_reviewed: 2026-06-24 | ||
|
|
||
|
|
||
| Quickstart | ||
| ========== | ||
|
|
||
| This guide gets you up and running with PINA in 5 minutes. By the end, you will have trained a Physics-Informed Neural Network (PINN) to solve the Poisson equation on a unit square. | ||
|
|
||
| Install | ||
| ------- | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| pip install pina-mathlab | ||
|
|
||
| Define a problem | ||
| ---------------- | ||
|
|
||
| Every PINA workflow starts by defining a :class:`~pina.problem.spatial_problem.SpatialProblem`. | ||
| A problem specifies the output variables, the computational domain, and the conditions | ||
| (PDE residual, boundary conditions, initial conditions, data) that the solver must satisfy. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from pina import Condition | ||
| from pina.problem import SpatialProblem | ||
| from pina.domain import CartesianDomain | ||
| from pina.equation import Equation, FixedValue | ||
|
|
||
| class PoissonProblem(SpatialProblem): | ||
| output_variables = ["u"] | ||
|
|
||
| domains = { | ||
| "domain": CartesianDomain({"x": [0, 1], "y": [0, 1]}), | ||
| "boundary": CartesianDomain({"x": [0, 1], "y": [0, 1]}), | ||
| } | ||
|
|
||
| conditions = { | ||
| "domain": Condition( | ||
| domain="domain", | ||
| equation=Equation("d2(u,x) + d2(u,y) + sin(pi*x)*sin(pi*y) = 0"), | ||
| ), | ||
| "boundary": Condition( | ||
| domain="boundary", | ||
| equation=FixedValue(0.0), | ||
| ), | ||
| } | ||
|
|
||
| problem = PoissonProblem() | ||
|
|
||
| Create a model | ||
| -------------- | ||
|
|
||
| Choose a neural network architecture. For standard PINNs, a :class:`~pina.model.feed_forward.FeedForward` (MLP) is a solid starting point. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from pina.model import FeedForward | ||
|
|
||
| model = FeedForward( | ||
| input_dimensions=2, | ||
| output_dimensions=1, | ||
| inner_size=20, | ||
| n_layers=3, | ||
| ) | ||
|
|
||
| Train with a solver | ||
| ------------------- | ||
|
|
||
| The :class:`~pina.solver.physics_informed_solver.pinn.PINN` solver wraps the problem and model, and the :class:`~pina._src.core.trainer.Trainer` orchestrates the training loop. | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from pina.solver import PINN | ||
| from pina import Trainer | ||
|
|
||
| pinn = PINN(problem=problem, model=model) | ||
| trainer = Trainer(solver=pinn, max_epochs=1000) | ||
| trainer.train() | ||
|
|
||
| Inspect results | ||
| --------------- | ||
|
|
||
| After training, the model stores its solution in the solver. Evaluate at any point: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import torch | ||
|
|
||
| x = torch.tensor([[0.5, 0.5]], requires_grad=True) | ||
| u_pred = pinn(x) | ||
| print(u_pred) | ||
|
|
||
| What's next? | ||
| ------------ | ||
|
|
||
| * Walk through the `Introductory Tutorial <tutorial17/tutorial.html>`_ for a deeper introduction. | ||
| * Explore the :doc:`API reference </_rst/_code>` for all available components. | ||
| * Read the :doc:`tutorials </_tutorial>` for domain-specific guides (Neural Operators, Supervised Learning, etc.). |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.