Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pina/problem/zoo/advection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class AdvectionProblem(SpatialProblem, TimeDependentProblem):
DOI: `arXiv:2308.08468 <https://arxiv.org/abs/2308.08468>`_.

:Example:
>>> problem = AdvectionProblem(c=1.0)

>>> problem = AdvectionProblem()
"""

output_variables = ["u"]
Expand All @@ -53,7 +54,7 @@ def __init__(self, c=1.0):
"""
Initialization of the :class:`AdvectionProblem`.

:param c: The advection velocity parameter.
:param c: The advection velocity parameter. Default is 1.0.
:type c: float | int
"""
super().__init__()
Expand Down
6 changes: 4 additions & 2 deletions pina/problem/zoo/allen_cahn.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class AllenCahnProblem(TimeDependentProblem, SpatialProblem):
:math:`[-1, 1]` and temporal interval :math:`[0, 1]`.

.. seealso::

**Original reference**: Sokratis J. Anagnostopoulos, Juan D. Toscano,
Nikolaos Stergiopulos, and George E. Karniadakis.
*Residual-based attention and connection to information
Expand All @@ -37,6 +38,7 @@ class AllenCahnProblem(TimeDependentProblem, SpatialProblem):
j.cma.2024.116805 <https://doi.org/10.1016/j.cma.2024.116805>`_.

:Example:

>>> problem = AllenCahnProblem()
"""

Expand All @@ -57,9 +59,9 @@ def __init__(self, alpha=1e-4, beta=5):
"""
Initialization of the :class:`AllenCahnProblem`.

:param alpha: The diffusion coefficient.
:param alpha: The diffusion coefficient. Default is 1e-4.
:type alpha: float | int
:param beta: The reaction coefficient.
:param beta: The reaction coefficient. Default is 5.0.
:type beta: float | int
"""
super().__init__()
Expand Down
4 changes: 3 additions & 1 deletion pina/problem/zoo/diffusion_reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ class DiffusionReactionProblem(TimeDependentProblem, SpatialProblem):
:math:`[-\pi, \pi]` and temporal interval :math:`[0, 1]`.

.. seealso::

**Original reference**: Si, Chenhao, et al. *Complex Physics-Informed
Neural Network.* arXiv preprint arXiv:2502.04917 (2025).
DOI: `arXiv:2502.04917 <https://arxiv.org/abs/2502.04917>`_.

:Example:

>>> problem = DiffusionReactionProblem()
"""

Expand All @@ -63,7 +65,7 @@ def __init__(self, alpha=1e-4):
"""
Initialization of the :class:`DiffusionReactionProblem`.

:param alpha: The diffusion coefficient.
:param alpha: The diffusion coefficient. Default is 1e-4.
:type alpha: float | int
"""
super().__init__()
Expand Down
4 changes: 3 additions & 1 deletion pina/problem/zoo/helmholtz.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ class HelmholtzProblem(SpatialProblem):
:math:`[-1, 1] \times [-1, 1]`.

.. seealso::

**Original reference**: Si, Chenhao, et al. *Complex Physics-Informed
Neural Network.* arXiv preprint arXiv:2502.04917 (2025).
DOI: `arXiv:2502.04917 <https://arxiv.org/abs/2502.04917>`_.

:Example:

>>> problem = HelmholtzProblem()
"""

Expand All @@ -44,7 +46,7 @@ def __init__(self, alpha=3.0):
"""
Initialization of the :class:`HelmholtzProblem` class.

:param alpha: Parameter of the forcing term.
:param alpha: Parameter of the forcing term. Default is 3.0.
:type alpha: float | int
"""
super().__init__()
Expand Down
16 changes: 10 additions & 6 deletions pina/problem/zoo/inverse_poisson_2d_square.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ def _load_tensor_from_url(url, labels, timeout=10):
and None is returned.

:param str url: URL to the remote `.pth` tensor file.
:param list[str] | tuple[str] labels: Labels for the resulting LabelTensor.
:param int timeout: Timeout for the request in seconds.
:param labels: Labels for the resulting LabelTensor.
:type labels: list[str] | tuple[str]
:param int timeout: Timeout for the request in seconds. Default is 10s.
:return: A LabelTensor object if successful, otherwise None.
:rtype: LabelTensor | None
"""
Expand Down Expand Up @@ -71,12 +72,14 @@ def laplace_equation(input_, output_, params_):
class InversePoisson2DSquareProblem(SpatialProblem, InverseProblem):
r"""
Implementation of the inverse 2-dimensional Poisson problem in the square
domain :math:`[0, 1] \times [0, 1]`,
with unknown parameter domain :math:`[-1, 1] \times [-1, 1]`.
The `"data"` condition is added only if the required files are
downloaded successfully.
domain :math:`[0, 1] \times [0, 1]`, with unknown parameter domain
:math:`[-1, 1] \times [-1, 1]`.

The `"data"` condition is added only if the required files are downloaded
successfully.

:Example:

>>> problem = InversePoisson2DSquareProblem()
"""

Expand Down Expand Up @@ -108,6 +111,7 @@ def __init__(self, load=True, data_size=1.0):

:param bool load: If True, it attempts to load data from remote URLs.
Set to False to skip data loading (e.g., if no internet connection).
Default is True.
:param float data_size: The fraction of the total data to use for the
"data" condition. If set to 1.0, all available data is used.
If set to 0.0, no data is used. Default is 1.0.
Expand Down
1 change: 1 addition & 0 deletions pina/problem/zoo/poisson_2d_square.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Poisson2DSquareProblem(SpatialProblem):
:math:`[0, 1] \times [0, 1]`.

:Example:

>>> problem = Poisson2DSquareProblem()
"""

Expand Down
8 changes: 8 additions & 0 deletions pina/problem/zoo/supervised_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SupervisedProblem(AbstractProblem):
:class:`~pina.condition.input_target_condition.InputTargetCondition`.

:Example:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried to render the doc locally? I think the space breaks it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should work. See Condition doc for reference: https://mathlab.github.io/PINA/_rst/condition/condition.html

>>> import torch
>>> input_data = torch.rand((100, 10))
>>> output_data = torch.rand((100, 10))
Expand All @@ -33,10 +34,17 @@ def __init__(
:type input_: torch.Tensor | LabelTensor | Graph | Data
:param output_: Output data of the problem.
:type output_: torch.Tensor | LabelTensor | Graph | Data
:param list[str] input_variables: List of names of the input variables.
If None, the input variables are inferred from `input_`.
Default is None.
:param list[str] output_variables: List of names of the output
variables. If None, the output variables are inferred from
`output_`. Default is None.
"""
# Set input and output variables
self.input_variables = input_variables
self.output_variables = output_variables

# Set the condition
self.conditions["data"] = Condition(input=input_, target=output_)
super().__init__()