Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 8 additions & 7 deletions README.md
Comment thread
dario-coscia marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ Want to dive deeper? Check out the official
import torch
from pina import Trainer
from pina.model import FeedForward
from pina.solver import SupervisedSolver
from pina.problem.zoo import SupervisedProblem
from pina.solver import SupervisedSingleModelSolver

input_tensor = torch.rand((10, 1))
target_tensor = input_tensor.pow(3)
Expand All @@ -232,7 +232,7 @@ problem = SupervisedProblem(input_tensor, target_tensor)
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])

# Step 3. Define solver
solver = SupervisedSolver(problem, model, use_lt=False)
solver = SupervisedSingleModelSolver(problem, model, use_lt=False)

# Step 4. Train
trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
Expand Down Expand Up @@ -261,13 +261,14 @@ In PINA, this can be implemented as:
</p>

```python
from pina import Trainer, Condition
from pina.problem import SpatialProblem
from pina.operator import grad
from pina.solver import PINN
from pina.model import FeedForward
from pina.equation import Equation
from pina import Trainer, Condition
from pina.domain import CartesianDomain
from pina.equation import Equation, FixedValue
from pina.problem import SpatialProblem
from pina.equation.zoo import FixedValue
from pina.solver import PhysicsInformedSingleModelSolver

def ode_equation(input_, output_):
u_x = grad(output_, input_, components=["u"], d=["x"])
Expand All @@ -294,7 +295,7 @@ problem.discretise_domain(n=100, mode="grid", domains=["D", "x0"])
model = FeedForward(input_dimensions=1, output_dimensions=1, layers=[64, 64])

# Step 3. Define solver
solver = PINN(problem, model)
solver = PhysicsInformedSingleModelSolver(problem, model)

# Step 4. Train
trainer = Trainer(solver, max_epochs=1000, accelerator="gpu")
Expand Down
4 changes: 4 additions & 0 deletions docs/source/_LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. docmeta::
:last_reviewed: 2026-06-24


License
==============

Expand Down
4 changes: 4 additions & 0 deletions docs/source/_cite.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.. docmeta::
:last_reviewed: 2026-06-24


Cite PINA
==============

Expand Down
50 changes: 25 additions & 25 deletions docs/source/_contributing.rst
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
Contributing to PINA
=====================
.. docmeta::
:last_reviewed: 2026-06-24

First off, thanks for taking the time to contribute to **PINA**! 🎉 Your help makes the project better for everyone. This document outlines the process for contributing, reporting issues, suggesting features, and submitting pull requests.

Table of Contents
------------------------
Contributing to PINA
=====================

1. `How to Contribute`_
2. `Reporting Bugs`_
3. `Suggesting Enhancements`_
4. `Pull Request Process`_
5. `Code Style & Guidelines`_
6. `Community Standards`_
First off, thanks for taking the time to contribute to **PINA**! Your help makes the project better for everyone. This document outlines the process for contributing, reporting issues, suggesting features, and submitting pull requests.

How to Contribute
------------------------
-----------------

You can contribute in several ways:

- Reporting bugs
- Suggesting features/enhancements
- Suggesting features or enhancements
- Submitting fixes or improvements via Pull Requests (PRs)
- Improving documentation

We encourage all contributions, big or small!

Reporting Bugs
------------------------
--------------

If you find a bug, please open an `issue <https://github.com/mathLab/PINA/issues>`_ and include:

Expand All @@ -38,23 +32,23 @@ If you find a bug, please open an `issue <https://github.com/mathLab/PINA/issues
- Environment info (OS, Python version, dependencies, etc.)

Suggesting Enhancements
------------------------
-----------------------

We welcome new ideas! If you have an idea to improve PINA:

1. Check the `issue tracker <https://github.com/mathLab/PINA/issues>`_ or the `discussions <https://github.com/mathLab/PINA/discussions>`_ to see if someone has already suggested it.
2. If not, open a new issue describing:
- The enhancement you'd like
- The enhancement you would like
- Why it would be useful
- Any ideas on how to implement it (optional but helpful)
3. If you are not sure about (something of) the enhancement, we suggest opening a discussion to collaborate on it with the PINA community.
3. If you are not sure about the enhancement, open a discussion to collaborate with the PINA community.

Pull Request Process
------------------------
--------------------

Before submitting a PR:

1. Ensure there’s an open issue related to your contribution (or create one).
1. Ensure there is an open issue related to your contribution (or create one).
2. `Fork <https://help.github.com/articles/fork-a-repo>`_ the repository and create a new branch from ``master``:

.. code-block:: bash
Expand All @@ -71,30 +65,36 @@ Before submitting a PR:

pytest

5. Properly format your code. If you want to save time, simply run:
5. Format your code:

.. code-block:: bash

bash code_formatter.sh

7. Submit a `pull request <https://help.github.com/articles/creating-a-pull-request>`_ with a clear explanation of your changes and reference the related issue if applicable.
6. Submit a `pull request <https://help.github.com/articles/creating-a-pull-request>`_ with a clear explanation of your changes and reference the related issue if applicable.

Pull Request Checklist
Pull Request Checklist:

1. Code follows the projects style guidelines
1. Code follows the project's style guidelines
2. Tests have been added or updated
3. Documentation has been updated if necessary
4. Pull request is linked to an open issue (if applicable)

Code Style & Guidelines
------------------------
-----------------------

- Follow PEP8 for Python code.
- Use descriptive commit messages (e.g. ``Fix parser crash on empty input``).
- Write clear docstrings for public classes, methods, and functions.
- Keep functions small and focused; do one thing and do it well.

Community Standards
------------------------
-------------------

By participating in this project, you agree to abide by our Code of Conduct. We are committed to maintaining a welcoming and inclusive community.

See Also
--------

* :doc:`Installation guide <_installation>`
* :doc:`API Reference <_rst/_code>`
56 changes: 37 additions & 19 deletions docs/source/_installation.rst
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>`
100 changes: 100 additions & 0 deletions docs/source/_quickstart.rst
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.).
Loading
Loading