aurel.maths

maths.py

This module contains functions for manipulating rank 2 tensors, including:
  • extracting components or formatting components into matrices,

  • computing determinants and inverses,

  • symmetrizing or antisymmetrizing tensors.

  • safe division

aurel.maths.antisymmetrise_tensor(fdown)[source]

Antisymmetrise a rank 2 tensor.

aurel.maths.determinant3(f)[source]

Determinant 3x3 matrice in every position of the data grid.

aurel.maths.determinant4(f)[source]

Determinant of a 4x4 matrice in every position of the data grid.

aurel.maths.format_rank2_3(f)[source]

Format a rank 2 tensor with 3D indices into a 3x3 array.

aurel.maths.format_rank2_4(f)[source]

Format a rank 2 tensor with 4D indices into a 4x4 array.

aurel.maths.getcomponents3(f)[source]

Extract components of a rank 2 tensor with 3D indices.

This assumes this tensor is symmetric.

Parameters:

f ((3, 3, Nx, Ny, Nz) array_like or list of 6 components [xx, xy, xz, yy, yz, zz])

Returns:

[xx, xy, xz, yy, yz, zz] – Each element is (Nx, Ny, Nz) array_like

Return type:

list

aurel.maths.getcomponents4(f)[source]

Extract components of a rank 2 tensor with 4D indices.

This assumes this tensor is symmetric.

Parameters:

f ((4, 4, Nx, Ny, Nz) array_like or list of 10 components [tt, tx, ty, tz, xx, xy, xz, yy, yz, zz])

Returns:

[tt, tx, ty, tz, xx, xy, xz, yy, yz, zz] – Each element is (Nx, Ny, Nz) array_like

Return type:

list

aurel.maths.inverse3(f)[source]

Inverse of a 3x3 matrice in every position of the data grid.

aurel.maths.inverse4(f)[source]

Inverse of a 4x4 matrice in every position of the data grid.

aurel.maths.populate_4Riemann(Riemann_ssss, Riemann_ssst, Riemann_stst)[source]

Populate the 4Riemann tensor with R_ssss, R_ssst, and R_stst

aurel.maths.safe_division(a, b)[source]

Safe division to avoid division by zero, so x/0 = 0.

aurel.maths.symmetrise_tensor(fdown)[source]

Symmetrise a rank 2 tensor.