DiffusionReactionProblem#

Formulation of the diffusion-reaction problem.

class DiffusionReactionProblem(alpha=0.0001)[source]#

Bases: TimeDependentProblem, SpatialProblem

Implementation of the one-dimensional diffusion-reaction problem on the space-time domain \(\Omega\times T = [-\pi, \pi] \times [0, 1]\).

The problem is governed by the forced diffusion-reaction equation

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

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

Homogeneous Dirichlet boundary conditions are imposed at the spatial boundaries:

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

The initial condition is prescribed as

\[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

\[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).\]

See also

Original reference: Si, Chenhao, et al. Complex Physics-Informed Neural Network. arXiv preprint arXiv:2502.04917 (2025). DOI: arXiv:2502.04917.

Example:
>>> problem = DiffusionReactionProblem()

Initialization of the DiffusionReactionProblem.

Parameters:

alpha (float | int) – The diffusion coefficient. Default is 1e-4.

solution(pts)[source]#

Implementation of the analytical solution of the diffusion-reaction problem.

Parameters:

pts (LabelTensor) – Points where the solution is evaluated.

Returns:

The analytical solution of the diffusion-reaction problem.

Return type:

LabelTensor