scimba_torch.physical_models.ode.abstract_ode

Module for abstract ODEs.

Functions

zeros_rhs(w, t, mu[, nb_func])

Function returning a zero right-hand side.

Classes

AbstractODE(space, init[, n_equations, rhs_func])

Base class for representing Ordinary Differential Equations (ODEs).

zeros_rhs(w, t, mu, nb_func=1)[source]

Function returning a zero right-hand side.

Parameters:
  • w (MultiLabelTensor) – Solution tensor.

  • t (LabelTensor) – Temporal coordinates tensor.

  • mu (LabelTensor) – Parameter tensor.

  • nb_func (int) – Number of functions to return (default is 1).

Return type:

Tensor

Returns:

A tensor of zeros with shape (number of points, nb_func).

class AbstractODE(space, init, n_equations=1, rhs_func=None, **kwargs)[source]

Bases: ABC

Base class for representing Ordinary Differential Equations (ODEs).

Parameters:
  • space (AbstractApproxSpace) – Approximation space used for the ODE

  • init (Callable) – Initial condition function

  • n_equations (int) – Number of equations in the system (default is 1)

  • rhs_func (Optional[Callable]) – Right-hand side function of the ODE (default is zeros_rhs)

  • **kwargs – Additional keyword arguments

grad(w, y)[source]

Compute the gradient of the tensor w with respect to the tensor y.

Parameters:
Return type:

Tensor | tuple[Tensor, ...]

Returns:

Gradient tensor

rhs(w, t, mu)[source]

Compute the right-hand side (RHS) of the PDE.

Parameters:
Return type:

Tensor | tuple[Tensor, ...]

Returns:

RHS tensor

abstract time_operator(w, t, mu)[source]

Apply the PDE operator.

Parameters:
Return type:

Tensor | tuple[Tensor, ...]

Returns:

Operator tensor

operator(w, t, mu)[source]

Apply the PDE operator.

Parameters:
Return type:

Tensor | tuple[Tensor, ...]

Returns:

Operator tensor

initial_condition(mu)[source]

Compute the initial condition.

Parameters:

mu (LabelTensor) – Parameter tensor

Return type:

tuple[Tensor, ...]

Returns:

Initial condition tensor

functional_operator_ic(func, mu, theta)[source]

Compute the functional operator for initial conditions.

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

  • mu (Tensor) – Parameter tensor

  • theta (Tensor) – Additional parameters tensor

Return type:

Tensor

Returns:

Functional operator tensor for initial conditions