pheromone_dispersion.diffusion_operator module

class pheromone_dispersion.diffusion_operator.Diffusion(*args: Any, **kwargs: Any)[source]

Bases: LinearOperator

Class containing the diffusion term linear operator \(D:c\mapsto -\nabla\cdot(\mathbf{K}\nabla c)~\forall (x,y)\in\Omega~\forall t\in]0;T]\) with the related boundary condition \(\mathbf{K}\nabla c\cdot\vec{n}=0~\forall (x,y)\in\partial\Omega\).

The implementation of this linear operator is a subclass of the LinearOperator class.

msh

The geometry of the domain.

Type:

MeshRect2D

K

The diffusion tensor \(\mathbf{K}(x,y,t)\).

Type:

DiffusionTensor

shape

Shape of the matrix of the linear operator. The shape is (msh.y.size * msh.x.size, msh.y.size * msh.x.size)

Type:

tuple of int

dtype

Data type of the elements of the matrix of the linear operator. The type is float64

Type:

dtype

__init__(K, msh)[source]

Constructor method

Parameters:
_matvec(x_out)[source]

Compute the image (matrix-vector product) of \(D:c\mapsto -\nabla\cdot(\mathbf{K}\nabla c)\) with the related boundary condition for a given concentration map \(c\) at the current time.

Parameters:

x_out (ndarray) – The map of concentration of pheromones \(c(x,y)\) at a given time \(t\) raveled into a vector.

Returns:

Array containing the image \(-\nabla\cdot(\mathbf{K}\nabla c)\).

Return type:

ndarray

Notes

The input \(c\) has to be raveled into a (msh.y.size * msh.x.size,)-shape array to match the format of the LinearOperator class. The same way, the ouput can be reshape into a (msh.y.size, msh.x.size)-shape array to get the map \(Dc(x,y)\) at the current time \(t\)

For now, the numerical scheme is implemented for diagonal diffusion tensor, i.e. for unidirectional wind field or for isotropic diffusion tensor (\(K_u=K_{u^\perp}\))

at_current_time(tc)[source]

Update the diffusion tensor at a given time.

Parameters:

tc (float or integer) – The current time.

Notes

Updates the diffusion tensor K and its own attributes using the method at_current_time() of the class DiffusionTensor.