pheromone_dispersion.diffusion_operator module
- class pheromone_dispersion.diffusion_operator.Diffusion(*args: Any, **kwargs: Any)[source]
Bases:
LinearOperatorClass 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
LinearOperatorclass.- msh
The geometry of the domain.
- Type:
- K
The diffusion tensor \(\mathbf{K}(x,y,t)\).
- Type:
- 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:
tupleofint
- dtype
Data type of the elements of the matrix of the linear operator. The type is float64
- Type:
- __init__(K, msh)[source]
Constructor method
- Parameters:
K (
DiffusionTensor) – The diffusion tensor \(\mathbf{K}(x,y,t)\).msh (
MeshRect2D) – The geometry of the domain.
- _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:
Notes
The input \(c\) has to be raveled into a (
msh.y.size*msh.x.size,)-shape array to match the format of theLinearOperatorclass. 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 (
floatorinteger) – The current time.
Notes
Updates the diffusion tensor
Kand its own attributes using the methodat_current_time()of the classDiffusionTensor.