Multibody System

(MSD)

Pierangelo Masarati

Revision March 9, 2020 Copyright c 2019-2020 Pierangelo Masarati Dipartimento di Scienze e Tecnologie Aerospaziali, Politecnico di Milano

Questo documento `esoggetto a copyright da parte degli autori e da parte del Dipartimento di Scienze e Tecnologie Aerospaziali del Politecnico di Milano. La sua riproduzione e diffusione `elibera purch´e avvenga per scopi consentiti dalle leggi vigenti in materia editoriale nello Stato italiano, e non avvenga per fini di lucro1. La riproduzione parziale per uso personale e l’uso per scopi istruzionali sono liberamente consentiti. E` condizione irrinunciabile che il documento non venga modificato al di fuori o contro il parere degli autori, che `evincolante, e che non venga privato di questo avviso di copyright.

This document is subjected to copyright by the authors and the Department of Aerospace Science and Technology of Politecnico di Milano. Its reproduction and diffusion is free provided it complies with Italian copyright rules and not for profit2. The partial reproduction for personal use and the use for instructional purposes are allowed. The document cannot be modified without or against the consent of the authors, which is binding. This copyright notice cannot be removed.

1E` consentita la stampa su carta e la fotocopia da parte di terzi per fini didattici, a un costo ragionevole, senza alcuna alterazione dei contenuti o del formato. 2The reproduction “as is” in hard copy is allowed by third parties for teaching purposes, at a reasonable cost, without any modification of the contents nor of the format.

i ii Contents

1 Introduction 1-1 1.1 Objectives...... 1-1 1.2 Resources ...... 1-1 1.2.1 Journals...... 1-1 1.2.2 Organizations...... 1-1 1.2.3 Events...... 1-2 1.2.4 FreeSoftware...... 1-2

I Basics 1-3

2 of Mechanical Systems 2-1 2.1 KinematicsofaPointinSpace ...... 2-1 2.1.1 Position...... 2-1 2.1.2 Velocity ...... 2-1 2.1.3 Acceleration...... 2-1 2.2 Rigid-BodyKinematicsinSpace ...... 2-2 2.2.1 Orientation ...... 2-2 2.2.2 ParametrizationofRotations ...... 2-4 2.2.3 RotationDifferentiation ...... 2-4 2.2.4 ParametrizationofAngularVelocity ...... 2-7 2.2.5 Parametrization of Other Rotation Derivatives ...... 2-7 2.2.6 AngularAcceleration...... 2-7 2.3 RelativeMotion...... 2-7 2.4 IncrementalOrientationApproach ...... 2-8 2.4.1 Updated-Updated Orientation Approach ...... 2-9

3 Dynamics of Mechanical Systems 3-1 3.1 DynamicsofaPointMass ...... 3-1 3.2 Invariants ...... 3-3 3.2.1 KineticEnergy ...... 3-3 3.3 DynamicsofaRigidBody...... 3-4 3.3.1 EquilibriumofaContinuum...... 3-4 3.3.2 KineticEnergyofaContinuum ...... 3-4 3.3.3 RigidityConstraint...... 3-5 3.3.4 InertiaForcesofaRigidBody ...... 3-6 3.3.5 EquationsofMotionofaRigidBody...... 3-7 3.3.6 KineticEnergyofaRigidBody...... 3-10 3.4 DynamicsofaSystemofRigidBodies ...... 3-12

iii 4 Analytical 4-1 4.1 VirtualWorkPrinciple...... 4-2 4.2 LagrangeEquationsoftheSecondKind ...... 4-2 4.3 Kinematic Constraints, Lagrange Multipliers, and Lagrange Equations of the First Kind . 4-3 4.3.1 HolonomicConstraints...... 4-3 4.3.2 Non-HolonomicConstraints ...... 4-4 4.4 Gauss’Principle ...... 4-5

II DynamicsofConstrainedMechanicalSystems 4-7

5 Integration of Ordinary Differential Equations 5-1 5.1 NumericalMethods...... 5-1 5.1.1 GeneralLinearMultistepMethods ...... 5-1 5.1.2 SingleStepMethods ...... 5-2 5.1.3 Implicitvs.ExplicitMethods ...... 5-2 5.2 Accuracy ...... 5-2 5.3 Stability...... 5-3 5.3.1 LinearStability...... 5-3 5.3.2 AlgorithmicStabilityvs.Accuracy ...... 5-4 5.3.3 FirstDahlquistbarrier...... 5-6 5.3.4 SecondDahlquistbarrier ...... 5-6 5.3.5 UsefulMethods...... 5-7 5.4 Intermediate Evaluations of the Problem ...... 5-7 5.4.1 Stability...... 5-10 5.5 Integration of Problems in Second-Order Differential Form...... 5-10 5.6 Integration of Implicit and Nonlinear Problems ...... 5-10 5.6.1 Predictor-Corrector ...... 5-11 5.6.2 LinearMultistepMethods ...... 5-11 5.6.3 LinearMultistageMethods ...... 5-12

6 Kinematic Constraints 6-1 6.1 LowerPairsandComplexConstraints ...... 6-1 6.2 OperationswithConstraintEquations ...... 6-3 6.3 PositionConstraints ...... 6-4 6.3.1 SphericalHinge...... 6-4 6.3.2 InlineConstraint ...... 6-7 6.3.3 InplaneConstraint ...... 6-8 6.3.4 DistanceConstraint ...... 6-9 6.4 OrientationConstraints ...... 6-11 6.4.1 ParallelismandOrthogonality ...... 6-11 6.4.2 RevoluteConstraint ...... 6-14 6.4.3 CardanJoint ...... 6-15

7 Minimal Coordinate Set 7-1 7.1 CoordinateReduction ...... 7-1 7.1.1 CoordinatePartitioning ...... 7-2 7.1.2 Coordinate Reduction and Orthogonality ...... 7-4 7.1.3 OtherProjectionMethods...... 7-7 7.1.4 Compliance with Holonomic Constraints ...... 7-7 7.2 RecursiveFormulations ...... 7-8

iv 8 Redundant Coordinate Set 8-1 8.1 Differential-AlgebraicEquations...... 8-1 8.2 Singular Perturbations Theory Interpretation ...... 8-2 8.2.1 SlowSubsystem ...... 8-4 8.2.2 FastSubsystem...... 8-4 8.3 ConceptofIndex ...... 8-4 8.3.1 Index1DAE ...... 8-5 8.3.2 Index2DAE ...... 8-6 8.3.3 Index3DAE ...... 8-6 8.4 IndexReduction ...... 8-7 8.4.1 Constraint Stabilization by Index Reduction ...... 8-7 8.4.2 Baumgarte’sMethod...... 8-8 8.5 Initialization ...... 8-9

9 Unconstrained Coordinate Set 9-1 9.1 Gauss’Principle ...... 9-1 9.2 AugmentedLagrangian ...... 9-1 9.3 ForceProjectionMethod...... 9-2 9.3.1 StabilizedConstrainedDynamics ...... 9-2 9.3.2 Stabilized Constrained Dynamics in ODE Form ...... 9-3 9.3.3 Elimination of Drift at the Position Level ...... 9-4

III Dynamics of Flexible Systems 9-7

10 Beam 10-1

11 Flexible Element 11-1

IV AdvancedProblemsandImplementationAspects 11-3

V Appendices 11-7

A Rotation Parametrizations A-1 A.1 ParametrizationofRotation...... A-1 A.1.1 EulerAngles ...... A-1 A.1.2 EulerVector ...... A-2 A.1.3 Cayley-Gibbs-Rodrigues Parameters ...... A-3 A.1.4 Euler-Rodrigues Parameters and Quaternions ...... A-4 A.2 ParametrizationofAngularVelocity ...... A-5 A.2.1 EulerAngles ...... A-5 A.2.2 EulerVector ...... A-5 A.2.3 Cayley-Gibbs-Rodrigues Parameters ...... A-5 A.2.4 Euler-Rodrigues Parameters and Quaternions ...... A-6

B Lagrange Equations of the Second Kind and Virtual Work Principle B-1 B.1 ContributionoftheInertiaForces...... B-1 B.2 ContributionoftheInertiaMoments ...... B-2

v vi List of Figures

3.1 Sir Isaac Newton (Woolsthorpe-by-Colsterworth, December 25, 1642–London, March 20, 1726)[fromWikipedia]...... 3-2 3.2 Jean Baptiste le Rond d’Alembert (Paris 1717–Paris 1783)[fromWikipedia]...... 3-3 3.3 (Basel, April 15, 1707–Saint Petersburg, September 18, 1783) [from Wikipedia]. 3-5

4.1 Joseph-Louis Lagrange, born Giuseppe Lodovico Lagrangia or Giuseppe Luigi Lagrangia or Lagrange (Turin, January 25, 1736 — Paris April 10, 1813) [from Wikipedia]...... 4-1

6.1 Sketch of the lower kinematic pairs (adapted from [1])...... 6-2 6.2 Sketch of the geometry of a generic pair formulated according to Bauchau [2] (adapted from[1])...... 6-2 6.3 SketchofaCardano’sjoint...... 6-16

vii viii List of Tables

A.1 Admissible rotation sequences for (Tait-Bryan/Cardano)-Eulerangles ...... A-1

ix x List of Examples

5.1 Trapezoidrule ...... 5-8 5.2 Gauss-Lobattomethod...... 5-8 5.3 Heun’smethod ...... 5-9

8.1 Slowandfastmechanicalsubsystems ...... 8-2

xi xii List of Exercises

3.1 Dynamicsofabar—puretranslation ...... 3-7 3.2 Internalforcesinabar—puretranslation...... 3-8 3.3 Dynamicsofabar—rotation...... 3-8

5.1 Accuracyoftwo-stepBDF...... 5-2 5.2 StabilityofCrank-Nicolsonmethod...... 5-6

6.1 Sphericalhingewithnooffsets ...... 6-4 6.2 Derivative of spherical hinge with no offsets ...... 6-4 6.3 Linearization of spherical hinge with no offsets ...... 6-4 6.4 Linearization of derivative of spherical hinge with no offsets ...... 6-5 6.5 Virtual perturbation of spherical hinge with no offsets ...... 6-5 6.6 Derivativeofsphericalhinge...... 6-5 6.7 Sphericalhingeinrelativeframe ...... 6-5 6.8 Linearization of spherical hinge in relative frame ...... 6-5 6.9 Linearization of spherical hinge constraint reactions ...... 6-6 6.10 Distanceconstraintwithnooffsets ...... 6-9 6.11 Derivative of distance constraint with no offsets ...... 6-10 6.12 Linearization of distance constraint with no offsets ...... 6-10 6.13 Derivativeofdistanceconstraint ...... 6-10 6.14 Linearization of parallelism constraint equation ...... 6-13 6.15 Jacobian matrix of revolute constraint ...... 6-15

7.1 Point mass pendulum by coordinate partitioning ...... 7-3 7.2 PointmasspendulumbyQRdecomposition ...... 7-6

xiii xiv List of Homework

2.1 Determinantoforientationmatrix ...... 2-2 2.2 Vectoroperationproperties ...... 2-5 2.3 Second-ordertensortransformation–1...... 2-6 2.4 Second-ordertensortransformation–2...... 2-6 2.5 Virtualperturbationof rotatingvector ...... 2-6 2.6 Velocityofpointonrigidbody ...... 2-6 2.7 Rotation perturbation in incremental approach–1 ...... 2-9 2.8 Angular velocity perturbation in incremental approach–1 ...... 2-9 2.9 Rotation perturbation in incremental approach–2 ...... 2-9 2.10 Angular velocity perturbation in incremental approach–2 ...... 2-9

3.1 Equation of motion for point of variable mass ...... 3-3 3.2 Centerofmass ...... 3-7 3.3 Internalforcesinabar—rotation ...... 3-9 3.4 Kineticenergyofrigidbody...... 3-11 3.5 Kineticenergyreferredto thecenterof mass ...... 3-12 3.6 Kineticenergyofabar...... 3-12

5.1 Linear stability of the Explicit Euler method ...... 5-7 5.2 Linear stability of the Implicit Euler method ...... 5-7 5.3 Linearstabilityofthetwo-stepBDFmethod ...... 5-7 5.4 Stability of trapezoid rule as Runge-Kutta method ...... 5-10 5.5 StabilityofRadauIIAmethod ...... 5-10

6.1 Linearizationofsphericalhinge ...... 6-5 6.2 Linearization of derivative of spherical hinge ...... 6-5 6.3 Virtualperturbationof sphericalhinge ...... 6-5 6.4 Inlineconstraint ...... 6-8 6.5 Inline constraint along arbitrarily curved line in space ...... 6-8 6.6 Inplaneconstraint ...... 6-8 6.7 Inplane constraint on arbitrarily curved surface in space ...... 6-9 6.8 Spherical hinge, inline and inplane constraints with prescribed displacement ...... 6-9 6.9 Linearization of derivative of distance constraint withnooffsets...... 6-10 6.10 Virtual perturbation of distance constraint with no offsets...... 6-10 6.11 Propertyofvectorcross-product ...... 6-11 6.12 Linearization of distance constraint ...... 6-11 6.13 Linearization of derivative of distance constraint ...... 6-11 6.14 Virtual perturbation of distance constraint...... 6-11 6.15 Linearization of distance constraint reactions ...... 6-11 6.16 Skew-symmetric part of rotation matrix ...... 6-12 6.17 Parallelism as constraining the skew-symmetric part of the relative rotation matrix . . . . 6-13 6.18 Parallelism as constraining the logarithm of the relativerotationmatrix ...... 6-13 6.19 Geometric interpretation of parallelism constraint Jacobianmatrix ...... 6-13 6.20 Derivative of parallelism constraint equation ...... 6-14

xv 6.21 Linearization of derivative of parallelism constraintequation...... 6-14 6.22 Virtual perturbation of parallelism constraint equation...... 6-14 6.23 Linearization of parallelism constraint reactions ...... 6-14 6.24 Linearization of revolute constraint equation ...... 6-15 6.25 Derivative of revolute constraint equation ...... 6-15 6.26 Linearization of derivative of revolute constraint equation ...... 6-15 6.27 Virtual perturbation of revolute constraint equation ...... 6-15 6.28 Linearization of revolute constraint reactions ...... 6-15 6.29 Linearization of universal constraint equation ...... 6-16 6.30 Derivative of universal constraint equation ...... 6-16 6.31 Linearization of derivative of universal constraint equation...... 6-16 6.32 Virtual perturbation of universal constraint equation...... 6-16 6.33 Linearization of universal constraint reactions ...... 6-16 6.34 Lowerpairoftype“a”(revolute) ...... 6-17 6.35 Lowerpairoftype“b”(prismatic) ...... 6-17 6.36 Lowerpairoftype“c”(screw) ...... 6-17 6.37 Lowerpairoftype“d”(cylindrical) ...... 6-17 6.38 Lowerpairoftype“f”(planar) ...... 6-17 6.39 Inventyourownkinematicconstraint...... 6-17

7.1 Verify that partitioned coordinates comply with constraints ...... 7-2 7.2 Justify the pre-multiplication of the EoM by the transpose of the transformation matrix . 7-2 7.3 Pseudo-inverse of constraint Jacobian matrix in QR form ...... 7-5

8.1 CheckofIndex1DAEs ...... 8-5 8.2 CheckofIndex2DAEs ...... 8-6 8.3 CheckofIndex3DAEs ...... 8-6 8.4 Index of DAEs for m1 → 0...... 8-6 8.5 Index of DAEs for k1 → ∞ ...... 8-6 8.6 Point mass pendulum with constraint stabilization ...... 8-8

9.1 Point mass pendulum using the Augmented Lagrangian method...... 9-2 9.2 Point mass pendulum using the Force Projection method ...... 9-5

A.1 Euleranglesfromorientationmatrix ...... A-2 A.2 Multiplication of orientation matrix by special vector ...... A-2 A.3 Orthogonality of exponential representation of rotations ...... A-3 A.4 Equivalence of orientation matrices from Euler vector and Euler-Rodrigues parameters . . A-3 A.5 Linear approximation of rotation matrix ...... A-4 A.6 Error of linear approximation of rotation matrix ...... A-4 A.7 Error of quadratic approximation of rotation matrix ...... A-4 A.8 Quaternion multiplication and rotation composition ...... A-5 A.9 Properties of quaternions derivatives–1 ...... A-6 A.10Properties of quaternions derivatives–2 ...... A-6 A.11 Angular velocity in local frame using quaternions ...... A-6

xvi Syllabus

1. Introduction to multibody dynamics

(a) Fundamentals of kinematics and dynamics of mechanical systems: kinematics and dynamics of point and rigid body, formulation and parametrization of rotations, kinematic constraints (0.4 cfu). (b) Equations of motion of point, rigid body, and systems of points and rigid bodies: Newton- Euler, d’Alembert-Lagrange (I and II kind), variational principles (Gauss, Hamilton), quasi- coordinates, holonomic and non-holonomic constraints (1 cfu). (c) Time integration of systems of Ordinary Differential Equations (ODE) and Differential-Algebraic Equations (DAE): methods, characteristics (0.4 cfu). (d) Minimal Coordinate Set, Redundant Coordinate Set, Unconstrained Coordinate Set: equa- tions of motion, constraint stabilization and index reduction, Augmented Lagrangian (0.4 cfu). (e) Systems of rigid and flexible bodies; Floating Frame of Reference (FFR), beam models, funda- mentals of Absolute Nodal Coordinate Formulation (ANCF); multi-field and multidisciplinary problems (1 cfu). (f) Problems: kinematic, kineto-static, initial value, inverse dynamics; linearization and eigen- analysis (0.4 cfu). (g) Advanced problems and implementation aspects: smooth and non-smooth problems, software architecture, parallelization, efficiency, cosimulation, multi-rate simulation, real-time simula- tion, virtual reality (1 cfu).

2. Applications (1.4 cfu)

(a) Helicopter dynamics: articulated/hingeless rotor, pitch control mechanism, complete rotor- craft. (b) Landing gear dynamics: extension/retraction, shimmy, ground resonance. (c) Mechanisms for aerodynamic control surfaces: flap, morphing wing devices.

1 2 Chapter 1

Introduction

All models are wrong, but some are useful.

George Box

Note: URLs may be outdated.

1.1 Objectives

1. formulate and solve the problem of constrained mechanical system dynamics (specialized to aerospace applications) 2. provide guidelines for the choice of the most appropriate method(s) for specific problems

1.2 Resources 1.2.1 Journals Journals dedicated to multibody system dynamics: • Multibody System Dynamics (Springer) https://www.springer.com/journal/11044 • ASME’s Journal of Computational and Nonlinear Dynamics https://asmedigitalcollection.asme.org/computationalnonlinear • Journal of Multi-Body Dynamics (SAGE) https://journals.sagepub.com/home/pik Other journals dedicated to computational mechanics and mechanics in general publish several papers related to multibody system dynamics; to mention a few: • Computational Mechanics • Nonlinear Dynamics

1.2.2 Organizations • ASME (American Society of Mechanical Engineers) https://www.asme.org/ • ECCOMAS (European Community on Computational Methods in Applied Sciences) https://www.eccomas.org/

1-1 • IFToMM (International Federation for the Promotion of Mechanism and Machine Science) http://iftomm.net/

– IFToMM Multibody Technical Committee http://www.iftomm-multibody.org/

1.2.3 Events • ASME IDETC/CIE’s MSNDC – conference on Multibody Systems, Nonlinear Dynamics and Con- trol (every year, in USA/Canada)

• ECCOMAS Thematic Conference on Multibody Dynamics (odd years, in Europe) • IMSD – Joint International Conference on Multibody System Dynamics (even years, worldwide)

• ACMD – Asian Conference on Multibody Dynamics (even years, in Asia)

1.2.4 Free Software • MBDyn http://www.mbdyn.org/

• Chrono::Engine http://projectchrono.org/

1-2 Part I

Basics

1-3

Chapter 2

Kinematics of Mechanical Systems

In this Section we describe the kinematics of a point and of a rigid body in space, with some care on the description and parametrization of rotations. The objective is to develop the capability to describe position, velocity and acceleration in the absolute and relative frame, which are later needed to formulate configuration-dependent forces and kinematic constraints.

2.1 Kinematics of a Point in Space

2.1.1 Position The position of a point in space is defined by the position vector, p. For example, in Cartesian coordinates:

px p = p (2.1)  y   pz    2.1.2 Velocity The velocity is the time derivative of the position:

dx v = = x˙ (2.2) dt For example, in Cartesian coordinates:

vx p˙x v = v = p˙ (2.3)  y   y   vz   p˙z      2.1.3 Acceleration The acceleration is the time derivative of the velocity, or the second-time derivative of the position:

dv d2p a = = = x¨ (2.4) dt dt2 For example, in Cartesian coordinates:

ax v˙x p¨x a = a = v˙ = p¨ (2.5)  y   y   y   az   v˙z   p¨z 

      2-1 2.2 Rigid-Body Kinematics in Space

The kinematics of a rigid body in space is defined by the position of an arbitrary point that belongs to the rigid body and the orientation of the rigid body. The kinematics of a point has been described in the previous section. The orientation can be described in several manners, which essentially differ in the way the orientation is parameterized. Unconventional descriptions radically depart from the above sketched description. They correspond to the so-called rotation-less kinematics formulations, based on so-called natural kinematics, which describe the orientation in terms of the position of independent points that belong to the rigid body, subjected to the appropriate rigid-body constraints.

2.2.1 Orientation The notion of orientation is strictly related to a change of reference system. Consider a local reference system, consisting of a triad1 that is rigidly connected to a rigid body. The orientation of that local reference system with respect to an absolute reference system can be described in several manners. Its main operation, from which the most important properties stem (its purpose, we could say), is to transform a vector b from the local to the absolute reference system. Let b˜ (vector b with a tilde on top) denote a vector in the local reference system; let b denote its representation in the absolute reference system. The vector’s components can be obtained by: • making the origin of the vector coincide with the origin of the triad that describes the reference system • projecting the vector along each axis of the triad. The operation can be repeated for both the local and the absolute reference systems, yielding

˜bx ˜ b = ˜by (2.6)  ˜   bz  and  

bx b = b (2.7)  y   bz  respectively.  Obviously the two representations refer to the very same vector; in fact, the norm of the vector (its length) does not depend on the choice of the reference frame:

1/2 T 2 2 2 kbk = b b = bx + by + bz

 T 1/2 q ˜ ˜ ˜ ˜2 ˜2 ˜2 = b = b b = bx + by + bz (2.8)   q

The orientation of the local frame can be described by its orientation matrix, R, namely the matrix of the director cosines of each unit vector of the triad2.

Homework 2.1 (Determinant of orientation matrix). Show that the norm of the determinant of an orientation matrix must be equal to 1.

1A triad of unit vectors that are mutually orthogonal and numbered according to the so-called right-hand rule. 2Matrix R is said to belong to the Special Orthogonal group 3, SO(3), i.e. to the set of 3 3 orthogonal matrices with positive determinant, det(R) +1. × ≡

2-2 The representation of vector b˜ in the absolute frame is thus

b = Rb˜ (2.9) which states that matrix R transforms vector b˜, expressed in the local reference frame, into its represen- tation in the absolute frame, b.

From Eq. (2.9), one may interpret the orientation matrix, R, as a matrix whose columns represent the directions of the coordinate axes of the local reference frame expressed with respect to the absolute reference frame. In fact, consider each of the coordinate axes in the local reference frame,

1 0 0 e˜ = 0 e˜ = 1 e˜ = 0 (2.10) 1   2   3    0   0   1  They transform in the absolute reference frame  as  

eˆ1 = Re˜1 = R(:, 1) eˆ2 = Re˜2 = R(:, 2) eˆ3 = Re˜3 = R(:, 3) (2.11)

Consider now the previously mentioned property of norm conservation:

1/2 T 1/2 kbk = bT b = b˜ RT Rb˜ (2.12)     For Eq. (2.8) to be intrinsically complied with, the property

RT R = I (2.13)

must hold. This property implies that the columns of matrix R are mutually orthogonal, and of unit length. Thus, we can state that the definition of orientation triad stems from the need to guarantee the property of invariance of the norm of a vector with respect to a change of reference frame. Matrix R ∈ R3×3 is characterized by 9 elements; the orthonormality condition introduces 6 con- straints; thus, only 3 parameters are needed to completely describe the matrix. The latter statement, however, suffers from a shortcoming: there is no way to tell the difference between two orientation matrices that differ by an arbitrary number of rotations of amplitude 2π about an arbitrary axis.

Consider now the inverse of Eq. (2.9), namely

b˜ = R−1b (2.14)

Again, the invariance of the norm of the vector similarly yields

T 1/2 1/2 b˜ = b˜ b˜ = bT R−T R−1b (2.15)     −1 But post-multiplication of Eq. (2.13) by R yields

RT = R−1 (2.16)

i.e. the transpose of the orientation matrix corresponds to its inverse. This fundamental property, along with the invariance of the norm, yields that also

RRT = I (2.17)

the other form of the orthonormality condition.

2-3 2.2.2 Parametrization of Rotations We have introduced the notion of orientation (or rotation) matrix, R, as the entity that operationally describes rotations, and some of its properties. However, for practical purposes, we need to introduce some effective manner to describe the rotation matrix as a function of useful parameters. As already mentioned, the matrix consists of 9 elements which are not independent, but related by the orthogonality condition. One possible, although inefficient, manner to parametrize rotations is to consider all 9 elements of the rotation matrix as parameters, subjected to explicit orthogonality conditions in form of algebraic constraint equations. Several other, more efficient parametrizations of rotations are known. We will only list and describe some; the interested reader is referred, for instance, to [3]. The basic operation in rotation parametrization is the computation of the orientation matrix R as a function of the rotation parameters. This operation is always possible. The inverse operation, i.e. extracting the rotation parameters from an orientation matrix may not be always possible, or may be subjected to indetermination, as discussed later. The choice of rotation parameters is often a trade-off between efficiency and effectiveness in describing the desired rotation. A common feature is that 3 parameter parametrizations can be extremely efficient, but intrinsically suffer from an indetermination: rotations in excess of some multiple of π are described by the very same set of parameter values. As a consequence, they are impractical to track and define arbitrarily large changes of orientations. Such limitation is an intrinsic characteristic of the orientation matrix; in fact, it is impossible to distinguish the orientation matrix resulting from a rotation of an angle θ from the one resulting from a rotation of an angle θ + 2nπ, n ∈ Z. At least 4 parameters are needed to uniquely identify a change of orientation. However, 4 parameter parametrizations introduce an algebraic constraint equation that must be dealt with in the solution process, much like other kinds of kinematic constraints that will be discussed later. Alternatively, considering that, in the numerical integration of mechanical problems, orientation changes between the solution at adjacent integration steps must be limited because of accuracy require- ments, incremental formulations based on 3 parameter parametrizations can be used. In such cases, the reference orientation is accumulated in the orientation matrix, and the parametrization only affects the increment of rotation.

Appendix A describes in detail some types of rotation parametrizations; Section A.1 specifically addresses the parametrization of the rotation matrix.

2.2.3 Rotation Differentiation The differentiation of rotations has several uses. It is used in the computation of:

• angular velocity, namely the time derivative of the orientation, or how orientations change in time;

• curvature, namely the space derivative of the orientation (we will see it for example in beams), or how orientations change in space;

• virtual rotation, namely the virtual perturbation of the orientation, or how an orientation changes in a virtual work sense.

What characterizes the differentiation of rotations is that it naturally applies to the orientation matrix. This can be clearly seen by computing the derivative of a vector, b˜, that is constant in a local reference frame, when the local reference frame is subjected to an arbitrarily varying angular motion, namely

db =d Rb˜ =dRb˜ + R d b˜ (2.18)   Considering now Eqs. (2.14) and (2.16), one obtains

db =dRRT b (2.19)

2-4 But if one considers the differential of Eq. (2.17), it yields dRRT + RdRT = 0 (2.20) or T dRRT = −RdRT = − dRRT (2.21)   which indicates that matrix dRRT is skew-symmetric. As such, it can be represented as3 T dRR = rd × (2.22) namely as the matrix resulting from the application of the cross-product operator to a three-dimensional 3 vector rd ∈ R :

0 −rz ry r × = r 0 −r (2.23) d  z x  −ry rx 0   One can also see Eq. (2.22) in terms of derivative of the orientation matrix, namely

dR = rd × R (2.24) which yields a practical rule for the differentiation of expressions that contain the orientation matrix.

Noteworthy vector operation properties.

1. Scalar (or inner) product: a · b = b · a (or aT b = bT a) (2.25)

2. Vector product: a × b = −b × a (or a × T = −a × ) (2.26)

3. Associativity: a × b × c = a × (b × c) (i.e.right-to-left) (2.27)

4. a · (b × c)= −c · (b × a) (2.28)

5. a × b × c = b (a · c) − (b · a) c (or a × b × = baT − bT aI) (2.29)

6. 0 = a × b × c + b × c × a + c × a × b (2.30)

7. (a × b) × c = a × b × c − b × a × c (or (a × b) × = a × b × − b × a × = b (a · c) − a (b · c) = baT − abT (2.31)

Homework 2.2 (Vector operation properties). Prove the proposed vector operation properties.

3 The notation rd is used instead of dr to mark the fact that rd is the vector that describes the differential of matrix R, i.e. dR, rather than a differential vector itself. The difference is subtle but important, as will be shown later when discussing the differentiation of rotations with respect to rotation parametrizations.

2-5 Transform vector rd back in the local reference frame:

T r˜d = R rd (2.32)

Its cross-product yields

T T T r˜d × = R rd × = R rd × R = R R˙ (2.33)   T T where the property R rd × = R rd × R stems from the property of reference frame transformation of second-order tensors, which can be easily proved.

Homework 2.3 (Second-order tensor transformation – 1). Prove that b˜× = RT b × = RT b×R.   Homework 2.4 (Second-order tensor transformation – 2). Prove that b × = Rb˜ × = Rb˜ × RT .  

Angular Velocity. When the differentiation is with respect to time, vector rd/dt assumes the meaning of angular velocity, ω, i.e. the rate of change of orientation about an axis aligned as rd and with the magnitude of krd/dtk. Back to the initial problem, the time derivative of vector b (its “velocity”) is thus

b˙ = ω × b

0 −ωz ωy bx ωybz − ωzby = ω 0 −ω b = ω b − ω b (2.34)  z x   y   z x x z  −ωy ωx 0  bz   ωxby − ωybx        Curvature. When the differentiation is with respect to space, e.g. along one coordinate ξ, vector rd/dξ assumes the meaning of curvature, ρ, i.e. the rate of change of orientation about an axis aligned as rd and with the magnitude of krd/dξk.

Virtual Rotation. When the differentiation is associated with a virtual perturbation, vector rd as- 4 sumes the meaning of virtual rotation , θδ, i.e. a virtual change of orientation about an axis aligned as rd and with the magnitude of krdk. Back to the initial problem, the virtual perturbation of vector b is thus

δb = θδ × b (2.35)

Homework 2.5 (Virtual perturbation of rotating vector). Compute δb.

Homework 2.6 (Velocity of point on rigid body). Consider a rigid body, whose motion is described by the position of point O, pO, and the orientation RO. Write the velocity of a point P, whose position relative to point O in the reference frame of the rigid body is o˜P, and thus its absolute position is pP = pO + ROo˜P.

4 The notation ( )δ instead of δ( ) is used to distinguish the virtual rotation from the virtual perturbation of the rotation parameters. The latter,· which is a· well-defined and perfectly legitimate quantity that will be used when appropriate, has an entirely different meaning that will be clarified later. The virtual rotation, which is energetically conjugated with the moment, results from the virtual perturbation of the orientation matrix as illustrated here.

2-6 2.2.4 Parametrization of Angular Velocity The angular velocity ω, in the global reference frame, is the vector that produces the skew-symmetric matrix ω × = RR˙ T . Consider an arbitrary rotation parametrization expressed by the parameter vector g, such that R = R(g). The angular velocity can be expressed as

ω = Gg˙ (2.36) i.e. a linear form in the time derivatives of the parameters, g˙ , where matrix G = G(g).

Section A.2 of Appendix A presents the differentiation of rotations in association with the previously mentioned types of rotation parametrizations.

2.2.5 Parametrization of Other Rotation Derivatives Similar considerations apply to other derivatives of the rotation. For example, a gradient in space is parametrized as

ρ = Gg/ξ (2.37)

whereas a virtual rotation is parametrized as

θδ = Gδg (2.38)

This expression represents the relationship between a virtual rotation and the virtual perturbation of the rotation parameters. When the rotation is “small” enough (e.g. infinitesimal), i.e. for g ≈ 0, then G ≈ I.

2.2.6 Angular Acceleration The angular acceleration is the time derivative of the angular velocity, namely ω˙ . The parametrization of the angular acceleration entails higher-order derivatives of the rotation pa- rameters, which can be rather involved. They are not presented here since they will seldom be used. The interested reader is directed to [4].

2.3 Relative Motion

Consider a rigid body motion, described by the motion pO of a reference point, O, and a rotation RO about point O. Consider then a point P, which moves with respect to O by the relative displacement o˜P (defined in the local reference frame, and not necessarily constant) and a triad with origin in P, that rotates by R˜ P−O relative to the rigid body. The absolute position of point P is the combination of the absolute position of point O, pO, and of the relative position of point P with respect to point O, o˜P, expressed in the absolute reference frame by means of its rotation by RO, namely

pP = pO + ROo˜P (2.39)

whereas the absolute orientation of the triad in P is obtained by right-multiplication of the relative orientation, R˜ P−O, by the orientation of the rigid body, RO, namely

RP = ROR˜ P−O (2.40)

The absolute velocity of point P is

˙ vP = p˙ O + ωO × oP + RO˜oP (2.41)

2-7 whereas the angular velocity of the triad in P, with respect to the absolute frame, is

ωP = ωO + ROω˜ P−O (2.42) The absolute acceleration of point P is ˙ ¨ aP = p¨O + ω˙ O × oP + ωO × ωO × oP + 2ωO × RO˜oP + RO˜oP (2.43) Euler Centrifugal Coriolis Relative whereas the angular| {z velocity} | of the{z triad in} P,| with{z respect} to| the{z absolute} frame, is

ω˙ P = ω˙ O + ωO × ROω˜ P−O + ROω˜˙ P−O (2.44)

2.4 Incremental Orientation Approach

The orientation R can be seen as the result of a rotation from orientation R0 to R by way of the relative rotation R∆:

R = R∆R0 (2.45)

Only R∆ needs be parametrized for the purpose of solving the problem; the initial orientation R0 is accumulated throughout the solution process. After convergence, R0 is updated by post-multiplication by R∆:

R0 ::= R∆R0 (2.46) and the process is restarted. Differentiation: two approaches are possible:

1. the initial solution is considered fixed; as such, R˙ 0 ≡ 0; then ˙ ˙ ˙ R = R∆R0 + R∆ R0 (2.47) and ˙ T ˙ T T ˙ T RR = R∆R0R0 R∆ = R∆R∆ = ω∆ × ≡ ω × (2.48) or

ω = ω∆ (2.49) i.e. all the angular velocity is accounted for by the derivative of the incremental rotation; 2. the increment is considered as a perturbation of the initial solution; as such

R˙ = R˙ ∆R0 + R∆R˙ 0 (2.50) and ˙ T ˙ ˙ T T ˙ T ˙ T T T RR = R∆R0 + R∆R0 R0 R∆ = R∆R∆ + R∆R0R0 R∆ = ω∆ × + R∆ω0 × R∆ = ω ×   (2.51) or

ω = ω∆ + R∆ω0 (2.52) In this latter case, also the angular velocity needs be accumulated, i.e.

ω0 ::= ω∆ + R∆ω0 (2.53)

Similar considerations apply to the perturbation of the orientation and to other forms of derivatives. Both approaches present advantages and disadvantages.

2-8 Homework 2.7 (Rotation perturbation in incremental approach–1). Formulate the virtual rotation in the incremental orientation approach–1.

Homework 2.8 (Angular velocity perturbation in incremental approach–1). Formulate the virtual perturbation of the angular velocity in the incremental orientation approach–1.

Homework 2.9 (Rotation perturbation in incremental approach–2). Formulate the virtual rotation in the incremental orientation approach–2.

Homework 2.10 (Angular velocity perturbation in incremental approach–2). Formulate the virtual perturbation of the angular velocity in the incremental orientation approach–2.

2.4.1 Updated-Updated Orientation Approach TODO (move to appendix?)

2-9 2-10 Chapter 3

Dynamics of Mechanical Systems

If I have seen further it is by standing on the shoulders of Giants.

Isaac Newton

Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things.

Isaac Newton

The general term“dynamics”is here mainly used to indicate the equations of motion of a mechanical system. Such equations express a balance of forces, moments, or generalized forces. It reduces to a sum of contributions of various nature (inertial, elastic, viscous, reactive, dead loads, aerodynamic, etc.). Many of these contributions may depend on the configuration (the “motion” of the system, described through the previously illustrated kinematics). Actually, the specific dependence of the loads on the kinematics is what characterize their nature. Generalizing a definition that typically applies to the stress- strain relationship in materials, and by extension to the force-displacement relationship of deformable components, we could describe the relationship between (generalized) forces and configuration as their constitutive property.

3.1 Dynamics of a Point Mass

The “modern”, albeit named “classical”, mechanics of the point mass is attributed to Sir Isaac Newton (Woolsthorpe-by-Colsterworth, December 25, 1642–London, March 20, 1726).

The notion of “point mass” should be somewhat intuitive, but a careful consideration is needed. One could interpret a point mass as a particle whose angular motion (rotation) is either absent (no rotation is present nor allowed) or inessential (rotation does not produce variation of momenta moment). Since the latter notion will be introduced and discussed later, for the sake of introducing the dynamics of a point mass let us assume for now that it is a body whose rotation is not allowed.

The dynamics equation, or equation of motion, of a point mass stems from Newton’s Principia1:

1Newton’s “Philosophiae Naturalis Principia Mathematica”, 1687 [5].

3-1 Figure 3.1: Sir Isaac Newton (Woolsthorpe-by-Colsterworth, December 25, 1642–London, March 20, 1726) [from Wikipedia].

LEX I. Corpus omne perseverare in statu suo quiescendi vel movendi uniformiter in directum, nisi quatenus illud a viribus impressis cogitur statum suum mutare.

LEX II. Mutationem motus proportionalem esse vi motrici impressæ, & fieri secundum lineam rectam qua vis illa imprimitur.

LEX III. Actioni contrariam semper & æqualem esse reactionem: sive corporum duorum actiones in se mutuo semper esse æquales & in partes contrarias dirigi.

Specifically, the second one, formulated in modern terms, states that the change of momentum (i.e. the time derivative of the momentum) of a point mass, of mass m, is equal to the sum of all the forces acting on it:

d(mv) = f (3.1) dt X The momentum mv is a vector, as well as the forces f are, whereas the mass m is a scalar. When the mass m does not change in time, this yields P dv m = f (3.2) dt X or

ma = f (3.3) X The acceleration a is a vector of magnitude proportional to the magnitude of the forces, | |, and inversely proportional to the mass m of the point, directed along the resultant of the forces f acting on the point. P P

3-2 Figure 3.2: Jean Baptiste le Rond d’Alembert (Paris 1717–Paris 1783) [from Wikipedia].

D’Alembert’s Principle. D’Alembert (Jean Baptiste le Rond d’Alembert, Paris 1717–Paris 1783) suggested that, by defining the inertia forces as

f ine = −ma (3.4)

one could formulate the dynamics of a point in the same manner of the statics, i.e. by stating that a point is at equilibrium when the summation of all forces acting on it is equal to zero, as long as the inertia forces, f ine were considered as well, namely

0 = f ine + f (3.5) X

Homework 3.1 (Equation of motion for point of variable mass). Write the equation of motion of a point mass whose mass varies in time.

3.2 Invariants

Some so-called invariants play an important role in the formulation of the dynamics of mechanical systems.

3.2.1 Kinetic Energy

One of the most important invariants is the kinetic (co-)energy, which we will indicate with Ek. Strictly speaking, the kinetic energy of a point mass is defined as half the square of the norm23 of its momentum, divided by the mass: 1 1 1 E = (mv)T (mv)= mvT v (3.6) k 2 m 2 T 2The inner product of a vector b is b b, which without ambiguity can also be expressed as b b. The norm of the vector T 2 is b = √b b, thus b b is a valid representation· of its square, b . k3Thek velocity,· v, and the momentum, mv, are vectors; pleasek dok not write v2, because the operation “power of a vector” 2 is not defined; use v v, or vT v, or v instead. · k k

3-3 when expressed as half the square of the norm of the velocity, multiplied by the mass, it should be called kinetic co-energy. Since when the momentum is expressed as a function of the velocity the two expressions are equivalent, the term kinetic energy is often used in both cases. The notion of kinetic energy also applies to rigid bodies, whose motion is described not only in terms of linear velocity, but also of angular velocity, in a manner that will be discussed later.

3.3 Dynamics of a Rigid Body

The dynamics of a rigid body includes the dynamics associated with rotations and moments. First of all, we need to introduce the notion of momentum, momenta moment, and mass distribution. Then we need to discuss the notion of equivalent quantities associated with the concept of rigid body. Finally, we need to generalize the notion of change of momentum to that of momenta moment.

3.3.1 Equilibrium of a Continuum When the motion does not correspond to a pure translation, i.e. all points of a body no longer have the same velocity at all instants of time, Newton’s equation of motion for a point mass is no longer valid when referred to the entire body. However, it remains valid for an infinitesimal volume of the body, i.e. it applies in (space) differential form:

d(dmv) = df (3.7) dt X where dm the infinitesimal portion of mass associated with the infinitesimal portion of volume of the body that is considered, which are related by the (local) density, dm = ρdV , whereas df are the infinitesimal forces acting on that volume4. Because of the interaction between adjacent infinitesimal volumes, those forces are mainly reactive, something that will be dealt with in a subsequent Section. What matters is that, along the line of d’Alembert’s intuition, we can define the infinitesimal inertia forces as

df ine = −dma (3.8) The overall inertia force of the entire body is thus

f ine = − ρa dV (3.9) ZV where a and ρ are evaluated at every point in the volume during the integration. The overall moment of inertia results from the integration over the entire domain of the moment with respect to a point O of the infinitesimal inertia force df ine, which is

mineO = (p − pO) × df ine = − ρ (p − pO) × a dV (3.10) ZV ZV

where pO is the position of point O, whereas p is the position of the generic point at which the acceleration a is evaluated during the volume integration.

3.3.2 Kinetic Energy of a Continuum Alternatively, one could consider the contribution of the infinitesimal mass dm to the kinetic energy of the body: 1 dE = dmvT v (3.11) k 2 4We can usually distinguish in df the forces per unit volume, φ, whose contribution is df = φdV , and the surface forces that act on the contour of the infinitesimal volume; however, within the scope of the present discussion, such distinction is moot.

3-4 Figure 3.3: Leonhard Euler (Basel, April 15, 1707–Saint Petersburg, September 18, 1783) [from Wikipedia].

The overall kinetic energy of the entire body is

1 E = dE = ρvT v dV (3.12) k k 2 ZV ZV 3.3.3 Rigidity Constraint The overall inertia forces and moments, as well as the overall kinetic energy of the body, result from an integration over the volume of the body which is formally well-defined but practically of little use, since to be performed it requires the knowledge of the kinematic field inside the body: velocity, acceleration, etc. Since all bodies are deformable, their kinematic field depends on the solution of the dynamical problem, resulting in a chicken-and-egg problem, that of continuum mechanics. In the case under consideration, however, we introduce an important assumption, that of rigidity of the body. Such assumption qualifies as an idealization, a simplification, and an approximation

• idealization: we idealize the notion that when a body is subjected to large motion but small defor- mation, the overall motion may dominate the dynamic loads the body is subjected to, depending on the rapidity of that motion5;

• simplification: it makes the problem much simpler to deal with;

• approximation: it neglects relevant aspects of the actual behavior of the system under evaluation; as such, to be acceptable it must be justifiable and quantifiable.

Should the above considerations be acceptable, introducing the rigidity constraint assumption greatly simplifies the problem, because the motion of every point of the body can be described as that of a reference point, pO, and of a reference triad, RO:

p = pO + ROo˜O (3.13a)

v = vO + ω × ROo˜O (3.13b)

a = aO + ω˙ × ROo˜O + ω × ω × ROo˜O (3.13c)

The motion of a rigid body that is no longer a pure translation, or whose extension can no longer be neglected, belong to a model that is attributed to Leonhard Euler (Basel, April 15, 1707–Saint Petersburg, September 18, 1783), in his 1756 treatise “Theoria Motus Corporum Solidorum seu Rigidorum” [6].

5The overall motion must be “slow” enough to produce negligible excitation of the internal dynamics of the body.

3-5 3.3.4 Inertia Forces of a Rigid Body The inertia forces are

f ine = − ρa dV ZV = − ρ (aO + ω˙ × ROo˜O + ω × ω × ROo˜O) dV ZV = − ρaO dV − ρω˙ × ROo˜O dV − ρω × ω × ROo˜O dV ZV ZV ZV = − ρ dV aO − ω˙ × RO ρo˜O dV − ω × ω × RO ρo˜O dV (3.14) ZV ZV ZV

m s˜ O s˜ O where the total| mass,{z }m, and the static| moment{z } with respect to point| {z O, s˜O}, have been highlighted:

m = ρ dV (3.15a) ZV s˜O = ρo˜O dV (3.15b) ZV Their moment with respect to point O is

mineO = − ρ (p − pO) × a dV ZV = − ρ (ROo˜O) × (aO + ω˙ × ROo˜O + ω × ω × ROo˜O) dV ZV = − ρ (ROo˜O) × aO dV − ρ (ROo˜O) × ω˙ × ROo˜O dV − ρ (ROo˜O) × ω × ω × ROo˜O dV ZV ZV ZV T T = aO × RO ρo˜O dV − ρ (ROo˜O) × (ROo˜O) × ω˙ dV − ρω × (ROo˜O) × (ROo˜O) × ω dV ZV ZV ZV

s˜ O | {z } T T T T T T = aO × ROs˜O − ρ ROo˜O × RO ROo˜O × RO ω˙ dV − ρω × ROo˜O × RO ROo˜O × RO ω dV V V Z    Z    T T T T = − (ROs˜O) × aO − RO ρo˜O × o˜O × dV ROω˙ − ω × RO ρo˜O × o˜O × dV ROω (3.16) ZV ZV

J˜O J˜O where pO is the position of point| O, whereas{z p is the position} of the generic| point{z at which the} acceleration a is evaluated during the volume integration. The inertia tensor with respect to point O, J˜O, has been highlighted:

T J˜O = ρo˜O × o˜O × dV (3.17) ZV The definitions of the inertia forces and moments with the rigidity constraint enforced thus reduce to

f ine = −maO − ω˙ × ROs˜O −ω × ω × ROs˜O (3.18a)

sO sO ˜ T ˜ T mineO = − (ROs˜O) ×aO| −{zR}OJORO ω˙ −| ω{z×}ROJORO ω (3.18b)

sO JO JO or | {z } | {z } | {z }

f ine = −maO − ω˙ × sO − ω × ω × sO (3.19a)

mineO = −sO × aO − JOω˙ − ω × JOω (3.19b)

3-6 where the static moment and the inertia moment have been transformed in the orientation of the absolute reference frame, and thus are no longer constant; they rather depend on the orientation of the body, RO, according to

sO = ROs˜O (3.20a) ˜ T JO = ROJORO (3.20b)

It is said that the inertia forces (and moments), which by definition are distributed loads, since they depend on the local presence of mass and acceleration, when the body is rigid become equivalent to lumped forces defined in terms of the overall inertia properties of the body (the mass m, and the static and inertia moment referred to an arbitrarily chosen point O, s˜O and J˜O), and on the corresponding rigid-body motion, described by its rotation and by the displacement of point O.

Such equivalence means that distributed inertia forces can be replaced by their lumped equivalents for the sole purpose of writing the overall dynamics of the rigid body.

Inertia distribution must be considered when evaluating, for example, internal forces.

The definition of the static moment can be exploited to leverage an important property of the mass distribution of rigid bodies: the reference point O can be chosen in such a manner that makes s˜O vanish. This choice corresponds to the definition of the so-called center of mass. In such case, the definitions of the inertia forces and moments become particularly expressive:

f ine = −macm (3.21a)

minecm = −Jcmω˙ − ω × Jcmω (3.21b)

i.e. the inertia forces of the rigid body only depend on the acceleration of its center of mass, and the inertia moments referred to the center of mass only depend on the angular velocity and acceleration (which are the same for all points of the body) by way of the inertia tensor referred to the center of mass.

Homework 3.2 (Center of mass). Starting from the definition of static moment with respect to a generic point O on the rigid body, define the position of the center of mass.

3.3.5 Equations of Motion of a Rigid Body The equations of motion of a rigid body are

macm = f (3.22a)

Jcmω˙ + ω × Jcmω = X mcm (3.22b) X where mcm are all the moments referred to the center of mass, including that of the forces in f.

Exercise 3.1 . (Dynamics of a bar — pure translation) Write ℓ y the equations of motion of a uniform, rigid bar of length ℓ and f mass m, subjected to a constant force f applied at one end, m x acting along the bar’s axis. At time t = 0 the bar stands still. ξ

The force acts along the axis of the bar, so its line of action passes through the bar’s center of mass, which is located at mid-span. Let’s assume, without loss of generality, that the bar is initially aligned

3-7 along global axis 1. The equations of motion yield

mx¨cm = f (3.23a)

Jcmω˙ + ω × Jcmω = 0 (3.23b) The moment of inertia with respect to the center of mass is

Jx 1  mℓ2  Jcm = 2 (3.24)  1 2   mℓ   2    Since at time t = 0 the angular velocity is zero, and there are no moments with respect to the center of mass, the angular acceleration is zero, and no rotation occurs. The equations of motion reduce to the scalar equation

mx¨ = f (3.25) along the axis of the bar. Since the force f is constant, the motion is f x˙ = t (3.26a) m f x = t2 (3.26b) m Exercise 3.2 (Internal forces in a bar — pure translation). Compute the internal forces in the bar of Exercise 3.1. The internal forces at the generic point ξ ∈ [0,ℓ] inside the bar result from the integration of the internal forces per unit span over a portion of the bar. Assuming that the force f is applied at ξ = 0 pointing towards the bar itself,

ξ m f ξ ξ Ψ(ξ) = Ψ(0)+ x¨ dη = −f + dη = − 1 f (3.27) ℓ ℓ ℓ Z0 Z0   i.e. the internal force is axial and compressive, varying linearly from −f for ξ = 0, where the force is applied, to zero in ξ = ℓ, namely at the unloaded end. Note that to formulate the equation of motion the mass was considered as lumped in the center of mass but, to evaluate the internal force, the actual mass distribution had to be taken into account.

Exercise 3.3 (Dynamics of a bar — rotation). Write the equa- f2 tions of motion of the uniform bar of length ℓ and mass m pre- ℓ y sented in Exercise 3.1, subjected to a pair of constant forces, f and f , each applied at one of the ends and acting along m 1 2 x a common direction that is normal to the axis of the bar, with ξ opposite sign. At time t = 0 the bar is not moving. f1 The forces acts normal to the axis of the bar, so their line of action does not pass through the bar’s center of mass. Let’s assume, without loss of generality, that the bar is initially aligned along global axis 1, and the forces initially act along axis 2. Let’s also assume that the forces remain orthogonal to the axis of the bar, i.e. their line of action rotates along with the bar. The equations of motion yield

mx¨cm = f i = 0 (3.28a) X Jcmω˙ + ω × Jcmω = bi × f i (3.28b) X

3-8 where bi are the arms of each force with respect to the center of mass. Now the sum of the forces, i f i, is exactly zero, so the acceleration of the center of mass is zero, x¨cm = 0. However, the moment of the forces is P ℓ ℓ ℓ ℓ b × f = e × f e + − e × f e = e × f e + − e × (−f ) e = ℓf e i i 2 1 1 2 2 1 2 2 2 1 1 2 2 1 1 2 1 3     X (3.29) since f2 = −f1 and e1 × e2 = e3. So the moment produced by the two forces has magnitude ℓf1 and acts about axis 3. The angular equation of motion is thus

Jx ω˙ 1 1 2  mℓ  ω˙ 2  2   1 2   ω˙ 3   mℓ   2      Jx 0 −ω3 ω2 ω1 0 1 2 + ω 0 −ω  mℓ  ω = 0 (3.30)  3 1  2  2    −ω2 ω1 0  1 2   ω3   ℓf1   mℓ     2        or

Jxω˙ 1 = 0 (3.31a)

1 2 1 2 mℓ ω˙ 2 − mℓ − Jx ω3ω1 = 0 (3.31b) 2 2 !

1 2 1 2 mℓ ω˙ 3 + mℓ − Jx ω1ω2 = ℓf1 (3.31c) 2 2 !

Since at time t = 0 the bar is still, the bar only accelerates about axis 3; as such, the equations of motion reduce to the scalar equation

1 mℓ2ω˙ = ℓf (3.32) 2 3 1 whose solution is 2f ω = 1 t (3.33a) 3 mℓ f θ = 1 t2 (3.33b) 3 mℓ where θ3 is the angle the body rotates about axis 3. Computing the angle in this manner is allowed since the rotation occurs about a fixed axis.

Homework 3.3 (Internal forces in a bar — rotation). Compute the internal forces in the bar of Exercise 3.3. (Hint: consider the shear force, the bending moment and the axial force that result from the inertia forces distributed along the bar.)

3-9 3.3.6 Kinetic Energy of a Rigid Body

The kinetic energy of the rigid body is

1 E = ρvT v dV k 2 ZV 1 = ρ (v + ω × R o˜ )T (v + ω × R o˜ ) dV 2 O O O O O O ZV 1 1 = ρvT v dV + ρvT (ω × R o˜ ) dV 2 O O 2 O O O ZV ZV 1 1 + ρ (ω × R o˜ )T v dV + ρ (ω × R o˜ )T (ω × R o˜ ) dV 2 O O O 2 O O O O ZV ZV 1 1 = ρ dV vT v + ρvT (R o˜ ) ×T ω dV 2 O O 2 O O O ZV ZV m 1 1 | +{z } ρωT (R o˜ ) × v dV + ρωT (R o˜ ) × (R o˜ ) ×T ω dV 2 O O O 2 O O O O ZV ZV

1 T 1 T   T 1 T   = mvOvO + vO RO ρo˜O dV × ω + ω RO ρo˜O dV × vO 2 2 V 2 V  Z   Z   ˜   ˜   sO   sO      1 T | {zT } T T | {z } + ρω ROo˜O × RO ROo˜O × RO ω dV 2 V Z    1 T 1 T T 1 T 1 T T T = mvOvO + vO (ROs˜O) × ω + ω (ROs˜O) ×vO + ω RO ρo˜O × o˜O× dV RO ω 2 2 2 2 V sO sO Z J˜O | {z } | {z } | J{zO } 1 1 1 1 = mvT v + vT s ×T ω + ωT s × v + ωT J ω | {z }(3.34) 2 O O 2 O O 2 O O 2 O

T T T It is worth noticing that vOsO × ω = ω sO × vO, thus

1 1 E = mvT v + vT s ×T ω + ωT J ω (3.35) k 2 O O O O 2 O

An alternative, systematic manner to compute the kinetic energy is here presented: express the velocity of the generic point by moving the kinematic variables of the rigid body on the right of the expression, namely

v = vO − (ROo˜O) × ω (3.36)

now collect the rigid body kinematic variables in a vector, and express the velocity of the arbitrary point as

v v = I (R o˜ ) × T O (3.37) O O ω     3-10 The kinetic energy of the rigid body can now be written as 1 E = ρvT v dV k 2 ZV T 1 v T v = ρ O I (R o˜ ) × T I (R o˜ ) × T O dV 2 ω O O O O ω ZV     T     1 vO I T vO = ρ I (ROo˜O) × dV 2 ω (ROo˜O) × ω   ZV     T  T  1 vO I (ROo˜O) × vO = ρ T dV 2 ω (ROo˜O) × (ROo˜O) × (ROo˜O) × ω   ZV     1 v T ρ dV I R ρo˜ dV × T v = O V O V O O 2 ω R ρo˜ dV × R ρo˜ × o˜ × T dV RT ω    O RV O O V RO O  O    T R  ρ dV IR ρo˜O dV × V V T  Z Z  T 1 vO RO 0 m s˜ RO 0 vO = O ω 0 R   0 R ω 2 O  o o o T  O      | ρ˜{zO d}V × |ρ˜O {z× ˜O }× dV       V V   Z Z   s˜ J˜   O O    | {z } | {z } (3.38) i.e., after defining the rigid body mass matrix oriented according to the rigid body triad (and thus constant) as mI s˜ ×T M˜ = O (3.39) rbO s˜ × J˜  O O  which transforms into the orientation of the absolute reference frame according to the rule

R 0 R 0 T M = O M˜ O rbO 0 R rbO 0 R  O   O  mR RT R s˜ ×T RT = O O O O O R s˜ × RT R J˜ RT  O O O O O O  mI s ×T = O (3.40) s × J  O O  the kinetic energy of the rigid body can be expressed as

1 v T v E = O M O (3.41) k 2 ω rbO ω     This approach provides a clear and systematic separation between the inertial characterization of the rigid body and the writing of its kinetic energy, an invariant that is of key importance in several formalisms for the formulation of the equations of motion of systems of rigid bodies.

Homework 3.4 (Kinetic energy of rigid body). Show that the kinetic energy in matrix form of Eq. (3.41) is equivalent to the form computed directly from the definition in Eq. (3.35).

When the center of mass is chosen as the reference point, the kinetic energy simplifies accordingly: 1 1 E = mvT v + ωT J ω (3.42) k 2 cm cm 2 cm

3-11 Homework 3.5 (Kinetic energy referred to the center of mass). Compute the transformation that brings the reference point in the center of mass, and use it to formulate the kinetic energy.

Homework 3.6 (Kinetic energy of a bar). Compute the kinetic energy of the bar of Exercises 3.1 and 3.3.

3.4 Dynamics of a System of Rigid Bodies

when considering a system of rigid bodies, one needs to write the equations of motion of each body, which may include the forces and moments they exchange. The exchange of forces and moments, according to the third of Newton’s principia, implies that any action (force or moment) body i exerts on body j, an analogous action, equal in magnitude but opposite in direction is exerted by body j on body i. Such actions are termed internal, in the sense that they act internally between members of the system. Each of the equations of motion of each single body can be replaced by a suitable linear combination of equations of motion of bodies, provided none of the resulting equation is a linear combination of the others. Combining the equations of motion of different bodies may be especially useful when in the resulting equation some internal forces vanish, either because they cancel or because their moment vanishes because of an appropriate choice of the reference point about which the moment is evaluated. However, in the following we are looking for systematic ways to generate the equations of motion of systems of bodies; as such, we will prefer formulations and algorithms that do not require, or limit as much as possible, the need to make choices or take decisions. Nonetheless, the knowledge of how equations can be formed and the ability in interpreting them can be of utmost importance in understanding how a model is conceived and in troubleshooting any inconvenient that may surface during code development, or model preparation and analysis.

3-12 Chapter 4

Analytical Mechanics

All the good music has already been written by people with wigs and stuff.

Frank Zappa

Lagrange (Joseph-Louis Lagrange, originally Giuseppe Luigi Lagrangia, Turin 1736–Paris 1813) coined the term analytical mechanics, the title of his seminal work on the topic (M´ecanique Analytique, 1788 [7]). Among his many contributions to classical mechanics, we recognize the Virtual Work Principle, with the rearrangement of the contribution of conservative forces stemming from the kinetic and potential energy collected in the Lagrangian function, and the Lagrange multipliers, a clever formalism that trans- forms constrained minimization problems in unconstraned ones with great elegance. These topics will be discussed in the following, along with contributions from other authors (among them Gauss, Appell, Jourdain) who devised alternative elegant ways to formalize the dynamics equations of constrained systems.

Figure 4.1: Joseph-Louis Lagrange, born Giuseppe Lodovico Lagrangia or Giuseppe Luigi Lagrangia or Lagrange (Turin, January 25, 1736 — Paris April 10, 1813) [from Wikipedia].

4-1 4.1 Virtual Work Principle

The virtual work of all forces acting on a system vanishes at equilibrium.

The virtual work principle (VWP) applies to dynamics when inertia forces are considered along with the other forces.

The virtual work is the work done by actual forces for an energetically conjugated virtual displace- ment.

Forces and virtual displacements are intended in a generalized sense, i.e. they include moments, which are energetically conjugated to virtual rotations.

A virtual displacement is

1. infinitesimal

2. compatible with the constraints

3. at fixed time

Consider a generic relationship between the generic position vector p and a set of independent coor- dinates q, namely p = p(q,t), which means that p depends on the coordinates q, and may optionally explicitly depend on the time, t. The time derivative of the position p yields the velocity, v, as

∂p ∂p v = p˙ = q˙ + = p q˙ + p (4.1) ∂q ∂t /q /t

The virtual perturbation of the position p yields the virtual displacement, δp, as

∂p δp = δq = p δq (4.2) ∂q /q

i.e. the virtual perturbation is analogous to the time derivative when no explicit dependence exists on time; otherwise, they differ in that the virtual displacement is considered at fixed time, i.e. any explicit dependence on time is not considered, since time is not an independent coordinate of the problem.

Virtual work of inertia forces:

T T δWine = δpcmf ine + θδ minecm T T = −δpcmmacm − θδ (Jcmω˙ + ω × Jcmω) (4.3)

4.2 Lagrange Equations of the Second Kind

Assume that both the kinetic and the potential energy of a system are known as functions of a set of generalized coordinates, q. The kinetic energy also depends on the time derivative of the coordinates. Define the Lagrangian function L as the difference between the kinetic and the potential energy of a system, namely

L(q, q˙ ,t)= Ek(q, q˙ ,t) −Ep(q) (4.4)

4-2 Define the virtual work of the remaining non-conservative forces, T δWnc = δq Q/q (4.5) The equations of motion of the system are obtained as d ∂ ∂ L − L = Q (4.6) dt ∂q˙ ∂q /q   Such equations are pure, i.e. they do not contain reaction forces, under the assumption that all constraints are ideal (i.e. they do not do work) and, indeed, they are intrinsically complied with by the choice of the coordinates q. How the contribution of the inertia forces to the Lagrange equations of the second kind can be obtained for a rigid body from the Virtual Work Principle is illustrated in Appendix B.

4.3 Kinematic Constraints, Lagrange Multipliers, and Lagrange Equations of the First Kind

Lagrange equations of the first kind are a general way to formulate the problem of constrained dynamics, which will be the subject of a subsequent Chapter. They are anticipated here for completeness and to present the formalism of the Lagrange multipliers.

4.3.1 Holonomic Constraints Consider a set of kinematic constraints expressed as algebraic equations, φ(q,t)= 0 (4.7) The nature of the constraint equations is not relevant at the moment; some indications about how they can be formulated will be provided in detail in subsequent Sections, specifically in Section 6. Such constraints, in finite form, are called holonomic. A holonomic constraint is rheonomous if it explicitly depends on time, scleronomous otherwise.

Virtual Work Principle Consider the product of a set of algebraic unknowns, λ (the Lagrange multipliers), for the constraint equations, λ · φ. Subtract its virtual perturbation from the virtual work, δW, as δW′ = δW− δ (λ · φ) (4.8) When the constraint equations are complied with, i.e. when the solution is found, they vanish: φ = 0; as such, being them independently equal to zero, also their inner product by the Lagrange multipliers is zero, whatever the value of the multipliers: λ · φ = 0, as well as its virtual perturbation, ∂φ T δ (λ · φ)= δλT φ + δq λ = δλT φ + δqT φT λ (4.9) ∂q /q   where φ/q, the partial derivative of the constraint equations with respect to the coordinates, is the so-called Jacobian matrix of the constraints. For this reason, when δW′ = 0, also δW = 0. In general, the virtual work of an unconstrained system can be formulated as T 0= δW = δq Qˆ q (4.10) where Qˆ q are all the generalized forces energetically conjugated to the coordinates q (i.e. including the inertia and the conservative forces, namely those that in the Lagrange formulation would result from the kinetic and the potential energy); then the virtual work associated with the constrained system is ′ T ˆ T T T 0= δW = δq Qq − δλ φ − δq φ/qλ T ˆ T T = δq Qq − φ/qλ − δλ φ (4.11)   4-3 Each virtual perturbation is independent; as such, it generates a corresponding equation: ˆ T 0 = Qq − φ/qλ (4.12a) φ = 0 (4.12b) What results in Eqs. (4.12) is a system of Differential-Algebraic Equations (DAEs). In Eq. (4.12a), T the term −φ/qλ is added to the equations of motion of the unconstrained system. It represents the generalized reaction forces exerted by the constraints described by φ to guarantee their satisfaction.

Lagrange Equations of the First Kind The application of the Lagrange multipliers formalism to the Lagrange equations follows a similar path. Augment first the Lagrangian function, L, with the product of the constraint equations by the Lagrange multipliers, namely L′ = L− λ · φ (4.13) At this stage, one only needs to apply the Lagrange formalism to the augmented Lagrangian function, L′, considering the multipliers λ as generic coordinates, much like those in vector q: d ∂ ∂ L′ − L′ = Q (4.14a) dt ∂q˙ ∂q q   d ∂ ∂ L′ − L′ = 0 (4.14b) dt λ˙ ∂λ ∂  where Qq now only represent the non-conservative generalized forces energetically conjugated with the coordinates q, since the inertia and conservative contributions are already dealt with by the derivatives of the Lagrangian function. The resulting Lagrange equations of the first kind are

d ∂ ∂ T L − L + φ/qλ = Qq (4.15a) dt ∂q˙ ! ∂q φ = 0 (4.15b) What results in Eqs. (4.15) is again a system of DAEs, which is exactly equivalent to the one obtained in Eqs. (4.12).

4.3.2 Non-Holonomic Constraints When a constraint equation cannot be expressed in finite form, it is termed non-holonomic. In that case, it is usually formulated as Adq = β (4.16) where A and β may depend on q and on the time, t. In principle, non-holonomic constraints can be nonlinear in the differential of the coordinates, although their occurrence in usual mechanisms is not common. Often, non-holonomic constraints are presented in the form Aq˙ = b (4.17) This is how they are usually implemented in formulations for the solution of the constrained dynamics problem, since the derivative of the coordinates, q˙ , is available as unknown. However, it is important to stress that non-holonomic constraints are not the time derivative of holonomic constraints. Their for- mulation in the differential of the coordinates, dq is by definition not integrable. In the case of non-holonomic constraints, the Lagrange multiplier formalism requires the addition to the virtual work of a contribution of the form δW′ = δW− δλT (Aq˙ − b) − δqT AT λ (4.18)

4-4 The rightmost contribution stems from the fact that the virtual perturbation of the non-holonomic constraint equation, in differential form, is Aδq, and not δ(Aq˙ − b). Considering the virtual work of the active forces according to Eq. (4.10), the resulting non-holonomically constrained dynamics equations are

T 0 = Qˆ q − A λ (4.19a) Aq˙ = b (4.19b)

The same approach can be used to introduce non-holonomic constraints in the Lagrange formalism, resulting in the corresponding Lagrange equations of the first kind.

4.4 Gauss’ Principle

Johann Friedrich Carl Gauss (Braunschweig, 1777–G¨ottingen, 1855) formulated the principle of least constraint in his work “Ueber ein neues algemeines Grundgesetz der Mechanik” [8]. Consider a system of differential equations that describes the dynamics of a constrained mechanical system,

Mx¨ = f + f c (4.20) where M is the mass matrix, f are external loads and f c are (yet unknown) constraint forces, subjected to a set of constraints (either holonomic or non-holonomic), whose derivative up to the acceleration level can be expressed as

Ax¨ = b (4.21)

The acceleration produced by forces f that is compatible with the constraints minimizes the scalar function 1 G = (x¨ − a)T M (x¨ − a) (4.22) 2 where

a = M−1f (4.23)

is the acceleration that the system would have if there were no constraints.

Thee proof is in two parts.

I. Show that the minimization of G produces the expected equations of motion. Transform the constrained minimization of G with respect to x¨ into an unconstrained minimization using the Lagrange multipliers:

G′ = G + λT (Ax¨ − b) (4.24)

Minimize G′ with respect to x¨ and λ, the Lagrange multipliers: ∂G′ = M (x¨ − a)+ AT λ = 0 (4.25a) ∂x¨ ∂G′ = Ax¨ − b = 0 (4.25b) ∂λ T i.e. f c = −A λ.

II. Show that only the solution minimizes G. Compute x¨:

x¨ = a − M−1AT λ (4.26)

4-5 i.e. the acceleration is equal to that without constraints minus a correction caused by the reaction forces Replace the constrained acceleration in the constraint equation derivative Aa − AM−1AT λ = b (4.27) and compute the value of the Lagrange multipliers

−1 λ = AM−1AT (Aa − b) (4.28)   where matrix AM−1AT is invertible as long as the mass matrix is positive definite and the constraint Jacobian matrix, A, is full rank1. Replace the Lagrange multipliers in the expression of the constrained acceleration

−1 x¨ = a − M−1AT AM−1AT (Aa − b) (4.29)   Now replace the solution in G, along with an arbitrary perturbation y¨, with the only requirement of being compatible with the constraints, A (x¨ + y¨)= b, or Ay¨ = 0: 1 G = (x¨ + y¨ − a)T M (x¨ + y¨ − a) 2 1 −1 T −1 = −M−1AT AM−1AT (Aa − b)+ y¨ M −M−1AT AM−1AT (Aa − b)+ y¨ 2       −1 ✭✘✘✭✭ ✘−✘1  T −1 T ✭−1✭✘✭✘ −1 T −✘1 ✘T 1 (Aa − b) AM A ✭AM✭ MM A ✘AM✘✘ A (Aa − b) =  −1 ✘✘  2 −2(Aa − b)T AM−1AT A✘MM✘ −1y¨ + y¨TMy¨       ✘✘✘ −1 ✘✘−1 1 T −1 T T ✘−1✘T T = (Aa − b) AM A (Aa − b) − 2(Aa − b) ✘AM✘ A Ay¨ + y¨ My¨ 2 ✘✘✘   ✘✘    ✘ 0  1  −1 1  = (Aa − b)T AM−1AT (Aa − b)+ y¨T My¨ |{z} (4.30) 2 2   Since M > 0, any acceleration perturbation y¨ that is compatible with the constraints yields an increase of G, thus the solution of Eq. (4.29) is the only one that truly minimizes G.

It is worth noticing that only the second derivative of a holonomic constraint, or the first derivative of a non-holonomic one, is being enforced. Integrating the solution as is would incur into the risk of drifting off the constraint manifold. This topic will be discussed further in subsequent Sections.

The solution can be rearranged as

−1 −1 x¨ = I − M−1AT AM−1AT A a + M−1AT AM−1AT b (4.31)       P or | {z } −1 −1 x¨ = M−1 I − AT AM−1AT AM−1 f + M−1AT AM−1AT b (4.32)       PT i.e. the acceleration| a, in Eq. (4.31),{z or the force f} , in Eq. (4.32), are filtered by a projector that removes their contribution that would otherwise result in a violation of the constraint. 1Notice that if matrix A is not full rank, then the constraints are not independent; in this case, a Moore-Penrose pseudo-inversion can be used, which gives a minimum norm solution for the otherwise undetermined Lagrange multipliers, but the solution, in terms of acceleration, is unaffected.

4-6 Part II

Dynamics of Constrained Mechanical Systems

4-7

The solution of the constrained dynamics problem is addressed in this Part. In the previous Part, the formulation of the problem as a system of Differential-Algebraic Equations (DAEs) was recalled, based on directly writing the Equations of Motion (EoM), following Newton’s and Euler’s models, or on Lagrange’s Analytical Mechanics (AM), including the Virtual Work Principle (VWP). In most of the cases of engineering interest, the practical solution of our problem consists in finding the numerical values of the coordinates and of their time derivatives that satisfy the equations of motion (equilibrium) and, at the same time, comply with the kinematic constraints (compatibility). Two basic strategies can be used: in one case, the problem is reduced to an equivalent set of Ordi- nary Differential Equations (ODEs), by eliminating the constraints and reducing the coordinates to the minimal set of truly independent ones (Minimal Coordinate Set, MCS); in the other case, the problem is directly solved in DAE form (Redundant Coordinate Set, RCS). Actually, a third case, that of the Unconstrained Coordinate Set (UCS), is possible.

• MCS: reduction to ODEs may not be straightforward and, except from special cases (e.g. special topologies, or special choices of coordinates) might not be easy to implement in automatic manner. However, the problem can then be integrated using explicit numerical schemes, which can be very efficient, but with a caveat: algorithmic stability is not guaranteed, so the choice of the time step is constrained by stability- rather than accuracy-related considerations.

• RCS: integrating DAEs requires the use of numerical techniques with specific characteristics, namely unconditional stability and algorithmic dissipation, which can only be provided by im- plicit integration schemes. The choice of the time step can be solely dictated by accuracy-related considerations.

• UCS: this strategy consists in preserving the structure of the unconstrained problem, while enforc- ing the constraints in indirect manner. Formally, the problem is ODE; thus, explicit integration schemes may be used, with the same caveats indicated for the MCS strategy.

The essential characteristics of numerical integration schemes are briefly discussed in Chapter 5. How kinematic constraints can be formulated is presented in Chapter 6. The MCS approach is described in Chapter 7. The RCS one is presented in Chapter 8. Finally, the UCS one is presented in Chapter 9, building on top of the previous ones.

4-9 4-10 Chapter 5

Integration of Ordinary Differential Equations

Consider a system of Ordinary Differential Equations (ODEs), either in explicit form, y˙ = f (y,t) (5.1) or in implicit form, f (y˙ , y,t)= 0 (5.2)

1 along with a set of initial conditions, y(t0) = y0, i.e. a so-called initial value or Cauchy , problem. It solution consists of the time history of y, namely y(t), for t ≥ t0. Computing the solution is called integration. Apart from special, usually simple, cases, only a numerical solution can be obtained. Numerical solutions typically represent an approximation of the actual solution. They usually consist of an estimate of the value of y(t) at a discrete number of values of time, t1,...,tN , which is obtained using numerical methods. The characteristics of the numerical method, along with the characteristics of the problem, determine the quality of the solution. Several types of numerical methods have been proposed. We restrict our consideration to linear methods, indicating with this definition those methods that express the value of y that is to be computed as a linear combination of other values of y and its derivatives. They can be classified as • single step vs. multistep • implicit vs. explicit, • with or without intermediate evaluations of the problem. Important properties are • accuracy • algorithmic stability.

5.1 Numerical Methods 5.1.1 General Linear Multistep Methods The general form of a linear multistep method (LMM) is

yk = aiyk−i + h bj y˙ k−j (5.3) i=1,n j=0,n X X 1Named after Augustin-Louis Cauchy (Paris, 1789–Sceaux, 1857).

5-1 2 where h is the time step , whereas ai and bj are the specific coefficients of each method. They multiply the values of y and y˙ at the various time steps required by the method. It is worth noticing that in Eq. (5.3) the variable that is being integrated, y, is represented by a vector; in this manner, the method is directly formulated for the solution of a system of equations.

5.1.2 Single Step Methods The method of Eq. (5.3) reduces to single step when n = 1; in that case,

yk = a1yk−1 + h (b0y˙ 0 + b1y˙ 1) (5.4)

5.1.3 Implicit vs. Explicit Methods

When the solution yk at time tk depends on the value of the derivative of yk at time tk, namely y˙ k, the method is implicit. An implicit method requires b0 6= 0. Otherwise, when b0 ≡ 0, the method is explicit.

5.2 Accuracy

With accuracy we indicate the capability of a numerical integration scheme to integrate a polynomial of a given order. A method with accuracy n can exactly integrate polynomials up to the nth order. i In order to check the accuracy, one needs to define the solution as y(t)= i=0,n t , replace it in the integration scheme, evaluating y(t) and its derivatives at the values of t required by the method, and check the lowest power of t that remains after elimination. P The actual accuracy trend can be evaluated using the expression E(2h) n = lim log2 − 1 (5.5) h→0 E(h)   A practical means to visualize the accuracy trend is to plot the error vs. the time step on a logarithmic scale; the accuracy is indicated by the slope of the curve as h → 0.

Exercise 5.1 (Accuracy of two-step BDF). Check the accuracy of the two-step BDF method.

Consider the linear two-step method 4 1 2 y = y − y + h y˙ (5.6) k 3 k−1 3 k−2 3 k known as two-step BDF. Consider the polynomial

i y = cit (5.7) i=0,n X

with tk = 0, and thus

yk = c0 (5.8) i yk−1 = ci(−h) (5.9) i=0,n X i yk−2 = ci(−2h) (5.10) i=0,n X y˙ k = c1 (5.11)

2The formula can be generalized to the case of variable time step; here, for simplicity, it is held constant, since the focus is on the properties of the methods.

5-2 Replacing these expressions in the method’s formula yields 4 1 2 c = c (−h)i − c (−2h)i + h c (5.12) 0 3 i 3 i 3 1 i=0,n i=0,n X X i.e.

4 ✟✟ ✚c = ✚c −✟c✟h +✟c h2 − c h3 + c (−h)i 0 3  0 1 2 3 i  i=4,n X   1 ✟✟ ✟✟2 3 i 2 − ✚c −✟2c h +✟4c h − 8c h + c (−2h) + c h (5.13) 3  0 1 2 3 i  3 1 i=4,n X   or 4 c (−h)i 0= c h3 + i 4 − 2i (5.14) 3 3 3 i=4,n X  i.e. the lowest order residual is of order o(h2), which means that the two-step BDF method is second- order accurate.

5.3 Stability

Stability is a property of utmost importance. The term refers to the stability of the numerical process that estimates the solution. A method that is not algorithmically stable could result in a divergent solution when the physical problem that is being solved does not. There is no guarantee for the opposite case: a method that is algorithmically stable may provide a non-divergent solution when the physical problem is actually unstable. In the following, we only consider stability when the integration scheme is applied to linear problems; this is an important caveat, as some properties are no longer guaranteed when the method is applied to nonlinear problems (as our multibody dynamics problems often are). Stability may be conditional or unconditional. Conditional stability occurs when it is verified only for a range of time steps that extends from zero to a limit value. This is the case of explicit integration schemes. When stability is only conditional, the size of the time step is limited by stability consider- ations irrespective of any accuracy consideration, as algorithmic stability is mandatory for a successful integration. Implicit integration schemes, on the contrary, can have unconditional stability. When stability is unconditional, the size of the time step can be chosen according to accuracy considerations, as algorithmic stability is always guaranteed.

5.3.1 Linear Stability Linear stability is assessed by testing the method with the simplest possible linear problem, y˙ = λy (5.15)

3 λt with λ complex Its exact solution is y(t)=e y0. The combination of problem and method yields a discrete problem; for example, in the case of a linear multistep method,

yk = aiyk−i + h bj λyk−j (5.16) i=1,n j=0,n X X 3When λ = jω, i.e. it is purely immaginary, the problem corresponds to an undamped oscillator.

5-3 which can be rearranged as

(1 − hλb0) yk − (ai + hλbi) yk−i = 0 (5.17) i=1,n X The recursive solution of a homogeneous discrete equation is

k yk = ρyk−1 = ρ y0 (5.18) the exact solution being ρ ≡ eλh, so the difference equation yields

(1 − hλb ) ρk − (a + hλb ) ρk−i y = (1 − hλb ) ρn − (a + hλb ) ρn−i ρk−ny = 0  0 i i  0  0 i i  0 i=1,n i=1,n X X     (5.19)

Regardless of the initial conditions y0, the polynomial in ρ

n n−i (1 − hλb0) ρ − (ai + hλbi) ρ = 0 (5.20) i=1,n X governs the evolution of the numerical solution. Its coefficients depend on those of the method, ai and bi, on the characteristics of the problem, λ, and on the time step, h. The algorithmic stability of the problem may thus be associated with:

• intrinsic properties of the method (ai, bi);

• the stability of the problem (the real part of λ);

• the size of the time step (h):

Notice that the time step and the problem always appear as a product, hλ. In fact, what matters is the relative time scale between the evolution of the problem, whose time scale is T ≈ 1/|λ|, and the evolution of the numerical solution, whose time scale is determined by the size of the time step, h. Thus, we can interpret the term |hλ| as |hλ|≈ h/T , the ratio between the two time scales. We expect the numerical solution to be non-divergent when the physical problem is not unstable. Thus, for Re(λ) ≤ 0 we expect the spectral radius ρ, i.e. the root of the polynomial of Eq. (5.20) of largest modulus, to satisfy the requirement |ρ|≤ 1.

• Zero-stability: we have Zero-stability when the method, applied to a stable problem, is not divergent for h → 0. This means that stability (i.e. |ρ|≤ 1) must exist for an interval of time steps h that includes h = 0. Zero-stability formalizes the notion of conditional stability.

• A-stability: we have A-stability when the method, applied to a stable problem, is Zero-stable and not divergent irrespective of the value of h, namely |ρ|≤ 1 for |hλ| → +∞. A-stability formalizes the notion of unconditional stability.

• L-stability: we have L-stability when the method, applied to a stable problem, is A-stable and the norm of the spectral radius ρ tends to zero as |hλ| → ∞. The rationale is that the norm of the spectral radius must reduce and eventually tend to zero as the time step h grows enough for the method to be no longer able to yield an accurate solution.

5.3.2 Algorithmic Stability vs. Accuracy Now that we have introduced the definitions of stability reported above, it is time to make some consid- erations about the solution of our problem. We typically want to solve problems with multiple degrees of freedom, often resulting in rather different time scales. For simplicity, and only in order to make

5-4 some scaling considerations, consider for a moment the case of a simple, linear multi-degree-of-freedom problem,

Mu¨ + Ku = f (5.21) which, after solving the related generalized eigenproblem

2 MUDiag ωi = KU (5.22) and defining the coordinate transformation u = Uq, can be reformulated in spectral form as

2 T Diag {mi} q¨ + Diag miωi q = U f (5.23) The problem of Eq. (5.23) is equivalent to that of Eq. (5.21) when no model order reduction is performed, i.e. when matrix U contains all the eigenvectors of the original problem. Thus, numerically integrating Eq. (5.23) with respect to the new coordinate set q is theoretically equivalent to integrating Eq. (5.21) with respect to the original set of coordinates u. In general, the problem may contain rather different eigenfrequencies ωi: the ratio max(ωi)/ min(ωi) can be quite large4. However, when the problem is integrated numerically, a single time step, h, is used; thus, the values of hωi may be rather different. For some values of ωi, the value of the time step h might 5 even violate the Nyquist-Shannon theorem, which requires a minimum sampling frequency fs = 1/h of twice the maximum frequency in the signal, fmax = max(ωi)/(2π), thus fs ≥ 2fmax requires π h ≤ (5.24) max(ωi) If we want the maximum accuracy from our numerical integration, we need to select a time step that by far exceeds6 the Nyquist-Shannon requirement of Eq. (5.24). Recall that if a conditionally stable algorithm is used, analogous requirements on the maximum size of the time step might be dictated by algorithmic stability. However, when an unconditionally stable algorithm is used, stability is no longer a concern. So, it might be appropriate to reverse the question: since for a given choice of the time step h we are not meeting the Nyquist-Shannon requirement of Eq. (5.24) for all the characteristic frequencies of our problem above a given threshold, how can we neglect their contribution to the solution? What happens when we use a purely A-stable algorithm? Well, it happens that the contribution to the solution given by the “modes” for which the requirement is violated not only is meaningless, but it also pollutes the solution. If the norm of the spectral radius of the method is identically 1, those disturbances never vanish; actually, if the high-frequency modes are poorly damped, they may result in self-sustained oscillations whose period is exactly twice the time step. Actually, as a consequence of mild nonlinearities in the model, those non-physical, purely numerical oscillations might even diverge. In those cases, it might be desirable that the numerical method introduces some algorithmic dissipa- tion. However, it would be preferable that such algorithmic dissipation be selective: we want it to be minimal when hωi ≪ 1, where the solution can be accurate, and to be maximum when h ≥ π/ max(ωi). This is what happens with L-stable algorithms. L-stability represents a limit case, that of asymptotic spectral radius ρ∞ = lim|hλ|→∞ max(|ρ|) equal to 0. Between the upper limit of A-stability (|ρ| ≡ 1 ∀|hω|) and the lower limit of L-stability (ρ∞ ≡ 0) there is room for schemes with |ρ| ≤ 1 ∀|hω| and 0 ≤ ρ∞ < 1, which introduce some algorithmic dissipation for large values of |hλ| and, at the same time, provide accurate results for hω ≪ 1.

4 Apart from going to infinity when rigid-body modes are present, i.e. when min(ωi) 0. 5Harry Theodor Nyquist (Nilsby, 1889–Harlingen, 1976), and Claude Elwood Shannon≡ (Petoskey, 1916–Medford, 2001) defined the minimum frequency, called the Nyquist frequency, that is required to sample a signal without losing information. For a limited band signal, the minimum sampling frequency is twice the maximum frequency contained in the signal. 6In practical applications, most second-order accurate methods require at 20 samples per period for decent accuracy, and even 100 for high-quality results.

5-5 Yet another problem needs to be accounted for. So far, we only considered purely ODE problems; however, we observed in previous Sections that constrained dynamics problems may also involve DAEs. To some extent, the algebraic equations may be interpreted as equations with infinitely fast dynamics, thus making the use of selectively algorithmically dissipative methods mandatory. This topic will be further discussed in Chapter 8 when addressing the Redundant Coordinate Set approach.

5.3.3 First Dahlquist barrier

Germund Dahlquist (1925–2005) proved that a Zero-stable n-step method cannot be more than accurate than n + 1, for n odd, or than n + 2, for n even; moreover if the method is explicit, it cannot be more accurate than n. This is Dahlquist’s first barrier (1956).

5.3.4 Second Dahlquist barrier

Explicit multistep methods cannot be A-stable; only implicit ones can7; those that are, can only achieve order 2 accuracy. Among them, the A-stable method with the smallest residual error is the one named after Crank-Nicolson (or trapezoid rule), with a1 = 1 and b0 = b1 = 1/2:

h y = y + y˙ + y˙ (5.25) k k−1 2 k k−1  This is Dahlquist’s second barrier (1963).

Exercise 5.2 (Stability of Crank-Nicolson method). Evaluate the stability of the Crank-Nicolson method.

Apply the Crank-Nicolson method, Eq. (5.25), to the scalar linear problem of Eq. (5.15):

h y = y + (λy + λy ) (5.26) k k−1 2 k k−1 i.e.

hλ hλ 1 − yk = 1+ yk−1 (5.27) 2 ! 2 !

which yields

hλ 1+ ρ = 2 (5.28) hλ 1 − 2 Its norm is

4 4 2 2 2 2 hσ hω hσ hω hσ hω 1+ + − 2 + 2 + 2 v u 2 ! 2 ! 2 ! 2 ! 2 ! 2 ! |ρ| = u (5.29) t 2 2 hσ hω 1 − + 2 ! 2 !

7But not all are: being implicit is only a necessary condition for A-stability.

5-6 where λ = σ + jω has been used. When the problem is only stable, but not asymptotically, i.e. when σ ≡ 0, the spectral radius’ norm becomes

4 2 hω hω 1+ + 2 v u 2 ! 2 ! |ρ| = u = 1 (5.30) t 2 hω 1+ 2 !

i.e. the method is A-stable but provides no algorithmic dissipation.

Homework 5.1 (Linear stability of the Explicit Euler method). Evaluate the linear stability of the Explicit Euler method, yk = yk−1 + hy˙ k−1. Homework 5.2 (Linear stability of the Implicit Euler method). Evaluate the linear stability of the Implicit Euler method, yk = yk−1 + hy˙ k. Homework 5.3 (Linear stability of the two-step BDF method). Evaluate the linear stability of the two-step BDF method, presented in Example 5.1.

5.3.5 Useful Methods • Crank-Nicolson: this method is only of use when the highest possible accuracy is needed and the accuracy requirement can be satisfied for the fastest possible dynamics. According to what stated in Section 5.3.2, it cannot be used to integrate systems of DAEs, as is the case of constrained dynamics formulated according to the RCS approach.

• Two-step BDF: this method, briefly presented in Example 5.1, is second-order accurate and L- stable. As such, it can be used to integrate systems of DAEs. It provides a considerable amount of algorithmic dissipation, at the cost of reduced accuracy.

• Two-step method with tunable algorithmic dissipation: this method, presented in [9] in variable time step form, is a two-step, second-order accurate algorithm with tunable dissipation. Its is defined according to Eq. (5.3), with n = 2; the coefficients are

4(1 − ρ∞) a1 = (5.31a) 3 − ρ∞

a2 = 1 − a1 (5.31b) 2 b0 = (5.31c) (1 + ρ∞)(3 − ρ∞) a b = 2 − 2b − 1 (5.31d) 1 0 2 a b = b − 1 (5.31e) 2 0 2

with 0 ≤ ρ∞ ≤ 1. When ρ∞ = 0, it reduces to the two-step BDF method.

5.4 Intermediate Evaluations of the Problem

An important class of methods that, although formally being single step, go beyond Dahlquist barriers are called Runge-Kutta methods (named after Carl David Tolm´eRunge, Bremen 1856–G¨ottingen, 1927, and Martin Wilhelm Kutta, Pitschen, 1867– Furstenfeldbruck,¨ 1944).

5-7 They require intermediate evaluations of the problem; as such, they are also called multistage methods. The general form is

y y y k = k−1 + h bj ˙ k−1+cj (5.32) j=1,s X with

y f y ˙ k−1+ci = k−1+cj ,tk−1+cj for i ∈ [1,s] (5.33a) y y  y  k−1+ci = k−1 + h aij ˙ k−1+cj for i ∈ [1,s] (5.33b) j=1,s X

tk−1+ci = tk−1 + cih for i ∈ [1,s] (5.33c)

i.e. the solution at time tk is equal to the solution at time tk−1 plus a linear combination of the derivatives of y evaluated at intermediate steps, which in turn are a linear combination of themselves. Intermediate times are defined by the set of coefficients 0 ≤ ci ≤ 1. The coefficients are usually collected in the Butcher8 tableau,

c1 a11 a12 ... a1s c2 a21 a22 ... a2s ...... (5.34) cs as1 as2 ... ass b1 b2 ... bs

Runge-Kutta methods are explicit when aij = 0 for j ≥ i.

Example 5.1 (Trapezoid rule). Trapezoid rule:

0 0 0 1 1/2 1/2 (5.35) 1/2 1/2

This method is implicit (a22 6= 0).

t = tk−1+0: yk−1+0 = yk−1 (moot: the solution at tk−1 has already been computed) (5.36a) 1 1 h t = t : y = y + h y˙ + y˙ = y + y˙ + y˙ (5.36b) k−1+1 k−1+1 k−1 2 k−1+0 2 k−1+1 k−1 2 k−1 k   1 1  y = y + h f y ,t + f y ,t k k−1 2 k−1+0 k−1+0 2 k−1+1 k−1+1   1 1 h  = y + h f y ,t + f y + y˙ + y˙ ,t k−1 2 k−1 k−1 2 k−1 2 k−1 k k    h   = y + y˙ + y˙ (5.36c) k−1 2 k−1 k  The solution depends on dotyk. We already met this method in Eq. (5.25). Example 5.2 (Gauss-Lobatto method). Gauss-Lobatto method:

8John Charles Butcher (1933–)

5-8 1/2 1/2 0 1/2 1/2 0 (5.37) 1/2 1/2

This method is implicit (a11 6= 0). 1 t = t : y = y + h y˙ (5.38a) k−1+1/2 k−1+1/2 k−1 2 k−1+1/2 1 t = t : y = y + h y˙ (a repetition of the previous equation) k−1+1/2 k−1+1/2 k−1 2 k−1+1/2 (5.38b) 1 1 y = y + h f y ,t + f y ,t k k−1 2 k−1+1/2 k−1+1/2 2 k−1+1/2 k−1+1/2      = yk−1 + hf yk−1+1/2,tk−1+1/2  1  = y + hf y + h y˙ ,t (5.38c) k−1 k−1 2 k−1+1/2 k−1/2  

The solution depends on y˙ k−1+1/2. Note that this method is equivalent to the trapezoid rule if the value of the derivative at mid-span is defined as the average between the values at the beginning and the end of the time step.

Example 5.3 (Heun’s method). Heun’s method:

0 0 0 1 1 0 (5.39) 1/2 1/2

This method is explicit.

t = tk−1+0: yk−1+0 = yk−1 (moot: the solution at tk−1 has already been computed) (5.40a)

t = tk−1+1: yk−1+1 = yk−1 + hy˙ k−1+0 = yk−1 + hf yk−1,tk−1 (5.40b) 1 1 y = y + h f y ,t + f y  ,t k k−1 2 k−1+0 k−1+0 2 k−1+1 k−1+1   1 1  = y + h f y ,t + f y + hf y ,t ,t k−1 2 k−1 k−1 2 k−1 k−1 k−1 k     (5.40c)

The solution only depends on values of y at the previous step.

Also Runge-Kutta methods must be implicit to be unconditionally stable. Higher-order accuracy is possible along with A- and L-stability. For example, the Radau IIA method is third-order accurate and L-stable. Its Butcher tableau is 1/3 5/12 −1/12 1 3/4 1/4 (5.41) 3/4 1/4

For example, methods can be designed that are third-order accurate and show tunable algorithmic dissipation [10].

5-9 5.4.1 Stability To evaluate the (linear) stability properties of Runge-Kutta methods, we can follow the same approach used for the multi-step methods, i.e. apply the method to the simple problem of Eq. (5.15), which for Eq. (5.32) yields

yk = yk−1 + hbY˙ = yk−1 + hbλY (5.42)

where b is the row vector constructed using the coefficients bj of the method, Y˙ is the column vector con-

structed using the intermediate evaluations of the function at times tk−1+ci , namelyy ˙k−1+ci = λyk−1+ci from Eq. (5.33a). From Eq. (5.33b) one obtains

Y = cyk−1 + hAY˙ = cyk−1 + hAλY (5.43)

where A is the matrix obtained from the coefficients aij of the method and the column vector c contains ones. Collecting Y and solving for it, one obtains

−1 Y =(I − hλA) cyk−1 (5.44)

which, replaced in Eq. (5.42), after collecting yk−1 gives

−1 yk = I + hλb (I − hλA) c yk−1 = ρyk−1 (5.45) h i The properties of the spectral radius ρ can be analyzed as already discussed in Section 5.3.1.

Homework 5.4 (Stability of trapezoid rule as Runge-Kutta method). Evaluate the linear stability of the trapezoid rule of Example 5.1 formulated as a Runge-Kutta method.

Homework 5.5 (Stability of Radau IIA method). Evaluate the linear stability of the Radau IIA method of Eq. 5.41.

5.5 Integration of Problems in Second-Order Differential Form

Although not always desirable, one may want to numerically integrate problems formulated directly as systems of second-order differential equations, as is typical of structural dynamics, namely

Mq¨ + Cq˙ + Kq = f (5.46)

Several methods exist in the literature, which have been directly formulated to be used in problems written in the form of Eq. (5.46). Presenting them in detail is outside the scope of the present notes. However, some are briefly mentioned. TODO

5.6 Integration of Implicit and Nonlinear Problems

Most of the methods presented so far presume the capability to explicitly evaluate the derivative of the state, y˙ , as a function of the state itself, y, and of the time, t. Consider an implicit ODE problem in the form

f (y˙ , y,t)= 0 (5.47)

In this case, one needs to use a different approach.

5-10 5.6.1 Predictor-Corrector

The so-called predictor-corrector approach can be used to transform the integration of the implicit differential problem into the solution of a nonlinear algebraic one. First of all, the derivative of the state is predicted, i.e. extrapolated to time tk based on the solution at previous time steps, yielding y˙ (0), where the superscript (·)(i) refers to the ith iteration. Different strategies can be used. Then, the selected integration method is used to predict the state, y(0). At this stage, a nonlinear solution strategy is used to solve the implicit problem. In the following, the Newton-Raphson method is used.

5.6.2 Linear Multistep Methods

(0) After estimating the derivative of the state, y˙ k , the state is predicted using the general equation of the method,

(0) (0) yk = aiyk−i + hb0y˙ k + h biy˙ k−i (5.48) i=1,n i=1,n X X The problem of Eq. (5.47) is expanded in a first-order Taylor series with respect to the state and its derivative,

∂f ∂f f (y˙ , y ,t ) =∼ f y˙ (0), y(0),t + ∆y˙ + ∆y = 0 (5.49) k k k k k k ∂y˙ ∂y   The formula of the integration method is perturbed as well, yielding the perturbation of the state as a function of the perturbation of the state derivative

∆y = ∆ a y + h b y˙ = hb ∆y˙ (5.50) k  i k−i j k−j 0 k i=1,n j=0,n X X   where perturbation of the state and its derivative at previous time steps is zero because they are no longer unknown. The perturbation of the state is replaced in the Taylor expansion of the problem, which is set equal to zero, yielding

∂f ∂f + hb ∆y˙ = −f y˙ (0), y(0),t (5.51) ∂y˙ ∂y 0 k     The problem is now linear in the perturbation of the state derivative, ∆y˙ . As such, it results in the Newton-Raphson method for the solution of nonlinear equations. Assuming the Jacobian matrix is non-singular, it can be solved. The solution of the linear problem is used to update the prediction,

(i+1) (i) y˙ k = y˙ k + ∆y˙ (5.52a) (i+1) (i) yk = yk + hb0∆y˙ (5.52b)

The implicit function of Eq. (5.47) is evaluated and tested for convergence. If needed, the operation is repeated, i.e. the problem is linearized again with respect to the current tentative solution,

∂f ∂f + hb ∆y˙ = −f y˙ (i), y(i),t (5.53) ∂y˙ ∂y 0 k     and solved again until convergence is achieved.

5-11 5.6.3 Linear Multistage Methods The procedure is similar, but now the implicit problem needs to be solved at each intermediate time

tk−1+ci . If the method is explicit, a cascade of problems similar to that presented for the LMM needs to be solved. When the method is implicit, however, the solution must be simultaneously found for all intermediate times. The Taylor expansion at the generic ith intermediate time yields

(0) (0) ∂f ∂f f y˙ , y ,tk−1+c = f y˙ , y ,tk−1+c + ∆y˙ + ∆y (5.54) k−1+ci k−1+ci i k−1+ci k−1+ci i ∂y˙ ci ∂y ci    The perturbation of the state at the ith intermediate time yields

y y ∆ ci = h aij ∆ ˙ cj (5.55) j=1,s X thus Eq. (5.54) can be rewritten as

(0) (0) ∂f ∂f f y˙ , y ,tk−1+c = f y˙ , y ,tk−1+c + ∆y˙ + h aij ∆y˙ k−1+ci k−1+ci i k−1+ci k−1+ci i ∂y˙ ci ∂y  cj  j=1,s    X (0) (0) ∂f  ∂f  = f y˙ , y ,tk−1+c + δij + haij ∆y˙ k−1+ci k−1+ci i ∂y˙ ∂y cj j=1,s   X   (5.56)

where δij is Kronecker’s “delta” function, which is equal to 1 only for i ≡ j and zero otherwise. The problem becomes

∂f ∂f ∂f (0) (0) ˙ + ha11 ... ha1s y f y˙ k−1+c , yk−1+c ,tk−1+c1 ∂y ∂y ∂y ∆ ˙ c1 1 1  . . .  .   .   . .. .  .  = − .    ∂f ∂f ∂f   ∆y˙   (0) (0)  ha ... + ha cs f y˙ , y ,t  s1 ∂y ˙ ss ∂y  k−1+cs k−1+cs k−1+cs  ∂y         (5.57)   The size of the problem is s times the size of the original system. The increase in computational cost must be carefully considered, along with any advantages in terms of accuracy.

5-12 Chapter 6

Kinematic Constraints

This Chapter deals with the formulation of the algebraic equations, φ = 0 for the holonomic constraints and Aq˙ = b for the non-holonomic ones, that reduce the number of degrees of freedom of the problem by introducing kinematic constraints.

6.1 Lower Pairs and Complex Constraints

Kinematic constraints introduce algebraic relationships between the configurations of otherwise uncon- strained bodies. They represent an important means to idealize the relationships between parts of mechanisms by eliminating the relative motion that is not allowed by the connection. This abstraction can be very important when the detailed dynamics of the interaction between parts described by the constraints is negligible or does not otherwise dominate the problem, compared to the overall motion of the mechanism. When multibody problems are formulated in terms of Lagrange’s equations of the first kind, or any equivalent formulation, they result in a system of Differential-Algebraic Equations (DAE) of the form

T M (q) q¨ + φ/qλ = f (q, q˙ ,t) (6.1a) φ (q,t)= 0, (6.1b)

where vector q represents an array of generalized coordinates, vector φ represents an array of (ideal, holonomic) constraint equations between the coordinates, M(q) is the configuration dependent inertia matrix, vector λ represents an array of Lagrange multipliers that expresses the generalized constraint T reaction force f c = φ/qλ by way of the transpose of the constraint Jacobian matrix φ/q, and vector f(q, q˙ ,t) accounts for the remaining forces. For a review of how the equations of motion and the related constraint equations can be formulated, the interested reader can consult either the excellent work of Schiehlen [11], or the recent one by Bauchau and Laulusa [12]. Without any loss in generality, consider the case of a set of rigid bodies whose generalized coordinates correspond to the position and orientation of the bodies, regardless of what parametrization is considered for orientations. The constraint equations in vector φ are naturally formulated as functions of the relative position and orientation of the constrained bodies. Constraints can be arbitrarily complex, involving an arbitrary number of bodies. In many applications, formulating dedicated constraint equations for specific components may be an option; for example, an ideal homokinetic joint is discussed in [13]. This approach is useful when a dedicated joint formulation allows to reduce the number of equations, or to highlight peculiar aspects of the problem. However, a more general approach consists in formulating simple constraints, like lower kinematic pairs (discussed by Hartenberg and Denavit [14] and Angeles [15,16]), and building more complex con- straints by assembling mechanisms from multiple instances of those pairs. All lower pairs, as well as more complex although relatively basic constraints, like the universal joint1, can be formulated indepen- dently. Lower pairs, sketched in Figure 6.1, allow one to model the most common joints. According

1Also known as “Cardan joint”, or “Hooke’s joint” in the Anglo-Saxon literature, since after Gerolamo Cardano’s early

6-1 a)revolute b)prismatic c)screw

d) cylindrical f) planar e) spherical

Figure 6.1: Sketch of the lower kinematic pairs (adapted from [1]).

a e3 ea 2 eb B 3 a ea b 1 e2 a Bb b e1

b

ua

ub

B0

x0

Figure 6.2: Sketch of the geometry of a generic pair formulated according to Bauchau [2] (adapted from [1]). to Angeles [15], lower pairs couple two elements “via a wrapping action, and contact takes place along a surface.” Three of them, namely the revolute, screw and cylindrical pairs are associated to relative rotation of the links about a fixed axis; a fourth one, the planar pair, is associated to relative rotation of the links about an axis whose direction is fixed. The screw requires special care, since the relative rotation about the screw axis is not free, but rather related to the relative translation along the same axis by a constant ratio, the ‘pitch’ of the screw. Bauchau [2] recognizes that lower pairs between parts a and b, sketched in Figure 6.2, can be formu- p p lated in terms of two orthonormal bases Bp = ei , i = 1, 3, and two position vectors x = x0 + up, where p = a,b indicates the part. The relative displacement along axis i of part a, di, is defined by

a ei · (ua − ub) − di = 0, (6.2)

while the relative rotation about axis i of part a, θi, is implicitly defined by

a b a b (ek · ek)sin θi − (ej · ek)cos θi = 0, (6.3) where j,k indicate the other two directions orthogonal to i. Equation (6.3) assumes that the relative a b orientation between parts a and b is characterized at most by a rotation about axis ei ≡ ei .

description in 1557, Robert Hooke, probably in 1667, realized that the transmitted angular velocity was not uniform.

6-2 Equations (6.2) and (6.3) constrain or prescribe the relative translation and rotation when di and θi are respectively imposed. Otherwise, they become additional ‘slack’ variables that can be proficiently used to introduce specific forces and moments dependent on the relative motion (e.g. springs, actuators, and so on). In [2] Bauchau recognizes that complex joints can often be constructed by combining lower pairs; “...In many cases, however, joints with specialized kinematic conditions must be developed.” Increasingly popular approaches, which radically depart from what stated so far, deserve a mention. Those based on natural coordinates, or absolute coordinates, mainly originating from the works of Garc´ıa de Jal´on et al. [17,18], embed the formulation of pairs into the description of the topology of the problem. The kinematics of rigid bodies is defined in terms of the position of basic points. The very rigidity of the bodies is enforced by means of constraints between the coordinates of the basic points that belong to the same part. Coincidence of points belonging to different parts is achieved by actually sharing common points between the connected parts. Kinematic relationships are mainly enforced by means of constraints that either enforce constant distance between points, or constant area of triangles formed by sets of three points. For example, as discussed in [19] about constraining the end of a beam modeled using the Absolute Nodal Coordinate Formulation (ANCF) to a rigid body, lower pairs can be efficiently formulated in most cases, although, to the author’s knowledge, a general approach has not been proposed yet. The problem is addressed by many authors [20–23]. To reduce software duplication, and to allow specific joints to change morphology during the analysis, a simple and effective framework was formulated in [1], which accommodates for lower pairs and a broad family of more sophisticated constraints based on a simple and effective expression of the relative position and orientation between two bodies.

6.2 Operations with Constraint Equations

We need to manipulate the constraint equations in several manners. With reference to holonomic con- straints, φ = 0: • since they are usually nonlinear, we need to linearize them, to find a solution to the constrained dynamics problems,

φ + φ/q∆q = 0 (6.4)

• sometimes we need to consider the time derivative of the constraint equations, as in the case of some formulations, or for the so-called constraint stabilization, ˙ φ = φ/qq˙ + φ/t = 0 (6.5)

• their time derivatives need to be linearized as well,

˙ ˙ ˙ φ + ∆φ = φ + φ/q∆q˙ + φ/qq˙ + φ/t ∆q = 0 (6.6) /q   • we need to consider their virtual perturbation,

δφ = φ/qδq (6.7)

T T T T T to formulate the reaction forces, f c = φ/qλ from their virtual work, δq f c = δφ λ = δq φ/qλ. All these operations imply the computation of the so-called Jacobian matrix of the constraint equation,

A = φ/q (6.8) When dealing with non-holonomic constraints, Aq˙ = b, we similarly have: • linearization,

Aq˙ − b +∆(Aq˙ − b)= Aq˙ − b + A∆q˙ +(Aq˙ − b)/q ∆q = 0 (6.9)

6-3 • virtual perturbation,

Aδq = 0 (6.10)

In the following, we formulate the above reported differentiations of common constraints, while providing general indications for the definition of new constraints.

6.3 Position Constraints 6.3.1 Spherical Hinge A spherical hinge is a connection between two parts that only allows relative rotation between the parts. It is the lower pair of type“e”in Fig. 6.1. Its formulation can be cast as: two points, each belonging to one of the parts, must remain coincident. Each part is identified by a reference point, whose absolute position is pp, and by an orientation, Rp. Each point of constraint, xp, may be offset from the part’s reference point by an offset, o˜p, which is usually constant in the reference frame of the part. Thus, the position of the constraint point with respect to each part is

xa = pa + Rao˜a = pa + oa (6.11a)

xb = pb + Rbo˜b = pb + ob (6.11b)

The constraint equation requires the two positions, xa and xb, to be coincident all times, namely

φ = xb − xa = 0 (6.12)

According to Eq. (6.12), φ ∈ R3; as such, it eliminates 3 degrees of freedom.

Exercise 6.1 (Spherical hinge with no offsets). Formulate the constraint equation of a spherical hinge with no offsets.

0 = φ = pb − pa (6.13)

Exercise 6.2 (Derivative of spherical hinge with no offsets). Formulate the time derivative of the constraint equation of a spherical hinge with no offsets.

p˙ 0 = φ˙ = p˙ − p˙ = I −I b (6.14) b a p˙  a   

Exercise 6.3 (Linearization of spherical hinge with no offsets). Formulate the linearization of the constraint equation of a spherical hinge with no offsets.

∆p 0 = ∆φ = ∆p − ∆p = I −I b (6.15) b a ∆p  a   

6-4 Exercise 6.4 (Linearization of derivative of spherical hinge with no offsets). Formulate the lin- earization of the time derivative of the constraint equation of a spherical hinge with no offsets.

∆p˙ 0 = ∆φ˙ = ∆p˙ − ∆p˙ = I −I b (6.16) b a ∆p˙  a   

Exercise 6.5 (Virtual perturbation of spherical hinge with no offsets). Formulate the virtual per- turbation of the constraint equation of a spherical hinge with no offsets.

δp 0 = δφ = δp − δp = I −I b (6.17) b a δp  a   

Exercise 6.6 (Derivative of spherical hinge). Formulate the time derivative of the constraint equa- tion of a spherical hinge.

Consider the time derivative of Eq. (6.12):

0 = φ˙ = x˙ b − x˙ a

= p˙ b + ωb × ob − p˙ a − ωa × oa

p˙ b ω I −o × −I −o ×  b  (6.18) b a p˙  a     ωa     

Homework 6.1 (Linearization of spherical hinge). Formulate the linearization of the constraint equation of a spherical hinge.

Homework 6.2 (Linearization of derivative of spherical hinge). Formulate the linearization of the time derivative of the constraint equation of a spherical hinge.

Homework 6.3 (Virtual perturbation of spherical hinge). Formulate the virtual perturbation of the constraint equation of a spherical hinge.

Exercise 6.7 (Spherical hinge in relative frame). Formulate the spherical hinge in the relative frame of part a

T φ = Ra (xb − xa)= 0 (6.19)

Exercise 6.8 (Linearization of spherical hinge in relative frame). Formulate the linearization of the spherical hinge in the relative frame of part a.

6-5 T T 0 = ∆φ = ∆Ra (xb − xa)+ Ra (∆xb − ∆xa) T T T = Ra θa∆ × (xb − xa)+ Ra (∆pb + θb∆ × ob − ∆pa − θa∆ × oa) T = Ra [−θa∆ × (xb − xa) + ∆pb + θb∆ × ob − ∆pa − θa∆ × oa] T ✟ ✟ = Ra [∆pb + θb∆ × ob − ∆pa − θa∆ × (pb + ob − pa −✟oa +✟oa)]

∆pb θ = RT I −o × −I (p + o − p ) ×  b∆  (6.20) a b b b a ∆p  a     θa∆    It is worth noticing that as long as the constraint is complie d with, i.e. if xb = xa, then pb +ob −pa = T oa, and the same Jacobian matrix of Exercise 6.6 is obtained, pre-multiplied by Ra .

The constraint reactions resulting from the spherical hinge constraint are T f c = φ/qλ I −o ×T = b λ [formulated in the absolute reference frame]  −I   o ×T   a   I  −o ×T = b R λ˜ [formulated in part a’sreferenceframe] (6.21)  −I  a  o ×T   a    where λ˜ should be interpreted as the vector of the Lagrange multipliers that is naturally defined in the local reference frame, rather than a mere transformation of λ from the global to the local frame. That is, when the constraint is formulated in part a’s reference frame, the actual reaction unknowns are in vector λ˜, whereas then it is formulated in the absolute frame, the actual reaction unknowns are in vector λ. Of course, the two solutions are related by λ = Raλ˜.

Exercise 6.9 (Linearization of spherical hinge constraint reactions). Linearize the constraint reac- tions of the spherical hinge. Often, when solving the constrained dynamics problem, which is nonlinear, the equations of motion must be linearized. This is the case, for example, when implicit integration schemes need to be used. As a consequence, also the constraint reactions must be linearized. In the absolute frame: I 0 −o ×T −λ × ∆o ∆f = b ∆λ +  b  c  −I  0    o ×T   λ × ∆o   a  a  I   0    −o ×T −λ × θ × o = b ∆λ +  b∆ b   −I  0    o ×T   λ × θ × o   a  a∆ a  I   0 0   −o ×T −λ × o ×T 0 θ = b ∆λ + b b∆ (6.22)  −I   0 0  θ  a∆   o ×T   0 λ × o ×T   a   a     

6-6 In the local frame: I I 0 T T T ˜ −ob× ˜ −ob× ˜ −∆ob × Raλ ∆f c =   Ra∆λ +   ∆Raλ +   −I −I  0  T T  T   oa×   oa×   ∆o × R λ˜      a a      0 I I   T T − R λ˜ × ∆o −ob× ˜ −ob× ˜  a b  =   Ra∆λ +   θa∆ × Raλ + −I −I   0     o ×T   o ×T     ˜   a   a  Raλ × ∆oa          0  I I   T T − R λ˜ × θ × o −ob× ˜ −ob× ˜ T  a b∆ b  =   Ra∆λ +   Raλ × θa∆ + −I −I    0     o ×T   o ×T     ˜   a   a  Raλ × θa∆ × oa       ˜     − Raλ ×  0  I  T ˜  ˜ T −o ×T ob × Raλ ×  − Raλ × ob × θb∆  = b R ∆λ˜ + θ +  −I  a a∆  0   Raλ˜ ×      T      oa×    R λ˜ × o ×T θ    −o ×T R λ˜ ×  a a a∆    a a                − Raλ˜ × 0 I  T ˜ ˜ T  −o ×T ob × Raλ × − Raλ × ob× θ = b R ∆λ˜ + b∆  −I  a θ  Raλ˜ ×  0  a∆ T      oa×       T ˜  ˜ T     −oa × Raλ × + Raλ × oa× 0     ˜     − Raλ × 0 I  T ˜  ˜ T −o ×T ob × Raλ ×  − Raλ × ob × θb∆  = b R ∆λ˜ + θ +  −I  a a∆  0   Raλ˜ ×      T      oa×    R λ˜ × o ×T θ    −o ×T R λ˜ ×  a a a∆    a a                − Raλ˜ × 0 I  T ˜ ˜ T  −o ×T ob × Raλ × − Raλ × ob× θ = b R ∆λ˜ + b∆ (6.23)  −I  a θ  Raλ˜ ×  0  a∆ T      oa×       ˜  T     Raλ × oa × 0     h  i 

6.3.2 Inline Constraint

The inline constraint requires a point that belongs to a part to remain on a line that is connected to another part. Here we focus on the case in which the line is straight; the generalization to the case of a line with arbitrary shape in space is relatively straightforward.

Consider a straight line attached to part a at a point A, offset by o˜b from the part’s reference position, and oriented according to part a’s local axis 3. The case of arbitrary orientation can be easily obtained by re-orienting the axis accordingly.

6-7 Consider a part b, with a point B rigidly attached to it and offset by o˜b, which is required to stay on the line. Define the distance between points A and B as

d = pb + ob − (pa + oa) (6.24) Point B belongs to the line when its distance from the line, defined as the shortest straight path from B to the line, or as the component of d that is normal to the line that passes through B, vanishes. This results in two constraint equations,

T T e d e T φ = 1 = 1 d = e e d = 0 (6.25) eT d eT 1 2  2   2    There is a strong similarity between the spherical hinge and the inline joint, in that one obtains the spherical hinge by also constraining the relative displacement along local axis 3, by adding the equation T e3 d = 0.

Homework 6.4 (Inline constraint). Based on what developed for the spherical hinge constraint equations written in the local frame, formulate the time derivative, linearization, virtual perturbation, and reaction forces associated with the inline constraint.

Homework 6.5 (Inline constraint along arbitrarily curved line in space). How the inline joint could be formulated to prescribe the displacement along an arbitrarily curved line in space, for example known in parametric form, e.g. as the position vector p = p(ξ) defined as a function of a curvilinear abscissa ξ along the line?

6.3.3 Inplane Constraint The inplane constraint requires a point that belongs to a part to remain on a surface that is connected to another part. Here we focus on the case in which the surface is flat; the generalization to the case of a surface with arbitrary shape in space is relatively straightforward. Consider a flat surface attached to part a at a point A, offset by o˜b from the part’s reference position, and with the normal oriented according to part a’s local axis 3. The case of arbitrary orientation can be easily obtained by re-orienting the normal accordingly. Consider a part b, with a point B rigidly attached to it and offset by o˜b, which is required to stay on the surface. Define the distance between points A and B as

d = pb + ob − (pa + oa) (6.26) Point B belongs to the surface when its distance from the surface, defined as the shortest straight path from B to the surface, or as the component of d that is normal to the surface that passes through B, vanishes. This results in a single constraint equation,

T φ = e3 d = 0 (6.27) There is a strong similarity between the spherical hinge and the inplane joint, in that one obtains the spherical hinge by also constraining the relative displacement along local axes 1 and 2, by adding the T T equations e1 d = 0 and e2 d.

Homework 6.6 (Inplane constraint). Based on what developed for the spherical hinge constraint equations written in the local frame, formulate the time derivative, linearization, virtual perturbation, and reaction forces associated with the inplane constraint.

6-8 Homework 6.7 (Inplane constraint on arbitrarily curved surface in space). How the inplane joint could be formulated to prescribe the displacement on an arbitrarily curved surface in space, for ex- ample known in parametric form, e.g. as the position vector p = p(ξ,η) defined as a function of a pair of curvilinear abscissae ξ, η on the surface?

Homework 6.8 (Spherical hinge, inline and inplane constraints with prescribed displacement). Based on what developed for the spherical hinge constraint equations written in the local frame, formulate a constraint that prescribes some components of the relative displacement in the local frame, while allowing others.

6.3.4 Distance Constraint The distance constraint requires two points on two parts to maintain a prescribed distance, d. The distance can be calculated as the norm of the difference between the positions of the two points. Each part is identified by a reference point, whose absolute position is pp, and by an orientation, Rp. Each point of constraint, xp, may be offset from the part’s reference point by an offset, o˜p, which is usually constant in the reference frame of the part. Thus, the position of the constraint point with respect to each part is

xa = pa + Rao˜a = pa + oa (6.28a)

xb = pb + Rbo˜b = pb + ob (6.28b) and the distance is

d = kxb − xak (6.29) Let

d = xb − xa (6.30) Then d = dT d (6.31) The algebraicp equation that expresses the distance kinematic constraint is thus φ = d − α(t) = 0 (6.32) with φ ∈ R; as such, the distance constraint eliminates 1 degree of freedom.

Exercise 6.10 (Distance constraint with no offsets). Formulate the constraint equation of a distance constraint with no offsets.

d = pb − pa (6.33)

1/2 d = dT d = dT d (6.34)  

0= φ = d − α(t) (6.35)

6-9 Exercise 6.11 (Derivative of distance constraint with no offsets). Formulate the time derivative of the constraint equation of a distance constraint with no offsets.

0= φ˙ = d˙ − α˙ (6.36)

1 −1/2 d˙ = dT d 2✁dT d˙ 2✁  −1/2 T T = d d d (p˙ b − p˙ a) (6.37)   i.e.

0= φ˙ = d˙ − α˙ (t) −1/2 p˙ = dT d dT −dT b − α˙ (t) p˙ a      p˙  = nT −nT b − α˙ (t) (6.38) p˙  a    where n is the unit vector that results from the normalization of d.

Exercise 6.12 (Linearization of distance constraint with no offsets). Formulate the linearization of the constraint equation of a distance constraint with no offsets.

0 = ∆φ = ∆d (6.39)

1 −1/2 ∆d = dT d 2✁dT ∆d 2✁  −1/2 T T = d d d (∆pb − ∆pa) (6.40)   i.e.

0 = ∆φ = ∆d −1/2 ∆p = dT d dT −dT b ∆pa      ∆p  = nT −nT b (6.41) ∆p  a   

Homework 6.9 (Linearization of derivative of distance constraint with no offsets). Formulate the linearization of the time derivative of the constraint equation of a distance constraint with no offsets.

Homework 6.10 (Virtual perturbation of distance constraint with no offsets). Formulate the virtual perturbation of the constraint equation of a distance constraint with no offsets.

Exercise 6.13 (Derivative of distance constraint). Formulate the time derivative of the constraint equation of a distance constraint.

6-10 0= φ˙ = d˙ − α˙ (6.42)

1 −1/2 d˙ = dT d 2✁dT d˙ 2✁  −1/2 T T = d d d (p˙ b + ωb × ob − p˙ a − ωa × oa) (6.43)   i.e.

0= φ˙ = d˙ − α˙ (t)

p˙ b −1/2 ω = dT d dT −dT o × −dT dT o ×  b  − α˙ (t) b a p˙  a       ωa  p˙   b   ω = nT − (n × o )T −nT (n × o )T  b  − α˙ (t) (6.44) b a p˙  a  h i  ωa    where n is the unit vector that results from the normalization  of d.

T T Homework 6.11 (Property of vector cross-product). Show that n oa × ≡ (n × oa) . Homework 6.12 (Linearization of distance constraint). Formulate the linearization of the constraint equation of a distance constraint.

Homework 6.13 (Linearization of derivative of distance constraint). Formulate the linearization of the time derivative of the constraint equation of a distance constraint.

Homework 6.14 (Virtual perturbation of distance constraint). Formulate the virtual perturbation of the constraint equation of a distance constraint.

The constraint reactions resulting from the distance constraint are

n −n × o f = φT λ = b λ (6.45) c /q  −n   n × o   a   

Homework 6.15 (Linearization of distance constraint reactions). Linearize the constraint reactions of the distance constraint.

6.4 Orientation Constraints 6.4.1 Parallelism and Orthogonality The parallelism constraint requires two parts to have the same relative orientation; a variant requires their relative orientation to differ by a constant rotation. It corresponds to the lower pair of type “b” (prismatic) in Fig. 6.1, when relative displacement between the parts is only allowed along one axis.

6-11 Consider two parts, whose absolute orientation is described by matrices Rp, with p ∈ a,b. In principle, one could express this constraint2 as

Rb − Ra = 0 (6.46)

however, such form is rather inefficient, because it consists of 9 equations that are not independent, since both orientation matrices are subjected to 6 orthogonality conditions each. T One should rather exploit the orthogonality condition and pre-multiply Eq. (6.46) by either Ra or T Rb (let’s consider the former), to obtain

T T Ra Rb − Ra Ra = 0 (6.47) I

The 9 constraint| {z equations} of Eq. (6.47) formally reduce to:

eT e (1, 1) a1 b1 = 1 (6.48a) eT e (1, 2) a1 b2 = 0 (6.48b) eT e (1, 3) a1 b3 = 0 (6.48c) eT e (2, 1) a2 b1 = 0 (6.48d) eT e (2, 2) a2 b2 = 1 (6.48e) eT e (2, 3) a2 b3 = 0 (6.48f) eT e (3, 1) a3 b1 = 0 (6.48g) eT e (3, 2) a3 b2 = 0 (6.48h) eT e (3, 3) a3 b3 = 1 (6.48i)

where epi is the ith column of the orientation matrix of part p. Equations (6.48) are not independent, as previously mentioned. In principle, any 3 of them should be sufficient to prescribe the desired parallelism condition; however, some choices are better than others. For example, the diagonal choices (1,1), (2,2), (3,3) are rather inefficient, since they are of second order with respect to a violation of parallelism. In fact, considering a perturbation ϑ of the alignment between eai and ebi , with i ∈ 1, 3, the scalar product of eai and ebi would yield

ϑ2 eT e = cos ϑ ≈ 1 − (6.49) ai bi 2 On the contrary, any of the off-diagonal conditions is of first order with respect to a violation of paral- lelism:

eT e ai bj = sin ϑ ≈ ϑ i 6= j (6.50) A convenient choice is

T T T T e e − e e R R − R R 1 a3 b2 a2 b3 φ = ax skw RT R = ax a b b a = eT e − eT e = 0 (6.51) a b 2 2  a1 b3 a3 b1  ! eT e − eT e     a2 b1 a1 b2  namely, the skew-symmetric terms of the relative rotation matrix. 

Homework 6.16 (Skew-symmetric part of rotation matrix). Extract the skew-symmetric part of the rotation matrix expressed according to Euler-Rodriguez’s formula, Eq. (A.6.

2 T The case of constant relative orientation may be easily obtained by redefining either Rb ::= RbRr or Ra ::= RaRr , where Rr is the constant relative orientation between the two parts.

6-12 Homework 6.17 (Parallelism as constraining the skew-symmetric part of the relative rotation matrix). Show that Eq. (6.51), which extracts from the relative rotation matrix the vector that repre- sents its skew-symmetric part, corresponds to enforcing no relative rotation between the parts (Hint: express the relative rotation using the Euler vector).

An even better approach would require the concept of rotation as exponential map (see Section 2.2.2):

−1 T φ = ax exp Ra Rb = θr = 0 (6.52)    where θr is the vector that describes the relative rotation between parts a and b according to Eq. (A.6.

Homework 6.18 (Parallelism as constraining the logarithm of the relative rotation matrix). Show that Eq. (6.52), which extracts from the relative rotation matrix the relative rotation vector, corre- sponds to enforcing no relative rotation between the parts (Hint: express the relative rotation using the Euler vector).

Exercise 6.14 (Linearization of parallelism constraint equation). Linearize the constraint equation that expresses the parallelism condition.

Without loss of generality, consider the first element of the constraint vector of Eq. (6.51); its linearization yields

eT e eT e eT e eT e eT e eT e ∆ a3 b2 − a2 b3 = ∆ a3 b2 + a3 ∆ b2 − ∆ a2 b3 − a2 ∆ b3 eT e eT e eT e eT e  = b2 ∆ a3 + a3 ∆ b2 − b3 ∆ a2 − a2 ∆ b3 (6.53) Each of the columns of the orientation matrices can be written as

epi = Rpe˜i (6.54)

with (see Eq. (2.10))

δ1i e˜ = δ (6.55) i  2i   δ3i 

being δji Kronecker’s  operator, i.e. δji = 1 when j ≡ i and zero otherwise. The perturbation of the columns of the orientation matrices thus yield

∆epi = ∆Rpe˜i = θp∆ × Rpe˜i = θp∆ × epi (6.56)

which implies

eT e eT e eT θ e eT θ e eT θ e eT θ e ∆ a3 b2 − a2 b3 = b2 a∆ × a3 + a3 b∆ × b2 − b3 a∆ × a2 − a2 b∆ × b3 eT e T θ eT e T θ eT e T θ eT e T θ = b2 a3 × a∆ + a3 b2 × b∆ − b3 a2 × a∆ − a2 b3 × b∆ T T T T =(ea3 × eb2 ) θa∆ +(eb2 × ea3 ) θb∆ − (ea2 × eb3 ) θa∆ − (eb3 × ea2 ) θb∆ T =(eb2 × ea3 − eb3 × ea2 ) (θb∆ − θa∆) T =(eb2 × ea3 + ea2 × eb3 ) (θb∆ − θa∆) (6.57)

Homework 6.19 (Geometric interpretation of parallelism constraint Jacobian matrix). Can you

give a geometric interpretation of vectors eb2 × ea3 and ea2 × eb3 that appear in the definition of the parallelism constraint linearization?

6-13 Repeating the process for the other two equations, and collecting the rotation increments, one obtains

1 T ∆φ = e × e + e × e e × e + e × e e × e + e × e (θ − θ ) 2 b2 a3 a2 b3 b3 a1 a3 b1 b1 a2 a1 b2 b∆ a∆ = Apar (θb∆ − θa∆)  (6.58)

with

1 T A = e × e + e × e e × e + e × e e × e + e × e par 2 b2 a3 a2 b3 b3 a1 a3 b1 b1 a2 a1 b2  (e × e + e × e )T  1 b2 a3 a2 b3 = e e e e T (6.59)  ( b3 × a1 + a3 × b1 )  2 T (eb × ea + ea × eb )  1 2 1 2    Notice that each row of matrix Apar may become ill-conditioned if the two unit vectors in each cross product tend to become parallel, i.e. if two directions which should be mutually orthogonal (recall that we desire that eT e ≡ 0 for i 6= j) become close to each other. This can only occur far from bi aj convergence, when the angle between the two unit vectors significantly departs from π/2.

Homework 6.20 (Derivative of parallelism constraint equation). Compute the time derivative of the constraint equation that expresses the parallelism condition.

Homework 6.21 (Linearization of derivative of parallelism constraint equation). Linearize the time derivative of the constraint equation that expresses the parallelism condition.

Homework 6.22 (Virtual perturbation of parallelism constraint equation). Compute the virtual perturbation of the constraint equation that expresses the parallelism condition.

The constraint reactions resulting from the parallelism constraint are

AT f = φT λ = par λ (6.60) c /q −AT  par  with Apar defined in Eq. (6.59).

Homework 6.23 (Linearization of parallelism constraint reactions). Linearize the constraint reac- tions of the parallelism constraint.

6.4.2 Revolute Constraint The revolute constraint allows the relative rotation of two parts about one axis, which is in common between the two parts. It is the lower pair of type“a”in Fig. 6.1 when the relative displacement between the parts is fully constrained, i.e. in addition to the spherical hinge of Section 6.3.1; it also corresponds to the lower pair of type“d”(cylindrical) when relative displacement is only allowed along the axis of the hinge, or to the lower pair of type“f”(planar) when relative displacement is allowed in the plane normal to the axis of the hinge. Assume, for example, that the two parts must share axis 3, i.e. that axis 3 of part a must remain parallel to axis 3 of the other part, b, whereas the relative rotation of the two parts about that axis may be arbitrary. In (na¨ıve) formulas,

eb3 − ea3 = 0 (6.61)

6-14 However, Eq. (6.61) is incorrect, as it formally eliminates 3 degrees of freedom, whereas a revolute constraint only eliminates 2. The correct formulation of the constraint equation consists in enforcing orthogonality of axis 3 of each part with respect to the other two axes of the other part, namely

eT e eT e a3 b1 = 0 a3 b2 = 0 (6.62a) eT e eT e b3 a1 = 0 b3 a2 = 0 (6.62b) Formally, borrowing from Eq. (6.51) of the parallelism constraint, one can express the constraint equation of the revolute constraint as eT e − eT e 1 0 0 1 a3 b2 a2 b3 φ = E ax skw RT R = eT e − eT e = 0 (6.63) rev a b 0 1 0 2  a1 b3 a3 b1  eT e − eT e       a2 b1 a1 b2  i.e. only enforcing the two constraint equations that restrain the non-allowed relative rotation.

Homework 6.24 (Linearization of revolute constraint equation). Linearize the constraint equation that expresses the revolute constraint.

Homework 6.25 (Derivative of revolute constraint equation). Compute the time derivative of the constraint equation that expresses the revolute constraint.

Homework 6.26 (Linearization of derivative of revolute constraint equation). Linearize the time derivative of the constraint equation that expresses the revolute constraint.

Homework 6.27 (Virtual perturbation of revolute constraint equation). Compute the virtual per- turbation of the constraint equation that expresses the revolute constraint.

The constraint reactions resulting from the revolute constraint are

AT ET f = φT λ = par rev λ (6.64) c /q −AT ET  par rev 

with Apar defined in Eq. (6.59).

Exercise 6.15 (Jacobian matrix of revolute constraint). Compute the basic block of the Jacobian matrix of the revolute constraint, Arev = ErevApar. The basic block of the Jacobian matrix of the revolute constraint, according to the definition of matrix Erev, consists of the first two rows of the basic block of the Jacobian matrix of the parallelism constraint, Apar, of Eq. (6.59). Homework 6.28 (Linearization of revolute constraint reactions). Linearize the constraint reactions of the revolute constraint.

6.4.3 Cardan Joint The Cardan joint (named after Gerolamo Cardano, Pavia 1501–Roma 1576, who first described it in 1557), or Hooke joint (after Robert Hooke, Freshwater 1635–London 1703, who rediscovered it in 1663), or universal joint, is intended to transmit torque between two parts that rotate about two loosely aligned axes, also when those axes are not exactly aligned. It represents perhaps the first example of homokinetic joint; for a discussion of homokinetic joints, see [13].

6-15 β a

b

Figure 6.3: Sketch of a Cardano’s joint.

It should actually be pictured as a sequence of three parts (see Fig. 6.3), the middle one connected to the other two by mutually orthogonal revolute constraints. The formulation of the constraint equation consists in enforcing orthogonality of axes 1 and 2 of both parts, namely

eT e eT e a1 b2 = 0 a2 b1 = 0 (6.65) Formally, borrowing from Eq. (6.51) of the parallelism constraint, one can express the constraint equation of the universal constraint as eT e − eT e 1 a3 b2 a2 b3 φ = E ax skw RT R = 0 0 1 eT e − eT e = 0 (6.66) unv a b 2  a1 b3 a3 b1  eT e − eT e       a2 b1 a1 b2  i.e. only enforcing the constraint equation that restrains the non-allowed relative rotation.

Homework 6.29 (Linearization of universal constraint equation). Linearize the constraint equation that expresses the universal constraint.

Homework 6.30 (Derivative of universal constraint equation). Compute the time derivative of the constraint equation that expresses the universal constraint.

Homework 6.31 (Linearization of derivative of universal constraint equation). Linearize the time derivative of the constraint equation that expresses the universal constraint.

Homework 6.32 (Virtual perturbation of universal constraint equation). Compute the virtual per- turbation of the constraint equation that expresses the universal constraint.

The constraint reactions resulting from the universal constraint are

AT ET f = φT λ = par unv λ (6.67) c /q −AT ET  par unv  with Apar defined in Eq. (6.59).

Homework 6.33 (Linearization of universal constraint reactions). Linearize the constraint reactions of the universal constraint.

6-16 Homework 6.34 (Lower pair of type“a”(revolute)). Formulate the lower pair of type“a”(revolute) in Fig. 6.1 (Hint: combine a spherical hinge and a revolute constraint).

Homework 6.35 (Lower pair of type “b” (prismatic)). Formulate the lower pair of type “b” (pris- matic) in Fig. 6.1 (Hint: combine an inline constraint and a parallelism constraint).

Homework 6.36 (Lower pair of type “c” (screw)). Formulate the lower pair of type “c” (screw) in Fig. 6.1.

Homework 6.37 (Lower pair of type“d”(cylindrical)). Formulate the lower pair of type “d” (cylin- drical) in Fig. 6.1 (Hint: combine an inline constraint and a revolute constraint).

Homework 6.38 (Lower pair of type “f” (planar)). Formulate the lower pair of type “f” (planar) in Fig. 6.1 (Hint: combine a planar constraint and a revolute constraint).

Homework 6.39 (Invent your own kinematic constraint). Invent your own kinematic constraint: define it, formulate the corresponding algebraic equation, its linearization, time derivative, virtual perturbation, and the corresponding constraint reaction forces (See for example [13]).

6-17 6-18 Chapter 7

Minimal Coordinate Set

The objective of the minimal coordinate set (MCS) approach is to reduce the previously defined con- strained dynamics problem

T Mu¨ + φ/uλ = f (u˙ , u,t) (7.1a) φ (u,t)= 0 (7.1b) written in terms of the set of unconstrained coordinates u, to the minimal set of coordinates that are truly independent when the constraints φ are enforced. We focus on the case of holonomic constraints; the case of non-holonomic ones is straightforward. As long as the problem is formulated as a MCS, it is governed by ordinary differential equations (ODEs), since constraint equations become embedded in the definition of the independent coordinates. As a consequence, it can be solved by numerical integration using either unconditionally stable algorithms, when the time resolution needs to be dictated by accuracy, or conditionally stable ones, taking the necessary provisions required to ensure algorithmic stability. In the latter case, the use of explicit algorithms, which offer simplicity and fixed computational cost, becomes appealing.

7.1 Coordinate Reduction

Formally, we are looking for a relationship that expresses the original coordinate set, u ∈ Rn, as a function of a new set of coordinates q ∈ Rn−m that naturally and intrinsically account for the m constraints described by equations φ ∈ Rm, namely

u = u (q,t) (7.2)

Such relationship, if available, would need to intrinsically comply with the constraints, namely

φ (u,t)= φ (u (q,t) ,t) ≡ 0 (7.3)

Since the constraint equations φ are typically nonlinear with respect to the original coordinates (for example because of rotations), such relationship is not straightforward to be determined in closed form, except in special cases (for instance, in case of special topologies and specific choices of coordinates, as is often the case in robotics). Nonetheless, it is usually straightforward to obtain the desired representation at the coordinate time derivative (i.e. velocity) level, starting from the time derivative of the constraint equations, dφ ∂φ ∂φ = u˙ + = φ u˙ + φ = φ u˙ − b′ = 0 (7.4) dt ∂u ∂t /u /t /u ′ −b Notice that the non-holonomic constraint|{z} equation has the same structure of Eq. (7.4), thus the non- holonomic case can be dealt with along the same lines that are discussed in the following.

7-1 7.1.1 Coordinate Partitioning A simple way to reduce the problem to a minimal set of coordinates is to choose, among the original n−m coordinates u, those that are to be considered independent, q = ui ∈ R , and express the remaining, m dependent ones, ud ∈ R , as functions of the independent ones. This can be easily performed at the velocity level, considering Eq. (7.4), rearranging the Jacobian matrix of the constraints accordingly, φ u φ u b′ 0 /ui ˙ i + /ud ˙ d − = (7.5) such that the dependent coordinate derivatives are

u˙ = −φ−1 φ u˙ − b′ (7.6) d /ud /ui i   φ m×m Matrix /ud ∈ R is (obviously) square and invertible as long as the constraints are not redundant, and generally not ill-conditioned except in the vicinity of a singularity configuration. The coordinates can thus be represented as

u˙ i I 0 u˙ = = −1 q˙ + −1 ′ = Tq˙ + t (7.7) u˙ d −φ φ/u φ b    /ud i   /ud 

Homework 7.1 (Verify that partitioned coordinates comply with constraints). Verify that the derivatives of the partitioned coordinates of Eq. (7.7) satisfy the derivative of the constraint equation.

In the inertia forces we need the second derivative of the coordinates, which yields

u¨ = Tq¨ + T˙ q˙ + t˙ = Tq¨ + h (7.8)

We can replace the second derivative of the coordinates in the equation of motion and pre-multiply the equation by the transpose of the coordinate transformation matrix,

T T T T T M (Tq¨ + h)+ T φ/uλ = T f (7.9) After noticing that by construction

φT T T T −T /ud T φ/ = I −φ/u φ T = 0 (7.10) u i /ud φ " /ui # h i the problem can be rearranged as

TT MTq¨ = TT (f − Mh) (7.11)

The resulting equations are pure: the constraint reactions have been eliminated by projection in the subspace of the coordinates that is tangent to the constraint manifold. The reduced mass matrix is positive definite as long as matrix M > 0 and the coordinate transformation matrix T is full rank. Eqs. (7.11) are named after Maggi-Kane. Gianantonio Maggi (Milano, 1856-Milano 1937) formulated them in the late nineteenth century in application to systems of non-holonomic constraints [24]. They were later independently reformulated by Thomas Reif Kane (1924–2019) in 1965 [25]. The equivalence of the two formulated was recognized in [26].

Homework 7.2 (Justify the pre-multiplication of the EoM by the transpose of the transformation matrix). Justify in Eq. (7.9) the pre-multiplication of the equations of motion of Eq. (7.1a) by the transpose of the transformation matrix T of Eq. (7.7).

7-2 The solution of the problem consists in the integration of Eq. (7.11) to obtain q˙ , −1 q¨ = TT MT TT (f − Mh) (7.12) and then of Eq. (7.7) to obtain u. However, in case of holonomic constraints, there is no guarantee that the result of the integration of Eq. (7.7) yields a set of constraint compliant coordinates. The result of the integration might drift away from the constraint manifold, although remaining tangent to it at the velocity level. Precautions must be taken to guarantee constraint compliance, as discussed in Section 7.1.4.

Exercise 7.1 (Point mass pendulum by coordinate partitioning). Write the MCS equations of a point mass pendulum using coordinate partitioning.

Consider an initially unconstrained point mass of mass m, whose z position in the vertical plane is described by the coordinates x x and z, subjected to gravity. To turn it into a pendulum, add the constraint x2 + y2 − L2 = 0. The equations of motion are L mx¨ + 2xλ = 0 (7.13a) mz¨ + 2zλ = −mg (7.13b) g m x2 + z2 − L2 = 0 (7.13c) Consider the time derivative of the constraint equation,

2xx˙ + 2zz˙ = 0 (7.14)

Set x = q; then x z˙ = − q˙ (7.15) z and x˙ 1 = q˙ (7.16) z˙ −x/z     The transformation is not defined for z = 0, and ill-conditioned when the pendulum is nearly horizontal. The second derivative of the coordinates yields

x¨ 1 0 = q¨ + q˙ z¨ −x/z −x/z˙ +zx/z ˙ 2       1 0 = q¨ + q˙2 (7.17) −x/z −1/z(1 + x2/z2)     The MCS problem is

m 0 1 1 −x/z q¨ 0 m −x/z      0 m 0 0 = 1 −x/z − q˙2 (7.18) −mg 0 m −1/z(1 + x2/z2)         i.e. x2 x x x2 m 1+ q¨ = mg − m 1+ q˙2 (7.19) z2 z z2 z2    

7-3 Linearize the equation about the equilibrium configuration x = 0, z = −L,q ˙ = 0: mg mq¨ = − q (7.20) L i.e. the expected equation of the linearized pendulum is found. Now, set q = z; then z x˙ = − q˙ (7.21) x The transformation is not defined for x = 0, and ill-conditioned when the pendulum is nearly vertical. In conclusion, there might be no unique choice of the independent coordinate; each choice might not be valid for all configurations; the resulting equations, although pure, may contain strong non- linearities.

7.1.2 Coordinate Reduction and Orthogonality What is the essential feature of the coordinate transformation devised through coordinate partitioning? It is its capability to turn the constrained equations of motion into pure equations, intrinsically eliminating T T the constraint reactions. It is the T φ/u ≡ 0 property that matters. So one might be tempted to ask: is there a better way to formulate a coordinate transformation that presents the same prop- erty, namely that produces a subspace of the coordinates that is intrinsically tangent to the constraint manifold? The answer, of course, is yes!

An efficient and robust algorithm to determine a suitable coordinate reduction is based on the QR T decomposition [27] of the transpose of the constraint Jacobian matrix, φ/u:

R φT = QR = Q Q 1 = Q R (7.22) /u 1 2 0 1 1     where Q ∈ Rn×n is an orthonormal matrix, i.e. QT Q = I, whereas matrix R ∈ Rn×m is composed of m×m two blocks: matrix R1 ∈ R is upper triangular, and the remaining block, of size (n − m) × m, is zero. The Jacobian matrix of the constraints is thus represented by the so-called economy QR decomposi- tion, Q1R1; submatrix Q2 represents a convenient subspace that by construction is orthogonal to Q1, and T T T thus is tangent to the constraint manifold. By choosing T = Q2, one obtains T φ/q = Q2 Q1R1 ≡ 0. Define

′ u˙ = Q2q˙ + Q1p (7.23) where p′ ∈ Rm is an unknown vector, that is computed by replacing Eq. (7.23) in the derivative of the constraint equation, Eq. (7.4),

′ ′ T T T ′ ′ φ/u (Q2q˙ + Q1p ) − b = R1 Q1Q2 q˙ + R1 Q1 Q1 p − b = 0 (7.24) 0 I which yields | {z } | {z }

′ −T ′ p = R1 b (7.25)

Notice that since R1 is upper triangular, its factorization is not required; only a back-substitution is needed.

7-4 The derivative of the original coordinates can be written as

−T ′ u˙ = Q2q˙ + Q1R1 b (7.26)

+ φ/u | {z } −T i.e. Q1R1 is the Moore-Penrose pseudo-inverse of the constraint Jacobian matrix.

Homework 7.3 (Pseudo-inverse of constraint Jacobian matrix in QR form). Show that the Moore- + −T Penrose pseudo-inverse of the constraint Jacobian matrix is φ/u = Q1R1 .

The second derivative of the coordinates is needed; it can be expressed as

′′ u¨ = Q2q¨ + Q1p (7.27) assuming that whatever is not proportional to q¨ must be in the subspace that is orthogonal to the constraint manifold, proportional to the unknown vector p′′ ∈ Rm. To determine p′′ we need the second time derivative of the holonomic constraint equation (or the first time derivative of the non-holonomic constraint equation), namely

dφ˙ φ¨ = dt d = φ u˙ + φ dt /u /t  ∂  ∂ = φ u¨ + φ u˙ + φ u˙ + φ u˙ + φ /u ∂u /u /t ∂t /u /t   ′′   −b ′′ φ/uu¨ − b | {z } (7.28) Substituting Eq. (7.27) in Eq. (7.28) one obtains

′′ ′′ T T T T ′′ ′′ φ/u (Q2q¨ + Q1p ) − b = R1 Q1 Q2 q¨ + R1 Q1 Q1 p − b = 0 (7.29) 0 I

which yields | {z } | {z }

′′ −T ′′ p = R1 b (7.30) so the second derivative of the original coordinates can be rewritten as

−T ′′ + ′′ u¨ = Q2q¨ + Q1R1 b = Q2q¨ + φ/ub (7.31)

The minimal set equations of motion after projection by matrix T = Q2 become

T + ′′ T T T Q2 M Q2q¨ + φ/ub + Q2 φ/uλ = Q2 f (7.32)   T T T Noticing that Q2 φ/u = Q2 Q1R1 ≡ 0, one obtains

T T + ′′ Q2 MQ2q¨ = Q2 f − Mφ/ub (7.33)   Equation (7.33) is equivalent to Eq. (7.11). The solution is obtained by integrating Eq. (7.33) to obtain q˙ ,

−1 T T + ′′ q¨ = Q2 MQ2Q2 f − Mφ/ub (7.34)     7-5 and then of Eq. (7.23) to obtain u, with the already mentioned caveats on the need to guarantee compliance of u resulting from the integration of the differential relationship between the reduced and original coordinate sets with the constraints, which will be addressed in Section 7.1.4.

Exercise 7.2 (Point mass pendulum by QR decomposition). Write the MCS equations of a point mass pendulum using the QR decomposition to find a suitable set of coordinates. Consider the same problem of Exercise 7.1. The QR decomposition of the transpose of the constraint Jacobian matrix is 2x Q Q R φT = = QR = 11 12 1 (7.35) /u 2y Q Q 0    21 22   Matrix Q must be orthonormal; as such, its coefficients are subjected to three algebraic constraints that express orthogonality,

Q11Q12 + Q21Q22 = 0 (7.36)

and unit normalization of each column,

2 2 Q11 + Q21 = 1 (7.37a) 2 2 Q12 + Q22 = 1 (7.37b) As such, it is convenient to express it as if it represented a rotation θ about axis y, namely

cos θ sin θ R = (7.38) − sin θ cos θ   which yields

2x R cos θ = 1 (7.39) 2z −R sin θ    1  i.e.

2 2 2 2 2 2 2 2 4x + 4z = R1 cos θ + R1 sin θ → R1 = 2 x + z → R1 = 2L (7.40a) R sin θ −2z z z 1 = → tan θ = −p → θ = tan−1 (7.40b) R1 cos θ 2x x x   or

R1 = 2L (7.41a) x/L Q = (7.41b) 1 −z/L   z/L Q = (7.41c) 2 x/L   Then x˙ z/L = Q q˙ = q˙ (7.42) z˙ 2 x/L     and, since

d x¨ (2xx˙ + 2zz˙) = 2xx¨ + 2zz¨ +2˙x2 +2˙z2 = 2x 2z + 2 x˙ 2 +z ˙2 (7.43) dt z¨   ′′ 2  φ/u  2˙q =−b  | {z } | {z }

7-6 then x¨ z/L x/L 1 = Q q¨ + Q R−T b′′ = q¨ − q˙2 (7.44) z¨ 2 1 1 x/L −z/L 2L       The equation of motion is

m 0 z/L z/L x/L q¨ 0 m x/L      0 m 0 x/L 1 = z/L x/L + q˙2 (7.45) −mg 0 m −z/L 2L         i.e. x mq¨ = − mg (7.46) L One may observe that

x˙ z/L − sin θ = q˙ = q˙ (7.47) y˙ x/L cos θ       thus redefiningq ˙ = Lθ˙ yields

x˙ − sin θ = Lθ˙ (7.48) y˙ cos θ     This expression is integrable; it yields

x cos θ = L (7.49) y sin θ     The equation of motion can be rewritten as mg mθ¨ = − cos θ (7.50) L Redefining θ = ϕ − π/2, i.e. rewriting it as a perturbation ϕ with respect to the stable equilibrium solution (pendulum pointing downwards), one obtains mg mϕ¨ + sin ϕ = 0 (7.51) L i.e. the usual pendulum equation, written using the angle as coordinate. The formulation of the equation of motion written using the coordinate obtained through the QR decomposition is valid for the entire domain q ∈ R and never becomes ill-conditioned.

7.1.3 Other Projection Methods TODO: SVD, zero eigenvalue theorem, ...

7.1.4 Compliance with Holonomic Constraints As already mentioned, when the constraint derivative definition is integrated, the set of unconstrained coordinates resulting from the integration might not exactly satisfy the holonomic constraint; on the contrary, it is likely that the numerical solution drifts away from the constraint manifold. The resulting constraint violation is destined to increasingly grow unbounded, unless measures are taken to counteract

7-7 it. One approach is to enforce compliance with the constraint as a correction of the solution resulting from the integration. Consider u(0) as the predicted solution resulting from the integration of any of Eqs. (7.7) or (7.23), depending on the method that is used to formulate the coordinate projection matrix T. The holonomic constraint equation, Eq. (7.1b), might not be satisfied by u(0); consider a linearization of Eq. (7.1b) about the tentative solution u(0) at time t,

(0) φ (u,t)= φ u ,t + φ/u ∆u = 0 (7.52) u(0)  

A solution is sought in the form

∆u = Q1∆ν + Q2∆ψ (7.53) i.e.

(0) (0) T T φ u ,t + φ/u ∆u = φ u ,t + R1 Q1 (Q1∆ν + Q2∆ψ) u(0)     = φ u(0),t + RT QT Q ∆ν + RT QT Q ∆ψ = 0 (7.54) 1 1 1 1 1 2   I 0 which means that the correction is normal to the constraint| {z } manifold,| i.e.{z } the correction of the solution is geometrically the smallest amount of displacement that is necessary to compensate the violation of the constraint, without adding any undue contributions in directions that are allowed by the constraint. It yields the solution

−T (0) ∆ν = −R1 φ u ,t (7.55)   It is worth recalling once more that matrix R1 does not need to be factored again, as it is upper triangular. As such, a back-substitution suffices. The solution is updated as

(1) (0) u = u + Q1∆ν (7.56) and the process is repeated until convergence. Notice that, since matrix φ/u may depend on u, in principle it should be updated and QR-decomposed again at each iteration:

−T (i) ∆ν = −R1 φ u ,t (7.57a) (i+1) (i)   u = u + Q1∆ν (7.57b)

or

(i+1) (i) −T (i) (i) + (i) u = u − Q1R1 φ u ,t = u − φ/uφ u ,t (7.58)     This kind of correction is needed any time a method only enforces a derivative of the constraint, rather than the constraint itself.

7.2 Recursive Formulations

TODO

7-8 Chapter 8

Redundant Coordinate Set

To discuss the redundant coordinate set (RCS) approach for the solution of the previously defined con- strained dynamics problem

T Mu¨ + φ/uλ = f (u˙ , u,t) (8.1a) φ (u,t)= 0 (8.1b)

we need to depart for a while from Eqs. (8.1) and discuss the theory of systems of Differential-Algebraic Equations (DAEs).

8.1 Differential-Algebraic Equations

Consider a system of differential equations in implicit form,

s (y˙ , y,t)= 0 (8.2)

It is said to be a system of Differential-Algebraic Equations (DAEs) when the partial derivative with respect to y˙ is structurally singular,

det s/y˙ ≡ 0 (8.3)   The problem remains well-posed when the matrix pencil

P (γ)= s/y˙ + γs/y (8.4) is singular at most for a finite number of values of γ 6= 0, which correspond to the inverse of the eigenvalues λ = 1/γ of the generalized eigenproblem

λs/y˙ + s/y ∆y = 0 (8.5)   By accurately partitioning the unknowns y in differential, x, and algebraic, z, parts, the problem can be rewritten as

f (x˙ , x, z,t)= 0 (8.6a) g (x, z,t)= 0 (8.6b)

or, as is often the case, in the partially explicit form

x˙ = fˆ (x, z,t) (8.7a) 0 = g (x, z,t) (8.7b)

The form of Eqs. (8.7) presents a very interesting interpretation, that will be further developed in a subsequent Section.A

8-1 8.2 Singular Perturbations Theory Interpretation

This Section presents an interesting interpretation of the DAE problem as the limit of an ordinary differential problem. Consider the form

x˙ = fˆ (x, z,ǫ,t) (8.8a) ǫz˙ = g (x, z,ǫ,t) (8.8b) with 0 < ǫ. We have a singular perturbations problem when 0 < ǫ ≪ 1, which corresponds to the form of Eqs. (8.7) for ǫ → 0. Of course, one could divide Eq. (8.8b) by ǫ and formally obtain a conventional ODE problem. The focus is on the fact that, for ǫ → 0, the dynamics of Eq. (8.8b) is much faster than that of Eq.(8.8a), the response becoming instantaneous for ǫ = 0, in which Eq. (8.8b) is replaced by Eq. (8.7b), and the problem becomes DAE. Considering the frquency separation, and under additional assumptions (related to the stability of the coupled problem), the singular perturbations problem can be split in two subproblems, which are solved indepenently. We are not interested in the details of the singular perturbations theory (the interested reader is referred to [] FIXME). What we need to point out is that the algebraic part may be seen as a much faster dynamical part. When integrated numerically, owing to the time step size, which intrinsically violates the Nyquist-Shannon theorem with respect to the characteristic frequency of the fast dynamics, it responds statically, i.e. in form of an algebraic equation. The concept may be brought to a limit even in case of analytical solution, for ǫ → 0, without considering that we mainly focus on the numerical integration of the problem.

Example 8.1 (Slow and fast mechanical subsystems). Consider two masses, m1 and m2, with m1 connected to the ground by a spring of stiffness k1, and connected to each other by another spring of stiffness k2. Evaluate the characteristic frequencies of the system for k1/m1 → ∞.

m1 m2

k1 k2 x2 x1

Equations of motion:

m 0 x¨ k + k −k x 0 1 1 + 1 2 2 1 = (8.9) 0 m x¨ −k k x 0  2   2   2 2   2    The eigenfrequencies of the problem are

1 k k + k 1 k k + k 2 k k ω2 = 2 + 1 2 ∓ 2 + 1 2 − 4 1 2 (8.10) 1,2 2 m m 2 m m m m  2 1  s 2 1  1 2 Explicit form:

x˙ 2 x˙ 2 = k2 k2 (8.11a) x¨2  x1 − x2     m2 m2  x˙ 1 x˙ 1   = k1 + k2 k2 (8.11b) x¨1  − x1 + x2     m1 m1    8-2 Divide the second block by k1/m1:

x˙ 2 x˙ 2 = k2 k2 (8.12a) x¨2  x1 − x2     m2 m2  m1  x˙ 1  m1 x˙ 1  k1  = k k (8.12b) k1 x¨1  2 2     − 1+ x1 + x2  ǫ k1! k1   We obtain|{z} a singular values perturbation problem when ǫ = m1/k1 → 0; but this can occur for two reasons:

• because k1 → ∞, implying that k2/k1 → 0; the second of Eqs. (8.12b), ✁ ✁ m✓✓1 k✁2 k✁2 x¨1 = − 1+ x1 + x2 (8.13) ✓k1 ✁k1! ✁k1 reduces to the algebraic equation

0= −x1 (8.14) This corresponds to clamping the first mass, making the system equivalent to a single degree of freedom one, that of mass m2, connected to the now clamped mass m1 by the spring of stiffness k2:

k2 k2 x¨2 = x1 − x2 (8.15) m2 m2 In this case, the frequencies tend to k ω = 2 ω = ∞ (8.16) 1 m 2 r 2

• because m1 → 0; the second of Eqs. (8.12b)

m✓✓1 k2 k2 x¨1 = − 1+ x1 + x2 (8.17) ✓k1 k1! k1 reduces to the algebraic equation k k 0= − 1+ 2 x + 2 x (8.18) k 1 k 2  1  1 This corresponds to trasforming the series of two springs, k1 and k2, in an equivalent one of compliance 1/k = 1/k1 + 1/k2,

k2 1

k2 k2 k2 k1 k2 m2 x¨2 = x1 − x2 = x2 − x2 = − x2 (8.19) m2 m2 m2 k2 m2 1 1 1+ + k1 k1 k2 In this case, the frequencies tend to

1 k v m2 ω1 = = u ω2 = ∞ (8.20) m2 u 1 1 r u + u k k u 1 2 t

8-3 We can have infinitely fast dynamics as a consequence of infinite stiffness (k → ∞, or rigididy) or negligible inertia (m → 0), both idealizations of practical conditions in which a characteristic of a part of the system is out of scale with respect to the rest of it. In both cases, by taking such scale condition to its limit one obtains a system of DAEs, where the algebraic part responds instantaeously (i.e. “statically”) to inputs. From the point of view of numerical integration, we have infinitely fast dynamics as a consequence of the algebraic portion of the problem, so we need unconditionally stable integration algorithms, as no reduction in time step size can achieve conditional stability. Moreover, we need algorithmic dissipation to remove the spurious effects of infinitely fast dynamics from our numerical solutions.

8.2.1 Slow Subsystem Back to the original definition of singular perturbations, consider first the case of ǫ → 0. If function g has distinct solutions z for ǫ = 0 in a neighborhood of x = x0, is differentiable, and its partial derivative with respect to z is not singular, one can locally compute z = gˆ(x,t) and replace it in fˆ, obtaining x˙ = fˆ(x, gˆ(x,t),t) with initial conditions x0 and z computed accordingly. This means that the problem is reduced to the minimal set of coordinates that are truly differential and thus need to be independent. As discussed earlier, the reduction may not be easy in many cases; it is only possible locally, so the reduction may need to be recomputed any time the function fˆ needs to be evaluated; often the original problem is significantly sparse, and sparsity can be exploited efficiently to manipulate it, whereas the reduced problem may become dense.

8.2.2 Fast Subsystem

Consider now a pseudo-time τ related to t by the relationship t = t0 + ǫτ, such that its differentiation consists in dt = ǫ dτ. The problem of Eqs. (8.8), written in pseudo-time, becomes dx 1 dx x˙ = = = fˆ (x, z,ǫ,t + ǫτ) (8.21a) dt ǫ dτ 0 dz dz ǫ z˙ = ǫ = = g (x, z,ǫ,t + ǫτ) . (8.21b) dt dτ 0 Equation (8.21a), rewritten as dx = ǫ fˆ (x, z,ǫ,t + ǫτ) , (8.22) dτ 0

yields limǫ→0 dx/dτ = 0, and thus x = x0. The limit of Eq. (8.21b), after writing z(t)= z(t) + ∆z(τ), yields d∆z = g (x , z + ∆z, 0,t ) . (8.23) dτ 0 0 As a consequence, the singular perturbation theory provides a useful means to separate the dynamics of the slow subsystem, where a static approximation of the fast variables z is used to describe the dynamics of the slow subsystem, from those of the fast subsystem, whose dynamics is confined in an infinitely fast boundary layer in pseudo-time, at fixed time t = t0. The latter results from the solution of Eq. (8.23) with initial conditions ∆z(0) = z0 − z(t0).

8.3 Concept of Index

To introduce the important concept of index of a system of DAEs we need to formally perform an operation that consists of a cascade of time derivatives of Eqs. (8.6) or of Eqs. (8.7); hovever,

this operation must NOT be actually performed to solve the problem!

8-4 It is only intended to justify the notion of index.

Starting from the DAE system in implicit form, one may want to write it in form of ODE by successive differentiation with respect to time. Assuming that g is locally invertible, i.e. g/z is not singular, consider its time derivative; the system becomes

x˙ = fˆ (x, z,t) (8.24a)

0 = g/xx˙ + g/zz˙ + g/t. (8.24b)

Substitute x˙ into the second equation:

x˙ = fˆ (x, z,t) (8.25a) −1 ˆ z˙ = −g/z g/xf (x, z,t)+ g/t . (8.25b)   The problem is now ODE in both sets of variables, x and z. The index of the DAE system is the number of derivatives required to write the system in ODE form. In this case, the index is 1.

Note: this does not mean that reducing the system to ODE in this na¨ıve manner is a good approach for its solution! On the contrary, as illustrated earlier, this is prone to drift, since only higher order derivatives of the algebraic equations would be actually enforced, and the initial equations would essentially be violated.

The larger the index, the more difficult the solution is. In mechanical systems, the maximum index is 3, which is characteristic of constrained dynamics problems with holonomic constraints. Higher values of index may occur for example in control-related problems and whenever complex, rather indirect algebraic relationships need to be enforced within the degrees of freedom of our problems.

8.3.1 Index 1 DAE Index 1 equations are those described earlier, in the form

f (x˙ , x, z,t)= 0 (8.26a) g (x, z,t)= 0. (8.26b)

A typical example is represented by equations whose algebraic part represents a definition of a term that is used in the differential part. Consider for example this simple structural dynamics problem:

v˙ = −r + f u, M−1v,t (8.27a) −1 u˙ = M v  (8.27b) r = k (u) , (8.27c)

where u are the positions, v are the momenta, and the algebraic equation contains the definition of the nonlinear elastic force r. Clearly, replacing Eq. (8.27c) in Eq. (8.27a) would make the problem ODE. The solution of these equations usually does not imply special issues, since the theory for DAEs of index 1 is rather complete.

Homework 8.1 (Check of Index 1 DAEs). Reduce Eqs. (8.26) to ODE and check the number of required differentiations.

8-5 8.3.2 Index 2 DAE Index 2 equations have the form

f (x˙ , x, z,t)= 0 (8.28a) g (x,t)= 0, (8.28b) i.e. the algebraic equation, g, does not directly depend on the algebraic part of the state, z. In this case two differentiations are required to write the problem in ODE form. A typical case is represented by non-holonomic constrains,

v˙ = AT λ + f u, M−1v,t (8.29a) −1 u˙ = M v  (8.29b) 0 = AM−1v − b′. (8.29c)

Homework 8.2 (Check of Index 2 DAEs). Reduce Eqs. (8.28) to ODE and check the number of required differentiations.

8.3.3 Index 3 DAE There exists a type of index 3 equations, called index 3 Hessenberg, that is very important since it describes typical mechanical systems holonomically constrained by kinematic relationships in form of algebraic equations, ˆ x˙ 1 = f 1 (x1, x2, z,t) (8.30a) ˆ x˙ 2 = f 2 (x1, x2,t) (8.30b)

0 = g (x2,t) . (8.30c)

As one can easily note, the algebraic equation, g, depends only on that differential portion of the state, ˆ x2, whose equation, f 2, does not contain the algebraic portion of the state itself, z. As a consequence, three differentiations are required to write the problem in ODE form. The algebraic portion of the state plays the role of constraint reaction forces, usually expressed using the Lagrange multipliers, λ. A typical mechanical example is

T −1 v˙ = φ/uλ + f u, M v,t (8.31a) −1 u˙ = M v  (8.31b) 0 = φ (u,t) . (8.31c)

The solution of this type of equations implies non-negligible numerical issues. The theory of DAEs of index higher than 1 is far from consolidated.

Homework 8.3 (Check of Index 3 DAEs). Reduce Eqs. (8.30) to ODE and check the number of required differentiations.

Homework 8.4 (Index of DAEs for m1 → 0). What is the index of Eqs. (8.12b) when ǫ → 0 because m1 → 0?

Homework 8.5 (Index of DAEs for k1 → ∞). What is the index of Eqs. (8.12b) when ǫ → 0 because k1 → ∞?

8-6 8.4 Index Reduction 8.4.1 Constraint Stabilization by Index Reduction As previously discussed, the higher the index is, the more difficult is the numerical solution of the problem. For this reason, some authors have proposed means to reduce the index. Among them, one of the most interesting is the method proposed by Gear et al. in 1985 [28]. Consider the algebraic equation, Eq. (8.30c), in the index 3 DAEs of Eqs. (8.30),

0 = g (x2,t) (8.32)

As long as it is complied with, also its time derivatives are implicitly satisfied, dn 0 = g (x ,t) (8.33) dtn 2 However, when the problem is solved numerically, there is no special reason for the derivatives of the constraint equation to be complied with by the derivatives of the solution. Gear and his co-workers proposed to explicitly add the derivative of the constraint equation,

0 g g x g = ˙ = /x2 ˙ 2 + /t (8.34) to the problem of Eqs. (8.30). However, to be able to enforce another set of algebraic constraints, new set of Lagrange multipliers is needed, z2, which act on the differential equation associated with the differential variable, x2 the constraint equation g depends on, resulting in ˆ x˙ 1 = f 1 (x1, x2, z1,t) (8.35a) x˙ fˆ x x gT z 2 = 2 ( 1, 2,t)+ /x2 2 (8.35b)

0 = g (x2,t) (8.35c) 0 g fˆ x x g = /x2 2 ( 1, 2,t)+ /t. (8.35d) One needs to realize that Eq. (8.35d) should be implicitly complied with by the exact solution; however, since a numerical solution could violate it unless it is explicitly enforced, its enforcement requires that some other condition be relaxed. The only condition that can be relaxed, however, is the definition of x˙ 2. In practice, to explicitly enforce compliance with the derivative of the constraint equation, one needs to relax satisfaction of (at least part of) the differential equations. The application to the mechanical example of Eqs. (8.31) yields

T −1 v˙ = φ/uλ + f u, M v,t (8.36a) −1 T u˙ = M v + φ/uµ  (8.36b) 0 = φ (u,t) (8.36c) −1 0 = φ/uM v + φ/t (8.36d) i.e. the definition of the momentum, v, as the product of the mass by the derivative of the position, u˙ , T needs to be relaxed by the addition of the term φ/uµ. Although such contribution is applied in a manner that is rather similar to that of the reaction T forces, φ/uλ, one should realize that the latter have the precise meaning of forces required to enforce the constraint. As such, they take whatever value is needed to enforce the constraint whenever the loads acting on the parts would otherwise result in a violation of the constraint. On the contrary, the additional constraint represented by the time derivative of the original one is almost exactly complied T with when the numerical solution is accurate enough. As such, the correction introduced by φ/uµ tends to be small, and rather represents a sort of measure of the accuracy of the solution. Other authors (Fuhrer¨ and Leimkuhler [29]) pushed the idea further, by explicitly enforcing also the second derivative of the constraint equation.

8-7 Homework 8.6 (Point mass pendulum with constraint stabilization). Stabilize the constraint of the point mass pendulum proposed in Exercise 7.1 adding the time derivative of the constraint equation.

8.4.2 Baumgarte’s Method The approach proposed in 1972 by Baumgarte [30] is inspired by control theory. It is mainly reported for completeness, for historical reasons, because it is still used by several authors, and because it provides an interesting point of view on the relationship between kinematic constraints and rapidity of their dynamics. Directly considering the mechanical constrained dynamics problem of Eqs. (8.1), Baumgarte’s idea is to linearly combine the holonomic constraint of Eq. (8.1b) with its first and second derivative. As a result, a linear combination of the constraint and of its derivatives is enforced instead of the actual constraint,

T T Mu¨ = f + φ/uλ → Mu¨ = f + φ/uλ (8.37a) 0 = φ (u,t) → 0 = φ¨ (u,t) + 2αφ˙ (u,t)+ β2φ (u,t) . (8.37b)

The problem can be conveniently manipulated to expose the second derivative of x in the modified constraint equation,

M −φT x¨ f /x = (8.38) −φ 0 λ −b′′ + 2αφ˙ (x,t)+ β2φ (x,t)  /x      ¨ ′′ where φ = φ/xx¨ − b is used. As already mentioned, a shortcoming of this approach is that it enforces a combination of the con- straint derivatives rather than the constraint itself. The problem that is integrated has a spectrum that differs from that of the original problem: consider the linearization of the original problem

M 0 δx¨ −f 0 δx˙ + /x˙ 0 0 δλ¨ 0 0 δλ˙         −f −φT δx 0 + /x /x = (8.39) −φ 0 δλ 0  /x      and that of the modified problem,

M 0 δx¨ −f /x˙ 0 δx˙ ¨ + ˙ −φ/x 0 δλ −2αφ 0 δλ      /x    −f −φT δx 0 + /x /x = . (8.40) −β2φ 0 δλ 0  /x      The two clearly differ, and it is apparent that in the latter case the infinitely fast dynamics related to the constraints become finite and depend on the magnitude of α and β; the larger β the faster the constraint dynamics, but the closer the problem becomes to DAE (in a singular perturbations sense, the role of ǫ is somehow played by 1/β2). The different spectrum may have a non-negligible impact, especially during very fast transients. The advantage of this method is that it turns a DAE into an ODE by substantially transforming the algebraic constraint equation, φ = 0, into a homogeneous linear differential equation in the constraint violation, φ¨ + 2αφ˙ + β2φ = 0. The stability and the rapidity of asymptotic convergence to zero of the solution of this equation can be controlled by properly choosing the coefficients α and β. Basically, β is related to the rapidity of response (it corresponds to k/m in a mechanical oscillator), whereas α is related to the sovraelongation (it corresponds to r/(2m)= ξ k/m in a mechanical oscillator). p p 8-8 Since the resulting equation is ODE, it could be efficiently integrated with explicit schemes; however, when β is large, the time step of a conditionally stable scheme would be dictated by the modified constraint equation rather than by the fundamental dynamics of the problem. In fact, the larger β, the closer the modified problem is to the original DAE.

8.5 Initialization

A purely ODE Cauchy problem in implicit form,

f (y˙ , y,t)= 0 y(t0)= y0 (8.41) requires the determination of y˙ (t0). This operation is straightforward when the problem is in explicit form, ˆ y˙ = f (y,t) y(t0)= y0 (8.42) In fact, one only needs to evaluate ˆ y˙ (t0)= f (y0,t0) (8.43) In the implicit form of Eq. (8.41), the problem

f (y˙ 0, y0,t0)= 0 (8.44)

needs to be treated as a nonlinear equation with respect to the unknown variable y˙ 0, for fixed y0, t0. Its solution may be found, for example, using a Newton-Raphson iteration,

f (y˙ 0, y0,t0)+ f /y˙ ∆y˙ 0 = 0 (8.45) whose solution is found as

y˙ (i+1) = y˙ (i) − f −1f y˙ (i), y ,t (8.46) 0 0 /y˙ 0 0 0   However, matrix f /y˙ is not invertible when the problem is DAE, according to the definition of DAE problem (see Section 8.1). When the problem is DAE, in fact, the definition itself of initialization changes. Without formalizing it for every type (or better for every index), we focus on the problem that is of most importance for us, the one of index 3, which formalizes the case of dynamics subjected to holonomic constraints. Consider the case of Eqs. (8.31), here reported for clarity:

T −1 v˙ = φ/uλ + f u, M v,t (8.47a) −1 u˙ = M v  (8.47b) 0 = φ (u,t) . (8.47c)

The initial conditions consist of u0 and v0, but also of λ0, u˙ 0, and v˙ 0. Let us analyze each variable type, and the derivatives of the differential ones.

i) The differential variables u0 are not independent; they must comply with the constraint equation,

0 = φ (u0,t0) (8.48)

As such, their initial value is not completely arbitrary.

ii) The derivatives of the differential variables u0, namely u˙ 0, are not independent as well; they must comply with the derivative of the constraint equation, ˙ 0 = φ (u0,t0)= φ/uu˙ 0 + φ/t (8.49)

8-9 However, considering the (trivial) relationship between u˙ 0 and v0 represented by Eq. (8.47b),

−1 u˙ 0 = M v0 (8.50)

the derivative of the constraint equation, evaluated at t = t0, can be interpreted as a condition on the value of v0,

−1 0 = φ/uM v0 + φ/t (8.51)

iii) The initial value of the Lagrange multipliers, λ0, must result from equilibrium, i.e. from Eq. (8.47a); first of all, we need to compute the second time derivative of the constraint equation,

0 = φ¨ (u0,t0) d = φ M−1v + φ dt /u 0 /t  −1 −1 −1 = φ/uM v˙ 0 + φ/uM v0 + φ/t u˙ 0 + φ/uM v0 + φ/t (8.52) /u /t     ˆ′′ −b | {z } Then we replace in it v˙ 0 from Eq. (8.47a),

−1 T −1 ˆ′′ 0 = φ/uM φ/uλ0 + f u0, M v0,t0 − b (8.53)   and solve for the Lagrange multipliers,

−1 −1 T ˆ′′ −1 −1 λ0 = φ/uM φ/u b − φ/uM f u0, M v0,t0 (8.54)     iv) The initial value of the momenta, v˙ 0, finally results from replacing the Lagrange multipliers, λ0, back into Eq. (8.47a),

−1 T −1 T ˆ′′ −1 −1 −1 v˙ 0 = φ/u φ/uM φ/u b − φ/uM f u0, M v0,t0 + f u0, M v0,t0    −1  −1 T −1 T −1 −1  T −1 T  ˆ′′ = I − φ/u φ/uM φ/u φ/uM f u0, M v0,t0 + φ/u φ/uM φ/u b       (8.55)

Notice that we already encountered this last expression when discussing Gauss’ Principle in Eq. (4.32).

Apart from the details, the essential aspect is that u0 and either v0 or u˙ 0 cannot be arbitrary; they must comply with the constraint equation and its first time derivative. The rest, namely λ0 and v˙ 0, result from equilibrium and compatibility with the second time derivative of the constraint equation. Altro?

8-10 Chapter 9

Unconstrained Coordinate Set

With the term unconstrained coordinate set (UCS) we refer to approaches that, although intended to solve the DAE problem of constrained dynamics,

T Mu¨ + φ/uλ = f (u˙ , u,t) (9.1a) φ (u,t)= 0 (9.1b) formally preserve the set of coordinates u of the unconstrained problem,

Mu¨ = f (u˙ , u,t) (9.2) somehow embedding the constraint equations in the solution process. This distinction is seldom made in the literature. In fact, there are little reasons for making it in the first place, since only in few cases it produces useful solution approaches (the only exception perhaps being the so-called Augmented Lagrangian one). However, their study is of some importance from a didactical point of view.

9.1 Gauss’ Principle

We have already encountered a UCS method when briefly recalling Gauss’ Principle in Section 4.4.

9.2 Augmented Lagrangian

Penalty-based relaxation of the constraints can be used to transform the system of DAEs in Eq. (9.1) into a set of n ODEs [31]. This approach makes the Lagrange multipliers λ proportional to the constraints violation at the configuration, velocity, and acceleration levels

λ = Ξ φ¨ + Θφ˙ + Ωφ (9.3)   where Ξ is an n × n matrix, symmetric, positive-definite and usually diagonal, that contains the penalty factors; Θ and Ω are also n × n matrices, symmetric, positive-definite and usually diagonal with stabi- lization parameters that have a similar function to those used in Baumgarte’s stabilization [30,32] (see Section 8.4.2). The derivatives of the constraints with respect to time are ˙ 0 = φ = φ/uu˙ + φ/t (9.4a) ¨ ˙ ˙ 0 = φ = φ/uu¨ + φ/uu˙ + φ/t (9.4b) This approach is equivalent to replacing the constraints with idealized mass-spring-damper systems. The resulting dynamics equations are

T ¨ ˙ Mu¨ + φ/uΞ φ + Θφ + Ωφ = f (u˙ , u,t) (9.5)   9-1 which can be rewritten as

T T ˙ ˙ ˙ M + φ/uΞφ/u u¨ + φ/uΞ φ/uu˙ + φ/t + Θφ + Ωφ = f (u˙ , u,t) (9.6)     It must be noted that the equilibrium configuration of Eq. (9.5) is not completely equivalent to that of Eq. (9.1). In most cases a certain violation of the kinematic constraints φ of Eq. (9.1b) will be required to balance the applied forces f in Eq. (9.1a). However, the constraint violation is intrinsically limited; no drift can occur, and no further constraint stabilization or correction is required. The amount of violation of the constraint equation, φ, which is required to produce the reaction forces that tend to limit the constraint violation, can be limited by increasing the value of the penalty coefficients in matrix Ω, which control the rapidity of the Lagrange multipliers in reacting to violations of the constraint. However, if such rapidity becomes too great, it may negatively impact the size of the time step that is need to meet the stability requirements posed by the conditional stability of explicit integration schemes (see Section 5.3.2). Additionally, this method does not preserve the spectrum of the original problem; all eigenvalues may be modified by the penalty functions, although a careful choice of the coefficients Ξ, Θ, and Ω can limit amount of modification to those that matter. Spurious eigenvalues, associated with the artificial dynamics of the constraint violation appear [33].

Homework 9.1 (Point mass pendulum using the Augmented Lagrangian method). Formulate the equations of motion of the point mass pendulum of Exercise 7.1 using the Augmented Lagrangian method.

9.3 Force Projection Method

The force projection method was proposed in [34], and further discussed in [35], as a formulation that indirectly adds kinematic constraints to an unconstrained problem without altering its structure, specif- ically the number and meaning of the coordinates, while at the same time providing adequate constraint stabilization. It builds on top of the formulation resulting from Gauss’ Principle, recasting the problem to first-order differential form, and projecting both accelerations and velocities in a subspace that is tangent to the constraint manifold, thus reducing the problem in a form that is equivalent to DAE of index 1. The acceleration and velocity projection, as well as the position correction, can be performed in a staggered manner as decoupled problems, allowing the use of rather efficient explicit integration schemes. An advantage of the proposed method is that it preserves the spectrum of the original problem, adding only zero-valued eigenvalues that can be easily recognized and eliminated.

9.3.1 Stabilized Constrained Dynamics The constrained dynamics problem in first-order differential form, enforcing both velocity- and acceleration- level constraints, is

u˙ + W−1AT µ = w (9.7a) Mw˙ + AT λ = f (9.7b) Au˙ = b′ (9.7c) Aw˙ = b′′, (9.7d)

where w˙ is used instead of u¨ in Eq. (9.7d), the second time derivative of the holonomic constaint equation

φ (u,t)= 0, (9.8)

9-2 namely

˙ ′ 0 = φ = φ/uu˙ + φ/t = Au˙ − b (9.9) ¨ ′′ 0 = φ = φ/uu¨ + φ/uu˙ + φ/t u˙ + φ/uu˙ + φ/t = Au¨ − b (9.10) /u /t     Enforcing the derivatives of the constraint equation to the acceleration level guarantees the reduction to index 1 of the original DAE. The enforcement of another constraint equation requires to correct the definition of w with the contribution of another multiplier µ. This removes from w its projection in a subspace of u that is skewed with respect to the constraint manifold, yielding Eq. (9.7a). The inverse of the arbitrarily chosen (symmetric, positive-definite) weight matrix W is used to distort the projection. The dimension of µ is that of a velocity times the dimension of W, [W]. Gear et al. [28] suggest to project the velocity correction in a subspace orthogonal to the constraint manifold, using W = I. Other authors suggest to use a ‘dynamic’ projection with W = M. Hairer and Wanner modify in this manner the stabilization proposed by Gear et al.“... for the sake of symmetry”[36]. Borri et al. justify it on the basis that in Hamiltonian dynamics the state is composed of the coordinates u and momenta p, so the correction naturally applies to momenta [37]. Braun and Goldfarb justify the corresponding multiplier µ in terms of a ‘mechanical impulse’ [38]; a relatively weak argument, though. Here a heuristic interpretation in terms of velocity correction that compensates for numerical inte- gration errors is preferred, with W = I. In fact, in this case Eq. (9.7a) guarantees that the velocity correction AT µ is orthogonal to any virtual displacement δu, which must satisfy δφ = Aδu = 0. Similar T considerations apply to the reaction forces f c = −A λ, which intrinsically do not do work for a virtual displacement δu. However, for generality, a weighting W is considered throughout the formalization of the approach.

9.3.2 Stabilized Constrained Dynamics in ODE Form An explicit expression for the derivative of the state can be obtained:

+ u˙ = w − W−1AT AW−1AT Aw − b′ (9.11a)  + w˙ = a − M−1AT AM−1AT Aa − b′′ . (9.11b)    After defining

+ Pw = W−1AT AW−1AT A (9.12a) + −1 T  −1 T  ′ pw = W A AW A b (9.12b)  + Pa = M−1AT AM−1AT A (9.12c) + −1 T  −1 T  ′′ pa = M A AM A b , (9.12d)   Eqs. (9.11) can be rewritten as

u˙ =(I − Pw) w + pw (9.13a) w˙ =(I − Pa) a + pa. (9.13b)

This form highlights the fact that the velocity- and acceleration-level constraints project the uncon- strained acceleration a and its integral w on the manifold of the constraints by means of the non- orthogonal projectors Pa and Pw. In case of rheonomic constraints, the unconstrained velocity is also corrected by pw. The acceleration is corrected by pa when the constraint at least bends the trajectory of the constrained bodies, or is rheonomic.

9-3 One may note that the two projectors are different, and might be tempted to use Pa for both projections. This may not be a good choice, since the two projectors act on different types of equations: a kinematic definition, Eq. (9.7a), involving velocities, and an equilibrium equation, Eq. (9.7b), involving forces; thus, they may legitimately differ. When W = I, Pw = A+A, where the property AT (AAT )+ = + + ′ A of the MPGI is exploited [39]. This projection is orthogonal; correspondingly, pw = A b . To yield Eqs. (9.11), the multipliers are

+ µ = AW−1AT Aw − b′ (9.14a)  + λ = AM−1AT Aa − b′′ . (9.14b)   The nature of the multiplier µ differs from that of λ because it represents the velocity correction that is required to bring w on the constraint manifold. As such, it should be identically zero, were the integration exact (see similar considerations made in Section 8.4.1 about constraint stabilization). The proposed approach minimizes the functional 1 1 G (w˙ , u˙ )= (w˙ − a)T M (w˙ − a)+ w (u˙ − w)T W (u˙ − w) , (9.15) 2 2 where the dimensionality is preserved by the uninfluential scalar coefficient w, of units [m][t−2][W−1]. Equation (9.15) expresses a modified first-order form of the Gaussian G (u¨) of Eq. (4.22). Its mini- mization is subjected to the constraints Au˙ = b′ and Aw˙ = b′′. The problem is equivalent to Gauss’ principle: when exact mathematics are considered, u˙ ≡ w; the velocity constraint implies the acceleration constraint, and G (w˙ , u˙ ) ≡ G (u¨).

9.3.3 Elimination of Drift at the Position Level In case of holonomic constraints, similarly to what was discussed in Section 7.1.4 for the minimal coor- dinate set, Eq. (9.8) is enforced by determining

u = u + W−1AT ν, (9.16) where u is obtained integrating u˙ from Eq. (9.11a), and thus may not comply with the constraint because of numerical drift; the resulting u is the position that complies with Eq. (9.8). This guarantees that the correction W−1AT ν does not alter the solution in directions that are locally compatible with the constraints. If W = I, it is a minimal norm correction with respect to the constraint violation. A Newton iteration can be used:

u0 = u (9.17a) + −1 T −1 T ui+1 = ui − W A AW A φ (ui,t) . (9.17b)   A solution of Eq. (9.8) must exist for the constraints to be consistent, regardless of being independent or not (constraints are not independent when matrix A is not full rank; they are inconsistent when they are not independent, and φ = 0 has no solution). The proposed approach reduces to 1 the index of DAE problems that describe the dynamics of constrained mechanical systems, since it enforces compliance with the constraints up to the second-order derivative of the coordinates u. In case of holonomic constraints, an embedded compliance iteration allows to substitute the multipliers, yielding a formally pure ODE representation of the constrained dynamics problem. In 1993, Eich [40] proposed a projection formally identical to that of Eq. (9.12a), with W = I, to project the integrated coordinates u onto the manifold of a linear constraint φ(u,t)= Au − b(t)= 0. In 2000, Yu and Chen [41] proposed an interesting algorithm, that consists in integrating Eqs. (9.2) and (9.10) directly, applying some correction to the resulting u˙ and u only when the constraint violation exceeds a given tolerance. The correction to u is analogous to that of Eq. (9.17), with W = I. The proposed approach differs from that of Yu and Chen by embedding the correction to u˙ in the problem, and by always applying the correction of Eq. (9.17).

9-4 Homework 9.2 (Point mass pendulum using the Force Projection method). Formulate the equations of motion of the point mass pendulum of Exercise 7.1 using the Force Projection method.

9-5 9-6 Part III

Dynamics of Flexible Systems

9-7

To Be Completed

9-9 9-10 Chapter 10

Beam

To Be Completed

10-1 10-2 Chapter 11

Flexible Element

To Be Completed

11-1 11-2 Part IV

Advanced Problems and Implementation Aspects

11-3

To Be Completed

11-5 11-6 Part V

Appendices

11-7

Appendix A

Rotation Parametrizations

A.1 Parametrization of Rotation A.1.1 Euler Angles The orientation matrix R is the result of three subsequent rotations about specific axes. Each rotation is performed starting from the orientation resulting from the previous one. Each rotation about a (local) coordinate axis takes the form 1 0 0 R1(θ)= 0 cos θ − sin θ axis 1 (A.1a)  0 sin θ cos θ   cos θ 0 sin θ  R2(θ)= 0 1 0 axis2 (A.1b)  − sin θ 0 cos θ   cos θ − sin θ 0  R3(θ)= sin θ cos θ 0 axis3 (A.1c)  0 0 1  Consider three angles α, β, γ, organized in the rotation parameters vector g as α g = β (A.2)    γ  Several combinations  of rotation sequences are possible, as reported in Table A.1. Any combination,

Table A.1: Admissible rotation sequences for (Tait-Bryan/Cardano)-Euler angles 1–2–1 2–1–2 3–1–2 1–2–3 2–1–3 3–1–3 1–3–1 2–3–1 3–2–1 1–3–2 2–3–2 3–2–3

including repetitions, is possible, provided repeated rotations are not consecutive. Among the many that have been proposed, the most common ones are 3–1–3 (first and last repeated, the proper or classical Euler angles definition), 1–2–3 and 3–2–1 (all three rotations differ, also known as Tait-Bryan or Cardano angles):

3–1–3: consider R = R3(α)R1(β)R3(γ), which yields cos α cos γ − sin α cos β sin γ − cos α sin γ − sin α cos β cos γ sin α sin β R = sin α cos γ + cos α cos β sin γ cos α cos β cos γ − sin α sin γ − cos α sin β (A.3)  sin β sin γ sin β cos γ cos β    A-1 1–2–3: consider R = R1(α)R2(β)R3(γ), which yields

cos β cos γ − cos β sin γ sin β R = cos α sin γ + sin α sin β cos γ cos α cos γ − sin α sin β sin γ − sin α cos β (A.4)  sin α sin γ − cos α sin β cos γ sin α cos γ + cos α sin β sin γ cos α cos β    This definition is often used in navigation to represent roll, pitch and yaw; the angles α, β, and γ are usually indicated with ϕ, ϑ, and ψ.

3–2–1: consider R = R3(α)R2(β)R1(γ), which yields

cos α cos β cos α sin β sin γ − sin α cos γ sin α sin γ + cos α sin β cos γ R = sin α cos β cos α cos γ + sin α sin β sin γ sin α sin β cos γ − cos α sin γ (A.5)  − sin β cos β sin γ cos β cos γ   

Homework A.1 (Euler angles from orientation matrix). Compute the Euler angles from the ele- ments of an orientation matrix.

A.1.2 Euler Vector This definition is very interesting, because the rotation is represented as a three-dimensional vector. The change of orientation is defined as a single rotation about an axis that brings the triad from the absolute reference frame to the local reference frame. The rotation axis is parallel to that of the vector, and the rotation magnitude is that of the vector: sin kθk 1 − cos kθk R = I + θ × + θ × θ × (A.6) kθk kθk2

Homework A.2 (Multiplication of orientation matrix by special vector). Multiply the orientation matrix expressed using the Euler vector by a vector decomposed in a part that is parallel to the Euler vector and a part that is orthogonal to it.

Notice that, for “small” (infinitesimal) values of the angle, i.e. kθk≈ 0, the rotation matrix is 1 R ≈ I + θ × + θ × θ × (A.7) 2 considering that, for kθk≈ 0, sin kθk / kθk≈ 1 and (1 − cos kθk)/ kθk2 ≈ 1/2. An interesting interpretation of the Euler Vector representation, and of rotations in general, is re- lated to the notion of exponential map, which is developed according to the theory of Lie groups. A rotation matrix, R, which belongs to the special orthogonal (Lie) group SO(3), can be interpreted as the exponential of a skew-symmetric matrix, θ × , in the Lie algebra so(3), namely

R = exp(θ × ) (A.8)

where the skew-symmetric matrix is constructed from the rotation vector θ through the usual matrix representation of the cross-product operator, (·) × . This can be verified through the definition of matrix exponential,

∞ 1 exp(A)= An (A.9) n! n=0 X

A-2 which, in the present case, yields

∞ 1 exp(θ × )= θ×n (A.10) n! n=0 X Recalling that

θ × θ × = θθT − θT θI (A.11) and thus ✘ θ × θ × θ × = ✘θ ×✘θθT − θT θθ× (A.12) one obtains a series that converges exactly to the formula of Eq. (A.6). Under this interpretation, the associativity property (i.e. consecutive rotations) is given by rotation multiplication:

R = R2R1 = exp(θ2 × )exp(θ1 × ) (A.13) whereas the “zero” element is the identity rotation,

I = exp(0×) (A.14)

Homework A.3 (Orthogonality of exponential representation of rotations). Verify the orthogonality of the exponential representation of rotations.

The inverse of Eq. (A.8) provides the rotation vector,

θ × = exp−1 (R) (A.15) and thus

θ = ax exp−1 (R) (A.16)  A.1.3 Cayley-Gibbs-Rodrigues Parameters The Euler Vector has a clear physical meaning, but rotations based on it suffer from poor computational efficiency, since several trigonometric functions need to be evaluated. Alternative formulations are possible, which share in part the physical interpretation of the parame- ters, but introduce a simple relationship between the magnitudes of the vectors that eliminates the need for evaluating expensive trigonometric functions. Amonmg them, the Cayley-Gibbs-Rodrigues (CGR) parameters g are defined as θ θ kθk g = 2tan = 2 tan (A.17) 2 kθk 2     The corresponding expression for the orientation matrix is 4 1 R = I + g × + g × g × (A.18) 4+ gT g 2  

Homework A.4 (Equivalence of orientation matrices from Euler vector and Euler-Rodrigues pa- rameters). Show that the orientation matrix obtained using the Euler-Rodrigues is equivalent to that obtained using the Euler vector.

A-3 An interesting aspect of the CGR parameters is that for “small” (infinitesimal) values of the param- eters, the formulation is equivalent to that of the Euler vector; namely, for kgk≈ 0, 1 R ≈ I + g × + g × g × (A.19) 2 which is exactly equivalent to the expression resulting from the Euler vector parametrization.

Homework A.5 (Linear approximation of rotation matrix). Formulate a linear approximation of the rotation matrix.

Homework A.6 (Error of linear approximation of rotation matrix). Compute the error in the linear approximation of the rotation matrix (Hint: exploit the orthogonality of rotation matrices).

Homework A.7 (Error of quadratic approximation of rotation matrix). Compute the error in the quadratic approximation of the rotation matrix (Hint: exploit the orthogonality of rotation matrices).

A.1.4 Euler-Rodrigues Parameters and Quaternions

The rotation is described by the 4 Euler-Rodrigues (ER) parameters, e0, e1, e2, e3, collected in a vector

e0 e g =  1  (A.20) e  2   e3    which are subjected by the normality condition T 2 2 2 2 g g = e0 + e1 + e2 + e3 = 1 (A.21) Alternative representations indicate them as cos(θ/2) n sin(θ/2) g =  1  (A.22) n sin(θ/2)  2   n3 sin(θ/2)    where θ is the magnitude of the rotation and n1, n2, n3 are the director cosines of the rotation axis, n, T 2 2 2 subjected to the constraint n n = n1 + n2 + n3 = 1. The orientation matrix is defined as 2 2 2 2 e0 + e1 − e2 − e3 2(e1e2 − e0e3) 2(e1e3 + e0e2) 2 2 2 2 R = 2(e1e2 + e0e3) e0 − e1 + e2 − e3 2(e2e3 − e0e1) (A.23)  2 2 2 2  2(e1e3 − e0e2) 2(e1e3 + e0e2) e0 − e1 − e2 + e3   Alternatively, in vector form,

R = I + 2e0w × + 2w × w × (A.24)

where w = {e1; e2; e3} = sin(θ/2)n. The relationship of ER with quaternions is apparent when considering that an ER set of parameters can be interpreted as the scalar part (e0) and the vector part (e1, e2, e3) of a unit length (or versor) quaternion e0 + e1i + e2j + e3k, with ii = jj = kk = −1 and ij = −ji = k, jk = −kj = i, and 2 2 2 2 ki = −ik = j, subjected to the constraint e0 + e1 + e2 + e3 = 1. The analogy with quaternions is particularly important because their multiplication corresponds to rotation composition, i.e. the rotation resulting from a sequence of two rotations is described by the quaternion resulting from the multiplication of the quaternions that express the two rotations.

A-4 Homework A.8 (Quaternion multiplication and rotation composition). Using quaternion multipli- cation, compute the ER parameters resulting from two consecutive rotations.

A.2 Parametrization of Angular Velocity A.2.1 Euler Angles Matrix G can be easily obtained by considering the partial derivatives of matrix R with respect to each angle, multiplied by the transpose of matrix R. By construction, each of them is a skew-symmetric T matrix, whose vector representation is the corresponding column of matrix G: G(:,i) = ax(R/θi R ). 3–1–3: 0 cos α sin α sin β G = 0 sin α − cos α sin β (A.25)  1 0 cos β    1–2–3: 1 0 sin β G = 0 cos α − sin α cos β (A.26)  0 sin α cos α cos β    3–2–1: 0 − sin α cos α cos β G = 0 cos α sin α cos β (A.27)  1 0 − sin β    A.2.2 Euler Vector

1 − cos kθk 1 sin kθk G = I + 2 θ × + 2 − 3 θ × θ × (A.28) kθk kθk kθk !

Notice that for kθk≈ 0

1 G ≈ I + θ × (A.29) 2 TODO

A.2.3 Cayley-Gibbs-Rodrigues Parameters

4 1 G = I + g × (A.30) 4+ gT g 2   Notice that, again, for kgk≈ 0,

1 G ≈ I + g × (A.31) 2 i.e. the same relationship of Eq. (A.29) for the Euler vector.

A-5 A.2.4 Euler-Rodrigues Parameters and Quaternions

ω = 2Eg˙ (A.32)

with

−e1 e0 −e3 e2 E = −e2 e3 e0 −e1 = −w e0I + w × (A.33)  −e −e e e  3 2 1 0     and

e˙0 e˙ g˙ =  1  (A.34) e˙  2   e˙3    The symbol E has been used because, in quaternions and rotations literature, matrix G, defined as

−e1 e0 e3 −e2 G = −e2 −e3 e0 e1 = −w e0I − w × (A.35)  −e e −e e  3 2 1 0     is associated with the angular velocity in the local reference frame, namely

RT ω = 2Gg˙ (A.36)

Homework A.9 (Properties of quaternions derivatives–1). Prove that GGT = I.

Homework A.10 (Properties of quaternions derivatives–2). Prove that R = EGT .

Homework A.11 (Angular velocity in local frame using quaternions). Prove Eq. (A.36).

A-6 Appendix B

Lagrange Equations of the Second Kind and Virtual Work Principle

B.1 Contribution of the Inertia Forces

Consider

pcm = pcm(q,t) (B.1)

vcm = pcm/qq˙ + pcm/t (B.2)

δpcm = pcm/qδq (B.3) The contribution to the virtual work associated with the inertia forces:

T δWine = −δpcmmacm d = −δqT pT m p q˙ + p cm/q dt cm/q cm/t   T T d T d = −δq pcm/qm pcm/qq˙ + pcm/t − pcm/q m pcm/qq˙ + pcm/t dt dt !   h  i   T  d ∂  pcm/qq˙ + pcm/t m pcm/qq˙ + pcm/t  dt  ∂q˙ !   = −δqT        T    d ∂    − p m p q˙ + p  dt∂q cm cm/q cm/t  !       T T  T  d ∂ ∂ d  = −δq vcm mvcm − pcm mvcm dt  ∂q˙ !  ∂q dt !      T  d ∂ 1 T ∂ 1 T  = −δq mvcmvcm − mvcmvcm (dt "∂q˙ 2 !# ∂q 2 !)

T d ∂ ∂ = −δq Ek − Ek (B.4) "dt ∂q˙ ! ∂q # For the arbitrariness of the virtual perturbations of the coordinates, the generalized inertia forces, ener- getically conjugated to the coordinates q, stem from

d ∂ ∂ f ineq = − Ek − Ek (B.5) "dt ∂q˙ ! ∂q #

B-1 It is worth noticing that, when the cartesian positions of bodies, p, are used as coordinates (regardless of being the positions of the center of mass or of an arbitrary point), then pcm/q ≡ I; the above expressions greatly simplify. The resulting equations, being energetically conjugated to a virtual displacement instead of a virtual perturbation of generalized coordinates, are true force equilibrium equations, rather than generalized equilibrium equations.

B.2 Contribution of the Inertia Moments

Consider now

g = g(q,t) (B.6)

g˙ = g/qq˙ + g/t (B.7)

ω = Gg˙ = G g/qq˙ + g/t (B.8)   δg = g/qδq (B.9)

θδ = Gδg = Gg/qδq (B.10)

The contribution to the virtual work associated with the inertia moments is

T δWine = −θδ (Jcmω˙ + ω × Jcmω)

T T T d = −δq g/qG Jcm (Gg˙ )+(Gg˙ ) × Jcm (Gg˙ ) " dt #

T T T d T T = −δq g/qG Jcm (Gg˙ )+ g/qG (Gg˙ ) × Jcm (Gg˙ ) ( dt )

T d T T d T T T T = −δq g/qG Jcm (Gg˙ ) − g/qG Jcm (Gg˙ )+ g/qG (Gg˙ ) × Jcm (Gg˙ ) (dt dt ) h i   d T T d T T g/qG Jcm (Gg˙ ) − g/qG Jcm (Gg˙ ) = −δqT dt dt  h d i     − gT GT (J )(Gg˙ )+ gT GT (Gg˙ ) × J (Gg˙ )   /q dt cm /q cm  d d  T T T T  T g/qG Jcm (Gg˙ ) − g/qG Jcm (Gg˙ ) = −δq dt dt ✭✭  T ✭✭✭ ✭✭✭ T ✭✭✭  − gT G [✭(G✭g˙ )✭h× J +✭J ✭(✭Gg˙i) ×T ](Gg˙ )+ gT G ✭(G✭g˙✭) × J (Gg˙ )  /q cm cm ✭/✭q ✭ cm  d ∂ T d T  ˙ T T T  = −δq g/qq + g/t G Jcm (Gg˙ ) − g/qG Jcm (Gg˙ ) (dt "∂q˙ # dt )     T T T d ∂ = −δq ω Jcmω − ω/q + ω × Gg/q Jcm (Gg˙ ) dt  ∂q˙ !         T  d ∂ 1 T ∂ 1 T  = −δq ω Jcmω − ω Jcmω (dt "∂q˙ 2 !# ∂q 2 !)

T d ∂ ∂ = −δq Ek − Ek (B.11) "dt ∂q˙ ! ∂q #

B-2 where

T Gg × = R/ R (B.12) /qi qi   d d T d T Gg/q × = R/q R + R/q R dt i dt i i dt h  i ∂ d    = R RT + R RT ω×T /qi ∂qi dt ! ∂ = (ω × R) RT + R RT ω×T /qi ∂qi = ω × RRT + ω × R RT + R RT ω×T /qi /qi /qi T = ω/ × + ω × Gg × + Gg × ω× qi /qi /qi     = ω/ × + ω × Gg × (B.13) qi /qi h  i thus d Gg/q = ω/q + ω × Gg/q (B.14) dt i i i   and since

∂ 1 T T T T ω Jcmω = ω Jcmω + ω R/q R Jcmω /qi i ∂qi 2 ! T T = ω Jcmω + ω Gg × Jcmω /qi /qi  T  = ω/ + ω × Gg Jcmω (B.15) qi /qi   For the arbitrariness of the virtual perturbations of the coordinates, the generalized inertia moments, energetically conjugated to the coordinates q, also stem from

d ∂ ∂ mineq = − Ek − Ek (B.16) "dt ∂q˙ ! ∂q #

It is worth noticing that, when any of the three-parameter orientation parameters of the bodies, g, are used as coordinates, then g/q ≡ I; the above expressions greatly simplify. In this case, all equations related to moments about the node are premultiplied by GT (actually, by δgT GT ); as such, the pre- multiplication by G can be eliminated (with limitations in case total rotations are used, since in those cases matrix G may become singular). Eliminating G is equivalent to recombining the corresponding three equations, or to considering θδ = Gδg as virtual perturbation instead of δg. The resulting equa- tions, being energetically conjugated to a virtual rotation instead of a virtual perturbation of rotation parameters, are true moment equilibrium equations, rather than generalized equilibrium equations.

B-3 B-4 Bibliography

[1] P. Masarati,“A formulation of kinematic constraints imposed by kinematic pairs using relative pose in vector form,” Multibody System Dynamics, vol. 29, no. 2, pp. 119–137, 2013. doi:10.1007/s11044- 012-9320-0.

[2] O. A. Bauchau, Flexible Multibody Dynamics. Dordrecht, Heidelberg, London, New-York: Springer, 2010.

[3] O. A. Bauchau and L. Trainelli, “The vectorial parameterization of rotation,” Nonlinear Dynamics, vol. 32, pp. 71–92, April 2003. doi:10.1023/A:1024265401576.

[4] T. Merlini and M. Morandini, “On successive differentiations of the rotation tensor: An application to nonlinear beam elements,” J. of Mechanics of Materials and Structures, vol. 8, no. 5–7, pp. 305– 340, 2013. doi:10.2140/jomms.2013.8.305.

[5] I. Newton, “Philosophiae naturalis principia mathematica,” 1687.

[6] L. Euler, Theoria Motus Corporum Solidorum seu Rigidorum. Rostochii et Gryphiswaldiae, 1765.

[7] J. L. Lagrange, M´ecanique Analytique. Paris: L’Acad´emie Royal des Sciences, 1788.

[8] C. F. Gauss, “Ueber ein neues algemeines Grundgesetz der Mechanik,” J. fuer die reine und ange- wandte Mathematik, vol. 4, pp. 232–235, 1829. In German.

[9] P. Masarati, M. Morandini, and P. Mantegazza, “An efficient formulation for general-purpose multi- body/multiphysics analysis,” J. of Computational and Nonlinear Dynamics, vol. 9, no. 4, p. 041001, 2014. doi:10.1115/1.4025628.

[10] P. Masarati, M. Lanz, and P. Mantegazza, “Multistep integration of ordinary, stiff and differential- algebraic problems for multibody dynamics applications,” in XVI Congresso Nazionale AIDAA, (Palermo), pp. 71.1–10, 24–28 September 2001.

[11] W. Schiehlen,“Multibody system dynamics: Roots and perspectives,” Multibody System Dynamics, vol. 1, pp. 149–188, June 1997. doi:10.1023/A:1009745432698.

[12] O. A. Bauchau and A. Laulusa, “Review of contemporary approaches for constraint enforce- ment in multibody systems,” J. of Computational and Nonlinear Dynamics, vol. 3, January 2008. doi:10.1115/1.2803258.

[13] P. Masarati and M. Morandini, “An ideal homokinetic joint formulation for general-purpose multi- body real-time simulation,” Multibody System Dynamics, vol. 20, pp. 251–270, October 2008. doi:10.1007/s11044-008-9112-8.

[14] R. S. Hartenberg and J. Denavit, Kinematic synthesis of linkages. McGraw-Hill, 1964.

[15] J. Angeles, Spatial Kinematic Chains. Berlin: Springer, 1982.

[16] J. Angeles, Fundamentals of Robotic Mechanical Systems — Theory, Methods, and Algorithms. Springer, 3rd ed., 2007.

B-5 [17] J. Garc´ıa de Jal´on, M. A. Serna, and R. Avil´es, “Computer method for kinematic analysis of lower- pair mechanisms — I velocities and accelerations,” Mech. Mach. Theor., vol. 16, no. 5, pp. 543–556, 1981. doi:10.1016/0094-114X(81)90026-4.

[18] J. Garc´ıa de Jal´on and E. Bayo, Kinematic and Dynamic Simulation of Multibody Systems: the Real Time Challenge. New York: Springer-Verlag, 1994.

[19] D. Garc´ıa-Vallejo, J. Mayo, J. L. Escalona, and J. Dom´ınguez, “Modelling three-dimensional rigid- flexible multibody systems by using absolute coordinates,” in 12th IFToMM World Congress, (Be- san¸con, France), pp. 1–6, June 18–21 2007.

[20] D. Garc´ıa-Vallejo, J. M. J. L. Escalona, and J. Dom´ınguez, “Describing rigid-flexible multibody systems using absolute coordinates,” Nonlinear Dynamics, vol. 34, no. 1–2, pp. 75–94, 2003. doi:10.1023/B:NODY.0000014553.98731.8d.

[21] H. Sugiyama, J. L. Escalona, and A. A. Shabana, “Formulation of three-dimensional joint constraints using the absolute nodal coordinates,” Nonlinear Dynamics, vol. 31, no. 2, pp. 167–195, 2003. doi:10.1023/A:1022082826627.

[22] B. A. Hussein, D. Weed, and A. A. Shabana,“Clamped end conditions and cross section deformation in the finite element absolute nodal coordinate formulation,” Multibody System Dynamics, vol. 21, no. 4, pp. 375–393, 2009. doi:10.1007/s11044-009-9146-6.

[23] H. Sugiyama and H. Yamashita, “Spatial joint constraints for the absolute nodal coordinate for- mulation using the non-generalized intermediate coordinates,” Multibody System Dynamics, vol. 26, no. 1, pp. 15–36, 2011. doi:10.1007/s11044-010-9236-5.

[24] G. A. Maggi, Principii di stereodinamica: Corso sulla formazione, l’interpretazione e l’integrazione delle equazioni del movimento dei solidi. Milano: Hoepli, 1903. In Italian.

[25] T. R. Kane and C. F. Wang,“On the derivation of equations of motion,” J. Soc. Ind. Appl. Math., vol. 13, no. 2, pp. 487–492, 1965.

[26] M. Borri, C. Bottasso, and P. Mantegazza, “Equivalence of Kane’s and Maggi’s equations,” Mecca- nica, vol. 25, no. 4, pp. 272–274, 1990. doi:10.1007/BF01559692.

[27] S. S. Kim and M. J. Vanderploeg, “QR decomposition for state space representation of con- strained mechanical dynamic systems,” J. of Mech. Trans., vol. 108, no. 2, pp. 183–188, 1986. doi:10.1115/1.3260800.

[28] C. W. Gear, B. Leimkuhler, and G. K. Gupta, “Automatic integration of Euler-Lagrange equa- tions with constraints,” J. Comp. Appl. Math., vol. 12&13, pp. 77–90, 1985. doi:10.1016/0377- 0427(85)90008-1.

[29] C. Fuhrer¨ and B. J. Leimkuhler, “Numerical solution of differential-algebraic equations for constrained mechanical motion,” Numerische Mathematik, vol. 59, pp. 55–69, December 1991. doi:10.1007/BF01385770.

[30] J. Baumgarte, “Stabilization of constraints and integrals of motion in dynamical systems,” Comput. Meth. Appl. Mech. Engng., vol. 1, pp. 1–36, 1972. doi:10.1016/0045-7825(72)90018-7.

[31] E. Bayo, J. G. de Jal´on, and M. A. Serna, “A modified Lagrangian formulation for the dynamic analysis of constrained mechanical systems,” Comput. Meth. Appl. Mech. Engng., vol. 71, no. 2, pp. 183–195, 1988. doi:10.1016/0045-7825(88)90085-0.

[32] F. Gonz´alez and J. K¨ovecses, “Use of penalty formulations in dynamic simulation and analysis of redundantly constrained multibody systems,” Multibody System Dynamics, vol. 29, no. 1, pp. 57–76, 2013.

B-6 [33] F. Gonz´alez, P. Masarati, J. Cuadrado, and M. A. Naya, “Assessment of linearization approaches for multibody dynamics formulations,” J. of Computational and Nonlinear Dynamics, vol. 12, no. 4, pp. 041009 1–7, 2017. doi:10.1115/1.4035410.

[34] P. Masarati, “Adding kinematic constraints to purely differential dynamics,” Computational Me- chanics, vol. 47, no. 2, pp. 187–203, 2011. doi:10.1007/s00466-010-0539-4.

[35] P. Masarati, “Constraint stabilization of mechanical systems in ODE form,” Proc. IMechE Part K: J. Multi-body Dynamics, vol. 225, no. 1, pp. 12–33, 2011. doi:10.1177/2041306810392117.

[36] E. Hairer and G. Wanner, Solving Ordinary Differential Equations, vol. II. Berlin Heidelberg, Germany: Springer-Verlag, 1996. 2nd rev. ed.

[37] M. Borri, L. Trainelli, and A. Croce,“The embedded projection method: A general index reduction procedure for constrained system dynamics,” Comput. Meth. Appl. Mech. Engng., vol. 195, pp. 6974– 6992, 2006. doi:10.1016/j.cma.2005.03.010.

[38] D. J. Braun and M. Goldfarb,“Eliminating constraint drift in the numerical simulation of constrained dynamical systems,” Comput. Meth. Appl. Mech. Engng., vol. 198, no. 37–40, pp. 3151–3160, 2009. doi:10.1016/j.cma.2009.05.013.

[39] A. Ben-Israel and T. N. E. Greville, Generalized inverses: theory and applications. New York: Wiley, 1974.

[40] E. Eich, “Convergence results for a coordinate projection method applied to mechanical systems with algebraic constraints,” SIAM Journal on Numerical Analysis, vol. 30, pp. 1467–1482, October 1993. doi:10.1137/0730076.

[41] Q. Yu and I.-M. Chen,“A direct violation correction method in numerical simulation of constrained multibody systems,”Computational Mechanics, vol. 26, pp. 52–57, 2000. doi:10.1007/s004660000149.

B-7