# siconos.kernel.LagrangianLinearDiagonalDS (Python class)¶

class siconos.kernel.LagrangianLinearDiagonalDS(*args)[source]

Bases: siconos.kernel.LagrangianDS

Lagrangian Linear Systems with time invariant and diagonal coefficients - $$M\dot v + Cv + Kq = F_{ext}(t,z) + p$$.

The class LagrangianLinearDiagonalDS allows to define and compute a generic ndof-dimensional Lagrangian Linear Time Invariant Dynamical System of the form : where $$M \ddot q + C \dot q + K q = F_{ext}(t,z) + p,$$ where

• $$q \in R^{ndof}$$ is the set of the generalized coordinates,
• $$\dot q \in R^{ndof}$$ the velocity, i. e. the time derivative of the generalized coordinates.
• $$\ddot q \in R^{ndof}$$ the acceleration, i. e. the second time derivative of the generalized coordinates.
• $$p \in R^{ndof}$$ the forces due to the Non Smooth Interaction. In particular case of Non Smooth evolution, the variable p contains the impulse and not the force.
• $$M \in R^{ndof \times ndof}$$ is Mass matrix stored in the SiconosMatrix mass().
• $$K \in R^{ndof \times ndof}$$ is the stiffness matrix stored in the SiconosMatrix K().
• $$C \in R^{ndof \times ndof}$$ is the viscosity matrix stored in the SiconosMatrix C().
• $$z \in R^{zSize}$$ is a vector of arbitrary algebraic variables, some sort of discret state.
• all matrix coefficients are diagonal

If required (e.g. for Event-Driven like simulation), reformulation as a first- order system (DynamicalSystem) is possible, with:

• $$n= 2 ndof$$

• $$x = \left[\begin{array}{c}q \\ \dot q\end{array}\right]$$

• rhs given by:



rhs(x,t,z) = left[begin{array}{c} dot q \ ddot q = M^{-1}left[F_{ext}(t, z) - C dot q - K q + p right]\ end{array}right]

Its jacobian is:



nabla_{x}rhs(x,t) = left[begin{array}{cc} 0 & I \ -M^{-1}K & -M^{-1}C \ end{array}right]

The input due to the non smooth law is:

$$r = \left[\begin{array}{c}0 \\ p \end{array}\right]$$

Generated class (swig), based on C++ header Program listing for file kernel/src/modelingTools/LagrangianLinearDiagonalDS.hpp.

Constructors

LagrangianLinearDiagonalDS(array_like (np.float64, 1D) q0, array_like (np.float64, 1D) v0, array_like (np.float64, 1D) stiffness, array_like (np.float64, 1D) damping, array_like (np.float64, 1D) mass)

constructor from initial state and all operators.

Parameters: q0 – initial coordinates v0 – initial velocity stiffness – diagonal of the stiffness matrix damping – diagonal of the damping matrix mass – diagonal of the mass matrix
LagrangianLinearDiagonalDS(array_like (np.float64, 1D) q0, array_like (np.float64, 1D) v0, array_like (np.float64, 1D) stiffness, array_like (np.float64, 1D) damping)

constructor for complete system with identity mass matrix

Parameters: q0 – initial coordinates v0 – initial velocity stiffness – diagonal of the stiffness matrix damping – diagonal of the damping matrix
LagrangianLinearDiagonalDS(array_like (np.float64, 1D) q0, array_like (np.float64, 1D) v0, array_like (np.float64, 1D) stiffness)

constructor for undamped system and identity mass matrix

Parameters: q0 – initial coordinates v0 – initial velocity stiffness – diagonal of the stiffness matrix
computeForces(double time, array_like (np.float64, 1D) q, array_like (np.float64, 1D) velocity) → None[source]

Compute $$F(v,q,t,z)$$.

Parameters: time – the current time q – SP::SiconosVector: pointers on q velocity – SP::SiconosVector: pointers on velocity
damping() -> array_like (np.float64, 1D)[source]

get damping matrix (diagonal only, pointer link)

Returns: pointer on a SiconosVector
display() → None[source]

print the data of the dynamical system on the standard output

get_damping() -> array_like (np.float64, 1D)[source]

get a copy of the damping matrix (diagonal only)

Returns: SiconosVector
get_stiffness() -> array_like (np.float64, 1D)[source]

get a copy of the stiffness matrix (diagonal only)

Returns: SiconosVector
initRhs(double t) → None[source]

allocate (if needed) and compute rhs and its jacobian.

Parameters: t – time of initialization
isLinear() → bool[source]
Returns: true if the Dynamical system is linear.
stiffness() -> array_like (np.float64, 1D)[source]

get stiffness matrix (diagonal only, pointer link)

Returns: pointer on a SiconosVector