# 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

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

~LagrangianLinearTIDS()

destructor

Right-hand side computation

void initRhs(double t)

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

Parameters
• t: time of initialization

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

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

Parameters
• time: the current time

• q: SP::SiconosVector: pointers on q

• velocity: SP::SiconosVector: pointers on velocity

Attributes access

const SimpleMatrix getK() const

get a copy of the stiffness matrix

Return

SP::SiconosMatrix K() const

Return

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

const SimpleMatrix getC() const

get a copy of the damping matrix

Return

SP::SiconosMatrix C() const

Return

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

SP::SiconosMatrix jacobianqForces() const

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

Return

pointer on a SiconosMatrix

SP::SiconosMatrix jacobianvForces() const

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

Return

pointer on a SiconosMatrix

Miscellaneous public methods

virtual bool isLinear()

Return

true if the Dynamical system is linear.

void display(bool brief = true) const

print the data onto the screen