The Kinematics Library

simcoon.ER_to_F(E: Annotated[numpy.typing.ArrayLike, numpy.float64], R: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Provides the transformation gradient from the Green-Lagrange strain and the rotation.

Parameters:
  • E (pybind11::array_t<double>) – Green-Lagrange strain tensor (3x3 matrix).

  • R (pybind11::array_t<double>) – Rotation tensor (3x3 matrix).

Returns:

Transformation gradient (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

E = np.random.rand(3, 3)
R = np.eye(3)
F = sim.ER_to_F(E, R)
print(F)
simcoon.eR_to_F(e: Annotated[numpy.typing.ArrayLike, numpy.float64], R: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Provides the transformation gradient from the logarithmic strain and the rotation.

Parameters:
  • e (pybind11::array_t<double>) – Logarithmic strain tensor (3x3 matrix).

  • R (pybind11::array_t<double>) – Rotation tensor (3x3 matrix).

Returns:

Transformation gradient (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

e = np.random.rand(3, 3)
R = np.eye(3)
F = sim.eR_to_F(e, R)
print(F)
simcoon.G_UdX(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the gradient of displacement (Lagrangian) from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Gradient of displacement (Lagrangian) (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
GradU = sim.G_UdX(F)
print(GradU)
simcoon.G_UdX_to_F(G: Annotated[numpy.typing.ArrayLike, numpy.float64], return_J: bool = False, n_threads: SupportsInt | SupportsIndex = 4) → object

Transformation gradient from the displacement gradient, the inverse of G_UdX().

Computes \(\mathbf{F} = \mathbf{I} + \partial \mathbf{u} / \partial \mathbf{X}\) and, on request, \(J = \det \mathbf{F}\) (closed form).

Parameters:
  • G (numpy.ndarray) – Displacement gradient \(\partial \mathbf{u} / \partial \mathbf{X}\), G[i, J] \(= \partial u_i / \partial X_J\), a (3, 3) matrix or a batch (3, 3, N), one point per slice.

  • return_J (bool) – Also return the determinant: the call then returns (F, J).

  • n_threads (int) – Number of threads of the batch loop: 1 runs serially, 0 uses all the cores. Default 4, as simcoon.umat(). Batches of at most 100 points always run serially; the GIL is released during the loop.

Returns:

F with the shape of G (Fortran ordered); with return_J, (F, J) where J is a float for one point or a (N,) array for a batch.

Return type:

numpy.ndarray or tuple

Examples

import numpy as np
import simcoon as sim

G = 0.01 * np.random.rand(3, 3, 100)
F = sim.G_UdX_to_F(G)
F, J = sim.G_UdX_to_F(G, return_J=True)
simcoon.G_Udx(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the gradient of displacement (Eulerian) from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Gradient of displacement (Eulerian) (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
gradU = sim.G_Udx(F)
print(gradU)
simcoon.R_Cauchy_Green(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Right Cauchy-Green tensor from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Right Cauchy-Green tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
C = sim.R_Cauchy_Green(F)
print(C)
simcoon.L_Cauchy_Green(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Left Cauchy-Green tensor from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Left Cauchy-Green tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
B = sim.L_Cauchy_Green(F)
print(B)
simcoon.RU_decomposition(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → tuple

Computes the RU decomposition of the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix), or a batch of them (3x3xN array).

Returns:

Rotation matrix (3x3) and right stretch tensor (3x3); for a batch, two 3x3xN arrays (computed per point in parallel, the GIL released).

Return type:

tuple

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
R, U = sim.RU_decomposition(F)
print(R, U)
simcoon.VR_decomposition(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → tuple

Computes the VR decomposition of the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix), or a batch of them (3x3xN array).

Returns:

Left stretch tensor (3x3) and rotation matrix (3x3); for a batch, two 3x3xN arrays (computed per point in parallel, the GIL released).

Return type:

tuple

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
V, R = sim.VR_decomposition(F)
print(V, R)
simcoon.Inv_X(input: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the invariants of a symmetric tensor.

Parameters:

X (pybind11::array_t<double>) – Symmetric tensor (3x3 matrix).

Returns:

Vector containing the three invariants of the tensor.

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

X = np.random.rand(3, 3)
invariants = sim.Inv_X(X)
print(invariants)
simcoon.Cauchy(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Cauchy tensor from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Cauchy tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
b = sim.Cauchy(F)
print(b)
simcoon.Green_Lagrange(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Green-Lagrange tensor from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Green-Lagrange tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
E = sim.Green_Lagrange(F)
print(E)
simcoon.Euler_Almansi(F: Annotated[numpy.typing.ArrayLike, numpy.float64], copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Euler-Almansi tensor from the transformation gradient.

Parameters:

F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix).

Returns:

Euler-Almansi tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
A = sim.Euler_Almansi(F)
print(A)
simcoon.Log_strain(F: Annotated[numpy.typing.ArrayLike, numpy.float64], voigt_form: bool = False, copy: bool = True, n_threads: SupportsInt | SupportsIndex = 4) → numpy.typing.NDArray[numpy.float64]

Computes the logarithmic strain tensor from the transformation gradient.

Parameters:
  • F (pybind11::array_t<double>) – Transformation gradient (3x3 matrix), or a batch of them (3, 3, N).

  • voigt_form (bool) – Return the strain in Voigt notation (6, or (6, N) for a batch).

  • copy (bool) – Return a copy of the result array.

  • n_threads (int) – Number of threads of the batch loop: 1 runs serially, 0 uses all the cores. Default 4, as simcoon.umat(). Batches of at most 100 points always run serially; the GIL is released during the loop.

Returns:

Logarithmic strain tensor (3x3 matrix), or a batch of them.

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F = np.random.rand(3, 3)
e = sim.Log_strain(F)
print(e)
simcoon.finite_L(F0: Annotated[numpy.typing.ArrayLike, numpy.float64], F1: Annotated[numpy.typing.ArrayLike, numpy.float64], DTime: SupportsFloat | SupportsIndex, copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Eulerian velocity tensor from the transformation gradient at two different times.

Parameters:
  • F0 (pybind11::array_t<double>) – Transformation gradient at time t0 (3x3 matrix).

  • F1 (pybind11::array_t<double>) – Transformation gradient at time t1 (3x3 matrix).

  • DTime (double) – Time difference (t1 - t0).

Returns:

Eulerian velocity tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F0 = np.random.rand(3, 3)
F1 = np.random.rand(3, 3)
DTime = 0.1
L = sim.finite_L(F0, F1, DTime)
print(L)
simcoon.finite_D(F0: Annotated[numpy.typing.ArrayLike, numpy.float64], F1: Annotated[numpy.typing.ArrayLike, numpy.float64], DTime: SupportsFloat | SupportsIndex, copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Eulerian symmetric rate tensor from the transformation gradient at two different times.

Parameters:
  • F0 (pybind11::array_t<double>) – Transformation gradient at time t0 (3x3 matrix).

  • F1 (pybind11::array_t<double>) – Transformation gradient at time t1 (3x3 matrix).

  • DTime (double) – Time difference (t1 - t0).

Returns:

Eulerian symmetric rate tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F0 = np.random.rand(3, 3)
F1 = np.random.rand(3, 3)
DTime = 0.1
D = sim.finite_D(F0, F1, DTime)
print(D)
simcoon.finite_W(F0: Annotated[numpy.typing.ArrayLike, numpy.float64], F1: Annotated[numpy.typing.ArrayLike, numpy.float64], DTime: SupportsFloat | SupportsIndex, copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Eulerian antisymmetric spin tensor from the transformation gradient at two different times.

Parameters:
  • F0 (pybind11::array_t<double>) – Transformation gradient at time t0 (3x3 matrix).

  • F1 (pybind11::array_t<double>) – Transformation gradient at time t1 (3x3 matrix).

  • DTime (double) – Time difference (t1 - t0).

Returns:

Eulerian antisymmetric spin tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F0 = np.random.rand(3, 3)
F1 = np.random.rand(3, 3)
DTime = 0.1
W = sim.finite_W(F0, F1, DTime)
print(W)
simcoon.finite_Omega(F0: Annotated[numpy.typing.ArrayLike, numpy.float64], F1: Annotated[numpy.typing.ArrayLike, numpy.float64], DTime: SupportsFloat | SupportsIndex, copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the rigid-body rotation spin tensor from the transformation gradient at two different times.

The spin is the inverse Cayley transform of the exact relative polar rotation DR = R1 R0^T (Green-Naghdi corotational rate): it is exactly skew-symmetric and its Hughes-Winget update recovers DR exactly. Returns zero when DTime <= iota. Raises for a 180-degree rotation increment or improper inputs (det F < 0): F0 and F1 must be genuine transformation gradients.

Parameters:
  • F0 (pybind11::array_t<double>) – Transformation gradient at time t0 (3x3 matrix, det > 0).

  • F1 (pybind11::array_t<double>) – Transformation gradient at time t1 (3x3 matrix, det > 0).

  • DTime (double) – Time difference (t1 - t0).

Returns:

Rigid-body rotation spin tensor (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

F0 = np.eye(3)
c, s = np.cos(0.3), np.sin(0.3)
F1 = np.array([[c, -s, 0.], [s, c, 0.], [0., 0., 1.]])
DTime = 0.1
Omega = sim.finite_Omega(F0, F1, DTime)
print(Omega)
simcoon.finite_DQ(Omega0: Annotated[numpy.typing.ArrayLike, numpy.float64], Omega1: Annotated[numpy.typing.ArrayLike, numpy.float64], DTime: SupportsFloat | SupportsIndex, copy: bool = True) → numpy.typing.NDArray[numpy.float64]

Computes the Hughes-Winget approximation of the increment of rotation or transformation.

Parameters:
  • Omega0 (pybind11::array_t<double>) – Spin/velocity at time t0 (3x3 matrix).

  • Omega1 (pybind11::array_t<double>) – Spin/velocity at time t1 (3x3 matrix).

  • DTime (double) – Time difference (t1 - t0).

Returns:

Increment of rotation or transformation (3x3 matrix).

Return type:

pybind11::array_t<double>

Examples

import numpy as np
import simcoon as sim

Omega0 = np.random.rand(3, 3)
Omega1 = np.random.rand(3, 3)
DTime = 0.1
DQ = sim.finite_DQ(Omega0, Omega1, DTime)
print(DQ)