implementations.problem_classes.GeneralizedFisher_1D_FD_implicit module

class generalized_fisher(nvars=127, nu=1.0, lambda0=2.0, newton_maxiter=100, newton_tol=1e-12, interval=(-5, 5), stop_at_nan=True)[source]

Bases: ptype

The following one-dimensional problem is an example of a reaction-diffusion equation with traveling waves, and can be seen as a generalized Fisher equation. This class implements a special case of the Kolmogorov-Petrovskii-Piskunov problem [1]

\[\frac{\partial u}{\partial t} = \Delta u + \lambda_0^2 u (1 - u^\nu)\]

with initial condition

\[u(x, 0) = \left[ 1 + \left(2^{\nu / 2} - 1\right) \exp\left(-(\nu / 2)\delta x\right) \right]^{2 / \nu}\]

for \(x \in \mathbb{R}\). For

\[\delta = \lambda_1 - \sqrt{\lambda_1^2 - \lambda_0^2},\]
\[\lambda_1 = \frac{\lambda_0}{2} \left[ \left(1 + \frac{\nu}{2}\right)^{1/2} + \left(1 + \frac{\nu}{2}\right)^{-1/2} \right],\]

the exact solution is

\[u(x, t) = \left( 1 + \left(2^{\nu / 2} - 1\right) \exp\left(-\frac{\nu}{2}\delta (x + 2 \lambda_1 t)\right) \right)^{-2 / n}.\]

Spatial discretization is done by centered finite differences.

Parameters:
  • nvars (int, optional) – Spatial resolution, i.e., number of degrees of freedom in space.

  • nu (float, optional) – Problem parameter \(\nu\).

  • lambda0 (float, optional) – Problem parameter \(\lambda_0\).

  • newton_maxiter (int, optional) – Maximum number of Newton iterations to solve the nonlinear system.

  • newton_tol (float, optional) – Tolerance for Newton to terminate.

  • interval (tuple, optional) – Defines the spatial domain.

  • stop_at_nan (bool, optional) – Indicates if the nonlinear solver should stop if nan values arise.

A

Second-order FD discretization of the 1D Laplace operator.

Type:

sparse matrix (CSC)

dx

Distance between two spatial nodes.

Type:

float

References

dtype_f

alias of mesh

dtype_u

alias of mesh

eval_f(u, t)[source]

Routine to evaluate the right-hand side of the problem.

Parameters:
  • u (dtype_u) – Current values of the numerical solution.

  • t (float) – Current time of the numerical solution is computed.

Returns:

f – The right-hand side of the problem.

Return type:

dtype_f

solve_system(rhs, factor, u0, t)[source]

Simple Newton solver.

Parameters:
  • rhs (dtype_f) – Right-hand side for the nonlinear system.

  • factor (float) – Abbrev. for the node-to-node stepsize (or any other factor required).

  • u0 (dtype_u) – Initial guess for the iterative solver.

  • t (float) – urrent time (required here for the BC).

Returns:

u – Solution.

Return type:

dtype_u

u_exact(t)[source]

Routine to compute the exact solution at time \(t\).

Parameters:

t (float) – Time of the exact solution.

Returns:

me – Exact solution.

Return type:

dtype_u