implementations.problem_classes.Brusselator module

class Brusselator(alpha=0.1, **kwargs)[source]

Bases: IMEX_Laplacian_MPIFFT

Two-dimensional Brusselator from [1]. This is a reaction-diffusion equation with non-autonomous source term:

\[\frac{\partial u}{\partial t} = \varalpha \Delta u + 1 + u^2 v - 4.4u _ f(x,y,t), \frac{\partial v}{\partial t} = \varalpha \Delta v + 3.4u - u^2 v\]

with the source term \(f(x,y,t) = 5\) if \((x-0.3)^2 + (y-0.6)^2 <= 0.1^2\) and \(t >= 1.1\) and 0 else. We discretize in a periodic domain of length 1 and solve with an IMEX scheme based on a spectral method for the Laplacian which we invert implicitly. We treat the reaction and source terms explicitly.

References

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

get_fig()[source]

Get a figure suitable to plot the solution of this problem

Returns:

self.fig

Return type:

matplotlib.pyplot.figure.Figure

plot(u, t=None, fig=None)[source]

Plot the solution. Please supply a figure with the same structure as returned by self.get_fig.

Parameters:
  • u (dtype_u) – Solution to be plotted

  • t (float) – Time to display at the top of the figure

  • fig (matplotlib.pyplot.figure.Figure) – Figure with the correct structure

Return type:

None

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

Simple FFT solver for the diffusion part.

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

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

  • u0 (dtype_u) – Initial guess for the iterative solver (not used here so far).

  • t (float) – Current time (e.g. for time-dependent BCs).

Returns:

me – Solution.

Return type:

dtype_u

u_exact(t, u_init=None, t_init=None)[source]

Initial conditions.

Parameters:
  • t (float) – Time of the exact solution.

  • u_init (dtype_u) – Initial conditions for getting the exact solution.

  • t_init (float) – The starting time.

Returns:

me – Exact solution.

Return type:

dtype_u