pheromone_dispersion.velocity module

class pheromone_dispersion.velocity.Velocity(msh, U_at_vertical_interface, U_at_horizontal_interface, t=None)[source]

Bases: object

Class containing the wind velocity field \(\vec{u}(x,y,t)=(u(x,y,t),v(x,y,t))\).

at_vertical_interface

The wind velocity field \(\vec{u}(x,y)\) at the vertical interfaces of each cells of the mesh at the current time \(t\).

Type:

ndarray

at_horizontal_interface

The wind velocity field \(\vec{u}(x,y)\) at the horizontal interfaces of each cells of the mesh at the current time \(t\).

Type:

ndarray

div

The divergence of the wind velocity field \(div~\vec{u}(x,y)=\partial_xu(x,y)+\partial_yv(x,y)\) at the center of each cells of the mesh at the current time \(t\).

Type:

ndarray

t

The array of times \(t\) at which the velocity fields maps \(\vec{u}(x,y)\) are given. If \(\vec{u}\) is stationary, set to None.

Type:

ndarray

time_interpolation_at_vertical_interface

Callable function used to compute the wind velocity field \(\vec{u}(x,y)\) at the vertical interfaces of each cells of the mesh given a time \(t\). Computation using the linear interpolation of the wind fields provided on the given time array.

Type:

scipy.interpolate.interp1d

time_interpolation_at_horizontal_interface

Callable function used to compute the wind velocity field \(\vec{u}(x,y)\) at the horizontal interfaces of each cells of the mesh given a time \(t\). Computation using the linear interpolation of the wind fields provided on the given time array.

Type:

scipy.interpolate.interp1d

time_interpolation_div

Callable function used to compute the divergence of the wind velocity field \(div~\vec{u}(x,y)\) given a time \(t\). Computation using the linear interpolation of the divergence of the wind fields originally computed on the given time array.

Type:

scipy.interpolate.interp1d

cell_above_upwind

For each cell, is True if the cell above is the upwind cell for the \(y\)-component of the wind velocity \(v\) at the current time \(t\).

Type:

ndarray of boolean

cell_under_upwind

For each cell, is True if the cell under is the upwind cell for the \(y\)-component of the wind velocity \(v\) at the current time \(t\)

Type:

ndarray of boolean

cell_right_upwind

For each cell, is True if the right cell is the upwind cell for the \(x\)-component of the wind velocity \(u\) at the current time \(t\)

Type:

ndarray of boolean

cell_left_upwind

For each cell, is True if the left cell is the upwind cell for the \(x\)-component of the wind velocity \(u\) at the current time \(t\)

Type:

ndarray of boolean

max_horizontal_U

The \(L^\infty\) norm of the horizontal component of the velocity field \(max_{(x,y,t)}(|u(x,y,t)|)\).

Type:

float

max_vertical_U

The \(L^\infty\) norm of the vertical component of the velocity field \(max_{(x,y,t)}(|v(x,y,t)|)\).

Type:

float

__init__(msh, U_at_vertical_interface, U_at_horizontal_interface, t=None)[source]

Constructor method.

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

  • U_at_vertical_interface (ndarray) – The wind velocity fields \(\vec{u}(x,y)\) at one or multiple times at the vertical interfaces of each cells of the mesh.

  • U_at_horizontal_interface (ndarray) – The wind velocity fields \(\vec{u}(x,y)\) at one or multiple times at the horizontal interfaces of each cells of the mesh.

  • t (ndarray or None, default: None) – The array of the times \(t\) at which the wind velocity fields \(\vec{u}(x,y)\) are given. None if the \(\vec{u}\) is stationary.

Raises:

ValueError – if the shape of the provided wind velocity fields \(\vec{u}(x,y)\) does not fit with the shape of the arrays of the coordinates of the cells’ interfaces and of the provided time array.

at_current_time(tc)[source]

Update the attributes at_vertical_interface, at_horizontal_interface and div at a given time using the linear interpolation callable attributes resp time_interpolation_at_vertical_interface, time_interpolation_at_horizontal_interface and time_interpolation_div.

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 wind velocity fields are given.

pheromone_dispersion.velocity.velocity_field_from_meteo_data(path_data, file_name_data, msh)[source]

Derive the wind velocity field \(\vec{u}\) as an object of the Velocity class from meteorogical data. Read the meteorological wind velocity data, linearly interpolate in space the meteorological wind data on the horizontal and vertical interfaces of each cells of the mesh and return an object of the Velocity class containing the linear interpolation of these data on the mesh.

Parameters:
  • path_data (str) – Path to the folder that contains the meteorogical data.

  • file_name_data (str) – Name of the file that contains the meteorological data.

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

Returns:

The velocity field \(\vec{u}\) obtained by linear interpolation of the meteorological data on the mesh.

Return type:

Velocity