# Class LagrangianLinearTIDS¶

class LagrangianLinearTIDS : public LagrangianDS

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

The class LagrangianLinearTIDS allows to define and compute a generic ndof-dimensional Lagrangian Linear Time Invariant Dynamical System of the form:

$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 the Mass matrix (access : mass() method).

• $$K \in R^{ndof \times ndof}$$ is the stiffness matrix (access : K() method).

• $$C \in R^{ndof \times ndof}$$ is the viscosity matrix (access : C() method).

• $$z \in R^{zSize}$$ is a vector of arbitrary algebraic variables, some sort of discret state.

The equation of motion is also shortly denoted as:

$M(q,z) \dot v = F(v, q, t, z) + p$

where

• $$F(v, q, t, z) \in R^{ndof}$$ collects the total forces acting on the system, that is $$F(v, q, t, z) = F_{ext}(t, z) - Cv - Kq$$.

This vector is saved and may be accessed using forces() method.

If required (e.g. for Event-Driven like simulation), reformulation as a first-order system is also available, and writes:

• $$n= 2 ndof$$

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

• rhs given by:

$\begin{split} 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] \end{split}$

Its jacobian is:

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

with the input due to the non smooth law:

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

public constructors

LagrangianLinearTIDS(SP::SiconosVector q0, SP::SiconosVector v0, SP::SiconosMatrix M, SP::SiconosMatrix K, SP::SiconosMatrix C)

constructor from initial state and all matrix operators.

Parameters
• q0 – initial coordinates

• v0 – initial velocity

• M – mass matrix

• K – stiffness matrix

• C – damping matrix

inline LagrangianLinearTIDS(SP::SiconosVector q0, SP::SiconosVector v0, SP::SiconosMatrix M)

constructor from initial state and mass matrix only.

Leads to $$M\dot v = F_{ext}(t,z) + p$$ .

Parameters
• q0 – initial coordinates

• v0 – initial velocity

• M – mass matrix

inline ~LagrangianLinearTIDS()

destructor

virtual void initRhs(double t) override

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

Parameters

t – time of initialization

virtual void computeForces(double time, SP::SiconosVector q, SP::SiconosVector velocity) override

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

Parameters
• time – the current time

• q – SP::SiconosVector: pointers on q

• velocity – SP::SiconosVector: pointers on velocity

inline const SimpleMatrix getK() const

get a copy of the stiffness matrix

Returns
inline SP::SiconosMatrix K() const

Returns

pointer on a SiconosMatrix

void setK(const SiconosMatrix &K)

set (copy) the value of the stiffness matrix

Parameters

K – new stiffness matrix

void setKPtr(SP::SiconosMatrix newPtr)

Parameters

newPtr – pointer to the new Stiffness matrix

inline const SimpleMatrix getC() const

get a copy of the damping matrix

Returns
inline SP::SiconosMatrix C() const

Returns

pointer on a SiconosMatrix

void setC(const SiconosMatrix &C)

set (copy) the value of the damping matrix

Parameters

C – new damping matrix

void setCPtr(SP::SiconosMatrix newPtr)

Parameters

newPtr – pointer to the new damping matrix

inline virtual SP::SiconosMatrix jacobianqForces() const override

get $$\nabla_qF(v,q,t,z)$$ (pointer link)

Returns

pointer on a SiconosMatrix

inline virtual SP::SiconosMatrix jacobianvForces() const override

get $$\nabla_{\dot q}F(v,q,t,z)$$ (pointer link)

Returns

pointer on a SiconosMatrix

inline virtual bool isLinear() override
Returns

true if the Dynamical system is linear.

virtual void display(bool brief = true) const override

print the data onto the screen