scimba_torch.physical_models.ode.rigid_body

Implementation of a rigid body ODE.

Classes

RigidBody(space, init[, rhs_func])

Implementation of a rigid body ODE.

class RigidBody(space, init, rhs_func=None, **kwargs)[source]

Bases: AbstractODE

Implementation of a rigid body ODE.

\[\begin{split}\frac{dx}{dt} = y z + f_x(t), \\ \frac{dy}{dt} = - x z + f_y(t), \\ \frac{dz}{dt} = x y + f_z(t), \\\end{split}\]

with an initial condition given by the function init and a right-hand side given by the function rhs_func, giving the three components of the right-hand side \(f_x\), \(f_y\), and \(f_z\).

Parameters:
  • space (AbstractApproxSpace) – The approximation space for the problem

  • init (Callable) – Callable for the initial condition

  • rhs_func (Callable) – Callable for the right-hand side of the ODE (default is zeros_rhs)

  • **kwargs – Additional keyword arguments

static compute_eqs(dx_dt, dy_dt, dz_dt, x, y, z, i_x, i_y, i_z)[source]

Compute the equations of the rigid body ODE.

Parameters:
  • dx_dt (Tensor) – Time derivative of x

  • dy_dt (Tensor) – Time derivative of y

  • dz_dt (Tensor) – Time derivative of z

  • x (Tensor) – Variable x

  • y (Tensor) – Variable y

  • z (Tensor) – Variable z

  • i_x (Tensor) – Parameter i_x

  • i_y (Tensor) – Parameter i_y

  • i_z (Tensor) – Parameter i_z

Return type:

tuple[Tensor, Tensor, Tensor]

Returns:

A tuple containing the equations for x, y, and z

time_operator(w, t, mu)[source]

Apply the ODE operator.

Parameters:
Return type:

Tensor | tuple[Tensor, ...]

Returns:

Operator tensor

functional_operator(func, t, mu, theta)[source]

Compute the functional operator.

Parameters:
  • func (VarArgCallable) – Callable representing the function

  • t (Tensor) – Temporal coordinate tensor

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor