Physics-Informed Neural networks for Advanced modeling

Physics-Informed Neural networks for Advanced modeling - Published in JOSS (2023)

https://github.com/mathlab/pina

Science Score: 100.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    9 of 34 committers (26.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

deep-learning differential-equations equation-learning hacktoberfest lightining machine-learning modeling neural-networks neural-operators ode pde physics-informed physics-informed-neural-networks pinn python pytorch pytorch-lightning torch-geometric

Keywords from Contributors

standardization autoencoder data-driven model-order-reduction model-reduction non-intrusive-model-order-reduction pod-gpr pod-interpolation pod-nn proper-orthogonal-decomposition
Last synced: 4 months ago · JSON representation ·

Repository

Physics-Informed Neural networks for Advanced modeling

Basic Info
Statistics
  • Stars: 554
  • Watchers: 15
  • Forks: 81
  • Open Issues: 31
  • Releases: 43
Topics
deep-learning differential-equations equation-learning hacktoberfest lightining machine-learning modeling neural-networks neural-operators ode pde physics-informed physics-informed-neural-networks pinn python pytorch pytorch-lightning torch-geometric
Created about 4 years ago · Last pushed 5 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Security

README.md

PINA logo

Solving Scientific Problems with Machine Learning, Intuitively


pages-build-deployment Version Downloads JOSS LICENSE

Getting Started | Documentation | Contributing

PINA is an open-source Python library designed to simplify and accelerate the development of Scientific Machine Learning (SciML) solutions. Built on top of PyTorch, PyTorch Lightning, and PyTorch Geometric, PINA provides an intuitive framework for defining, experimenting with, and solving complex problems using Neural Networks, Physics-Informed Neural Networks (PINNs), Neural Operators, and more.

  • Modular Architecture: Designed with modularity in mind and relying on powerful yet composable abstractions, PINA allows users to easily plug, replace, or extend components, making experimentation and customization straightforward.

  • Scalable Performance: With native support for multi-device training, PINA handles large datasets efficiently, offering performance close to hand-crafted implementations with minimal overhead.

  • Highly Flexible: Whether you're looking for full automation or granular control, PINA adapts to your workflow. High-level abstractions simplify model definition, while expert users can dive deep to fine-tune every aspect of the training and inference process.

Installation

Installing a stable PINA release

Install using pip: sh pip install "pina-mathlab"

Install from source: sh git clone https://github.com/mathLab/PINA cd PINA git checkout master pip install .

Install with extra packages:

To install extra dependencies required to run tests or tutorials directories, please use the following command: sh 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.

Quick Tour for New Users

Solving a differential problem in PINA follows the four steps pipeline:

  1. Define the problem to be solved with its constraints using the Problem API.

  2. Design your model using PyTorch, or for graph-based problems, leverage PyTorch Geometric to build Graph Neural Networks. You can also import models directly from the Model API.

  3. Select or build a Solver for the Problem, e.g., supervised solvers, or physics-informed (e.g., PINN) solvers. PINA Solvers are modular and can be used as-is or customized.

  4. Train the model using the Trainer API class, built on PyTorch Lightning, which supports efficient, scalable training with advanced features.

Do you want to learn more about it? Look at our Tutorials.

Solve Data Driven Problems

Data driven modelling aims to learn a function that given some input data gives an output (e.g. regression, classification, ...). In PINA you can easily do this by: ```python import torch from pina import Trainer from pina.model import FeedForward from pina.solver import SupervisedSolver from pina.problem.zoo import SupervisedProblem

inputtensor = torch.rand((10, 1)) targettensor = input_tensor.pow(3)

Step 1. Define problem

problem = SupervisedProblem(inputtensor, targettensor)

Step 2. Design model (you can use your favourite torch.nn.Module in here)

model = FeedForward(inputdimensions=1, outputdimensions=1, layers=[64, 64])

Step 3. Define Solver

solver = SupervisedSolver(problem, model, use_lt=False)

Step 4. Train

trainer = Trainer(solver, max_epochs=1000, accelerator='gpu') trainer.train() ```

Solve Physics Informed Problems

Physics-informed modeling aims to learn functions that not only fit data, but also satisfy known physical laws, such as differential equations or boundary conditions. For example, the following differential problem:

$$ \begin{cases} \frac{d}{dx}u(x) &= u(x) \quad x \in(0,1)\ u(x=0) &= 1 \end{cases} $$

in PINA, can be easily implemented by:

```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.domain import CartesianDomain from pina.equation import Equation, FixedValue

def odeequation(input, output): ux = grad(output, input, components=["u"], d=["x"]) u = output.extract(["u"]) return ux - u

build the problem

class SimpleODE(SpatialProblem): outputvariables = ["u"] spatialdomain = CartesianDomain({"x": [0, 1]}) domains = { "x0": CartesianDomain({"x": 0.0}), "D": CartesianDomain({"x": [0, 1]}), } conditions = { "boundcond": Condition(domain="x0", equation=FixedValue(1.0)), "physcond": Condition(domain="D", equation=Equation(ode_equation)), }

Step 1. Define problem

problem = SimpleODE() problem.discretise_domain(n=100, mode="grid", domains=["D", "x0"])

Step 2. Design model (you can use your favourite torch.nn.Module in here)

model = FeedForward(inputdimensions=1, outputdimensions=1, layers=[64, 64])

Step 3. Define Solver

solver = PINN(problem, model)

Step 4. Train

trainer = Trainer(solver, max_epochs=1000, accelerator='gpu') trainer.train() ```

Application Programming Interface

Here's a quick look at PINA's main module. For a better experience and full details, check out the documentation.

Contributing and Community

We would love to develop PINA together with our community! Best way to get started is to select any issue from the good-first-issue label. If you would like to contribute, please review our Contributing Guide for all relevant details.

We warmly thank all the contributors that have supported PINA so far:

Contributors

Made with contrib.rocks.

Citation

If PINA has been significant in your research, and you would like to acknowledge the project in your academic publication, we suggest citing the following paper:

Coscia, D., Ivagnes, A., Demo, N., & Rozza, G. (2023). Physics-Informed Neural networks for Advanced modeling. Journal of Open Source Software, 8(87), 5352.

Or in BibTex format @article{coscia2023physics, title={Physics-Informed Neural networks for Advanced modeling}, author={Coscia, Dario and Ivagnes, Anna and Demo, Nicola and Rozza, Gianluigi}, journal={Journal of Open Source Software}, volume={8}, number={87}, pages={5352}, year={2023} }

Owner

  • Name: SISSA mathLab
  • Login: mathLab
  • Kind: organization
  • Email: luca.heltai@sissa.it
  • Location: Via Bonomea 265, 34133 Trieste, TS, Italy

Applied Mathematics Laboratory @ SISSA

JOSS Publication

Physics-Informed Neural networks for Advanced modeling
Published
July 19, 2023
Volume 8, Issue 87, Page 5352
Authors
Dario Coscia ORCID
SISSA, International School of Advanced Studies, Via Bonomea 265, Trieste, Italy
Anna Ivagnes ORCID
SISSA, International School of Advanced Studies, Via Bonomea 265, Trieste, Italy
Nicola Demo ORCID
SISSA, International School of Advanced Studies, Via Bonomea 265, Trieste, Italy
Gianluigi Rozza ORCID
SISSA, International School of Advanced Studies, Via Bonomea 265, Trieste, Italy
Editor
Daniel S. Katz ORCID
Tags
python deep learning physics-informed neural networks scientific machine learning differential equations.

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- family-names: Coscia
  given-names: Dario
  orcid: "https://orcid.org/0000-0001-8833-6833"
- family-names: Ivagnes
  given-names: Anna
  orcid: "https://orcid.org/0000-0002-2369-4493"
- family-names: Demo
  given-names: Nicola
  orcid: "https://orcid.org/0000-0003-3107-9738"
- family-names: Rozza
  given-names: Gianluigi
  orcid: "https://orcid.org/0000-0002-0810-8812"
doi: 10.5281/zenodo.8163732
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - family-names: Coscia
    given-names: Dario
    orcid: "https://orcid.org/0000-0001-8833-6833"
  - family-names: Ivagnes
    given-names: Anna
    orcid: "https://orcid.org/0000-0002-2369-4493"
  - family-names: Demo
    given-names: Nicola
    orcid: "https://orcid.org/0000-0003-3107-9738"
  - family-names: Rozza
    given-names: Gianluigi
    orcid: "https://orcid.org/0000-0002-0810-8812"
  date-published: 2023-07-19
  doi: 10.21105/joss.05352
  issn: 2475-9066
  issue: 87
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 5352
  title: Physics-Informed Neural networks for Advanced modeling
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.05352"
  volume: 8
title: Physics-Informed Neural networks for Advanced modeling

GitHub Events

Total
  • Create event: 104
  • Release event: 17
  • Issues event: 132
  • Watch event: 153
  • Delete event: 87
  • Member event: 2
  • Issue comment event: 242
  • Push event: 613
  • Pull request review comment event: 276
  • Pull request review event: 320
  • Pull request event: 258
  • Fork event: 14
Last Year
  • Create event: 104
  • Release event: 17
  • Issues event: 133
  • Watch event: 154
  • Delete event: 87
  • Member event: 2
  • Issue comment event: 243
  • Push event: 613
  • Pull request review comment event: 276
  • Pull request review event: 320
  • Pull request event: 258
  • Fork event: 14

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 571
  • Total Committers: 34
  • Avg Commits per committer: 16.794
  • Development Distribution Score (DDS): 0.723
Past Year
  • Commits: 309
  • Committers: 12
  • Avg Commits per committer: 25.75
  • Development Distribution Score (DDS): 0.693
Top Committers
Name Email Commits
Dario Coscia 9****a 158
Nicola Demo d****a@g****m 140
FilippoOlivo f****o@f****m 95
giovanni g****8@y****t 33
Matteo Bertocchi m****4@g****m 19
Anna Ivagnes 7****s 17
github-actions[bot] 4****] 14
Dario Coscia d****a@c****t 11
Dario Coscia d****a@D****l 9
Giovanni Canali 1****8 8
Francesco Andreuzzi a****o@g****m 8
Dario Coscia d****a@d****t 8
Giuseppe Alessio D'Inverno 6****e 6
Kush 5****K 6
Zahra Mirzaiyan Dehkordi z****y@z****t 6
Dario Coscia d****a@c****t 5
Monthly Tag bot m****t@n****m 4
Dario Coscia d****a@d****t 2
Dario Coscia d****a@d****t 2
Ben Volokh 8****3 2
guglielmopadula 9****a 2
M.Couraud m****s@c****t 2
Pasquale Africa p****a@s****t 2
Daniel S. Katz d****z@i****g 2
Bo van Hasselt 6****t 1
Dario Coscia d****a@c****t 1
Dario Coscia d****a@c****t 1
Dario Coscia d****a@c****t 1
Eli Prater p****4@g****m 1
Gabriele Codega 1****a 1
and 4 more...

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 182
  • Total pull requests: 519
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 33
  • Total pull request authors: 30
  • Average comments per issue: 1.16
  • Average comments per pull request: 1.0
  • Merged pull requests: 387
  • Bot issues: 0
  • Bot pull requests: 58
Past Year
  • Issues: 94
  • Pull requests: 225
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 4 days
  • Issue authors: 15
  • Pull request authors: 14
  • Average comments per issue: 0.45
  • Average comments per pull request: 1.19
  • Merged pull requests: 147
  • Bot issues: 0
  • Bot pull requests: 27
Top Authors
Issue Authors
  • dario-coscia (62)
  • ndem0 (34)
  • GiovanniCanali (15)
  • LoveFrootLoops (8)
  • FilippoOlivo (6)
  • annaivagnes (5)
  • gc031298 (5)
  • dgm2 (5)
  • karthikncsuiisc (5)
  • luAndre00 (4)
  • Bovhasselt (3)
  • AleDinve (3)
  • yorkiva (2)
  • karfungc (2)
  • akshaysubr (2)
Pull Request Authors
  • dario-coscia (196)
  • ndem0 (90)
  • github-actions[bot] (58)
  • FilippoOlivo (45)
  • GiovanniCanali (20)
  • annaivagnes (18)
  • AleDinve (12)
  • gc031298 (10)
  • fAndreuzzi (9)
  • MatteB03 (8)
  • SpartaKushK (8)
  • benv123 (8)
  • guglielmopadula (7)
  • ZahraMirzaiyan (4)
  • avisquid (3)
Top Labels
Issue Labels
enhancement (70) bug (59) v0.2 (19) help wanted (18) high priority (16) question (9) low priority (7) tutorials (7) good first issue (6) v0.1 (4) documentation (3) maintenance (3) duplicate (2) priority (1) wontfix (1)
Pull Request Labels
pr-to-review (108) enhancement (47) pr-to-fix (35) v0.2 (29) maintenance (26) bug (21) high priority (20) v0.1 (10) tutorials (9) documentation (4) low priority (3)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 217 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 26
  • Total maintainers: 1
pypi.org: pina-mathlab

Physic Informed Neural networks for Advance modeling.

  • Versions: 26
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 217 Last month
Rankings
Stargazers count: 5.3%
Forks count: 6.4%
Dependent packages count: 10.1%
Average: 11.1%
Downloads: 12.3%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/create-release.yml actions
  • actions/checkout v2 composite
  • ncipollo/release-action v1 composite
.github/workflows/monthly-tag.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/pypi-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/sphinx-build.yml actions
  • actions/checkout v2 composite
  • ammaraskar/sphinx-action master composite
  • peaceiris/actions-gh-pages v3 composite
.github/workflows/testing_pr.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite