# 4.3.4. pde.pdes.diffusion module

A simple diffusion equation

class DiffusionPDE(diffusivity=1, *, bc='auto_periodic_neumann', noise=0, rng=None)[source]

Bases: PDEBase

A simple diffusion equation

The mathematical definition is

$\partial_t c = D \nabla^2 c$

where $$c$$ is a scalar field and $$D$$ denotes the diffusivity.

Parameters:
• diffusivity (float) – The diffusivity of the described species

• bc (Dict[str, Dict | str | BCBase] | Dict | str | BCBase | Tuple[Dict | str | BCBase, Dict | str | BCBase] | BoundaryAxisBase | Sequence[Dict[str, Dict | str | BCBase] | Dict | str | BCBase | Tuple[Dict | str | BCBase, Dict | str | BCBase] | BoundaryAxisBase]) – The boundary conditions applied to the field. Boundary conditions are generally given as a list with one condition for each axis. For periodic axes, only periodic boundary conditions are allowed (indicated by ‘periodic’ and ‘anti-periodic’). For non-periodic axes, different boundary conditions can be specified for the lower and upper end (using a tuple of two conditions). For instance, Dirichlet conditions enforcing a value NUM (specified by {‘value’: NUM}) and Neumann conditions enforcing the value DERIV for the derivative in the normal direction (specified by {‘derivative’: DERIV}) are supported. Note that the special value ‘natural’ imposes periodic boundary conditions for periodic axis and a vanishing derivative otherwise. More information can be found in the boundaries documentation.

• noise (float) – Variance of the (additive) noise term

• rng (Generator) – Random number generator (default: default_rng()) used for stochastic simulations. Note that this random number generator is only used for numpy function, while compiled numba code uses the random number generator of numba. Moreover, in simulations using multiprocessing, setting the same generator in all processes might yield unintended correlations in the simulation results.

diagnostics: Dict[str, Any]

Diagnostic information (available after the PDE has been solved)

Type:

dict

evolution_rate(state, t=0)[source]

evaluate the right hand side of the PDE

Parameters:
• state (ScalarField) – The scalar field describing the concentration distribution

• t (float) – The current time point

Returns:

Scalar field describing the evolution rate of the PDE

Return type:

ScalarField

explicit_time_dependence: bool | None = False

Flag indicating whether the right hand side of the PDE has an explicit time dependence.

Type:

bool

property expression: str

the expression of the right hand side of this PDE

Type:

str