pheromone_dispersion.reaction_operator module
- class pheromone_dispersion.reaction_operator.Reaction(*args: Any, **kwargs: Any)[source]
Bases:
LinearOperatorClass containing the reaction term linear operator \(R:c\mapsto \tau_{loss}c~\forall (x,y)\in\Omega~\forall t\in]0;T]\).
The implementation of this linear operator is a subclass of the
LinearOperatorclass.- msh
The geometry of the domain.
- 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__(reaction_coeff, msh)[source]
Constructor method
- Parameters:
reaction_coeff (
ndarray) – The loss coefficient \(\tau_{loss}(x,y)\) at the center of each cells.msh (
MeshRect2D) – The geometry of the domain.
- Raises:
ValueError – if shape of the array of loss coefficient does not fit with the shape of the arrays of the coordinates of the cells’ center.
- _matvec(x_out)[source]
Compute the image (matrix-vector product) of \(R:c\mapsto \tau_{loss}c\) 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 \(\tau_{loss}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 \(Rc(x,y)\) at the current time \(t\)
- update_reaction_coeff(reaction_coeff)[source]
Update the attribute
reaction_coeffwith the value provided as input.- Parameters:
reaction_coeff (
ndarray) – The new value of loss coefficient \(\tau_{loss}(x,y)\).