1 Introduction

The motion of mechanical systems subject to holonomic constraints is governed by differential–algebraic equations (DAEs) with differentiation index three (cf. [1, 2]). These DAEs are known to be prone to numerical instabilities. The GGL stabilization due to Gear, Leimkuhler and Gupta [3] yields an index reduction by taking into account the hidden constraints on velocity level. In particular, the GGL stabilization achieves an index reduction by minimal extension [1] and facilitates a stable numerical integration of the resulting index 2 DAEs.

Since, apart from the index reduction property, the GGL stabilization does not suffer from the drift off phenomenon [2], it gained high popularity over the last decades. In fact, the GGL stabilization has been widely used in the design of numerical methods for constrained mechanical systems. For example, the GGL stabilization is frequently used in the computer simulation of flexible multibody dynamics [2, 4, 5]. It has been shown to be advantageous for the numerical solution of optimal control problems of multibody systems [6, 7]. Moreover, it has been employed in the design of DAE Lie group methods [8]. Related works on constrained mechanical systems benefiting from the usage of velocity constraints have been developed in [9, 10].

In the past, a number of structure-preserving schemes has been developed for the numerical integration of constrained mechanical systems. Representative examples are symplectic integrators [11,12,13] and energy–momentum schemes [14,15,16,17]. These methods typically rely on a direct discretization of the constrained equations of motion in the Hamiltonian framework. In the present work, we follow another path towards the design of structure-preserving integrators, which is based on Livens principle. This variational principle can be traced back to Livens [18] (see also Pars [19]), where it has been formulated in the context of mechanical systems without constraints. In recent times, Livens principle has also been termed Hamilton–Pontryagin principle (see [20,21,22]) due to its close relation with optimal control problems.

In the present work, we propose an extension of Livens principle to mechanical systems subject to holonomic constraints. The Euler–Lagrange equations of the newly devised variational principle yield an index reduction of the underlying DAEs to index 2 in the spirit of the GGL stabilization. Therefore, we choose the name GGL principle for the novel variational principle, which accounts for both position constraints and hidden velocity constraints. In contrast to the original GGL stabilization, the availability of the GGL variational principle makes possible the design of variational integrators (VIs). VIs rely on the direct discretization of the underlying variational functional [23,24,25]. We stress that previously developed VIs for constrained mechanical systems such as [23] do not rely on GGL-type stabilization, which hinges on a suitable modification of the underlying continuous formulation. VIs are typically symplectic and capable of conserving momentum maps in the case of systems with symmetry. In addition to that, we show that the Euler–Lagrange equations of the GGL principle facilitate the design of energy–momentum (EM) schemes. EM schemes typically rely on the notion of a discrete derivative [26,27,28] and are capable of conserving the system’s total energy and momentum maps.

The remainder of this work is structured as follows. Section 2 contains an outline of Livens principle and a summary of the original GGL stabilization approach to constrained mechanical systems. In addition to that, structural properties of interest are summarized. In Sect. 3, the newly proposed GGL variational principle for constrained mechanical systems is introduced. Novel VIs based on the GGL principle are devised in Sect. 4. In addition to that, a new EM scheme resulting from the discretization of the Euler–Lagrange equations of the GGL principle is presented in Sect. 5. In Sect. 6, the properties of the time-stepping schemes at hand are investigated in the context of representative numerical examples. Eventually, conclusions are drawn in Sect. 7.

2 Fundamentals

This section contains an outline of important relationships required for the subsequent developments.

2.1 Livens principle

Consider a dynamical system with d degrees of freedom and generalized coordinates \(\textbf{q} \in \hat{{\mathcal {Q}}}\). Within the time interval \({\mathcal {I}} = [0,T]\), the trajectory on the configuration space \(\hat{{\mathcal {Q}}}\) is characterized by \(\textbf{q}:{\mathcal {I}}\rightarrow \hat{{\mathcal {Q}}}\). The corresponding velocities \(\textbf{v} \in T_{\varvec{q}} \hat{{\mathcal {Q}}}\) can be used as independent variables in Hamilton’s principle of least action. To this end, the kinematic relation \(\dot{\textbf{q}} = \textbf{v}\) is appended to the Lagrangian by using Lagrange multipliers \(\textbf{p} \in T_{\varvec{q}}^* \hat{{\mathcal {Q}}}\). The corresponding augmented action integral reads

$$\begin{aligned} {S}(\textbf{q},\textbf{v},\textbf{p}) = \int _0^T \left[ L(\textbf{q},\textbf{v}) + \textbf{p} \cdot (\dot{\textbf{q}} - \textbf{v}) \right] \, \textrm{d}t\ \text {,} \end{aligned}$$
(1)

where \(L(\textbf{q},\textbf{v}): T\hat{{\mathcal {Q}}} \rightarrow {\mathbb {R}}\) is the Lagrangian. The functional (1) can be linked to Livens theorem (cf. Section 26.2 in Pars [19]) which goes back to Livens [18]. More recently, the term Hamilton–Pontryagin principle has been used [20,21,22] in allusion to the close relation with optimization problems for dynamical systems (cf. Bryson and Ho [29]).Footnote 1 Livens principle unifies both Lagrangian and Hamiltonian viewpoints on mechanics and automatically accounts for the Legendre transformation.

By stating the stationary condition \(\delta {S}(\textbf{q},\textbf{v},\textbf{p}) = 0\) and performing the variations with respect to every independent variable, one obtains the Euler–Lagrange equations in the form

$$\begin{aligned} \dot{\textbf{q}}&= \textbf{v} \!\ \text {,} \end{aligned}$$
(2a)
$$\begin{aligned} \dot{\textbf{p}}&= \textrm{D}_1 L(\textbf{q},\textbf{v})\! \ \text {,} \end{aligned}$$
(2b)
$$\begin{aligned} \textbf{p}&= \textrm{D}_2 L(\textbf{q},\textbf{v})\! \ \text {.}\end{aligned}$$
(2c)

Note that integration by parts and the usual endpoint conditions \(\delta \textbf{q}(0) = \delta \textbf{q}(T) = \textbf{0}\) have been employed. Moreover, \(\textrm{D}_j L(\textbf{q},\textbf{v})\) stands for the partial derivative of function L with respect to the j’s argument.

With regard to (2c), the multiplier \(\textbf{p}\) can be identified as the conjugate momentum. Accordingly, the Legendre transformation is built into the variational principle via its fiber derivative. Note that after substituting (2c) for \(\textbf{p}\) in (2b) and making use of (2a), Livens principle traces back to the Lagrange equations.

In the present work, we focus on mechanical systems whose Lagrangian takes the form

$$\begin{aligned}&L(\textbf{q},\textbf{v}) = \frac{1}{2}\textbf{v}\cdot \textbf{M}\textbf{v}-V(\textbf{q}) \ \text {.}\end{aligned}$$
(3)

Here, \(\textbf{M} \in {\mathbb {R}}^{d \times d}\) is a symmetric, positive-definite mass matrix and \(V: \hat{{\mathcal {Q}}} \rightarrow {\mathbb {R}}\) is a potential function. Introducing the total energy function

$$\begin{aligned}&E(\textbf{q},\textbf{v},\textbf{p}) = \textbf{p} \cdot \textbf{v} - L(\textbf{q},\textbf{v}) \ \text {,}\end{aligned}$$
(4)

variational functional (1) can be recast in the form

$$\begin{aligned}&{S}(\textbf{q},\textbf{v},\textbf{p}) = \int _0^T \left[ \textbf{p} \cdot \dot{\textbf{q}} - E(\textbf{q},\textbf{v},\textbf{p}) \right] \, \textrm{d}t\ \text {.}\end{aligned}$$
(5)

Remark 1

Making use of (2c), the velocities can be expressed in terms of the coordinates \(\textbf{q}\) and conjugate momenta \(\textbf{p}\), i.e., \(\textbf{v} = \tilde{\textbf{v}}(\textbf{q},\textbf{p})\). Thus, it is possible to eliminate the velocities from the formulation such that the generalized energy (4) can be identified as the Hamiltonian

$$\begin{aligned} H(\textbf{q},\textbf{p}) = E(\textbf{q},\tilde{\textbf{v}}(\textbf{q},\textbf{p}),\textbf{p}) \ \text {.}\end{aligned}$$
(6)

In the case of mechanical systems with Lagrangian of the form (3), one obtains

$$\begin{aligned} H(\textbf{q},\textbf{p}) = \frac{1}{2}\textbf{p}\cdot \textbf{M}^{-1}\textbf{p}+V(\textbf{q}) \ \text {.}\end{aligned}$$
(7)

Substituting (6) into (5), the two-field variational principle

$$\begin{aligned} {\tilde{S}}(\textbf{q},\textbf{p}) = \int _0^T \left[ \textbf{p} \cdot \dot{\textbf{q}} - H(\textbf{q},\textbf{p}) \right] \, \textrm{d}t\end{aligned}$$
(8)

remains, which is sometimes referred to as the modified Hamilton’s principle (e.g., Sect. 8–5 in Goldstein [31]). The Euler–Lagrange equations corresponding to the modified Hamilton’s principle are given by

$$\begin{aligned} \dot{\textbf{q}}&= \textrm{D}_2 H(\textbf{q},\textbf{p}) \ \text {,}\end{aligned}$$
(9a)
$$\begin{aligned} \dot{\textbf{p}}&= -\textrm{D}_1 H(\textbf{q},\textbf{p}) \ \text {,}\end{aligned}$$
(9b)

and thus take the form of Hamilton’s canonical equations of motion.

2.2 Structural properties

Next, we outline main structural properties of mechanical systems in the context of the equations of motion (2) emanating from Livens principle. These properties will also play a crucial role in the subsequent treatment of constrained mechanical systems.

2.2.1 Symmetries and momentum maps

Consider a one-parameter family of curves \(\textbf{q}^\alpha (t)\) in configuration space \(\hat{{\mathcal {Q}}}\) with \(\textbf{q}^0(t) = \textbf{q}(t)\). Conforming with (2a), we introduce \(\textbf{v}^\alpha (t) = \dot{\textbf{q}}^{\alpha }(t)\). The corresponding infinitesimal generators are defined by

$$\begin{aligned} \mathbf {\xi }_{\mathcal {Q}}= & {} \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{q}^\alpha (t)\ \text {,} \end{aligned}$$
(10a)
$$\begin{aligned} \mathbf {\xi }_{\mathcal {V}}= & {} \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{v}^\alpha (t)\ \text {.} \end{aligned}$$
(10b)

The mechanical system has symmetry if at all times t the condition

$$\begin{aligned} L(\textbf{q}^\alpha (t),\textbf{v}^\alpha (t)) = L(\textbf{q}(t),\textbf{v}(t)) \end{aligned}$$
(11)

holds. Correspondingly, the infinitesimal symmetry condition is given by

$$\begin{aligned} \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0}&L(\textbf{q}^\alpha ,\textbf{v}^\alpha ) \nonumber \\ {=}&\,\textrm{D}_1 L(\textbf{q},\textbf{v}) \cdot \mathbf {\xi }_{\mathcal {Q}} ~{+}~ \textrm{D}_2 L(\textbf{q},\textbf{v}) \cdot \mathbf {\xi }_{\mathcal {V}}\, {=}\,0 \ \text {.}\end{aligned}$$
(12)

According to Noether’s theorem, each symmetry of the system leads to the conservation of an associated momentum map. This can be verified by resorting to the equations of motion (2). Scalar multiplying (2b) by \(\mathbf {\xi }_{\mathcal {Q}}\) and (2c) by \(\mathbf {\xi }_{\mathcal {V}}\) and subsequently adding both resulting equations yield

$$\begin{aligned} \dot{\textbf{p}}\cdot \mathbf {\xi }_{\mathcal {Q}} + \textbf{p}\cdot \mathbf {\xi }_{\mathcal {V}} =0 \ \text {,}\end{aligned}$$
(13)

where symmetry condition (12) has been used. Since (2a) together with (10) implies \(\mathbf {\xi }_{\mathcal {V}} = \dot{\mathbf {\xi }}_{\mathcal {Q}}\), (13) gives rise to

$$\begin{aligned} \dot{\textbf{p}}\cdot \mathbf {\xi }_{\mathcal {Q}} + \textbf{p}\cdot \dot{\mathbf {\xi }}_{\mathcal {Q}} = \frac{\,\textrm{d}}{\,\textrm{d}t}\left( \textbf{p}\cdot \mathbf {\xi }_{\mathcal {Q}} \right) =0 \ \text {,}\end{aligned}$$
(14)

so that the momentum map

$$\begin{aligned} J_{\varvec{\xi }} {:}{=} \textbf{p}\cdot \mathbf {\xi }_{\mathcal {Q}} \end{aligned}$$
(15)

is a conserved quantity.

We are particularly interested on curves

$$\begin{aligned} \textbf{q}^\alpha (t) = \textbf{A}^\alpha \textbf{q}(t) \end{aligned}$$
(16)

resulting from the action of a matrix group G on the configuration space \(\hat{{\mathcal {Q}}}\), where \(\textbf{A}^\alpha \in G \subset \textrm{GL}(d,{\mathbb {R}})\), the general linear group of \({\mathbb {R}}^d\). As before, \(\textbf{q}^0(t) = \textbf{q}(t)\), which implies \(\textbf{A}^0 = \textbf{I}\), where \(\textbf{I}\) is the \(d\times d\) identity matrix. Now, the infinitesimal generator (10a) assumes the specific form

$$\begin{aligned} \mathbf {\xi }_{\mathcal {Q}} = \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{q}^\alpha (t) = \mathbf {\xi }\textbf{q} \ \text {,}\end{aligned}$$
(17)

where \(\mathbf {\xi }\in {\mathfrak {g}}\), the Lie algebra of G. With regard to (2a), we further obtain

$$\begin{aligned} \textbf{v}^\alpha (t) = \textbf{A}^\alpha \textbf{v}(t) \end{aligned}$$
(18)

together with

$$\begin{aligned} \mathbf {\xi }_{\mathcal {V}} = \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{v}^\alpha (t) = \mathbf {\xi }\textbf{v} \ \text {.}\end{aligned}$$
(19)

Moreover, (2c) implies \(\textbf{p}^\alpha = \textrm{D}_2 L(\textbf{q}^\alpha ,\textbf{v}^\alpha )\). Thus, making use of symmetry property (11), one obtains

$$\begin{aligned} \textbf{p}^\alpha (t) = \textbf{A}^{\alpha ^{-T}}\textbf{p}(t) \ \text {,}\end{aligned}$$
(20)

from which follows the corresponding infinitesimal generator

$$\begin{aligned} \mathbf {\xi }_{\mathcal {P}} = \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{p}^\alpha (t) = -\mathbf {\xi }^T\textbf{p} \ \text {.}\end{aligned}$$
(21)

We eventually remark that the symmetry properties considered above imply the invariance of the energy function (4). That is, \(E(\textbf{q}^\alpha ,\textbf{v}^\alpha ,\textbf{p}^\alpha ) = E(\textbf{q},\textbf{v},\textbf{p})\).

2.2.2 Conservation of energy

In the case of an autonomous Lagrangian, the total energy of the mechanical system is conserved. Differentiating energy function (4) with respect to time yields

$$\begin{aligned} \frac{\,\textrm{d}}{\,\textrm{d}t} E\, {=}\, \dot{\textbf{p}} \cdot \textbf{v} ~{-}~ \textrm{D}_1 L(\textbf{q},\textbf{v})\cdot \dot{\textbf{q}} \,{+} \,\left( \textbf{p} ~{-}~ \textrm{D}_2 L(\textbf{q},\textbf{v})\right) \cdot \dot{\textbf{v}}\ \text {.}\nonumber \\ \end{aligned}$$
(22)

Taking into account the Euler–Lagrange equations (2), one obtains \({\dot{E}} = 0\), so that the total energy is a conserved quantity.

2.2.3 Symplecticness

The flow generated by the equations of motion (2) is symplectic. It is convenient to define symplecticness by expressing the symplectic two-form in terms of the exterior or wedge product (Sanz-Serna and Calvo [32], Leimkuhler and Reich [13]). Accordingly,

(23)

where \(\,\textrm{d}\textbf{q}\) and \(\,\textrm{d}\textbf{p}\) represent differentials of the coordinates \(\textbf{q}\) and momenta \(\textbf{p}\), respectively. Important properties of the wedge product are summarized in Appendix A.1. Correspondingly, the property of symplecticness is equivalent to the fact that the symplectic two-form is conserved along solution trajectories of the equations of motion (2), i.e., . For completeness, this is verified in Appendix A.2.

2.3 Constrained dynamics and classical GGL stabilization

Assume that the coordinates \(\textbf{q}\) are redundant due to the presence of m independent scleronomic, holonomic constraints. Arranging the constraint functions \(g_k: {\mathbb {R}}^d \rightarrow {\mathbb {R}}\) (\(k=1,\ldots ,m\)) in a column vector \(\textbf{g} \in {\mathbb {R}}^m\), the constraints are given by

$$\begin{aligned} \textbf{g}(\textbf{q}) = \textbf{0} \ \text {.}\end{aligned}$$
(24)

The constraint functions are assumed to be independent, so that the constraint Jacobian \(\textbf{G}(\textbf{q}) = \textrm{D}\textbf{g}(\textbf{q})\) has rank m. Note that the constraints give rise to the configuration manifold

$$\begin{aligned} {\mathcal {Q}} = \left\{ \textbf{q} \in {\mathbb {R}}^d \;\vert \; \textbf{g}(\textbf{q})=\textbf{0} \right\} \ \text {.}\end{aligned}$$
(25)

To get the equations of motion, Livens principle can be augmented to account for the constraints (24). Accordingly, the corresponding functional assumes the form

$$\begin{aligned} {\hat{S}}(\textbf{q},\textbf{v},\textbf{p},\mathbf {\lambda }) = {S}(\textbf{q},\textbf{v},\textbf{p}) + \int \nolimits _0^T\mathbf {\lambda }\cdot \textbf{g}(\textbf{q})\, \textrm{d}t\ \text {,}\end{aligned}$$
(26)

where represents Lagrange multipliers for the enforcement of the constraints. Imposing the stationary conditions on functional (26), the resulting Euler–Lagrange equations are given by

$$\begin{aligned} \dot{\textbf{q}}&= \textbf{v} \ \text {,} \end{aligned}$$
(27a)
$$\begin{aligned} \dot{\textbf{p}}&= \textrm{D}_1 L(\textbf{q},\textbf{v}) - \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\lambda }\ \text {,} \end{aligned}$$
(27b)
$$\begin{aligned} \textbf{p}&= \textrm{D}_2 L(\textbf{q},\textbf{v}) \ \text {,}\end{aligned}$$
(27c)
$$\begin{aligned} \textbf{0}&= \textbf{g}(\textbf{q}) \ \text {.} \end{aligned}$$
(27d)

If we take into account the specific form of the Lagrangian (3), the above equations can be recast in the form

$$\begin{aligned} \dot{\textbf{q}}&= \textbf{v} \ \text {,} \end{aligned}$$
(28a)
$$\begin{aligned} \dot{\textbf{p}}&=-\textrm{D}V(\textbf{q}) - \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\lambda }\ \text {,} \end{aligned}$$
(28b)
$$\begin{aligned} \textbf{p}&= \textbf{M} \textbf{v} \ \text {,}\end{aligned}$$
(28c)
$$\begin{aligned} \textbf{0}&= \textbf{g}(\textbf{q}) \ \text {.} \end{aligned}$$
(28d)

Note that (28c) can be used to eliminate either the velocity \(\textbf{v}\) or the momentum \(\textbf{p}\) from the formulation. It is well known that the above differential algebraic equations (DAEs) have differentiation index 3 (see, for example, [1, 2]). One established way to stabilize numerical integration schemes for constrained mechanical systems is to apply the GGL method [3]. The GGL method also takes into account the secondary (or hidden) constraints on velocity level arising from differentiating the constraints (24) with respect to time and making use of (28a) and (28c). Accordingly, the secondary constraints can be written as \(\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) = \textbf{0}\), where

$$\begin{aligned} \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})&= \textbf{G}(\textbf{q}) \textbf{M}^{-1}\textbf{p} \ \text {.}\end{aligned}$$
(29)

The GGL method relies on the inclusion of the secondary constraints as additional algebraic constraints. This procedure leads to the DAEs

$$\begin{aligned} \dot{\textbf{q}}&= \textbf{M}^{-1}\textbf{p} + \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\gamma } \ \text {,}\end{aligned}$$
(30a)
$$\begin{aligned} \dot{\textbf{p}}&=-\textrm{D}V(\textbf{q}) - \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\lambda }\ \text {,}\end{aligned}$$
(30b)
$$\begin{aligned} \textbf{0}&= \textbf{g}(\textbf{q}) \ \text {,}\end{aligned}$$
(30c)
$$\begin{aligned} \textbf{0}&= \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})\ \text {.} \end{aligned}$$
(30d)

The new variables can be viewed as additional multipliers for the enforcement of the secondary constraints (30d). It is well known [1,2,3] that the DAEs (30) have differentiation index 2. It is important to realize that the inclusion of both the constraints (30c) and (30d) confines the dynamics of the constrained mechanical system to the phase space manifold

$$\begin{aligned} {\mathcal {M}} = \left\{ (\textbf{q},\textbf{p}) \in {\mathbb {R}}^d\times {\mathbb {R}}^d \;\vert \; \textbf{g}(\textbf{q})=\textbf{0},\; \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})=\textbf{0} \right\} \nonumber \\ \end{aligned}$$
(31)

This is a prerequisite for the design of symplectic integrators which preserve the restriction to \({\mathcal {M}}\) of the symplectic two-form (23) in \({\mathbb {R}}^d\times {\mathbb {R}}^d\), see Leimkuhler and Skeel [11]. However, the presence of the extra variable \(\mathbf {\gamma }\) in (30a) essentially hinders the design of structure-preserving integrators. For example, concerning conservation of energy, differentiating the Hamiltonian (7) with respect to time yields

$$\begin{aligned} \frac{\,\textrm{d}}{\,\textrm{d}t}{H}&= \textrm{D}_1 H(\textbf{q},\textbf{p}) \cdot \dot{\textbf{q}} + \textrm{D}_2 H(\textbf{q},\textbf{p}) \cdot \dot{\textbf{p}} \nonumber \\&= \textrm{D}V(\textbf{q}) \cdot \left( \textbf{M}^{-1}\textbf{p} + \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\gamma } \right) \nonumber \\&\quad + (\textbf{M}^{-1}\textbf{p}) \cdot \left( -D V(\textbf{q}) - \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\lambda } \right) \nonumber \\&= \mathbf {\gamma }\cdot \textbf{G}(\textbf{q})\textrm{D}V(\textbf{q}) \ \text {.}\end{aligned}$$
(32)

Accordingly, energy conservation holds under the provision that \(\mathbf {\gamma } = \textbf{0}\), which is true for the time-continuous case [1,2,3]. However, in the discrete setting the discrete counterpart of \(\mathbf {\gamma }\) is in general non-zero, since it is required to impose the velocity constraints. Accordingly, the presence of the extra \(\mathbf {\gamma }\) term in (32) indicates that the design of energy conserving time-stepping schemes is not feasible. Similar conclusions can be made regarding the conservation of the symplectic two-form (see Appendix A.3 for details) as well as the conservation of momentum maps.

3 GGL principle

In this section, we present a new variational principle which achieves an index reduction of the index 3 DAEs (27) in the spirit of the GGL method. We show that the newly introduced GGL variational principle is particularly well suited for the design of structure-preserving numerical methods.

3.1 Governing equations

The GGL variational principle can be viewed as an extension of Livens principle (1). Similar to the GGL stabilization, the GGL principle relies on the introduction of extra Lagrange multipliers which serve the purpose to enforce the secondary constraints (29) in addition to the primary constraints (24). In particular, the GGL principle relies on the augmented action integral

$$\begin{aligned} S_\textrm{GGL} = \int _0^T \big [&L(\textbf{q},\textbf{v}) + \textbf{p} \cdot ( \dot{\textbf{q}} - \textbf{v} ) \nonumber \\&- \mathbf {\lambda } \cdot \textbf{g}(\textbf{q}) - \mathbf {\gamma } \cdot \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \big ] \, \textrm{d}t\ \text {.}\end{aligned}$$
(33)

where the velocity constraint function \(\textbf{g}^{\textbf{v}}\) has previously been introduced in (29). It can be easily observed that functional (33) boils down to Livens augmented action integral (1) if no constraints are present. Imposing the stationary condition

$$\begin{aligned} \delta S_\textrm{GGL}(\textbf{q},\textbf{v},\textbf{p},\mathbf {\lambda },\mathbf {\gamma }) = 0 \end{aligned}$$
(34)

yields

$$\begin{aligned}&\int _0^T \delta \textbf{p} \cdot \left( \dot{\textbf{q}} - \textbf{v} - \textrm{D}_2 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})^\textrm{T}\, \mathbf {\gamma }) \right) \, \textrm{d}t= 0 \ \text {,}\end{aligned}$$
(35a)
$$\begin{aligned}&\int _0^T \Big ( \big ( \textrm{D}_1 L(\textbf{q},\textbf{v}) - \textbf{G}(\textbf{q})^\textrm{T}\mathbf {\lambda } \big ) \cdot \delta \textbf{q} \nonumber \\&\qquad + \textbf{p} \cdot \delta \dot{\textbf{q}} - \delta \textbf{q} \cdot \textrm{D}_1 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})^\textrm{T}\mathbf {\gamma } \Big ) \, \textrm{d}t= 0 \ \text {,}\end{aligned}$$
(35b)
$$\begin{aligned}&\int _0^T \delta \textbf{v} \cdot \left( \textrm{D}_2 L(\textbf{q},\textbf{v}) - \textbf{p} \right) \, \textrm{d}t= 0 \ \text {,}\end{aligned}$$
(35c)
$$\begin{aligned}&\int _0^T \delta \mathbf {\lambda } \cdot \textbf{g}(\textbf{q}) \, \textrm{d}t= 0 \ \text {,}\end{aligned}$$
(35d)
$$\begin{aligned}&\int _0^T \textbf{p} \cdot \textbf{M}^{-1}\, \textbf{G}(\textbf{q})^\textrm{T}\, \delta \mathbf {\gamma } \, \textrm{d}t= 0 \ \text {.}\end{aligned}$$
(35e)

With regard to (35b), we apply integration by parts to obtain

$$\begin{aligned}&\int _0^T \textbf{p}\cdot \delta \dot{\textbf{q}} \, \textrm{d}t= - \int _0^T \delta \textbf{q} \cdot \dot{\textbf{p}} \, \textrm{d}t+ \delta \textbf{q} \cdot \textbf{p} \Big |_0^T \ \text {.}\end{aligned}$$
(36)

Consequently, taking into account the arbitrariness of the variations \(\delta \textbf{q}\), \(\delta \textbf{v}\), \(\delta \textbf{p}\), \(\delta \mathbf {\lambda }\) and \(\delta \mathbf {\gamma }\), as well as considering the usual endpoint conditions \(\delta \textbf{q}(0) = \delta \textbf{q}(T)=0\), we obtain the Euler–Lagrange equations

$$\begin{aligned} \dot{\textbf{q}}&= \textbf{v} + \textrm{D}_2 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})^\textrm{T}\mathbf {\gamma } \ \text {,}\end{aligned}$$
(37a)
$$\begin{aligned} \dot{\textbf{p}}&= \textrm{D}_1 L(\textbf{q},\textbf{v}) - \textrm{D}\textbf{g}(\textbf{q})^\textrm{T}\mathbf {\lambda } - \textrm{D}_1 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})^\textrm{T}\mathbf {\gamma } \ \text {,}\end{aligned}$$
(37b)
$$\begin{aligned} \textbf{p}&= \textrm{D}_2 L(\textbf{q},\textbf{v}) \ \text {,}\end{aligned}$$
(37c)
$$\begin{aligned} \textbf{0}&= \textbf{g}(\textbf{q}) \ \text {,}\end{aligned}$$
(37d)
$$\begin{aligned} \textbf{0}&= \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \ \text {.} \end{aligned}$$
(37e)

It can be concluded from the fiber derivative (37c) that \(\textbf{p}\) represents the conjugate momenta in analogy to the Livens principle. Moreover, it can be observed from (37d) and (37e) that both the primary and the secondary constraints are enforced. The presence of the secondary constraints entails an index reduction in the spirit of the GGL stabilization. In particular, we show in Appendix A.4 that the DAEs (37) (i) have differentiation index 2, and (ii) yield \(\mathbf {\gamma }=\textbf{0}\) in analogy to the classical GGL stabilization. Thus, in the time-continuous setting, the DAEs (37) boil down to the underlying DAEs (27).

Remark 2

Similar to the original Livens principle, \(\textbf{p}\) in the GGL principle (33) plays the role of a Lagrange multiplier for the imposition of the side condition

$$\begin{aligned} \dot{\textbf{q}} = \textbf{f}^{\varvec{\gamma }}(\textbf{q},\textbf{v}) \ \text {,}\end{aligned}$$
(38)

where

$$\begin{aligned} \textbf{f}^{\varvec{\gamma }}(\textbf{q},\textbf{v}) = \textbf{v} + \textbf{G}(\textbf{q}) \textbf{M}^{-1}\mathbf {\gamma } \ \text {,}\end{aligned}$$
(39)

cf. (37a).

Remark 3

The GGL principle (33) is also valid for configuration-dependent mass matrices \(\textbf{M}(\textbf{q})\), implying \(\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) = \textbf{G}(\textbf{q}) \textbf{M}(\textbf{q})^{-1}\textbf{p}\).

Remark 4

There seems to be some ambiguity in the representation of the secondary constraints in functional (33). An alternative form relies on

$$\begin{aligned} {\tilde{S}}_\textrm{GGL} = \int _0^T \big [&L(\textbf{q},\textbf{v}) + \textbf{p} \cdot ( \dot{\textbf{q}} - \textbf{v} ) \nonumber \\&\ \ - \mathbf {\lambda } \cdot \textbf{g}(\textbf{q}) - \mathbf {\gamma } \cdot \widetilde{\textbf{g}}^{\textbf{v}}(\textbf{q},\textbf{v}) \big ] \, \textrm{d}t\ \text {,}\end{aligned}$$
(40)

where the secondary constraints are given by \(\widetilde{\textbf{g}}^{\textbf{v}}(\textbf{q},\textbf{v}) = \textbf{G}(\textbf{q}) \textbf{v}\). This version, however, does not yield the correct equations of motion for constrained mechanical systems. For further details, we refer to Appendix A.5.

3.2 Structural properties

This section contains an outline of the main structural properties of the Euler–Lagrange equations (37) emanating from the GGL principle. These properties are not affected by the additional multiplier \(\mathbf {\gamma }\) as will become obvious in the sequel.

3.2.1 Symmetries and momentum maps

Assume that the Lagrangian has invariance property (11), i.e., \(L(\textbf{q}^\alpha ,\textbf{v}^\alpha ) = L(\textbf{q},\textbf{v})\), where the one-parameter curves \((\textbf{q}^\alpha ,\textbf{v}^\alpha )\) have to comply with the constraints. That is, \(\textbf{q}^\alpha \in {\mathcal {Q}}\) and \(\textbf{v}^\alpha \in T_{\varvec{q}}{\mathcal {Q}}\). Correspondingly, \((\textbf{q}^\alpha ,\textbf{p}^\alpha )\in {\mathcal {M}}\). Now the symmetry of the constrained mechanical system at hand is assumed to be characterized by the infinitesimal symmetry conditions

$$\begin{aligned} 0&= \textrm{D}_1 L(\textbf{q},\textbf{v}) \cdot \mathbf {\xi }_{\mathcal {Q}} + \textrm{D}_2 L(\textbf{q},\textbf{v}) \cdot \mathbf {\xi }_{\mathcal {V}} \ \text {,}\end{aligned}$$
(41a)
$$\begin{aligned} 0&= \textrm{D}_1 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \, \mathbf {\xi }_{\mathcal {Q}} + \textrm{D}_2 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \, \mathbf {\xi }_{\mathcal {P}} \ \text {,}\end{aligned}$$
(41b)
$$\begin{aligned} 0&= \textrm{D}\textbf{g}(\textbf{q}) \, \mathbf {\xi }_{\mathcal {Q}}\ \text {.} \end{aligned}$$
(41c)

Note that (41a) follows from invariance property (11) as has been shown in (12). Similarly, (41b) and (41c) typically follow from invariance properties \(\textbf{g}^{\textbf{v}}(\textbf{q}^\alpha ,\textbf{p}^\alpha )=\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})\) and \(\textbf{g}(\textbf{q}^\alpha )=\textbf{g}(\textbf{q})\), respectively. The symmetry properties (41) give rise to the conservation of an associated momentum map as shown next.

Scalar multiplying (37a) by \((-\mathbf {\xi }_{\mathcal {P}})\), (37b) by \(\mathbf {\xi }_{\mathcal {Q}}\), (37c) by \(\mathbf {\xi }_{\mathcal {V}}\), and subsequently adding the resulting equations yields

$$\begin{aligned} -\mathbf {\xi }_{\mathcal {P}}\cdot \dot{\textbf{q}} + \mathbf {\xi }_{\mathcal {Q}}\cdot \dot{\textbf{p}} + \mathbf {\xi }_{\mathcal {V}}\cdot \textbf{p} = -\mathbf {\xi }_{\mathcal {P}}\cdot \textbf{v} \ \text {,}\end{aligned}$$
(42)

where symmetry conditions (41) have been taken into account. Inserting the infinitesimal generators (17), (19) and (21) into the last equation yields

$$\begin{aligned} (\mathbf {\xi }^T\textbf{p})\cdot \dot{\textbf{q}} + (\mathbf {\xi }\textbf{q})\cdot \dot{\textbf{p}} + (\mathbf {\xi }\textbf{v})\cdot \textbf{p} = (\mathbf {\xi }^T\textbf{p})\cdot \textbf{v} \ \text {,}\end{aligned}$$
(43)

and thus

$$\begin{aligned} 0=\textbf{p}\cdot \mathbf {\xi }\dot{\textbf{q}} + \dot{\textbf{p}}\cdot \mathbf {\xi }\textbf{q} = \frac{\,\textrm{d}}{\,\textrm{d}t}\left( \textbf{p}\cdot \mathbf {\xi }{\textbf{q}}\right) \ \text {.}\end{aligned}$$
(44)

Accordingly, the momentum map

$$\begin{aligned} J_{\varvec{\xi }} = \textbf{p}\cdot \mathbf {\xi }{\textbf{q}} \end{aligned}$$
(45)

is a conserved quantity.

3.2.2 Conservation of energy

Similar to Sect. 2.2.2, we consider the time derivative of the total energy (4) to obtain

$$\begin{aligned} \frac{\,\textrm{d}}{\,\textrm{d}t} E = \dot{\textbf{p}} \cdot \textbf{v} - \textrm{D}_1 L(\textbf{q},\textbf{v})\cdot \dot{\textbf{q}} + \left( \textbf{p} - \textrm{D}_2 L(\textbf{q},\textbf{v})\right) \cdot \dot{\textbf{v}}\ \text {.}\nonumber \\ \end{aligned}$$
(46)

The last term on the right-hand side vanishes due to (37c). Inserting from (37a) for \(\textbf{v}\) and from (37b) for \(\textrm{D}_1 L\) into the last equation yields

$$\begin{aligned} \frac{\,\textrm{d}}{\,\textrm{d}t} E&=-\mathbf {\lambda } \cdot \textrm{D}\textbf{g}(\textbf{q}) \dot{\textbf{q}} \nonumber \\&\qquad -\mathbf {\gamma } \cdot \left( \textrm{D}_1 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \, \dot{\textbf{q}} + \textrm{D}_2 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \, \dot{\textbf{p}} \right) \nonumber \\&= - \mathbf {\lambda } \cdot \frac{\,\textrm{d}}{\,\textrm{d}t}\textbf{g}(\textbf{q}) - \mathbf {\gamma } \cdot \frac{\,\textrm{d}}{\,\textrm{d}t}\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) \nonumber \\&= 0 \ \text {.}\end{aligned}$$
(47)

The last equation holds independently from the Lagrange multipliers \(\mathbf {\lambda }\) and \(\mathbf {\gamma }\) due to the consistency conditions \(\,\textrm{d}\textbf{g}/\,\textrm{d}t = \textbf{0}\) and \(\,\textrm{d}\textbf{g}^{\textbf{v}}/\,\textrm{d}t = \textbf{0}\) which result from (37d) and (37e), respectively.

3.2.3 Symplecticness

Solutions \((\textbf{q}(t),\textbf{p}(t))\in {\mathcal {M}}\) of the Euler–Lagrange equations (37) preserve the symplectic two-form (23). To show this, consider the differential one-forms resulting from (37):

$$\begin{aligned} \,\textrm{d}\dot{\textbf{q}}&= \,\textrm{d}\textbf{v} + \,\textrm{d}\left( \textrm{D}_2 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})^\textrm{T}\mathbf {\gamma }\right) \ \text {,}\end{aligned}$$
(48a)
$$\begin{aligned} \,\textrm{d}\dot{\textbf{p}}&= \textrm{D}^2_{11} L(\textbf{q},\textbf{v}) \,\textrm{d}\textbf{q} + \textrm{D}^2_{12} L(\textbf{q},\textbf{v}) \,\textrm{d}\textbf{v} \end{aligned}$$
(48b)
$$\begin{aligned}&\quad - \,\textrm{d}\left( \textrm{D}\textbf{g}(\textbf{q})^\textrm{T}\mathbf {\lambda }\right) - \,\textrm{d}\left( \textrm{D}_1 \textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})^\textrm{T}\mathbf {\gamma }\right) \ \text {,}\nonumber \\ \,\textrm{d}\textbf{p}&= \textrm{D}^2_{21} L(\textbf{q},\textbf{v}) \,\textrm{d}\textbf{q} + \textrm{D}^2_{22} L(\textbf{q},\textbf{v}) \,\textrm{d}\textbf{v} \ \text {,}\end{aligned}$$
(48c)

These relationships can be inserted into the expression for the time derivative of the symplectic two-form (23) leading to

(49)

Missing terms in the last equation vanish (cf. Appendix A.2) and thus have been omitted. The second term on the right-hand side of the last equation vanishes as well as shown in Appendix A.3, (135). Accordingly, we arrive at

(50)

Note that the first term on the right-hand side of the above equation vanishes since (37e) implies \(\,\textrm{d}\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p}) = \textbf{0}\). The second term also vanishes due to the equality of mixed derivatives. Accordingly, the symplectic two-form is preserved, independently from multiplier \(\mathbf {\gamma }\).

4 GGL variational integrators

Variational integrators (VIs) can be designed by directly discretizing the underlying functional. Subsequently, the discretized functional can be extremized to obtain the discrete Euler–Lagrange (DEL) equations. In this section, this procedure shall be applied in the framework of the newly devised GGL functional. We refer to Lew and Mata [24] and Hairer et al. [33] for more background on variational integrators.

4.1 First-order scheme

To illustrate the design of VIs emanating from the GGL functional, we start with a simple scheme, which has already been presented in the preliminary work [34]. The time interval \({\mathcal {I}} = [0, T]\) is divided into N subintervals leading to

$$\begin{aligned} {\mathcal {I}} = \bigcup _{n=0}^{N-1} [t^{n}\ , \ t^{n+1}] \end{aligned}$$
(51)

with \(t^0 = 0\) and \(t^N = T\). For simplicity, we consider time steps of constant size \(h=t^{n+1}- t^{n}\). The approximation of a function \((\bullet )(t)\) at time \(t^n\) is denoted by \((\bullet )^n\), so that, for example, \(\textbf{q}^{n}\approx \textbf{q}(t^n)\). The GGL functional (33) may now be approximated by the discrete action sum

$$\begin{aligned} S_\textrm{d}&= \sum _{n=0}^{N-1} \big [ h\, L(\textbf{q}^{n}, \textbf{v}^{n}) - h\,\mathbf {\lambda }^{n+1}\cdot \textbf{g}(\textbf{q}^{n+1}) \nonumber \\&\qquad \qquad \qquad + \textbf{p}^{n+1}\cdot \big ( \textbf{q}^{n+1}- \textbf{q}^{n}-h\, \textbf{v}^{n}\nonumber \\&\qquad \qquad \qquad -h\, \textbf{M} ^{-1}\textbf{G}(\bar{\textbf{q}}) ^\textrm{T}\mathbf {\gamma }^{n+1}\big ) \big ] \ \text {,}\end{aligned}$$
(52)

where

$$\begin{aligned} \bar{\textbf{q}} = \textbf{q}^{n}+ h\, \textbf{v}^{n} \end{aligned}$$
(53)

has been introduced. Note that in each time interval \([t^{n}\, \ t^{n+1}]\), side condition (38) is discretized similarly to the explicit Euler method with associated Lagrange multiplier \(\textbf{p}^{n+1}\). Moreover, \(\int _{t^{n}}^{t^{n+1}} L(\textbf{q},\textbf{v})\textrm{d}t\) is approximated by \(h L(\textbf{q}^{n}, \textbf{v}^{n})\), while multiplier \(\mathbf {\lambda }^{n+1}\) enforces the holonomic contraints at the end of each time interval.

Stationary conditions can be applied directly to the discrete functional. Taking into account the independence of the respective variables, this yields

$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \textbf{p}^{n+1}\cdot \big ( \textbf{q}^{n+1}- \textbf{q}^{n}-h\, \textbf{v}^{n}\nonumber \\&\qquad \qquad \qquad \quad - h\, \textbf{M} ^{-1}\textbf{G}(\bar{\textbf{q}}) ^\textrm{T}\mathbf {\gamma }^{n+1}\big ) = 0 \ \text {,}\end{aligned}$$
(54a)
$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \textbf{q}^{n}\cdot \big ( h\, \textrm{D}_1 L(\textbf{q}^{n},\textbf{v}^{n}) - \textbf{p}^{n+1}\nonumber \\&\qquad \qquad \qquad -h\,\sum _{k=1}^m \gamma _k^{n+1}\textrm{D}^2 g_k(\bar{\textbf{q}}) \textbf{M}^{-1}\textbf{p}^{n+1}\big ) \end{aligned}$$
(54b)
$$\begin{aligned}&+\sum _{n=0}^{N-1} \delta \textbf{q}^{n+1}\cdot \left( -h\,\textbf{G}(\textbf{q}^{n+1})^\textrm{T}\mathbf {\lambda }^{n+1}+ \textbf{p}^{n+1}\right) = 0 \nonumber \ \text {,}\\&\sum _{n=0}^{N-1} \delta \textbf{v}^{n}\cdot \big ( h\, \textrm{D}_2 L(\textbf{q}^{n},\textbf{v}^{n}) - h\, \textbf{p}^{n+1}\nonumber \\&\qquad \qquad \qquad -h^2 \,\sum _{k=1}^m \gamma _k^{n+1}\textrm{D}^2 g_k(\bar{\textbf{q}}) \textbf{M}^{-1}\textbf{p}^{n+1}\big ) = 0 \ \text {,}\end{aligned}$$
(54c)

along with

$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \mathbf {\lambda }^{n+1}\cdot \textbf{g}(\textbf{q}^{n+1}) = 0 \ \text {,}\end{aligned}$$
(54d)
$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \mathbf {\gamma }^{n+1}\cdot \textbf{G}(\bar{\textbf{q}})\textbf{M}^{-1}\textbf{p}^{n+1}= 0 \ \text {.}\end{aligned}$$
(54e)

Next, we apply an index shift in the second part of (54b) from \(n+1\) to n. This procedure is also referred to as discrete integration by parts (see Marsden and West [23]). In addition to that, we apply the usual endpoint conditions \(\delta \textbf{q}^0 = \delta \textbf{q}^N = \textbf{0}\). Taking into account the arbitrariness of the variations, we obtain the discrete Euler–Lagrange (DEL) equations

$$\begin{aligned} \textbf{q}^{n+1}- \textbf{q}^{n}= & {} h\, \textbf{v}^{n}+ h\, \textbf{M} ^{-1}\textbf{G}(\bar{\textbf{q}}) ^\textrm{T}\mathbf {\gamma }^{n+1}\ \text {,} \end{aligned}$$
(55a)
$$\begin{aligned} \textbf{p}^{n+1}-\textbf{p}^{n}= & {} h\, \textrm{D}_1 L(\textbf{q}^{n},\textbf{v}^{n}) - h\,\textbf{G}(\textbf{q}^{n})^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\{} & {} \qquad - h\,\sum _{k=1}^m \gamma _k^{n+1}\textrm{D}^2 g_k(\bar{\textbf{q}}) \textbf{M}^{-1}\textbf{p}^{n+1}\nonumber \ \text {,} \end{aligned}$$
(55b)
$$\begin{aligned} \textrm{D}_2 L(\textbf{q}^{n},\textbf{v}^{n})= & {} \nonumber \\{} & {} \big ( \textbf{I}_{d \times d}+ h \,\sum _{k=1}^m \gamma _k^{n+1}\textrm{D}^2 g_k(\bar{\textbf{q}}) \textbf{M}^{-1}\big ) \textbf{p}^{n+1}\ \text {,}\end{aligned}$$
(55c)
$$\begin{aligned} \textbf{g}(\textbf{q}^{n+1})= & {} \textbf{0} \ \text {,}\end{aligned}$$
(55d)
$$\begin{aligned} \textbf{G}(\bar{\textbf{q}})\textbf{M}^{-1}\textbf{p}^{n+1}= & {} \textbf{0} \ \text {,}\end{aligned}$$
(55e)

for \(n = 0,\ldots , N-1\). In total, (55) provide \((3\,d+2\,m)\) equations for the determination of the unknowns (\(\textbf{q}^{n+1}\), \(\textbf{p}^{n+1}\), \(\textbf{v}^{n}\), \(\mathbf {\lambda }^{n}\), \(\mathbf {\gamma }^{n+1}\)) in every time step. Scheme (55) can be viewed as discrete counterpart of the continuous Euler–Lagrange equations (37). Note that relation (55c) can be interpreted as the discrete fiber derivative of the Legendre transformation, which links velocity and momentum variables. Moreover, the primary constraints (55d) are enforced at the end of each time step, while the secondary constraints are enforced in an intermediate sense (cf. (55e)).

It is worth mentioning that scheme (55) can be regarded as generalization to constrained mechanical systems of the symplectic Euler method (see Hairer et al. [33]). For the sake of completeness, we verify in Appendix A.6 that scheme (55) is symplectic and capable of conserving momentum maps of the form (45).

4.2 One-step GGL variational integrators with improved accuracy

The specific GGL variational integrator devised in the previous section is first-order accurate. We next aim at one-step GGL variational integrators with enhanced numerical accuracy. To this end, we borrow ideas from the discretization approach developed in Betsch and Becker [35] within the context of optimal control problems. The developments therein follow the philosophy first discretize then optimize, which is closely related to the present task of discretizing the GGL functional. Accordingly, we introduce the discrete GGL action sum

$$\begin{aligned} {\mathcal {S}}_\textrm{d}&= \sum _{n=0}^{N-1} \big [ L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \nonumber \\&\qquad \qquad + \textbf{p}^{n+1}\cdot \left( \textbf{q}^{n+1}- \textbf{q}^{n}- \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \right) \nonumber \\&\qquad + \textbf{P}^{n}\cdot \left( \textbf{Q}^{n}\ \ - \textbf{q}^{n}- \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \right) \big ] \ \text {.}\end{aligned}$$
(56)

Here, auxiliary coordinates \(\textbf{Q}^{n}\) and momenta \(\textbf{P}^{n}\) have been introduced which will be determined below. Furthermore, the functions

$$\begin{aligned} L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1})&{=}&L_\textrm{d}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1})\nonumber \\{} & {} \quad {-} \mathbf {\lambda }^{n}\cdot \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{Q}^{n}) \ \text {,}\nonumber \\ \end{aligned}$$
(57)

and

$$\begin{aligned} \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) = h\textbf{v}^{n+1}+ \textbf{M} ^{-1}\textbf{G}_\textrm{d}(\textbf{q}^{n},\textbf{Q}^{n})^\textrm{T}\mathbf {\gamma }^{n}\nonumber \\ \end{aligned}$$
(58)

have been introduced, where \(L_\textrm{d}\), \(\textbf{g}_\textrm{d}\) and \(\textbf{G}_\textrm{d}\) will be specified in the sequel. In this connection,

$$\begin{aligned} L_\textrm{d}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \approx \int _{t^{n}}^{t^{n+1}} L(\textbf{q},\textbf{v}) \textrm{d}t\end{aligned}$$
(59)

represents the discrete Lagrangian. Similarly, \(\textbf{g}_\textrm{d}\) and \(\textbf{G}_\textrm{d}\) stand for discrete versions of the constraint function and the constraint Jacobian, respectively. The specific discretization (56) of the GGL functional can be motivated in the following way. In each time interval \([t^{n}\, \ t^{n+1}]\), side condition (38) is discretized in the spirit of a one-stage Runge–Kutta method (see Hager [36]). In this regard, \(\textbf{Q}^{n}\) is closely related to the stage value in a Runge–Kutta method. Moreover, \(\textbf{p}^{n+1}\) and \(\textbf{P}^{n}\) play the role of Lagrange multipliers.

Evaluating the discrete stationary conditions emanating from (56), we obtain

$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \textbf{p}^{n+1}\cdot \left[ \textbf{q}^{n+1}- \textbf{q}^{n}- \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \right] = 0 \ \text {,}\end{aligned}$$
(60a)
$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \textbf{P}^{n}\cdot \left[ \textbf{Q}^{n}\ \ - \textbf{q}^{n}- \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \right] = 0 \ \text {,}\end{aligned}$$
(60b)
$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \textbf{q}^{n}\cdot \big [ \textrm{D}_1 L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) - \textbf{p}^{n+1}- \textbf{P}^{n}\nonumber \\&\qquad \qquad \qquad - \textrm{D}_1 {\textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) }^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \big ] \nonumber \\&+ \sum _{n=0}^{N-1} \delta \textbf{q}^{n+1}\cdot \textbf{p}^{n+1}= 0 \ \text {,}\end{aligned}$$
(60c)
$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \textbf{Q}^{n}\cdot \big [ \textrm{D}_2 L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) + \textbf{P}^{n}\end{aligned}$$
(60d)
$$\begin{aligned}&\qquad \qquad - \textrm{D}_2 {\textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1})}^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \big ] = 0 \ \text {,}\nonumber \\&\sum _{n=0}^{N-1} \delta \textbf{v}^{n+1}\cdot \big [ \textrm{D}_3 L_\textrm{d}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) \end{aligned}$$
(60e)
$$\begin{aligned}&\qquad \qquad - \textrm{D}_3 {\textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1})}^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \big ] = 0 \ \text {,}\nonumber \\&\sum _{n=0}^{N-1} \delta \mathbf {\lambda }^{n}\cdot \textrm{D}_{\varvec{\lambda }} L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1}) =0 \ \text {,}\end{aligned}$$
(60f)
$$\begin{aligned}&\sum _{n=0}^{N-1} \delta \mathbf {\gamma }^{n}\cdot \textrm{D}_{\varvec{\gamma }} {\textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{Q}^{n}, \textbf{v}^{n+1})}^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) =0 \ \text {,}\end{aligned}$$
(60g)

for \(n=0,...,N-1\). Due to the arbitrariness of \(\delta \textbf{p}^{n+1}\) and \(\delta \textbf{P}^{n}\), (60a) and (60b) imply that

$$\begin{aligned} \textbf{Q}^{n}= \textbf{q}^{n+1} \ \text {.}\end{aligned}$$
(61)

Performing again an index shift in (60c) and taking into account the arbitrariness of the variations, the discrete equations of motion can be obtained as

$$\begin{aligned}{} & {} \textbf{q}^{n+1}- \textbf{q}^{n}= \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1}) \ \text {,}\end{aligned}$$
(62a)
$$\begin{aligned}{} & {} \textbf{p}^{n+1}-\textbf{p}^{n}+ \textbf{P}^{n}= \textrm{D}_1 L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1}) \end{aligned}$$
(62b)
$$\begin{aligned}{} & {} \qquad \qquad - \textrm{D}_1 \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }} (\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \ \text {,}\nonumber \\{} & {} -\textbf{P}^{n}= \textrm{D}_2 L_\textrm{d}^\mathrm {\varvec{\lambda }} (\textbf{q}^{n}, \textbf{q}^{n+1}, \textbf{v}^{n+1}) \end{aligned}$$
(62c)
$$\begin{aligned}{} & {} \qquad \qquad - \textrm{D}_2 \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }} (\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \ \text {,}\nonumber \\{} & {} \nonumber \\{} & {} \textbf{0} = \textrm{D}_3 L_\textrm{d}(\textbf{q}^{n}, \textbf{q}^{n+1},\textbf{v}^{n+1}) \nonumber \\{} & {} \qquad - \textrm{D}_3 \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }} (\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \ \text {,}\nonumber \\ \end{aligned}$$
(62d)

together with the discrete constraints

$$\begin{aligned} \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})&=\textbf{0} \ \text {,}\end{aligned}$$
(62e)
$$\begin{aligned} \textbf{g}_\textrm{d}^{\textbf{v}}(\textbf{q}^{n},\textbf{q}^{n+1},\textbf{p}^{n+1}+ \textbf{P}^{n})&= \textbf{0} \ \text {,}\end{aligned}$$
(62f)

for \(n=0,...,N-1\). In (62f), the discrete constraint function

$$\begin{aligned} \textbf{g}_\textrm{d}^{\textbf{v}} = \textbf{G}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})\textbf{M}^{-1}(\textbf{p}^{n+1}+ \textbf{P}^{n}) \end{aligned}$$
(63)

has been introduced. Note that (62d) serves as a discrete version of the fiber derivative (37c) and links velocity to momentum variables. In total, the above DEL equations constitute a set of \((4\,d+2\,m)\) equations for the determination of the unknowns \((\textbf{q}^{n+1},\textbf{p}^{n+1},\textbf{P}^{n},\textbf{v}^{n+1},\) \(\mathbf {\lambda }^{n},\mathbf {\gamma }^{n})\).

Depending on the specific choice for \(L_\textrm{d}\), \(\textbf{G}_\textrm{d}\) and \(\textbf{g}_\textrm{d}\), the above DEL equations generate a family of symplectic integrators (cf. Appendix A.7.1). In addition to that the above family of integrators is capable of conserving momentum maps of the form (45), provided that the following discrete symmetry conditions are satisfied by the specific choice for \(L_\textrm{d}\), \(\textbf{G}_\textrm{d}\) and \(\textbf{g}_\textrm{d}\) (cf. Appendix A.7.2):

$$\begin{aligned} 0&= \textrm{D}_1 L_\textrm{d} \cdot \mathbf {\xi }\textbf{q}^{n}+ \textrm{D}_2 L_\textrm{d} \cdot \mathbf {\xi }\textbf{q}^{n+1}+ \textrm{D}_3 L_\textrm{d} \cdot \mathbf {\xi }\textbf{v}^{n+1}\ \text {,}\end{aligned}$$
(64a)
$$\begin{aligned} 0&~{=}~ \textrm{D}_1 \textbf{g}_\textrm{d}^{\textbf{v}} \mathbf {\xi }\textbf{q}^{n}+ \textrm{D}_2 \textbf{g}_\textrm{d}^{\textbf{v}} \mathbf {\xi }\textbf{q}^{n+1}- \textrm{D}_3 \textbf{g}_\textrm{d}^{\textbf{v}} \mathbf {\xi }^\textrm{T}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \ \text {,}\end{aligned}$$
(64b)
$$\begin{aligned} 0&= \textrm{D}_1 \textbf{g}_\textrm{d} \mathbf {\xi }\textbf{q}^{n}+ \textrm{D}_2 \textbf{g}_\textrm{d} \mathbf {\xi }\textbf{q}^{n+1} \ \text {.}\end{aligned}$$
(64c)

Of course, the discrete symmetry conditions are closely connected to the continuous symmetry conditions (41).

4.3 One-stage theta methods

To particularize specific integrators emanating from (62), we introduce the convex combination

$$\begin{aligned} \textbf{q}^{n+\theta }= (1-\theta )\,\textbf{q}^{n}+ \theta \,\textbf{q}^{n+1}\end{aligned}$$
(65)

for \(\theta \in [0,1]\). We now are in a position to choose

$$\begin{aligned} L_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&= h L(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) \ \text {,}\end{aligned}$$
(66a)
$$\begin{aligned} \textbf{G}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})&= h\textbf{G}(\textbf{q}^{n+\theta }) \ \text {.}\end{aligned}$$
(66b)

It can be verified that this choice satisfies the discrete symmetry conditions (64a) and (64b), provided that the continuous conditions (41a) and (41b) hold. Based on the choice (66), functions (57) and (58) can be recast in the form

$$\begin{aligned}&L_\textrm{d}^\mathrm {\varvec{\lambda }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1}) \nonumber \\&\qquad \qquad = h L(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) - \mathbf {\lambda }^{n}\cdot \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1}) \ \text {,}\end{aligned}$$
(67)

and

$$\begin{aligned} \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&= h\textbf{v}^{n+1}+ h\,\textbf{M}^{-1}{\textbf{G}(\textbf{q}^{n+\theta })}^\textrm{T}\mathbf {\gamma }^{n}\ \text {.}\end{aligned}$$
(68)

Now the partial derivatives appearing in (62) can be written as

$$\begin{aligned} \textrm{D}_1 L_\textrm{d}^{\varvec{\lambda }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&= h(1-\theta )\, \textrm{D}_1 L(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) \nonumber \\&\qquad \quad - D_1 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})^\textrm{T}\mathbf {\lambda }^{n}\ \text {,}\end{aligned}$$
(69a)
$$\begin{aligned} \textrm{D}_2 L_\textrm{d}^{\varvec{\lambda }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&= h\theta \, \textrm{D}_1 L(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) \nonumber \\&\qquad \qquad - D_2 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})^\textrm{T}\mathbf {\lambda }^{n}\ \text {,}\end{aligned}$$
(69b)
$$\begin{aligned} \textrm{D}_1 \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&\end{aligned}$$
(69c)
$$\begin{aligned} =h (1-\theta )&\sum _{k=1}^m \gamma _k \textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{M}^{-1}, \nonumber \\ \textrm{D}_2 \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&= h\theta \,\sum _{k=1}^m \gamma _k \textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{M}^{-1}\ \text {,}\end{aligned}$$
(69d)
$$\begin{aligned} \textrm{D}_3 \textbf{f}_\textrm{d}^\mathrm {\varvec{\gamma }}(\textbf{q}^{n},\textbf{q}^{n+1}, \textbf{v}^{n+1})&= h \, \textbf{I} \ \text {.}\end{aligned}$$
(69e)

Moreover, (62d) yields

$$\begin{aligned} \textbf{M}\textbf{v}^{n+1}= \textbf{p}^{n+1}+ \textbf{P}^{n} \ \text {,}\end{aligned}$$
(70)

while (62c) leads to

$$\begin{aligned} \textbf{P}^{n}&= - h\theta \textrm{D}_1 L(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) + D_2 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\&\ \ + h \theta \,\sum _{k=1}^m \gamma _k \textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{M}^{-1}\left( \textbf{p}^{n+1}+ \textbf{P}^{n}\right) \ \text {.}\end{aligned}$$
(71)

Adding up (62b) and (62c) yields

$$\begin{aligned} \textbf{p}^{n+1}\,{-}\, \textbf{p}^{n}&~{=}~ h\textrm{D}_1 L(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) \,{-}\, \left( \textrm{D}_1 \textbf{g}_\textrm{d}\, {+} \,\textrm{D}_2 \textbf{g}_\textrm{d} \right) ^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\&\ \ {-}\, h \,\sum _{k=1}^m \gamma _k \textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{M}^{-1}\left( \textbf{p}^{n+1}\,{+}\, \textbf{P}^{n}\right) \! \ \text {.}\end{aligned}$$
(72)

Inserting \(\textrm{D}_1 L(\textbf{q}^{n+\theta },\textbf{v}^{n+1})\) from the last equation into (71), one obtains

$$\begin{aligned} \textbf{P}^{n}~{=}~ {-}\theta \left( \textbf{p}^{n+1}\,{-}\,\textbf{p}^{n}\right) \,{-}\, \left( \theta \, \textrm{D}_1 \textbf{g}_\textrm{d}^\textrm{T}\,{-}\,~ (1\,{-}\,~\theta ) \, \textrm{D}_2 \textbf{g}_\textrm{d}^\textrm{T}\right) \mathbf {\lambda }^{n}\ \text {.}\end{aligned}$$
(73)

Substituting \(\textbf{P}^{n}\) from the last equation into (70) eventually yields

$$\begin{aligned} \textbf{M}\textbf{v}^{n+1}~{=}~ \textbf{p}^{n+1-\theta }\,{-}\, \left( \theta \, \textrm{D}_1 \textbf{g}_\textrm{d}^\textrm{T}\,{-}\, (1-~\theta ) \, \textrm{D}_2 \textbf{g}_\textrm{d}^\textrm{T}\right) \mathbf {\lambda }^{n}\nonumber \\ \end{aligned}$$
(74)

where

$$\begin{aligned} \textbf{p}^{n+1-\theta }= \theta \, \textbf{p}^{n}+ (1-\theta )\, \textbf{p}^{n+1}\end{aligned}$$
(75)

has been introduced.

To summarize, the \(\theta \)-version of the DEL (62) can be written in the form

$$\begin{aligned}&\textbf{q}^{n+1}- \textbf{q}^{n}= h\,\textbf{v}^{n+1}+ h\,\textbf{M}^{-1}{\textbf{G}(\textbf{q}^{n+\theta })}^\textrm{T}\mathbf {\gamma }^{n}\ \text {,}\end{aligned}$$
(76a)
$$\begin{aligned}&\textbf{p}^{n+1}\, {-}\,\textbf{p}^{n}{=} \,h\,\textrm{D}_1 L(\textbf{q}^{n+\theta },\textbf{v}^{n+1})\, {-}\, \left( \textrm{D}_1 \textbf{g}_\textrm{d} \,{+}\, \textrm{D}_2 \textbf{g}_\textrm{d} \right) ^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\&\qquad \qquad \qquad \qquad - h\,\sum _{k=1}^m\gamma _k^{n}\textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{v}^{n+1}\ \text {,}\end{aligned}$$
(76b)
$$\begin{aligned}&\textbf{M}\textbf{v}^{n+1}= \textbf{p}^{n+1-\theta }- \left( \theta \, \textrm{D}_1 \textbf{g}_\textrm{d}^\textrm{T}- (1-\theta )\, \textrm{D}_2 \textbf{g}_\textrm{d}^\textrm{T}\right) \mathbf {\lambda }^{n}\ \text {,} \end{aligned}$$
(76c)
$$\begin{aligned}&\textbf{0} = \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1}) \ \text {,}\end{aligned}$$
(76d)
$$\begin{aligned}&\textbf{0} = \textbf{G}(\textbf{q}^{n+\theta })\textbf{v}^{n+1}\ \text {.}\end{aligned}$$
(76e)

Note that we still have to specify the discrete constraint function \(\textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})\) to obtain a specific integrator. For that purpose, we shall consider the ensuing two options.

4.3.1 Option A: Intermediate constraint evaluation

The first option is based on the choice

$$\begin{aligned} \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1}) = h\,\textbf{g}(\textbf{q}^{n+\theta }) \ \text {.}\end{aligned}$$
(77)

It can be shown that this choice satisfies the discrete symmetry condition (64c) under the assumption that the continuous condition (41c) holds. Choice (77) gives rise to the partial derivatives

$$\begin{aligned} \textrm{D}_1 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})&= h\,(1-\theta )\,\textbf{G}(\textbf{q}^{n+\theta }) \ \text {,}\end{aligned}$$
(78a)
$$\begin{aligned} \textrm{D}_2 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})&= h\,\theta \,\textbf{G}(\textbf{q}^{n+\theta }) \ \text {.}\end{aligned}$$
(78b)

Inserting these relations into (76), the resulting DEL are given by

$$\begin{aligned}&\textbf{q}^{n+1}- \textbf{q}^{n}= h\,\textbf{v}^{n+1}+ h\,\textbf{M}^{-1}{\textbf{G}(\textbf{q}^{n+\theta })}^\textrm{T}\mathbf {\gamma }^{n}\ \text {,}\end{aligned}$$
(79a)
$$\begin{aligned}&\textbf{p}^{n+1}-\textbf{p}^{n}= \textrm{D}_1 L_\textrm{d}(\textbf{q}^{n+\theta },\textbf{v}^{n+1}) - h\,\textbf{G}(\textbf{q}^{n+\theta }) ^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\&\qquad \qquad \qquad - h\,\sum _{k=1}^m\gamma _k^{n}\textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{v}^{n+1}\ \text {,}\end{aligned}$$
(79b)
$$\begin{aligned}&\textbf{M}\textbf{v}^{n+1}= \textbf{p}^{n+1-\theta }\ \text {,}\end{aligned}$$
(79c)
$$\begin{aligned}&\textbf{g}(\textbf{q}^{n+\theta }) = \textbf{0} \ \text {,}\end{aligned}$$
(79d)
$$\begin{aligned}&\textbf{G}(\textbf{q}^{n+\theta })\textbf{v}^{n+1}= \textbf{0} \ \text {.}\end{aligned}$$
(79e)

The above DEL can be used for \( \theta \in (0, 1) \).

4.3.2 Option B: Trapezoidal constraint evaluation

The second option relies on the introduction of a second parameter \(\vartheta \in (0,1]\) to control the evaluation of the constraint on configuration level. Specifically, we choose

$$\begin{aligned} \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1}) = h\,\left( (1-\vartheta ) \, \textbf{g}(\textbf{q}^{n}) + \vartheta \, \textbf{g}(\textbf{q}^{n+1}) \right) \ \text {.} \end{aligned}$$
(80)

Since consistent initial conditions for \(\textbf{q}_0 = \textbf{q}(t=0)\) ensure that \(\textbf{g}(\textbf{q}_0) = \textbf{0}\), the discrete constraint equation (80) enforces the configuration constraint at \(t^{n+1}\) for arbitrary \(\vartheta \in (0,1]\). It can be shown that (80) satisfies the discrete symmetry condition (64c) under the assumption that the continuous condition (41c) holds. The partial derivatives of (80) yield

$$\begin{aligned} \textrm{D}_1 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})&= h\,(1-\vartheta )\,\textbf{G}(\textbf{q}^{n}) \ \text {,}\end{aligned}$$
(81a)
$$\begin{aligned} \textrm{D}_2 \textbf{g}_\textrm{d}(\textbf{q}^{n},\textbf{q}^{n+1})&= h\,\vartheta \,\textbf{G}(\textbf{q}^{n+1}) \ \text {.}\end{aligned}$$
(81b)

Hence, (76) gives rise to the DEL

$$\begin{aligned}&\textbf{q}^{n+1}- \textbf{q}^{n}= h\,\textbf{v}^{n+1}+ h\,\textbf{M}^{-1}{\textbf{G}(\textbf{q}^{n+\theta })}^\textrm{T}\mathbf {\gamma }^{n}\ \text {,}\end{aligned}$$
(82a)
$$\begin{aligned}&\textbf{p}^{n+1}-\textbf{p}^{n}= \textrm{D}_1 L_\textrm{d}(\textbf{q}^{n+\theta },\textbf{v}^{n+1})\end{aligned}$$
(82b)
$$\begin{aligned}&\quad \qquad \qquad \qquad - h\, \left( (1-\vartheta )\,\textbf{G}(\textbf{q}^{n}) + \vartheta \,\textbf{G}(\textbf{q}^{n+1}) \right) ^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\&\quad \qquad \qquad \qquad - h\,\sum _{k=1}^m\gamma _k^{n}\textrm{D}^2 g_k(\textbf{q}^{n+\theta }) \textbf{v}^{n+1}\ \text {,}\nonumber \\&\textbf{M}\textbf{v}^{n+1}= \textbf{p}^{n+1-\theta }- h\, \big ( \theta \, (1-\vartheta )\,\textbf{G}(\textbf{q}^{n}) ^\textrm{T}\end{aligned}$$
(82c)
$$\begin{aligned}&\qquad \qquad \qquad - (1-\theta )\,\vartheta \,\textbf{G}(\textbf{q}^{n+1}) ^\textrm{T}\big ) \mathbf {\lambda }^{n}\ \text {,}\nonumber \\&\textbf{g}(\textbf{q}^{n+1}) = \textbf{0} \ \text {,}\end{aligned}$$
(82d)
$$\begin{aligned}&\textbf{G}(\textbf{q}^{n+\theta })\textbf{v}^{n+1}= \textbf{0} \ \text {,}\end{aligned}$$
(82e)

for \( \theta \in [0, 1] \) and \(\vartheta \in (0,1]\). For example, the choice \(\theta =1\) and \(\vartheta = 0.5\) yields the specific integrator

$$\begin{aligned}&\textbf{q}^{n+1}- \textbf{q}^{n}= h\,\textbf{v}^{n+1}+ h\,\textbf{M}^{-1}{\textbf{G}(\textbf{q}^{n+1})}^\textrm{T}\mathbf {\gamma }^{n}\ \text {,}\end{aligned}$$
(83a)
$$\begin{aligned}&\textbf{p}^{n+1}-\textbf{p}^{n}= \textrm{D}_1 L_\textrm{d}(\textbf{q}^{n+1},\textbf{v}^{n+1})\end{aligned}$$
(83b)
$$\begin{aligned}&\quad \qquad \qquad \qquad - \frac{h}{2}\,( \textbf{G}(\textbf{q}^{n}) + \textbf{G}(\textbf{q}^{n+1}) )^\textrm{T}\mathbf {\lambda }^{n}\nonumber \\&\quad \qquad \qquad \qquad - h\,\sum _{k=1}^m\gamma _k^{n}\textrm{D}^2 g_k(\textbf{q}^{n+1}) \textbf{v}^{n+1}\ \text {,}\nonumber \\&\textbf{M}\textbf{v}^{n+1}= \textbf{p}^{n}- \frac{h}{2} \textbf{G}(\textbf{q}^{n}) ^\textrm{T}\mathbf {\lambda }^{n}\ \text {,}\end{aligned}$$
(83c)
$$\begin{aligned}&\textbf{g}(\textbf{q}^{n+1}) = \textbf{0} \ \text {,}\end{aligned}$$
(83d)
$$\begin{aligned}&\textbf{G}(\textbf{q}^{n+1})\textbf{v}^{n+1}= \textbf{0} \ \text {.}\end{aligned}$$
(83e)

5 Energy–momentum scheme

In this section, we present a new energy–momentum (EM) conserving scheme which conserves both primary and secondary constraints. This scheme results from a direct discretization of the Euler–Lagrange equations (37) emanating from the GGL principle. Specifically, we consider

$$\begin{aligned}&\textbf{q}^{n+1}-\textbf{q}^{n}= h\textbf{v}^{n+1/2}+ h({\textsf{D}}^\textrm{G}_{\textbf{p}} \textbf{g}^{\textbf{v}})^\textrm{T}\mathbf {\gamma }^{n+1} \ \text {,}\end{aligned}$$
(84a)
$$\begin{aligned}&\textbf{p}^{n+1}-\textbf{p}^{n}= h{\textsf{D}}^\textrm{G}_{\textbf{q}} L - h{\textsf{D}}^\textrm{G}\textbf{g}^\textrm{T}\mathbf {\lambda }^{n+1}- h({\textsf{D}}^\textrm{G}_{\textbf{q}} \textbf{g}^{\textbf{v}})^\textrm{T}\mathbf {\gamma }^{n+1} \ \text {,}\end{aligned}$$
(84b)
$$\begin{aligned}&\textbf{p}^{n+1/2}= {\textsf{D}}^\textrm{G}_{\textbf{v}} L \ \text {,}\end{aligned}$$
(84c)
$$\begin{aligned}&\textbf{0} = \textbf{g}(\textbf{q}^{n+1}) \ \text {,} \end{aligned}$$
(84d)
$$\begin{aligned}&\textbf{0} = \textbf{g}^{\textbf{v}}(\textbf{q}^{n+1},\textbf{p}^{n+1}) \ \text {,} \end{aligned}$$
(84e)

where the derivatives in (37) have been replaced by corresponding discrete derivatives in the sense of Gonzalez [26]. In (84), the expression \({\textsf{D}}^\textrm{G}_{\varvec{\alpha }}(\bullet )\) denotes the discrete derivative with respect to the argument \(\mathbf {\alpha }\). The discrete derivatives represent second-order perturbations of the midpoint derivatives. Particular examples are provided in the context of the numerical examples in Sect. 6. The discrete derivatives have to satisfy the following properties:

  1. 1.

    Orthogonality conditions corresponding to the symmetry conditions (41)

    $$\begin{aligned} 0&= {\textsf{D}}^\textrm{G}_{\textbf{q}} L \cdot \mathbf {\xi }\textbf{q}^{n+1/2}+ {\textsf{D}}^\textrm{G}_{\textbf{v}} L \cdot \mathbf {\xi }\textbf{v}^{n+1/2}\ \text {,}\end{aligned}$$
    (85a)
    $$\begin{aligned} 0&= {\textsf{D}}^\textrm{G}_{\textbf{q}} \textbf{g}^{\textbf{v}} \mathbf {\xi }\textbf{q}^{n+1/2}- {\textsf{D}}^\textrm{G}_{\textbf{p}} \textbf{g}^{\textbf{v}} \mathbf {\xi }^\textrm{T}\textbf{p}^{n+1/2}\ \text {,}\end{aligned}$$
    (85b)
    $$\begin{aligned} 0&= {\textsf{D}}^\textrm{G}\textbf{g} \mathbf {\xi }\textbf{q}^{n+1/2} \ \text {.}\end{aligned}$$
    (85c)

    Note that in the underlying symmetry conditions (41), the infinitesimal generators (17), (19) and (21) have been evaluated in the midpoint to arrive at (85).

  2. 2.

    Directionality conditions (cf. Gonzalez [26])

    $$\begin{aligned} L(&\textbf{q}^{n+1},\textbf{v}^{n+1}) - L(\textbf{q}^{n},\textbf{v}^{n})\end{aligned}$$
    (86a)
    $$\begin{aligned}&={\textsf{D}}^\textrm{G}_{\textbf{q}} L \cdot (\textbf{q}^{n+1}-\textbf{q}^{n}) + {\textsf{D}}^\textrm{G}_{\textbf{v}} L \cdot (\textbf{v}^{n+1}-\textbf{v}^{n}) \ \text {,}\nonumber \\ \textbf{g}^{\textbf{v}}(&\textbf{q}^{n+1},\textbf{p}^{n+1}) - \textbf{g}^{\textbf{v}}(\textbf{q}^{n},\textbf{p}^{n}) \end{aligned}$$
    (86b)
    $$\begin{aligned}&={\textsf{D}}^\textrm{G}_{\textbf{q}} \textbf{g}^{\textbf{v}} (\textbf{q}^{n+1}-\textbf{q}^{n}) + {\textsf{D}}^\textrm{G}_{\textbf{p}} \textbf{g}^{\textbf{v}} (\textbf{p}^{n+1}-\textbf{p}^{n})\ \text {,}\nonumber \\ \textbf{g}(&\textbf{q}^{n+1}) - \textbf{g}(\textbf{q}^{n}) = {\textsf{D}}^\textrm{G}\textbf{g} (\textbf{q}^{n+1}-\textbf{q}^{n}) \ \text {.}\end{aligned}$$
    (86c)

For systems with a constant mass matrix, the EM scheme (84) can be related to the method presented by Gonzalez [14] in a Hamiltonian framework. The present scheme, however, additionally preserves the secondary constraints and does not require to set up a Hamiltonian as it solely relies on the Lagrangian L.

5.1 Conservation of energy

To show that scheme (84) conserves the energy (4), take the scalar product of (84a) with \((\textbf{p}^{n+1}-\textbf{p}^{n})\), the scalar product of (84b) with \(-(\textbf{q}^{n+1}-\textbf{q}^{n})\), the scalar product of (84c) with \(-h(\textbf{v}^{n+1}-\textbf{v}^{n})\), and add the resulting equations to obtain

$$\begin{aligned} \textbf{p}&^{n}\cdot \textbf{v}^{n}- \textbf{p}^{n+1}\cdot \textbf{v}^{n+1}\nonumber \\&=-\left( {\textsf{D}}^\textrm{G}_{\textbf{q}} L \cdot (\textbf{q}^{n+1}-\textbf{q}^{n}) + {\textsf{D}}^\textrm{G}_{\textbf{v}} L \cdot (\textbf{v}^{n+1}-\textbf{v}^{n})\right) \nonumber \\&\quad \,\,\,+ \mathbf {\gamma }^{n+1}\cdot \left( {\textsf{D}}^\textrm{G}_{\textbf{q}} \textbf{g}^{\textbf{v}} (\textbf{q}^{n+1}{-}\textbf{q}^{n}) {+} {\textsf{D}}^\textrm{G}_{\textbf{p}} \textbf{g}^{\textbf{v}} (\textbf{p}^{n+1}{-}\textbf{p}^{n}) \right) \nonumber \\&\quad \,\,\, + \mathbf {\lambda }^{n+1}\cdot {\textsf{D}}^\textrm{G}\textbf{g} (\textbf{q}^{n+1}-\textbf{q}^{n}) \ \text {.}\end{aligned}$$
(87)

Taking into account the directionality properties (86) of the (partitioned) discrete derivatives, we get

$$\begin{aligned} \textbf{p}^{n}&\cdot \textbf{v}^{n}- \textbf{p}^{n+1}\cdot \textbf{v}^{n+1}\nonumber \\ =&-\left( L(\textbf{q}^{n+1},\textbf{v}^{n+1}) - L(\textbf{q}^{n},\textbf{v}^{n}) \right) \nonumber \\&+\mathbf {\gamma }^{n+1}\cdot \left( \textbf{g}^{\textbf{v}}(\textbf{q}^{n+1},\textbf{p}^{n+1}) - \textbf{g}^{\textbf{v}}(\textbf{q}^{n},\textbf{p}^{n}) \right) \nonumber \\&+ \mathbf {\lambda }^{n+1}\cdot \left( \textbf{g}(\textbf{q}^{n+1}) - \textbf{g}(\textbf{q}^{n}) \right) \ \text {.}\end{aligned}$$
(88)

The last two lines vanish due to (84d) and (84e). Accordingly, algorithmic conservation of the total energy holds in the sense that

$$\begin{aligned} E(\textbf{q}^{n+1},\textbf{v}^{n+1},\textbf{p}^{n+1}) = E(\textbf{q}^{n},\textbf{v}^{n},\textbf{p}^{n}) \ \text {.}\end{aligned}$$
(89)
Table 1 Overview of integration methods

5.2 Conservation of momentum maps

To show that scheme (84) is capable of conserving momentum maps of the form (45), take the scalar product of (84a) with \(\mathbf {\xi }^\textrm{T}\textbf{p}^{n+1/2}\), the scalar product of (84b) with \(\mathbf {\xi }\textbf{q}^{n+1/2}\), the scalar product of (84c) with \(h\mathbf {\xi }\textbf{v}^{n+1/2}\), and add the resulting equations to get

$$\begin{aligned} \textbf{p}&^{n+1}\cdot \mathbf {\xi }\textbf{q}^{n+1}- \textbf{p}^{n}\cdot \mathbf {\xi }\textbf{q}^{n}\nonumber \\&= h \left( {\textsf{D}}^\textrm{G}_{\textbf{q}} L \cdot \mathbf {\xi }\textbf{q}^{n+1/2}+ {\textsf{D}}^\textrm{G}_{\textbf{v}} L \cdot \mathbf {\xi }\textbf{v}^{n+1/2}\right) \nonumber \\&\qquad \qquad - h\mathbf {\gamma }^{n+1}\cdot \left( {\textsf{D}}^\textrm{G}_{\textbf{q}} \textbf{g}^{\textbf{v}} \mathbf {\xi }\textbf{q}^{n+1/2}- {\textsf{D}}^\textrm{G}_{\textbf{p}} \textbf{g}^{\textbf{v}} \mathbf {\xi }\textbf{p}^{n+1/2}\right) \nonumber \\&\qquad \qquad - h\mathbf {\lambda }^{n+1}\cdot {\textsf{D}}^\textrm{G}\textbf{g} \mathbf {\xi }\textbf{q}^{n+1/2}\nonumber \\&=0 \ \text {.}\end{aligned}$$
(90)

Accordingly, algorithmic conservation of momentum maps holds in the sense that

$$\begin{aligned} \textbf{p}^{n+1}\cdot \mathbf {\xi }\textbf{q}^{n+1}= \textbf{p}^{n}\cdot \mathbf {\xi }\textbf{q}^{n}\ \text {,}\end{aligned}$$
(91)

provided that the orthogonality conditions (85) of the discrete derivatives are satisfied.

6 Numerical investigations

Throughout this section, the previously developed integration schemes are analyzed by means of numerical examples. In particular, we focus on the schemes summarized in Table 1. Newton’s method has been applied to solve the algebraic system of equations corresponding to the respective scheme. If not otherwise specified, the known quantities at \(t^{n}\) have been taken as initial guess for the computation of the unknowns at \(t^\mathrm {n+1}\). The tolerance in Newton’s method has been set to \(\epsilon _\textrm{tol} = 10^{-9}\) for all of the subsequent examples. The computations have been performed using the open source package metis, which is available at [37] together with detailed simulation data.

6.1 Mathematical pendulum in 3D

Fig. 1
figure 1

Mathematical Pendulum

As a first example, we investigate the mathematical pendulum in three dimensions (Fig. 1), consisting of a massless rod of length \(l = 1\) which forces the point mass with mass \(m = 1\) onto its configuration manifold \(S^2\), the unit sphere. Gravitation acts in the negative \(\textbf{e}_3\)-direction leading to the potential function \(V(\textbf{q}) = - m \textbf{b}\cdot \textbf{q}\), where \(\textbf{b} = -9.81 \textbf{e}_3\) is the gravitational acceleration. Moreover, the kinetic energy is given by \(T(\textbf{v}) = \frac{1}{2}m \textbf{v}\cdot \textbf{v}\) leading to the mass matrix \(\textbf{M}=\text{ diag }(m,m,m)\). Correspondingly, Lagrangian (3) is given by

$$\begin{aligned} L(\textbf{q},\textbf{v}) = \frac{1}{2}m \textbf{v}\cdot \textbf{v} + m \textbf{b}\cdot \textbf{q} \ \text {.}\end{aligned}$$
(92)

The configuration constraint assumes the form

$$\begin{aligned} g(\textbf{q}) = \frac{1}{2} \left( \frac{\textbf{q} \cdot \textbf{q}}{l^2} -1 \right) = 0 \ \text {,} \end{aligned}$$
(93)

giving rise to the secondary constraint

$$\begin{aligned} g^{\textbf{v}}(\textbf{q},\textbf{p}) = \frac{1}{m l^2} \textbf{q} \cdot \textbf{p} = 0 \ \text {.} \end{aligned}$$
(94)

The present problem has rotational symmetry about the \(\textbf{e}_3\)-axis. Accordingly, matrix \(\textbf{A}^\alpha \) in (16) is orthogonal (i.e., \(G=SO(3)\), the special orthogonal group in \({\mathbb {R}}^3\)) and can be written in the form

$$\begin{aligned} \textbf{A}^\alpha = \exp (\alpha \hat{\textbf{e}}_3) \ \text {,}\end{aligned}$$
(95)

where \(\hat{\textbf{e}}_3\) is a skew-symmetric matrix with associated axial vector \(\textbf{e}_3\) satisfying \(\hat{\textbf{e}}_3 \textbf{a} = \textbf{e}_3 \times \textbf{a}\) for any \(\textbf{a} \in {\mathbb {R}}^3\). To show that invariance property (11) holds, consider

$$\begin{aligned} L(\textbf{q}^\alpha ,\textbf{v}^\alpha )&= \frac{1}{2}m \textbf{v}\cdot (\textbf{A}^{\alpha })^\textrm{T}\textbf{A}^\alpha \textbf{v} + m \textbf{q}\cdot (\textbf{A}^{\alpha })^\textrm{T}\textbf{b} \nonumber \\&= L(\textbf{q},\textbf{v}) \ \text {,}\end{aligned}$$
(96)

where orthogonality property \((\textbf{A}^{\alpha })^\textrm{T}= (\textbf{A}^{\alpha })^{-1}\) along with \((\textbf{A}^{\alpha })^\textrm{T}\textbf{b} = -9.81 \exp (-\alpha \hat{\textbf{e}}_3)\textbf{e}_3 = -9.81 \textbf{e}_3 = \textbf{b}\) have been used. Similarly, it can be easily shown that invariance properties \(\textbf{g}(\textbf{q}^\alpha )=\textbf{g}(\textbf{q})\) and \(\textbf{g}^{\textbf{v}}(\textbf{q}^\alpha ,\textbf{p}^\alpha )=\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})\) are satisfied.

Moreover, equation (95) leads to

$$\begin{aligned} \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{A}^\alpha = \hat{\textbf{e}}_3 = \mathbf {\xi } \ \text {.}\end{aligned}$$
(97)

Now, it can be easily verified that the symmetry conditions (41) are satisfied. The corresponding momentum map (45) takes the form

$$\begin{aligned} J_3 = (\textbf{q}\times \textbf{p})\cdot \textbf{e}_3. \end{aligned}$$
(98)

Accordingly, the angular momentum \(J_3\) of the pendulum is a first integral of the motion.

The discrete derivatives featuring in the EM scheme (84) need to be applied to the functions \(L(\textbf{q},\textbf{v})\), \(g(\textbf{q})\) and \(g^{\textbf{v}}(\textbf{q},\textbf{p})\). Since these functions are at most quadratic, the discrete derivatives coincide with the respective midpoint derivatives. That is,

$$\begin{aligned}&{\textsf{D}}^\textrm{G}_{\textbf{q}} L = m \textbf{b} \ \text {,}\end{aligned}$$
(99a)
$$\begin{aligned}&{\textsf{D}}^\textrm{G}_{\textbf{v}} L = m \textbf{v}^{n+1/2}\ \text {,}\end{aligned}$$
(99b)
$$\begin{aligned}&{\textsf{D}}^\textrm{G}_{\textbf{q}}{g}^{\textbf{v}} = \frac{1}{ml^2}\textbf{p}^{n+1/2}\ \text {,}\end{aligned}$$
(99c)
$$\begin{aligned}&{\textsf{D}}^\textrm{G}_{\textbf{p}}{g}^{\textbf{v}} = \frac{1}{ml^2}\textbf{q}^{n+1/2}\ \text {,}\end{aligned}$$
(99d)
$$\begin{aligned}&{\textsf{D}}^\textrm{G}\textbf{g} = \frac{1}{l^2}\textbf{q}^{n+1/2}\ \text {.}\end{aligned}$$
(99e)

It can be easily checked that orthogonality conditions (85) are satisfied.

Being initially released from position \(\textbf{q}^0 = [1, 0, 0]^\textrm{T}\) with a velocity of \(\textbf{v}^0 = [0, 1, 0]^\textrm{T}\), the pendulum undergoes a motion which is exemplarily shown in Fig. 6, where the initial configuration and the configuration at \(t=T\) is depicted. The momenta have been initialized with \(\textbf{p}^0 = \textbf{M}\textbf{v}^0\). The total simulation period is \(T= 10\), and the time step size has been chosen as \(h = 0.05\).

Fig. 2
figure 2

Position

Fig. 3
figure 3

Momentum

Fig. 4
figure 4

Lagrange multiplier for position constraint

Fig. 5
figure 5

Lagrange multiplier for velocity constraint

The 1-component of the positions and momenta are depicted in Figs. 2 and 3, respectively, to show that slight deviations between the different schemes occur. Those differences can also be viewed with respect to the energies. The Lagrange multipliers enforcing position constraint (93) and velocity constraint (94) are displayed in Figs. 4 and 5, respectively. It becomes obvious that solutions obtained with VI-A and VI-B exhibit slight oscillations in \(\lambda \) and \(\gamma \), respectively.

Fig. 6
figure 6

Trajectory calculated with VI-S

The results for kinetic energy T, potential energy V and Hamiltonian H are exemplarily displayed for the VI-S scheme in Fig. 7. All the VIs (VI-S, VI-A and VI-B) exhibit fluctuations of the energy function E that are typical for symplectic methods (cf. Fig. 8). In contrast to that, as expected, the EM scheme conserves the energy of the pendulum up to numerical round-off. This can be seen from Figs. 8 and 9.

Fig. 7
figure 7

Energy quantities (VI-S)

Fig. 8
figure 8

Energy function E

Fig. 9
figure 9

Incremental changes of the energy function E (EM)

Furthermore, the evolution of the angular momentum components is exemplarily displayed for the VI-S method in Fig. 10. The other schemes yield only small deviations from these results. All of the present integrators conserve the 3-component of the angular momentum (98) up to numerical round-off. This can be observed from Fig 11.

Fig. 10
figure 10

Angular momentum components (VI-S)

Fig. 11
figure 11

Incremental changes of the 3-component of the angular momentum

The primary constraint on position level is correctly captured by VI-S, VI-B and EM, as can be seen from Fig. 12. In contrast to that, VI-A violates the primary constraint by design (Fig. 13).

Fig. 12
figure 12

Constraint on configuration level

Fig. 13
figure 13

Constraint on configuration level (VI-A)

Similarly, the secondary constraint on velocity level is correctly captured by VI-S, VI-B and EM (Fig. 14), while VI-A violates the secondary constraint by design (Fig. 15). Although VI-S shows the correct behavior in this simple example, this is not the case anymore for more involved examples (see below).

Fig. 14
figure 14

Constraint on momentum level

Fig. 15
figure 15

Constraint on momentum level (VI-A)

6.2 Steady precession of a gyroscopic top

This example has been taken from Betsch and Leyendecker [38] (see also [16, 17]). In particular, the rigid body is described as constrained mechanical system, see [39, 40] for further details.

Accordingly, the configuration of the rigid body is characterized by the coordinate vector

$$\begin{aligned} \textbf{q} = \begin{bmatrix} \textbf{q}_1 \\ \textbf{q}_2 \\ \textbf{q}_3 \\ \textbf{q}_4 \end{bmatrix} = \begin{bmatrix} \mathbf {\varphi } \\ \textbf{d}_1 \\ \textbf{d}_2 \\ \textbf{d}_3 \end{bmatrix} \ \text {,}\end{aligned}$$
(100)
Fig. 16
figure 16

Gyroscopic top

where is the position vector of the center of mass and \(\textbf{d}_i\in {\mathbb {R}}^3\) (\(i=1,2,3\)) constitute a body-fixed director frame (Fig. 16). For simplicity, the director axis are assumed to coincide with the principal axis of the rigid body. In the Lagrangian (3), the potential energy is given by \(V(\textbf{q})= -m\textbf{b}\cdot \mathbf {\varphi }\), where \(\textbf{b} = -9.81 \textbf{e}_3\) is the gravitational acceleration. The mass matrix takes the form

$$\begin{aligned} \textbf{M} = \begin{bmatrix} m \textbf{I} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} E_1 \textbf{I} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} E_2 \textbf{I} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} E_3 \textbf{I} \end{bmatrix} \ \text {.} \end{aligned}$$
(101)

The inertia quantities are given by the total mass m of the rigid body along with the principal moments of inertia \(I_i\) (\(i=1,2,3\)) about its center of mass, from which \(E_i\) in (101) follow as \(E_{i} = 1/2\left( I_{j} + I_{k} - I_{i}\right) \) for even permutations of the indices (ijk).

There are two types of holonomic constraints leading to the constraint function

$$\begin{aligned} \textbf{g}(\textbf{q}) = \begin{bmatrix} \textbf{g}_{\textrm{int}}(\textbf{q}) \\ \textbf{g}_{\textrm{ext}}(\textbf{q})\end{bmatrix} \ \text {.}\end{aligned}$$
(102)

To enforce the orthonormality of the director frame, internal constraints of the form

$$\begin{aligned} \textbf{g}_{\textrm{int}}(\textbf{q}) = \begin{bmatrix} \frac{1}{2}(\textbf{d}_1 \cdot \textbf{d}_1 - 1) \\ \frac{1}{2}(\textbf{d}_2 \cdot \textbf{d}_2 - 1) \\ \frac{1}{2}(\textbf{d}_3 \cdot \textbf{d}_3 - 1) \\ \textbf{d}_1 \cdot \textbf{d}_2 \\ \textbf{d}_1 \cdot \textbf{d}_3 \\ \textbf{d}_2 \cdot \textbf{d}_3 \end{bmatrix} \end{aligned}$$
(103)

are imposed. To fix the tip of the gyroscopic top to the origin of the inertial frame (Fig. 16), the external constraint

$$\begin{aligned} \textbf{g}_\textrm{ext}(\textbf{q}) = \frac{1}{l}\mathbf {\varphi } - \textbf{d}_3 \end{aligned}$$
(104)

is used. Accordingly, to describe the mechanical system at hand, the \(n=3+9=12\) redundant coordinates are subjected to \(m=6+3=9\) constraints.

Similar to the last example, the present problem has rotational symmetry about the \(\textbf{e}_3\)-axis. Accordingly, matrix \(\textbf{A}^\alpha \) in (16) is given by

$$\begin{aligned} \textbf{A}^\alpha = \begin{bmatrix} \exp (\alpha \hat{\textbf{e}}_3) &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \exp (\alpha \hat{\textbf{e}}_3) &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \exp (\alpha \hat{\textbf{e}}_3) &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \exp (\alpha \hat{\textbf{e}}_3) \end{bmatrix} \end{aligned}$$
(105)

leading to

$$\begin{aligned} \mathbf {\xi } = \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{A}^\alpha = \begin{bmatrix} \hat{\textbf{e}}_3 &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \hat{\textbf{e}}_3 &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \hat{\textbf{e}}_3 &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \hat{\textbf{e}}_3 \end{bmatrix} \ \text {.}\end{aligned}$$
(106)

It is straightforward to verify that symmetry conditions (41) are satisfied.Footnote 2

The corresponding momentum map (45) takes the form

$$\begin{aligned} J_{\varvec{\xi }} = \textbf{p}\cdot \mathbf {\xi }\textbf{q}&= \sum \nolimits _{i=1}^4 \textbf{p}_i \hat{\textbf{e}}_3\textbf{q}_i \nonumber \\&= \textbf{e}_3 \cdot \left( \sum \nolimits _{i=1}^4 \textbf{q}_i\times \textbf{p}_i\right) \ \text {,}\end{aligned}$$
(107)

so that the 3-component of the total angular momentum of the rigid top is a first integral of the motion.

Since the functions \(L(\textbf{q},\textbf{v})\), \(g(\textbf{q})\), and \(g^{\textbf{v}}(\textbf{q},\textbf{p})\) are at most quadratic, the discrete derivatives required in the EM scheme (84) coincide with the respective midpoint derivatives.

The data used in the numerical example are as follows. The total mass of the top amounts to \(m=0.7069\), the moments of inertia are \(I_1 = I_2 = I_3 = 5.3014 \cdot 10^{-4}\) and the center of mass is located along the symmetry axis at \(l=0.075\).

The initial nutation angle is \(\alpha _0 = \pi /3\). Correspondingly, the initial coordinates in (100) are specified by using the rotation matrix

$$\begin{aligned} \textbf{R}(\alpha _0) = \begin{bmatrix} 1 &{} &{} 0 &{} &{} 0 \\ 0 &{} &{} \cos (\alpha _0) &{} &{} -\sin (\alpha _0) \\ 0 &{} &{} \sin (\alpha _0) &{} &{} \cos (\alpha _0) \end{bmatrix} \ \text {,}\end{aligned}$$
(108)

such that

$$\begin{aligned} \textbf{d}_i^0 = \textbf{R}(\alpha _0) \textbf{e}_i \end{aligned}$$
(109)

and

$$\begin{aligned} \mathbf {\varphi }^0 = \textbf{R}(\alpha _0) \begin{bmatrix} 0 \\ 0 \\ l \end{bmatrix} \ \text {.}\end{aligned}$$
(110)

The gyroscopic top is subject to an initial angular velocity vector of

$$\begin{aligned} \mathbf {\omega }_0 = \omega _\textrm{p}\,\textbf{e}_3 + \omega _\textrm{s}\,\textbf{d}_3 \ \text {,}\end{aligned}$$
(111)

where the initial precession rate is chosen as \(\omega _p = 10\). The initial velocities corresponding to the coordinates given in (100) are obtained by \(\textbf{v}_i^0= \mathbf {\omega }_0 \times \textbf{q}_i^0\), with \(i \in \{1, 2, 3, 4\}\). The conjugate momenta have been set to \(\textbf{p}^0 = \textbf{M}\textbf{v}^0\). In order to achieve the case of steady precession, the initial spin rate has to fulfill

$$\begin{aligned} \omega _\textrm{s} = \frac{m\,g\,l}{I_\textrm{3}\, \omega _\textrm{p}} + \frac{I_1 + m\, l^2 - I_3}{I_3}\,\omega _p\, \cos (\alpha _0) \end{aligned}$$
(112)

(cf. p. 221 in Goldstein [31]). In the present example, it amounts to \(\omega _\textrm{s} = 135.6\). By ensuring the condition for steady precession (112), the center of mass has to rotate on a constant height of \(\varphi _\textrm{3,ana}=0.0375\) about the vertical axis.

In addition to the present integration schemes (cf. Table 1), we apply the scheme proposed in Bobenko and Suris [41] (see also [42]), which has been developed specifically for the Lagrange top. This scheme is summarized in Appendix A.8 and labeled “BS99”.

None of the schemes under investigation satisfies the condition of steady precession (i.e., \(\varphi _3 = \varphi _\textrm{3,ana}=0.0375\)) as shown for \(h=0.002\) in Fig. 17 due to reasons of numerical accuracy.

Fig. 17
figure 17

Vertical coordinate of the center of mass

To check the order of accuracy, the relative error in the vertical coordinate of the center of mass is calculated according to

$$\begin{aligned} e_{\textbf{q}} = \frac{ | \varphi _3(t=0.001) - \varphi _{3,\text {ana}} |}{\varphi _{3,\text {ana}}} \ \text {.}\end{aligned}$$
(113)
Fig. 18
figure 18

Relative error in \(\textbf{q}\)

Fig. 19
figure 19

Relative error in \(\textbf{p}\)

As shown in Fig. 18, VI-S, BS99 and VI-B are first-order accurate, whereas VI-A and EM are second-order accurate. Figure 19 depicts the error for the momentum vector of the center of mass calculated via

$$\begin{aligned} e_{\textbf{p}} = \frac{ || \textbf{p}_1(t=0.001) - \textbf{p}_{1,\text {ref}} || }{||\textbf{p}_{1,\text {ref}}||} \ \text {,}\end{aligned}$$
(114)

where \(\textbf{p}_\textrm{1,ref}\) represents the solution at \(t=0.001\) obtained with the EM scheme with \(h=5 \cdot 10^{-7}\). It becomes visible that VI-S, BS99 and VI-B are first-order accurate, whereas VI-A and EM are second-order accurate.

Again, as expected, only the EM scheme is capable of conserving the total energy of the system. However, all integrators at hand conserve the total angular momentum of the top about the vertical axis. In contrast to the pendulum example from Sect. 6.1, VI-S is not able to fulfill the velocity constraints exactly. Representative constraints are depicted in Fig. 20. Note, however, that the linear external constraints (i.e., \(k \in \{7,8,9\}\)) are still exactly fulfilled down to computer precision. As already pointed out in the previous example, VI-A does not fulfill both types of constraints in the endpoints, while VI-B and EM, by design, exactly capture the constraints both on configuration and on velocity level.

Fig. 20
figure 20

Constraints on momentum level (VI-S)

6.3 Four-particle system

Fig. 21
figure 21

Four-particle system

The goal of this next example is to analyze the newly devised schemes with respect to robustness and the required computational effort. Moreover, we compare the EM method with the original scheme by Gonzalez [14]. The example of the four-particle system depicted in Fig. 21 has been taken from Gonzalez [14]. The configuration of the system is characterized by the configuration vector

$$\begin{aligned} \textbf{q} = \begin{bmatrix} \textbf{q}_1 \\ \textbf{q}_2 \\ \textbf{q}_3 \\ \textbf{q}_4 \end{bmatrix}\!\ \text {.}\end{aligned}$$
(115)

The two nonlinear springs give rise to the potential function

$$\begin{aligned} V(\textbf{q})&= \frac{1}{2}\, k_{13} \left( (\textbf{q}_3 - \textbf{q}_1) \cdot (\textbf{q}_3 - \textbf{q}_1) - l_{13}^2 \right) ^2 \nonumber \\&\quad + \frac{1}{2}\, k_{24} \left( (\textbf{q}_4 - \textbf{q}_2) \cdot (\textbf{q}_4 - \textbf{q}_2) - l_{24}^2 \right) ^2 \!\ \text {,}\end{aligned}$$
(116)

where the spring stiffnesses are set to \(k_{13} = 50\) and \(k_{24} = 500\). The natural lengths of the two springs are \(l_{13}= l_{24} = 1\), respectively. Obviously, the mass matrix is block diagonal and contains the masses \(m_i\) (\(i=1,\ldots ,4\)). Specifically, \(m_1 = 1, m_2 = 3, m_3=2.3, m_4=1.7\). There are two holonomic constraints with associated constraint functions

$$\begin{aligned} g_1(\textbf{q})&{=} \frac{1}{2}\left( {\frac{1}{l_{12}^2}} (\textbf{q}_2 \,{-}\,~ \textbf{q}_1) \cdot (\textbf{q}_2\, {-}\, ~\textbf{q}_1) - {1} \right) \! \ \text {,}\end{aligned}$$
(117a)
$$\begin{aligned} g_2(\textbf{q})&{=} \frac{1}{2}\left( {\frac{1}{l_{34}^2}} (\textbf{q}_4 \,{-}\,~ \textbf{q}_3) \cdot (\textbf{q}_4 -~ \textbf{q}_3) - {1} \right) \!\ \text {,}\end{aligned}$$
(117b)

where \(l_{12}= l_{34} = 1\), respectively.

To summarize, the system has \(n=12\) redundant coordinates subject to \(m=2\) constraints. Moreover, the system has two symmetries. The first symmetry is related to the translational invariance of the system characterized by \(\textbf{q}_i^\alpha = \textbf{q}_i + \alpha \textbf{e}\) for arbitrary \(\textbf{e}\in {\mathbb {R}}^3\). Correspondingly, (10a) yields \(\mathbf {\xi }_{\mathcal {Q}}^T = [\textbf{e}^T,\textbf{e}^T,\textbf{e}^T,\textbf{e}^T]\), so that momentum map (15) results in

$$\begin{aligned} J_{\varvec{\xi }} = \textbf{e}\cdot \left( \sum \nolimits _{i=1}^4 \textbf{p}_i \right) \end{aligned}$$
(118)

Since \(\textbf{e}\) is arbitrary, the total linear momentum \(\textbf{L} {:}{=}\sum \nolimits _{i=1}^4 \textbf{p}_i\) is a first integral of the motion.

The second symmetry is related to the rotational invariance of the system. With regard to (16), rotational invariance is characterized by

$$\begin{aligned} \textbf{A}^\alpha = \begin{bmatrix} \exp (\alpha \hat{\textbf{e}}) &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \exp (\alpha \hat{\textbf{e}}) &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \exp (\alpha \hat{\textbf{e}}) &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \exp (\alpha \hat{\textbf{e}}) \end{bmatrix} \end{aligned}$$
(119)

for arbitrary \(\textbf{e}\in {\mathbb {R}}^3\). The last equation yields

$$\begin{aligned} \mathbf {\xi } = \left. \frac{\,\textrm{d}}{\,\textrm{d}\alpha }\right| _{\alpha =0} \textbf{A}^\alpha = \begin{bmatrix} \hat{\textbf{e}} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \hat{\textbf{e}} &{} &{} \textbf{0} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \hat{\textbf{e}} &{} &{} \textbf{0} \\ \textbf{0} &{} &{} \textbf{0} &{} &{} \textbf{0} &{} &{} \hat{\textbf{e}} \end{bmatrix} \ \text {.}\end{aligned}$$
(120)

It is straightforward to verify that symmetry conditions (41) are satisfied. The corresponding momentum map (45) takes the form

$$\begin{aligned} J_{\varvec{\xi }} = \textbf{p}\cdot \mathbf {\xi }\textbf{q}&= \sum \nolimits _{i=1}^4 \textbf{p}_i \hat{\textbf{e}}\textbf{q}_i \nonumber \\&= \textbf{e} \cdot \left( \sum \nolimits _{i=1}^4 \textbf{q}_i\times \textbf{p}_i\right) \ \text {.}\end{aligned}$$
(121)

Since \(\textbf{e}\) is arbitrary, the total angular momentum \(\textbf{J} {:}{=} \sum \nolimits _{i=1}^4 \textbf{q}_i\times \textbf{p}_i\) is a first integral of the motion.

Since the kinetic energy, \(\textbf{g}(\textbf{q})\) and \(\textbf{g}^{\textbf{v}}(\textbf{q},\textbf{p})\) are at most quadratic, the corresponding discrete derivatives required in the EM scheme (84) coincide with the midpoint derivatives. In contrast to that, the higher nonlinearity of potential function (116) demands a proper design of the corresponding discrete derivative (cf. Gonzalez [26]). To this end, we introduce the quadratic invariants

$$\begin{aligned} \pi _1(\textbf{q})&= (\textbf{q}_3 - \textbf{q}_1) \cdot (\textbf{q}_3 - \textbf{q}_1) \ \text {,}\end{aligned}$$
(122a)
$$\begin{aligned} \pi _2(\textbf{q})&= (\textbf{q}_4 - \textbf{q}_3) \cdot (\textbf{q}_4 - \textbf{q}_3) \ \text {.}\end{aligned}$$
(122b)

Note that these invariants account for both symmetry properties. Now, potential function (116) can be recast in the form

$$\begin{aligned} V(\textbf{q}) = {\tilde{V}}_1(\pi _1(\textbf{q})) + {\tilde{V}}_2(\pi _2(\textbf{q})) \ \text {,}\end{aligned}$$
(123)

where

$$\begin{aligned} {\tilde{V}}_1(\pi _1(\textbf{q}))&= \frac{1}{2}\, k_{13} \left( \pi _1(\textbf{q}) - l_{13}^2 \right) ^2 \ \text {,}\end{aligned}$$
(124a)
$$\begin{aligned} {\tilde{V}}_2(\pi _2(\textbf{q}))&= \frac{1}{2}\, k_{24} \left( \pi _2(\textbf{q}) - l_{24}^2 \right) ^2 \ \text {.}\end{aligned}$$
(124b)

The discrete derivative of \(V(\textbf{q})\) can be viewed as discrete counterpart of the chain rule result

$$\begin{aligned} DV(\textbf{q}) = {\tilde{V}}_1'(\pi _1)\frac{\partial \pi _1}{\partial \textbf{q}} + {\tilde{V}}_2'(\pi _2)\frac{\partial \pi _1}{\partial \textbf{q}} \ \text {,}\end{aligned}$$
(125)

in which the classical Greenspan’s formula [43] is applied to obtain

$$\begin{aligned} {\textsf{D}}^\textrm{G}V&= \frac{{\tilde{V}}_1(\pi _1^{n+1}) - {\tilde{V}}_1(\pi _1^{n})}{\pi _1^{n+1}- \pi _1^{n}} \frac{\partial \pi _1}{\partial \textbf{q}}(\textbf{q}^{n+1/2}) \nonumber \\&\quad + \frac{{\tilde{V}}_2(\pi _2^{n+1}) - {\tilde{V}}_2(\pi _2^{n})}{\pi _2^{n+1}- \pi _2^{n}} \frac{\partial \pi _2}{\partial \textbf{q}}(\textbf{q}^{n+1/2}) \ \text {.}\end{aligned}$$
(126)

It is straightforward to verify that both orthogonality condition (85) and directionality condition (86) are satisfied.

In the numerical simulations, the following initial conditions have been applied:

$$\begin{aligned} \textbf{q}_1^0&= \begin{bmatrix} 0 , 0 , 0 \end{bmatrix} \ , \ \textbf{q}_2^0 = \begin{bmatrix} 1 , 0 , 0 \end{bmatrix} \ , \end{aligned}$$
(127a)
$$\begin{aligned} \textbf{q}_3^0&= \begin{bmatrix} 0 , 1 , 0 \end{bmatrix} \ , \ \textbf{q}_4^0 = \begin{bmatrix} 1 , 1 , 0 \end{bmatrix} \end{aligned}$$
(127b)

and

$$\begin{aligned} \textbf{v}_1^0&= \begin{bmatrix} 0 , 0 , 0 \end{bmatrix} \ , \ \textbf{v}_2^0 = \begin{bmatrix} 0 , 0 , 0 \end{bmatrix} \ , \end{aligned}$$
(127c)
$$\begin{aligned} \textbf{v}_3^0&= \begin{bmatrix} 0 , 0 , 0 \end{bmatrix} \ , \ \textbf{v}_4^0 = \begin{bmatrix} 0 , 0 , 2/1.7 \end{bmatrix} \ \text {.}\end{aligned}$$
(127d)

The momenta have been initialized with \(\textbf{p}_i^0 = m_i \textbf{v}_i^0\). The simulations have been conducted with \(h=0.01\) for a total time of \(T=10\).

Fig. 22
figure 22

Snapshots of the motion of the four-particle system computed with the EM at \(t = \left\{ 0\,, \, 2 \,, \, 4 \,, \, 6 \,, \, 8 \,, \, 10 \right\} \)

The motion of the four-particle system is illustrated with some snapshots in Fig. 22.

For the sake of comparability, we have also included results of the original EM scheme developed by Gonzalez [14]. This scheme only takes into account the primary constraints and is labeled as “EM-G”. Although EM-G does not exactly satisfy the secondary constraints (Fig. 23), which is in contrast to the present EM scheme (Fig. 24), both schemes yield comparable results concerning conservation of total energy (Fig. 25) conservation of angular momentum (Figs. 26 and 27) and accuracy.

Fig. 23
figure 23

Constraints on momentum level (EM-G)

Fig. 24
figure 24

Constraints on momentum level (EM)

Fig. 25
figure 25

Incremental changes of the energy function E

Fig. 26
figure 26

Angular momentum components (EM and EM-G)

Fig. 27
figure 27

Incremental changes of the angular momentum components (EM)

Table 2 Computational effort

Next we investigate the numerical effort caused by the schemes at hand. To this end, we compare the computation time along with the mean number of Newton iterations \({\bar{n}}_\textrm{iter}\) required per time step. In particular, the computation time \(t_\textrm{comp}\) is normalized with respect to the time required by VI-S. The results in Table 2 refer to the use of two alternative initial guesses for \(\textbf{q}^{n+1}\) in Newton’s method. In the first two columns of Table 2, \(\textbf{q}^{n}\) has been used as initial guess (“ simple initial guess”), while the results in the second column rely on the initial guess \(\textbf{q}^{n}+ h\, \textbf{v}^{n}\) (“ advanced initial guess”). It can be observed that EM causes the largest numerical effort due to the computation of discrete gradients. Moreover, an advanced initial guess for the Newton method serves the purpose to decrease the necessary amount of iterations.

Figure 28 shows that both EM and EM-G are second-order accurate in the coordinates. Specifically, the relative error for the position of the fourth particle at \(t=0.1\) has been calculated via

$$\begin{aligned} e_{\textbf{q}} = \frac{|| \textbf{q}_4(t=0.1) - \textbf{q}_\textrm{4,ref} || }{|| \textbf{q}_\textrm{4,ref} ||} \ \text {,}\end{aligned}$$
(128)

where \(\textbf{q}_\textrm{4,ref}\) represents the reference solution calculated with EM for \(h=10^{-5}\). Similarly, both schemes yield second-order accuracy in the momenta (cf. Figure 29) and first-order accuracy in the Lagrange multipliers \(\mathbf {\lambda }\) as can be observed from Fig. 30.

Fig. 28
figure 28

Relative error in \(\textbf{q}\)

Fig. 29
figure 29

Relative error in \(\textbf{p}\)

Fig. 30
figure 30

Relative error in \(\mathbf {\lambda }\)

Eventually, we focus on the numerical stability of the schemes under investigation. Since only EM is capable of conserving the total energy, it exhibits superior numerical stability properties (see Gonzalez and Simo [44] for a related stability analysis). This is confirmed by the results depicted in Figs. 3132 and 33. For \(h=0.01\), all of the schemes under investigation remain stable (cf. Fig. 31). In fact, for \(h\le 0.04\) all schemes under investigation keep stable at least until \(T = 1000\). The lower-order schemes VI-S and VI-B experience numerical energy blow-up already for \(h=0.05\) as shown in Fig. 32. For \(h=0.25\) (Fig. 33), VI-A exhibits an energy blow-up at about \(t=55\). Interestingly, EM keeps stable even for quite large time steps of \(h=0.675\).

It can be concluded that the superior numerical stability of EM comes at the expense of a larger numerical effort per time step.

Fig. 31
figure 31

Stable energies with \(h=0.01\)

Fig. 32
figure 32

Energy blow-ups with \(h=0.05\)

Fig. 33
figure 33

Energy blow-ups with \(h=0.25\)

7 Conclusion

The present approach to the numerical integration of the DAEs governing the motion of constrained mechanical systems relies on an index reduction in the spirit of the well-known GGL stabilization. We have presented the GGL variational principle which can be viewed as an extension of the Livens principle to constrained mechanical systems. The judicious inclusion of the secondary constraints into the GGL principle yields the desired index reduction in the spirit of the GGL stabilization. Accordingly, the Euler–Lagrange equations of the GGL principle assume the form of index 2 DAEs. These DAEs have been shown to preserve main structural properties of the underlying mechanical system independently of the multiplier associated with the secondary constraints. This feature is in sharp contrast to the original GGL stabilization and makes possible the design of structure-preserving discretization methods. In particular, the availability of the GGL functional has facilitated the design of novel variational integrators for the constrained mechanical systems at hand. These integrators have been shown to be symplectic and capable of conserving angular momentum maps. In addition to that, a new energy–momentum scheme has been developed by discretizing the Euler–Lagrange index 2 DAEs pertaining to the GGL principle.

While the GGL functional in the form (33) is valid for configuration-dependent (or non-constant) mass matrices, the development of variational integrators has been restricted to mechanical systems with constant mass matrix. The inclusion of non-constant mass matrices would be of interest for future work.

Similar observations hold for the EM scheme (84) presented in Sect. 5. Apart from the inclusion of the velocity constraints, scheme (84) in general differs from the EM scheme due to Gonzalez [14] in the case of non-constant mass matrices. This holds true even for the unconstrained case dealt with in [26].

As the numerical investigations have shown, thepresent integrators are at most second-order accurate in the coordinates and the momenta. The development of higher-order variational integrators should be possible by following the ideas presented in Wenger et al. [45]. In this connection, the approach recently developed in Altmann and Herzog [46] should also be applicable. Furthermore, it would be of interest to investigate constrained symplectic partitioned Runge–Kutta methods (see Jay [12] and Marsden and West [23]) in the framework of the GGL principle.