diff --git a/pina/problem/zoo/advection.py b/pina/problem/zoo/advection.py index 74bac9b22..ed1c900e6 100644 --- a/pina/problem/zoo/advection.py +++ b/pina/problem/zoo/advection.py @@ -33,7 +33,8 @@ class AdvectionProblem(SpatialProblem, TimeDependentProblem): DOI: `arXiv:2308.08468 `_. :Example: - >>> problem = AdvectionProblem(c=1.0) + + >>> problem = AdvectionProblem() """ output_variables = ["u"] @@ -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__() diff --git a/pina/problem/zoo/allen_cahn.py b/pina/problem/zoo/allen_cahn.py index c88285338..b930aece4 100644 --- a/pina/problem/zoo/allen_cahn.py +++ b/pina/problem/zoo/allen_cahn.py @@ -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 @@ -37,6 +38,7 @@ class AllenCahnProblem(TimeDependentProblem, SpatialProblem): j.cma.2024.116805 `_. :Example: + >>> problem = AllenCahnProblem() """ @@ -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__() diff --git a/pina/problem/zoo/diffusion_reaction.py b/pina/problem/zoo/diffusion_reaction.py index 416cdb253..3ba8faafd 100644 --- a/pina/problem/zoo/diffusion_reaction.py +++ b/pina/problem/zoo/diffusion_reaction.py @@ -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 `_. :Example: + >>> problem = DiffusionReactionProblem() """ @@ -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__() diff --git a/pina/problem/zoo/helmholtz.py b/pina/problem/zoo/helmholtz.py index 0f38780c7..1a79bd84e 100644 --- a/pina/problem/zoo/helmholtz.py +++ b/pina/problem/zoo/helmholtz.py @@ -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 `_. :Example: + >>> problem = HelmholtzProblem() """ @@ -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__() diff --git a/pina/problem/zoo/inverse_poisson_2d_square.py b/pina/problem/zoo/inverse_poisson_2d_square.py index ab89c4c16..769febb9a 100644 --- a/pina/problem/zoo/inverse_poisson_2d_square.py +++ b/pina/problem/zoo/inverse_poisson_2d_square.py @@ -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 """ @@ -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() """ @@ -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. diff --git a/pina/problem/zoo/poisson_2d_square.py b/pina/problem/zoo/poisson_2d_square.py index 27d7fc870..d01def915 100644 --- a/pina/problem/zoo/poisson_2d_square.py +++ b/pina/problem/zoo/poisson_2d_square.py @@ -28,6 +28,7 @@ class Poisson2DSquareProblem(SpatialProblem): :math:`[0, 1] \times [0, 1]`. :Example: + >>> problem = Poisson2DSquareProblem() """ diff --git a/pina/problem/zoo/supervised_problem.py b/pina/problem/zoo/supervised_problem.py index 3fe683f13..61a49c0cb 100644 --- a/pina/problem/zoo/supervised_problem.py +++ b/pina/problem/zoo/supervised_problem.py @@ -13,6 +13,7 @@ class SupervisedProblem(AbstractProblem): :class:`~pina.condition.input_target_condition.InputTargetCondition`. :Example: + >>> import torch >>> input_data = torch.rand((100, 10)) >>> output_data = torch.rand((100, 10)) @@ -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__()