pheromone_dispersion.source_term module

class pheromone_dispersion.source_term.Source(msh, value, t=None)[source]

Bases: object

Class containing the source term \(s(x,y,t)~\forall (x,y)\in\Omega~\forall t\in[0;T]\) that is the quantity of pheromone emitted per second.

t

The array of times \(t\) at which the source term maps \(s(x,y)\) are given. If the source is stationary, set to None.

Type:

ndarray

value

Quantity of pheromone emitted (source term) map \(s(x,y)\) at the current time \(t\).

Type:

ndarray

time_interpolation

Callable function used to compute the source term map \(s(x,y)\) given a time \(t\). Computation using the linear interpolation of the source term maps provided on the given time array.

Type:

scipy.interpolate.interp1d

__init__(msh, value, t=None)[source]

Constructor method.

Parameters:
  • msh (MeshRect2D) – The geometry of the domain.

  • value (ndarray) – The source term maps \(s(x,y)\) at one or multiple times.

  • t (ndarray, default: None) – The array of the times \(t\) at which the source term maps \(s(x,y)\) are given. None if the source is stationary.

Raises:

ValueError – if the shape of the provided values of the source term \(s(x,y)\) does not fit with the shape of the arrays of the coordinates of the cells’ center and of the provided time array.

at_current_time(tc)[source]

Update the attribute value at a given time using the linear interpolation callable attribute time_interpolation.

Parameters:

tc (float or integer) – The current time.

Raises:

ValueError – if the given time is not between the first and last times of the attribute t, i.e. between the first and last times at which the source term maps are given.