Diffusivity

Diffusivity

pigreads.diffusivity.diffusivity_matrix(f=None, n=None, Df=1.0, Ds=None, Dn=None, dtype=<class 'numpy.float32'>)

Define a diffusivity matrix \(\textbf D\) for the reaction-diffusion equation.

If f and n are given, the matrix is defined as:

\[\textbf D = \textbf D_s \textbf I + (\textbf D_f - \textbf D_s) \textbf f \textbf f^\mathrm{T} + (\textbf D_n - \textbf D_s) \textbf n \textbf n^\mathrm{T}\]
Parameters:
  • f (ndarray[Any, Any] | list[int] | tuple[int, int, int] | None) – The main direction of diffusion, i.e., the fibre direction. 3D vector over space with shape (Nz, Ny, Nx, 3). The last index contains three elements: the x, y, and z component of the vector. Optional if \(D_f=D_s=D_n\). (default: None)

  • n (ndarray[Any, Any] | list[int] | tuple[int, int, int] | None) – The direction of weakest diffusion, i.e., the direction normal to the fibre sheets. A 3D vector over space with shape (Nz, Ny, Nx, 3). The last index contains three elements: the x, y, and z component of the vector. Optional if \(D_s=D_n\). (default: None)

  • Df (ndarray[Any, Any] | float) – The diffusivity in the direction of the fibres, \(\mathbf{f}\). (default: 1.0)

  • Ds (ndarray[Any, Any] | float | None) – The diffusivity in the fibre sheets, but normal to \(\mathbf{f}\). If None, \(D_s\) is set to \(D_f\). (default: None)

  • Dn (ndarray[Any, Any] | float | None) – The diffusivity in the direction normal to the fibre sheets, i.e., along \(\mathbf{n}\). If None, \(D_n\) is set to \(D_s\). (default: None)

  • dtype (type) – Data type of the arrays, i.e., single or double precision floating point numbers. (default: <class 'numpy.float32'>)

Return type:

ndarray[Any, Any]

Returns:

A 4D array with shape (Nz, Ny, Nx, 6).

See also pigreads.helper.get_upper_triangle() for the convention used for the last axis of the output array.