File kernel/src/modelingTools/LagrangianLinearTIDS.hpp

Go to the source code of this file

class LagrangianLinearTIDS : public LagrangianDS
#include <LagrangianLinearTIDS.hpp>

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 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.

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 stored in the SiconosVector forces()

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:

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

The input due to the non smooth law is:

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

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
SimpleMatrix

SP::SiconosMatrix K() const

get stiffness matrix (pointer link)

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)

set stiffness matrix (pointer link)

Parameters
  • newPtr: pointer to the new Stiffness matrix

const SimpleMatrix getC() const

get a copy of the damping matrix

Return
SimpleMatrix

SP::SiconosMatrix C() const

get damping matrix (pointer link)

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)

set damping matrix (pointer link)

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 jacobianqDotForces() 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() const

print the data onto the screen

Public Functions

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

ACCEPT_STD_VISITORS()

Protected Functions

LagrangianLinearTIDS()

default constructor

ACCEPT_SERIALIZATION(LagrangianLinearTIDS)

Protected Attributes

SP::SiconosMatrix _C

damping matrix

SP::SiconosMatrix _K

stiffness matrix