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
46 changes: 44 additions & 2 deletions pina/_src/problem/zoo/acoustic_wave_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,50 @@ def initial_condition(input_, output_):

class AcousticWaveProblem(TimeDependentProblem, SpatialProblem):
r"""
Implementation of the acoustic wave problem in the spatial interval
:math:`[0, 1]` and temporal interval :math:`[0, 1]`.
Implementation of the one-dimensional acoustic wave problem on the
space-time domain :math:`\Omega\times T = [0, 1] \times [0, 1]`.

The problem is governed by the acoustic wave equation

.. math::

\frac{\partial^2 u}{\partial t^2}
=
c^2 \frac{\partial^2 u}{\partial x^2},

where :math:`u = u(x, t)` is the solution field and :math:`c > 0` is the
wave propagation speed.

Homogeneous Dirichlet boundary conditions are imposed at the spatial
boundaries:

.. math::

u(0, t) = u(1, t) = 0, \qquad t \in [0, 1].

The initial displacement is prescribed as

.. math::

u(x, 0) = \sin(\pi x) + \frac{1}{2}\sin(4\pi x),
\qquad x \in [0, 1],

together with zero initial velocity:

.. math::

\frac{\partial u}{\partial t}(x, 0) = 0,
\qquad x \in [0, 1].

The analytical solution is given by

.. math::

u(x, t)
=
\sin(\pi x)\cos(c\pi t)
+
\frac{1}{2}\sin(4\pi x)\cos(4c\pi t).

.. seealso::

Expand Down
36 changes: 33 additions & 3 deletions pina/_src/problem/zoo/advection_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,39 @@ def initial_condition(input_, output_):

class AdvectionProblem(SpatialProblem, TimeDependentProblem):
r"""
Implementation of the advection problem in the spatial interval
:math:`[0, 2 \pi]` and temporal interval :math:`[0, 1]` with periodic
boundary conditions.
Implementation of the one-dimensional advection problem on the space-time
domain :math:`\Omega\times T = [0, 2\pi] \times [0, 1]`.

The problem is governed by the linear advection equation

.. math::

\frac{\partial u}{\partial t}
+
c \frac{\partial u}{\partial x}
=
0,

where :math:`u = u(x, t)` is the solution field and :math:`c` is the
advection velocity.

Periodic boundary conditions are imposed at the spatial boundaries:

.. math::

u(0, t) = u(2\pi, t), \qquad t \in [0, 1].

The initial condition is prescribed as

.. math::

u(x, 0) = \sin(x), \qquad x \in [0, 2\pi].

The analytical solution is given by

.. math::

u(x, t) = \sin(x - ct).

.. seealso::

Expand Down
32 changes: 29 additions & 3 deletions pina/_src/problem/zoo/allen_cahn_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,35 @@ def initial_condition(input_, output_):

class AllenCahnProblem(TimeDependentProblem, SpatialProblem):
r"""
Implementation of the Allen Cahn problem in the spatial interval
:math:`[-1, 1]` and temporal interval :math:`[0, 1]` with periodic
boundary conditions.
Implementation of the one-dimensional Allen-Cahn problem on the space-time
domain :math:`\Omega\times T = [-1, 1] \times [0, 1]`.

The problem is governed by the Allen-Cahn equation

.. math::

\frac{\partial u}{\partial t}
-
\alpha \frac{\partial^2 u}{\partial x^2}
+
\beta \left(u^3 - u\right)
=
0,

where :math:`u = u(x, t)` is the solution field, :math:`\alpha` is the
diffusion coefficient, and :math:`\beta` is the reaction coefficient.

Periodic boundary conditions are imposed at the spatial boundaries:

.. math::

u(-1, t) = u(1, t), \qquad t \in [0, 1].

The initial condition is prescribed as

.. math::

u(x, 0) = x^2 \cos(\pi x), \qquad x \in [-1, 1].

.. seealso::

Expand Down
59 changes: 57 additions & 2 deletions pina/_src/problem/zoo/diffusion_reaction_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,63 @@ def initial_condition(input_, output_):

class DiffusionReactionProblem(TimeDependentProblem, SpatialProblem):
r"""
Implementation of the diffusion-reaction problem in the spatial interval
:math:`[-\pi, \pi]` and temporal interval :math:`[0, 1]`.
Implementation of the one-dimensional diffusion-reaction problem on the
space-time domain :math:`\Omega\times T = [-\pi, \pi] \times [0, 1]`.

The problem is governed by the forced diffusion-reaction equation

.. math::

\frac{\partial u}{\partial t}
-
\alpha \frac{\partial^2 u}{\partial x^2}
=
f(x, t),

where :math:`u = u(x, t)` is the solution field, :math:`\alpha` is the
diffusion coefficient, and :math:`f(x, t)` is a forcing term.

Homogeneous Dirichlet boundary conditions are imposed at the spatial
boundaries:

.. math::

u(-\pi, t) = u(\pi, t) = 0, \qquad t \in [0, 1].

The initial condition is prescribed as

.. math::

u(x, 0)
=
\sin(x)
+
\frac{1}{2}\sin(2x)
+
\frac{1}{3}\sin(3x)
+
\frac{1}{4}\sin(4x)
+
\frac{1}{8}\sin(8x).

The analytical solution is given by

.. math::

u(x, t)
=
e^{-t}
\left(
\sin(x)
+
\frac{1}{2}\sin(2x)
+
\frac{1}{3}\sin(3x)
+
\frac{1}{4}\sin(4x)
+
\frac{1}{8}\sin(8x)
\right).

.. seealso::

Expand Down
41 changes: 39 additions & 2 deletions pina/_src/problem/zoo/helmholtz_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,45 @@

class HelmholtzProblem(SpatialProblem):
r"""
Implementation of the Helmholtz problem in the square domain
:math:`[-1, 1] \times [-1, 1]`.
Implementation of the two-dimensional Helmholtz problem on the square domain
:math:`\Omega = [-1, 1] \times [-1, 1]`.

The problem is governed by the forced Helmholtz equation

.. math::

\Delta u + k u = f(x, y),

where :math:`u = u(x, y)` is the solution field, :math:`k` is the squared
wavenumber, and :math:`f(x, y)` is a forcing term.

Homogeneous Dirichlet boundary conditions are imposed on the boundary of
the domain:

.. math::

u(x, y) = 0, \qquad (x, y) \in \partial \Omega.

The analytical solution is given by

.. math::

u(x, y)
=
\sin(\alpha_x \pi x)
\sin(\alpha_y \pi y),

with forcing term

.. math::

f(x, y)
=
\left[
k - (\alpha_x^2 + \alpha_y^2)\pi^2
\right]
\sin(\alpha_x \pi x)
\sin(\alpha_y \pi y).

.. seealso::

Expand Down
30 changes: 27 additions & 3 deletions pina/_src/problem/zoo/inverse_poisson_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,33 @@ 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]`.
Implementation of the inverse two-dimensional Poisson problem on the square
domain :math:`\Omega = [-2, 2] \times [-2, 2]`, with unknown parameter
domain :math:`\Theta = [-1, 1] \times [-1, 1]`.

The problem is governed by the parameterized Poisson equation

.. math::

\Delta u
=
\exp\left(
-2(x - \mu_1)^2
-2(y - \mu_2)^2
\right),

where :math:`u = u(x, y)` is the solution field and :math:`\mu_1, \mu_2` are
unknown parameters controlling the forcing term.

Homogeneous Dirichlet boundary conditions are imposed on the boundary of the
domain:

.. math::

u(x, y) = 0, \qquad (x, y) \in \partial \Omega.

The inverse problem aims to infer the unknown parameters :math:`\mu_1` and
:math:`\mu_2` from solution data.

The `"data"` condition is added only if the required files are downloaded
successfully.
Expand Down
36 changes: 34 additions & 2 deletions pina/_src/problem/zoo/poisson_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,40 @@ def forcing_term(input_):

class Poisson2DSquareProblem(SpatialProblem):
r"""
Implementation of the 2-dimensional Poisson problem in the square domain
:math:`[0, 1] \times [0, 1]`.
Implementation of the two-dimensional Poisson problem on the square domain
:math:`\Omega = [0, 1] \times [0, 1]`.

The problem is governed by the Poisson equation

.. math::

\Delta u = f(x, y),

where :math:`u = u(x, y)` is the solution field and :math:`f(x, y)` is the
forcing term.

Homogeneous Dirichlet boundary conditions are imposed on the boundary of the
domain:

.. math::

u(x, y) = 0, \qquad (x, y) \in \partial \Omega.

The forcing term is given by

.. math::

f(x, y)
=
2\pi^2 \sin(\pi x)\sin(\pi y).

The analytical solution is given by

.. math::

u(x, y)
=
-\sin(\pi x)\sin(\pi y).

:Example:

Expand Down
Loading