Skip to content

Commit dcac3a9

Browse files
enhance problem formulation
1 parent 0f36713 commit dcac3a9

7 files changed

Lines changed: 263 additions & 17 deletions

pina/_src/problem/zoo/acoustic_wave_problem.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,50 @@ def initial_condition(input_, output_):
2828

2929
class AcousticWaveProblem(TimeDependentProblem, SpatialProblem):
3030
r"""
31-
Implementation of the acoustic wave problem in the spatial interval
32-
:math:`[0, 1]` and temporal interval :math:`[0, 1]`.
31+
Implementation of the one-dimensional acoustic wave problem on the
32+
space-time domain :math:`\Omega\times T = [0, 1] \times [0, 1]`.
33+
34+
The problem is governed by the acoustic wave equation
35+
36+
.. math::
37+
38+
\frac{\partial^2 u}{\partial t^2}
39+
=
40+
c^2 \frac{\partial^2 u}{\partial x^2},
41+
42+
where :math:`u = u(x, t)` is the solution field and :math:`c > 0` is the
43+
wave propagation speed.
44+
45+
Homogeneous Dirichlet boundary conditions are imposed at the spatial
46+
boundaries:
47+
48+
.. math::
49+
50+
u(0, t) = u(1, t) = 0, \qquad t \in [0, 1].
51+
52+
The initial displacement is prescribed as
53+
54+
.. math::
55+
56+
u(x, 0) = \sin(\pi x) + \frac{1}{2}\sin(4\pi x),
57+
\qquad x \in [0, 1],
58+
59+
together with zero initial velocity:
60+
61+
.. math::
62+
63+
\frac{\partial u}{\partial t}(x, 0) = 0,
64+
\qquad x \in [0, 1].
65+
66+
The analytical solution is given by
67+
68+
.. math::
69+
70+
u(x, t)
71+
=
72+
\sin(\pi x)\cos(c\pi t)
73+
+
74+
\frac{1}{2}\sin(4\pi x)\cos(4c\pi t).
3375
3476
.. seealso::
3577

pina/_src/problem/zoo/advection_problem.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,39 @@ def initial_condition(input_, output_):
2424

2525
class AdvectionProblem(SpatialProblem, TimeDependentProblem):
2626
r"""
27-
Implementation of the advection problem in the spatial interval
28-
:math:`[0, 2 \pi]` and temporal interval :math:`[0, 1]` with periodic
29-
boundary conditions.
27+
Implementation of the one-dimensional advection problem on the space-time
28+
domain :math:`\Omega\times T = [0, 2\pi] \times [0, 1]`.
29+
30+
The problem is governed by the linear advection equation
31+
32+
.. math::
33+
34+
\frac{\partial u}{\partial t}
35+
+
36+
c \frac{\partial u}{\partial x}
37+
=
38+
0,
39+
40+
where :math:`u = u(x, t)` is the solution field and :math:`c` is the
41+
advection velocity.
42+
43+
Periodic boundary conditions are imposed at the spatial boundaries:
44+
45+
.. math::
46+
47+
u(0, t) = u(2\pi, t), \qquad t \in [0, 1].
48+
49+
The initial condition is prescribed as
50+
51+
.. math::
52+
53+
u(x, 0) = \sin(x), \qquad x \in [0, 2\pi].
54+
55+
The analytical solution is given by
56+
57+
.. math::
58+
59+
u(x, t) = \sin(x - ct).
3060
3161
.. seealso::
3262

pina/_src/problem/zoo/allen_cahn_problem.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,35 @@ def initial_condition(input_, output_):
2626

2727
class AllenCahnProblem(TimeDependentProblem, SpatialProblem):
2828
r"""
29-
Implementation of the Allen Cahn problem in the spatial interval
30-
:math:`[-1, 1]` and temporal interval :math:`[0, 1]` with periodic
31-
boundary conditions.
29+
Implementation of the one-dimensional Allen-Cahn problem on the space-time
30+
domain :math:`\Omega\times T = [-1, 1] \times [0, 1]`.
31+
32+
The problem is governed by the Allen-Cahn equation
33+
34+
.. math::
35+
36+
\frac{\partial u}{\partial t}
37+
-
38+
\alpha \frac{\partial^2 u}{\partial x^2}
39+
+
40+
\beta \left(u^3 - u\right)
41+
=
42+
0,
43+
44+
where :math:`u = u(x, t)` is the solution field, :math:`\alpha` is the
45+
diffusion coefficient, and :math:`\beta` is the reaction coefficient.
46+
47+
Periodic boundary conditions are imposed at the spatial boundaries:
48+
49+
.. math::
50+
51+
u(-1, t) = u(1, t), \qquad t \in [0, 1].
52+
53+
The initial condition is prescribed as
54+
55+
.. math::
56+
57+
u(x, 0) = x^2 \cos(\pi x), \qquad x \in [-1, 1].
3258
3359
.. seealso::
3460

pina/_src/problem/zoo/diffusion_reaction_problem.py

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,63 @@ def initial_condition(input_, output_):
3535

3636
class DiffusionReactionProblem(TimeDependentProblem, SpatialProblem):
3737
r"""
38-
Implementation of the diffusion-reaction problem in the spatial interval
39-
:math:`[-\pi, \pi]` and temporal interval :math:`[0, 1]`.
38+
Implementation of the one-dimensional diffusion-reaction problem on the
39+
space-time domain :math:`\Omega\times T = [-\pi, \pi] \times [0, 1]`.
40+
41+
The problem is governed by the forced diffusion-reaction equation
42+
43+
.. math::
44+
45+
\frac{\partial u}{\partial t}
46+
-
47+
\alpha \frac{\partial^2 u}{\partial x^2}
48+
=
49+
f(x, t),
50+
51+
where :math:`u = u(x, t)` is the solution field, :math:`\alpha` is the
52+
diffusion coefficient, and :math:`f(x, t)` is a forcing term.
53+
54+
Homogeneous Dirichlet boundary conditions are imposed at the spatial
55+
boundaries:
56+
57+
.. math::
58+
59+
u(-\pi, t) = u(\pi, t) = 0, \qquad t \in [0, 1].
60+
61+
The initial condition is prescribed as
62+
63+
.. math::
64+
65+
u(x, 0)
66+
=
67+
\sin(x)
68+
+
69+
\frac{1}{2}\sin(2x)
70+
+
71+
\frac{1}{3}\sin(3x)
72+
+
73+
\frac{1}{4}\sin(4x)
74+
+
75+
\frac{1}{8}\sin(8x).
76+
77+
The analytical solution is given by
78+
79+
.. math::
80+
81+
u(x, t)
82+
=
83+
e^{-t}
84+
\left(
85+
\sin(x)
86+
+
87+
\frac{1}{2}\sin(2x)
88+
+
89+
\frac{1}{3}\sin(3x)
90+
+
91+
\frac{1}{4}\sin(4x)
92+
+
93+
\frac{1}{8}\sin(8x)
94+
\right).
4095
4196
.. seealso::
4297

pina/_src/problem/zoo/helmholtz_problem.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,45 @@
1111

1212
class HelmholtzProblem(SpatialProblem):
1313
r"""
14-
Implementation of the Helmholtz problem in the square domain
15-
:math:`[-1, 1] \times [-1, 1]`.
14+
Implementation of the two-dimensional Helmholtz problem on the square domain
15+
:math:`\Omega = [-1, 1] \times [-1, 1]`.
16+
17+
The problem is governed by the forced Helmholtz equation
18+
19+
.. math::
20+
21+
\Delta u + k u = f(x, y),
22+
23+
where :math:`u = u(x, y)` is the solution field, :math:`k` is the squared
24+
wavenumber, and :math:`f(x, y)` is a forcing term.
25+
26+
Homogeneous Dirichlet boundary conditions are imposed on the boundary of
27+
the domain:
28+
29+
.. math::
30+
31+
u(x, y) = 0, \qquad (x, y) \in \partial \Omega.
32+
33+
The analytical solution is given by
34+
35+
.. math::
36+
37+
u(x, y)
38+
=
39+
\sin(\alpha_x \pi x)
40+
\sin(\alpha_y \pi y),
41+
42+
with forcing term
43+
44+
.. math::
45+
46+
f(x, y)
47+
=
48+
\left[
49+
k - (\alpha_x^2 + \alpha_y^2)\pi^2
50+
\right]
51+
\sin(\alpha_x \pi x)
52+
\sin(\alpha_y \pi y).
1653
1754
.. seealso::
1855

pina/_src/problem/zoo/inverse_poisson_problem.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,33 @@ def laplace_equation(input_, output_, params_):
7474

7575
class InversePoisson2DSquareProblem(SpatialProblem, InverseProblem):
7676
r"""
77-
Implementation of the inverse 2-dimensional Poisson problem in the square
78-
domain :math:`[0, 1] \times [0, 1]`, with unknown parameter domain
79-
:math:`[-1, 1] \times [-1, 1]`.
77+
Implementation of the inverse two-dimensional Poisson problem on the square
78+
domain :math:`\Omega = [-2, 2] \times [-2, 2]`, with unknown parameter
79+
domain :math:`\Theta = [-1, 1] \times [-1, 1]`.
80+
81+
The problem is governed by the parameterized Poisson equation
82+
83+
.. math::
84+
85+
\Delta u
86+
=
87+
\exp\left(
88+
-2(x - \mu_1)^2
89+
-2(y - \mu_2)^2
90+
\right),
91+
92+
where :math:`u = u(x, y)` is the solution field and :math:`\mu_1, \mu_2` are
93+
unknown parameters controlling the forcing term.
94+
95+
Homogeneous Dirichlet boundary conditions are imposed on the boundary of the
96+
domain:
97+
98+
.. math::
99+
100+
u(x, y) = 0, \qquad (x, y) \in \partial \Omega.
101+
102+
The inverse problem aims to infer the unknown parameters :math:`\mu_1` and
103+
:math:`\mu_2` from solution data.
80104
81105
The `"data"` condition is added only if the required files are downloaded
82106
successfully.

pina/_src/problem/zoo/poisson_problem.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,40 @@ def forcing_term(input_):
2626

2727
class Poisson2DSquareProblem(SpatialProblem):
2828
r"""
29-
Implementation of the 2-dimensional Poisson problem in the square domain
30-
:math:`[0, 1] \times [0, 1]`.
29+
Implementation of the two-dimensional Poisson problem on the square domain
30+
:math:`\Omega = [0, 1] \times [0, 1]`.
31+
32+
The problem is governed by the Poisson equation
33+
34+
.. math::
35+
36+
\Delta u = f(x, y),
37+
38+
where :math:`u = u(x, y)` is the solution field and :math:`f(x, y)` is the
39+
forcing term.
40+
41+
Homogeneous Dirichlet boundary conditions are imposed on the boundary of the
42+
domain:
43+
44+
.. math::
45+
46+
u(x, y) = 0, \qquad (x, y) \in \partial \Omega.
47+
48+
The forcing term is given by
49+
50+
.. math::
51+
52+
f(x, y)
53+
=
54+
2\pi^2 \sin(\pi x)\sin(\pi y).
55+
56+
The analytical solution is given by
57+
58+
.. math::
59+
60+
u(x, y)
61+
=
62+
-\sin(\pi x)\sin(\pi y).
3163
3264
:Example:
3365

0 commit comments

Comments
 (0)