1 Introduction

Multibody system dynamics problems can be typically formulated as a set of Differential-Algebraic Equations (DAEs), often in semi-explicit form. The numerical treatment of DAEs is more challenging than that of Ordinary Differential Equations (ODEs). Typically, two strategies are employed: direct discretization of DAEs and discretization after reformulation [3]. Reformulation usually consists of some sort of index reduction that can convert DAEs into ODEs, and thus allows the problems to be solved using relatively conventional methods. However, this process may be costly, since it may require substantial user intervention and may be convenient only when a substantial reduction in coordinates can be achieved, which is not the case for examples where mechanisms are analyzed made of flexible components, so direct discretization has gained more attention in software development.

Direct discretization poses strict requirements on time integration methods. Explicit integrators, such as the central difference method [13] and the explicit Runge–Kutta methods [10], are difficult to use to solve DAEs directly because they cannot satisfy the algebraic constraint equations at the position level. Implicit integrators, including the linear multi-step methods [23, 24], the implicit Runge–Kutta methods [9] and many direct integration methods [30], are required. They are designed to possess good accuracy, A-stability (unconditional stability), and tunable algorithmic dissipation to provide accurate and robust solutions.

Implicit time integrators are briefly reviewed here. In the field of structural dynamics, several single-step single-solve methods, such as the Newmark method [25], the Wilson-\(\theta \) method [31], the HHT-\(\alpha \) method [17] (proposed by Hilber, Hughes and Taylor), the generalized-\(\alpha \) method [11, 22], the GSSSS (Generalized Single-Step Single-Solve) method [37], and many others [18, 32], have been developed since the 1950s. Most of these methods have second-order accuracy, A-stability and tunable algorithmic dissipation from linear analysis. They were initially designed to solve second-order ODEs in structural dynamics, and some of their improved formulations can also be used to solve DAEs and general first-order differential equations [2, 8, 20]. Some comparisons between the linear two-step method and single-step methods have already been presented in [34, 36] and are not reproduced here. Therefore, these single-step methods are not considered further in this work.

In the class of multi-step methods, the linear two-step method [24], and several backward difference formulas (BDFs) [19, 28], have been efficiently used in multibody system dynamics. The optimal parameters of the linear three- and four-step methods with second-order accuracy, A-stability and tunable algorithmic dissipation were given in [36]. According to Dahlquist’s second barrier [12], the linear multi-step methods cannot exceed second-order accuracy to possess A-stability. To eliminate the additional starting procedures of the multi-step methods, their equivalent single-step reformulations, obtained by introducing a few auxiliary variables, have been also proposed in [36]. These multi-step and equivalent single-step integrators are designed for systems of first-order differential equations, and can be generalized to solve second- and higher-order differential equations in a straightforward way.

Another important branch of implicit integrators are the multi-stage methods, represented by the Runge–Kutta family [10]. They evaluate the states at intermediate time points per step, and compute the states at discrete time points using a scheme like the quadrature formula. For solving DAEs, the stiffly-accurate Runge–Kutta methods without the quadrature step are more practical, because the constraints are satisfied at the final stage, but may not be satisfied after implementing the quadrature formula. Multi-stage methods can be designed to have higher-order accuracy and A-stability simultaneously, as in [1, 6, 21, 35]. Considering the computational cost, the singly diagonally-implicit Runge–Kutta methods [27], which perform the computation of each stage in sequence, are more convenient and recommended. Consequently, a few recently proposed second- and higher-order stiffly-accurate, singly diagonally-implicit Runge-Kutta methods with explicit first-stage [21, 35] are employed in this work.

The purpose of this work is to present a comparative study of several representative implicit, A-stable and algorithmically dissipative time integration methods for multibody system dynamics. The time integration methods employed include the linear multi-step methods [23, 24, 36], their equivalent single-step methods [36], and stiffly-accurate, explicit first-stage, singly diagonally-implicit Runge–Kutta (ESDIRK) methods [21, 35]. These methods are implemented in the free general-purpose multibody dynamics analysis software MBDynFootnote 1 [24]. Their formulation is presented in Sect. 2, whereas Sect. 3 describes their implementation in MBDyn. Considering a linear problem, the accuracy, algorithmic dissipation and dispersion properties of these methods are discussed in Sect. 4. These methods are then applied to solve of some benchmark multibody dynamics problems in Sect. 5. By comparing the numerical results, several general conclusions on the implementation and selection of time integration methods are finally summarized in Sect. 6.

2 Formulation

Initial-value problems in MBDyn are formulated as a set of implicit first-order DAEs, whose general form is

$$\begin{aligned} \boldsymbol{r}\left (\boldsymbol{y},\dot{\boldsymbol{y}},t\right )=\boldsymbol{0},\quad\boldsymbol{y}(t_{0})= \boldsymbol{y}_{0} \end{aligned}$$
(1)

where \(\boldsymbol{y}\) collects the differential and algebraic variables, and the overdot indicates the derivative with respect to time \(t\). The initial condition \(\boldsymbol{y}_{0}\) is given, and \(\dot{\boldsymbol{y}}_{0}\) needs to be solved from \(\boldsymbol{r}(\boldsymbol{y}_{0},\dot{\boldsymbol{y}}_{0},t_{0})=\boldsymbol{0}\). For a detailed problem description, the reader should refer to [24].

Problems associated with constrained dynamics, as discussed later in Sect. 5, are formulated as Index-3 DAEs, by directly enforcing the holonomic kinematic constraints on the position level through algebraic relations between the coordinates of the problem using Lagrange multipliers. No elaborated scaling strategy is used, except for scaling the Jacobian matrix contribution by the inverse of \(\Delta t b_{0}\), the coefficient that multiplies the derivative of the state at the current time step in implicit numerical schemes, as proposed in [7]. No hidden constraints, e.g., on the velocity level, are considered.

2.1 Linear multi-step methods

The linear multi-step methods can be expressed as

$$\begin{aligned} \boldsymbol{y}_{k}=\sum _{j=1}^{r}\alpha _{j}\boldsymbol{y}_{k-j}+\Delta t\sum _{j=0}^{r} \beta _{j}\dot{\boldsymbol{y}}_{k-j} \end{aligned}$$
(2)

where \(\boldsymbol{y}_{k}\) and \(\dot{\boldsymbol{y}}_{k}\) represent the numerical solution at time \(t_{k}\), \(\Delta t=t_{k}-t_{k-1}\) is the time step size, \(\alpha _{j}\) and \(\beta _{j}\) are control parameters of the method. Considering the conditions of second-order accuracy, A-stability, and tunable algorithmic dissipation, the optimal parameters of the linear two-, three-, and four-step methods, referred to as LMS2, LMS3 and LMS4, can be found in [36]. They are controlled by a single parameter \(\rho _{\infty }\in [0,1]\), to adjust the degree of algorithmic dissipation. The algorithmic dissipation becomes stronger as \(\rho _{\infty }\) decreases. When \(\rho _{\infty } = 0\), they reduce to a second-order BDF. In [24], the parameters of LMS2 used in variable-time-step cases were given, while so far LMS3 and LMS4 were previously formulated only for fixed time steps. The initialization of the integration procedure of the multi-step methods, is performed employing the trapezoidal rule for the first few steps

$$\begin{aligned} \boldsymbol{y}_{k}=\boldsymbol{y}_{k-1}+\frac{\Delta t}{2}\left (\dot{\boldsymbol{y}}_{k}+ \dot{\boldsymbol{y}}_{k-1}\right ) \end{aligned}$$
(3)

which is A-stable and second-order accurate.

2.2 Equivalent single-step methods

The single-step method proposed in [36], which can be used as an equivalent alternative of the linear multi-step method, has the form

$$\begin{aligned} &\boldsymbol{y}_{k}=\boldsymbol{y}_{k-1}+\Delta t((1-\gamma _{0})\dot{\boldsymbol{y}}_{k-1}^{r-1}+ \gamma _{0}\dot{\boldsymbol{y}}_{k}^{r-1}) \end{aligned}$$
(4a)
$$\begin{aligned} &(1-\gamma _{1})\dot{\boldsymbol{y}}_{k-1}^{r-1}+\gamma _{1}\dot{\boldsymbol{y}}_{k}^{r-1}=(1- \gamma _{2})\dot{\boldsymbol{y}}_{k-1}^{r-2}+\gamma _{2}\dot{\boldsymbol{y}}_{k}^{r-2} \end{aligned}$$
(4b)
$$\begin{aligned} &(1-\gamma _{3})\dot{\boldsymbol{y}}_{k-1}^{r-2}+\gamma _{3}\dot{\boldsymbol{y}}_{k}^{r-2}=(1- \gamma _{4})\dot{\boldsymbol{y}}_{k-1}^{r-3}+\gamma _{4}\dot{\boldsymbol{y}}_{k}^{r-3} \end{aligned}$$
(4c)
$$\begin{aligned} &\ldots \end{aligned}$$
(4d)
$$\begin{aligned} &(1-\gamma _{2r-3})\dot{\boldsymbol{y}}_{k-1}^{1}+\gamma _{2r-3}\dot{\boldsymbol{y}}_{k}^{1}=(1- \gamma _{2r-2})\dot{\boldsymbol{y}}_{k-1}+\gamma _{2r-2}\dot{\boldsymbol{y}}_{k} \end{aligned}$$
(4e)

where \(\dot{\boldsymbol{y}}_{k}^{j} (j=1,2,\ldots ,r-1)\) are auxiliary variables, and \(\gamma _{i}\) are control parameters. At the beginning, \(\dot{\boldsymbol{y}}_{0}^{1}=\dot{\boldsymbol{y}}_{0}^{2}=\cdots =\dot{\boldsymbol{y}}_{k}^{r-1}= \dot{\boldsymbol{y}}_{0}\) is used. The parameters of the single-step methods equivalent to LMS2, LMS3 and LMS4, referred to as SS2, SS3 and SS4, respectively, were also given in [36]. SS3 and SS4 have complex parameters, so the auxiliary variables they produce may be complex numbers, but the state variables are real, as demonstrated in [36].

2.3 Explicit first-stage, singly diagonally-implicit Runge–Kutta (ESDIRK) methods

The stiffly-accurate \(s\)-stage ESDIRK is represented using Butcher’s tableau [10], as

$$\begin{aligned} \textstyle\begin{array}{c@{\ \ }|@{\ \ }c@{\quad}c@{\quad}c@{\quad}c@{\quad}c@{\quad}c} 0 & 0 & 0 & 0 & \ldots & 0 & 0\\ c_{2} & a_{21} & \gamma & 0 & \ldots & 0 & 0\\ c_{3} & a_{31} & a_{32} & \gamma & \ddots & 0 & 0\\ \vdots & \vdots & \vdots & \ddots & \ddots & \vdots & \vdots \\ c_{s-1} & a_{s-1,1} & a_{s-1,2} & a_{s-1,3} & \ldots & \gamma & 0\\ 1 & b_{1} & b_{2} & b_{3} & \ldots & b_{s-1} & \gamma \\ \hline & b_{1} & b_{2} & b_{3} & \ldots & b_{s-1} & \gamma \end{array}\displaystyle \end{aligned}$$

where \(\gamma \), \(a_{ij}\), \(c_{i}\), \(b_{i}\) are control parameters. Considering the implicit first-order equation (1), the intermediate stages are formulated as

$$\begin{aligned} &\boldsymbol{y}_{k-1+c_{i}}=\boldsymbol{y}_{k-1}+\Delta t\left (\sum _{j=1}^{i-1}a_{ij} \dot{\boldsymbol{y}}_{k-1+c_{j}}+\gamma \dot{\boldsymbol{y}}_{k-1+c_{i}}\right ) \\ &i=2,3,4,\ldots ,s-1 \end{aligned}$$
(5)

The last stage is

$$\begin{aligned} \boldsymbol{y}_{k}=\boldsymbol{y}_{k-1}+\Delta t\left (\sum _{j=1}^{s-1}b_{j} \dot{\boldsymbol{y}}_{k-1+c_{j}}+\gamma \dot{\boldsymbol{y}}_{k}\right ) \end{aligned}$$
(6)

where \(c_{1}=0\) and \(c_{s}=1\). The computation of each stage can be implemented in sequence. Except for the explicit first stage, every other stage uses an implicit single-step or multi-step formula. They share the same effective stiffness matrix for linear analysis and the same form of Jacobian matrix in nonlinear iterations. In the procedure, the state variables at the time points are given, but those at the intermediate stages are not output. Therefore, the multi-stage methods are essentially single-step schemes, which only use the information from the last step to update the current one.

The two-sub-step \(\rho _{\infty }\)-Bathe method [26], which can be seen as a 3-stage ESDIRK with second-order accuracy, A-stability and tunable algorithmic dissipation, is presented. Its parameters are

$$\begin{aligned} &\gamma =\left \{ \textstyle\begin{array}{c@{\quad }c} \cfrac{2-\sqrt{2(1+\rho _{\infty })}}{2(1-\rho _{\infty })}, & \rho _{\infty }\in \left [0,1\right ) \\ \cfrac{1}{4},&\rho _{\infty }=1 \end{array}\displaystyle \right . \\ &b_{1}=-\frac{4\gamma ^{2}-6\gamma +1}{4\gamma },\qquad b_{2}= \frac{1-2\gamma }{4\gamma } \end{aligned}$$
(7)

The multi-sub-step methods MSSTC(\(n\)) and MSSTH(\(n\)), as \((n+1)\)-stage ESDIRKs proposed in [35], are also employed. MSSTC(\(n\)) is designed to have second-order accuracy, A-stability, tunable algorithmic dissipation, preserving low-frequency dynamics as much as possible. It employs the trapezoidal rule from the second to the \(n\)th stage, and a general formula in the last one. The optimal parameters of MSSTC(\(3,4,5\)) were given in [35].

MSSTH(\(n\)) is designed to have \(n\)th-order accuracy, A-stability, and tunable algorithmic dissipation. However, since only linear analysis was considered in [35], its parameters are modified here to satisfy the overall-order and stage-order conditions for Runge–Kutta methods [10, 16, 21], without changing the linear characteristics. The design of the modified MSSTH(\(3,4,5\)) considers the following conditions:

  • Each stage, from the second-one, has at least second-order accuracy;

  • The overall accuracy is \(n\)th-order, and on this basis, the local truncation error is minimized;

  • A-stability and tunable algorithmic dissipation for linear analysis.

Under the premise of A-stability, MSSTH(\(n\)) is designed to achieve the highest possible accuracy for a given \(\rho _{\infty }\). The details of the parameter selection are shown in the Appendix.

Besides, several stiffly-accurate ESDIRKs developed in [21], including the third-order 4-stage ESDIRK3(2)4L[2]SA, the third-order 5-stage ESDIRK3(2)5L[2]SA, and the fourth-order 6-stage ESDIRK4(3)6L[2]SA2, are also employed. These methods are designed to be L-stable (\(\rho _{\infty }= 0\)), and their internal stages are also designed to be L-stable whenever possible. Their parameters can be found in [21].

3 Implementation

The detailed problem description, solution phases and implementation structure of MBDyn were presented in [24]. Time integrators are defined in the class ImplicitStepIntegrator. The multi-step, single-step, and multi-stage integrators are constructed using the template classes tplStepNIntegrator, tplSingleStepIntegrator and tplStageNIntegrator, respectively. They provide an Advance() method to perform a complete step. For multi-stage integrators, the operations of all stages are encapsulated in the method Advance(), so the solutions in the internal stages are hidden.

With the initial condition at \(t_{0}\), the multi-step and single-step integrators sequentially calculate the state variables at \(t_{1}\), \(t_{2}\), \(t_{3}\), ⋯, \(t_{k}\), ⋯, and the ESDIRKs need to solve the results at \(t_{0+c_{2}}\), \(t_{0+c_{3}}\), ⋯, \(t_{0+c_{s-1}}\), \(t_{1}\), \(t_{1+c_{2}}\), \(t_{1+c_{3}}\), ⋯, \(t_{1+c_{s-1}}\), \(t_{2}\), ⋯, \(t_{k}\), ⋯ in turn. Note that the explicit first stage of ESDIRKs does not require any calculation. All methods show a very similar structure at each time point; the difference lies in the parameters and the number of previous time points used. The single-step methods, must additionally solve and store the auxiliary variables. Therefore, the implementation at a certain discrete time point, \(t_{N}\), which is used to represent all time points, including those at the end of each step \(t_{k}\) and the internal time points of the ESDIRKs, is explained uniformly in this section. For multi-step and single-step methods, the information at \(t_{N-1}\), \(t_{N-2}\), ⋯, used at the current time point \(t_{N}\) are the states of previous steps. For ESDIRKs, the information of \(t_{N-1}\), \(t_{N-2}\), ⋯, are the states of the previously solved time points, which can be the last step and last stages.

At the discrete time point \(t_{N}\), the state variables \(\boldsymbol{y}_{N}\) and \(\boldsymbol{\dot{y}}_{N}\) are obtained by solving

$$\begin{aligned} &\boldsymbol{r}\left (\boldsymbol{y}_{N},\boldsymbol{\dot{y}}_{N},t_{N}\right )=\boldsymbol{0} \end{aligned}$$
(8a)
$$\begin{aligned} &\boldsymbol{y}_{N}=\boldsymbol{f}\left (\boldsymbol{y}_{N-1},\boldsymbol{y}_{N-2},\ldots , \dot{\boldsymbol{y}}_{N}, \dot{\boldsymbol{y}}_{N-1},\dot{\boldsymbol{y}}_{N-2},\ldots , \dot{\boldsymbol{y}}_{N-1}^{1}, \dot{\boldsymbol{y}}_{N-1}^{2}, \ldots ,\dot{\boldsymbol{y}}_{N-1}^{r} \right ) \end{aligned}$$
(8b)

Here Eq. (8b) represents the integration scheme. It is Eq. (2) for multi-step integrators, and Eq. (5) or Eq. (6) for the ESDIRKs. For single-step methods, it needs to be reorganized from Eqs. (4a)–(4e). SS2 uses

$$\begin{aligned} \boldsymbol{y}_{N}=\boldsymbol{y}_{N-1}+\Delta t\left ( \frac{\gamma _{0}\gamma _{2}}{\gamma _{1}}\dot{\boldsymbol{y}}_{N}+ \frac{\gamma _{0}(1-\gamma _{2})}{\gamma _{1}}\dot{\boldsymbol{y}}_{N-1}+ \frac{\gamma _{1}-\gamma _{0}}{\gamma _{1}}\dot{\boldsymbol{y}}_{N-1}^{1} \right ) \end{aligned}$$
(9)

SS3 uses

$$\begin{aligned} &\boldsymbol{y}_{N}=\boldsymbol{y}_{N-1} \\ &+\Delta t\left ( \frac{\gamma _{0}\gamma _{2}\gamma _{4}}{\gamma _{1}\gamma _{3}} \dot{\boldsymbol{y}}_{N}+ \frac{\gamma _{0}\gamma _{2}(1-\gamma _{4})}{\gamma _{1}\gamma _{3}} \dot{\boldsymbol{y}}_{N-1}+ \frac{\gamma _{0}(\gamma _{3}-\gamma _{2})}{\gamma _{1}\gamma _{3}} \dot{\boldsymbol{y}}_{N-1}^{1}+\frac{\gamma _{1}-\gamma _{0}}{\gamma _{1}} \dot{\boldsymbol{y}}_{k-1}^{2}\right ) \end{aligned}$$
(10)

SS4 uses

$$\begin{aligned} &\boldsymbol{y}_{N}=\boldsymbol{y}_{N-1} \\ &+\Delta t\left ( \frac{\gamma _{0}\gamma _{2}\gamma _{4}\gamma _{6}}{\gamma _{1}\gamma _{3}\gamma _{5}} \dot{\boldsymbol{y}}_{N}+ \frac{\gamma _{0}\gamma _{2}\gamma _{4}(1-\gamma _{6})}{\gamma _{1}\gamma _{3}\gamma _{5}} \dot{\boldsymbol{y}}_{N-1}+\right . \\ &\left . \frac{\gamma _{0}\gamma _{2}(\gamma _{5}-\gamma _{4})}{\gamma _{1}\gamma _{3}\gamma _{5}} \dot{\boldsymbol{y}}_{N-1}^{1}+ \frac{\gamma _{0}(\gamma _{3}-\gamma _{2})}{\gamma _{1}\gamma _{3}} \dot{\boldsymbol{y}}_{k-1}^{2}+\frac{\gamma _{1}-\gamma _{0}}{\gamma _{1}} \dot{\boldsymbol{y}}_{k-1}^{3}\right ) \end{aligned}$$
(11)

3.1 Prediction

A predictor-corrector approach [24] is used to solve Eqs. (8a)–(8b) in MBDyn. Prediction and correction are two separate, independent, and consecutive phases. The objective of the prediction phase is to determine a tentative value for the solution to start the correction. Here \(\dot{\boldsymbol{y}}_{N}^{(0)}\) is used to represent the predicted value, and then \(\boldsymbol{y}_{N}^{(0)}\) can be obtained directly by the integration scheme. The scheme for prediction has minimal effect on the accuracy of the solutions, but it may affect the number of iterations required, as shown in Sect. 5. The closer the predicted value is to the final solution, the fewer iterations are required. Consequently, the criterion for choosing the prediction scheme here is that it should not employ extra information that was not used in the integration scheme, and that it should have similar accuracy order to the integration scheme.

For the multi-step integrators, \(\dot{\boldsymbol{y}}_{N}^{(0)}\) is predicted by a second-order scheme, as

$$\begin{aligned} \boldsymbol{\dot{y}}_{N}^{(0)}=\frac{1}{t_{N}-t_{N-1}}(m_{0} \boldsymbol{y}_{N-1}+m_{1} \boldsymbol{y}_{N-2})+n_{0}\boldsymbol{\dot{y}}_{N-1}+n_{1}\boldsymbol{\dot{y}}_{N-2} \end{aligned}$$
(12)

Its local truncation error is defined as

$$\begin{aligned} \sigma &=\boldsymbol{\dot{y}}(t_{N})-n_{0}\boldsymbol{\dot{y}}(t_{N-1})-n_{1} \boldsymbol{\dot{y}}(t_{N-2})-\frac{1}{t_{N}-t_{N-1}}\left (m_{0} \boldsymbol{y}(t_{N-1})+m_{1} \boldsymbol{y}(t_{N-2})\right ) \end{aligned}$$
(13)

Expanding the right-hand side at \(t_{N}\) by Taylor’s theorem and letting the local truncation error satisfy \(\sigma =O((t_{N}-t_{N-1})^{3})\), i.e., second-order accuracy, yields

α = t N t N 1 t N 1 t N 2 m 0 = 6 α 2 ( 1 + α ) , m 1 = m 0 n 0 = ( 1 + α ) ( 1 + 3 α ) , n 1 = α ( 2 + 3 α )
(14)

For the single-step integrators, the integration schemes use only the states of the last step. So to make them truly single-step, the constant prediction is used, as

$$\begin{aligned} \boldsymbol{\dot{y}}_{N}^{(0)}=\boldsymbol{\dot{y}}_{N-1} \end{aligned}$$
(15)

For the ESDIRKs, if \(t_{N}\) is in the second-stage, using only the states of the last time point, the constant prediction in Eq. (15) is employed. If \(t_{N}\) is in the third to \((s-1)\)th stage, since the integration scheme in these stages are all second-order accurate, the second-order prediction in Eq. (12) is used. Note that in these cases \(t_{N}\) is the current time and \(t_{N-1}\) is the time of the last stage, so \(t_{N}-t_{N-1}\) in Eq. (12) is not the time step size \(\Delta t\). The accuracy of the last stage has the same order as the overall accuracy, so the second-order \(\rho _{\infty }\)-Bathe method, MSSTC(\(3,4,5\)), as well as the third-order MSSTH(3), ESDIRK3(2)4L[2]SA and ESDIRK3(2)5L[2]SA still use second-order prediction in the last stage, but for the last stage of the fourth-order MSSTH(4), ESDIRK4(3)6L[2]SA2 and the fifth-order MSSTH(5), a fourth-order prediction scheme is employed, as

$$\begin{aligned} \boldsymbol{\dot{y}}_{N}^{(0)}&=\frac{1}{t_{N}-t_{N-1}}\left (m_{0} \boldsymbol{y}_{N-1}+m_{1} \boldsymbol{y}_{N-2}+m_{2}\boldsymbol{y}_{N-3}\right ) \\ &+n_{0}\boldsymbol{\dot{y}}_{N-1}+n_{1}\boldsymbol{\dot{y}}_{N-2}+n_{2}\boldsymbol{\dot{y}}_{N-3} \end{aligned}$$
(16)

The parameters are determined by making it fourth-order accurate, as

$$\begin{aligned} &\alpha _{1}=\frac{t_{N}-t_{N-1}}{t_{N-1}-t_{N-2}},\qquad\alpha _{2}= \frac{t_{N}-t_{N-1}}{t_{N-2}-t_{N-3}} \end{aligned}$$
(17a)
$$\begin{aligned} &m_{0}=- \frac{2\alpha _{1}^{2}(1+\alpha _{1})}{(\alpha _{1}+\alpha _{2})^{3}} \left (5\alpha _{1}^{3}\alpha _{2}^{2}+8\alpha _{1}^{3}\alpha _{2}+10 \alpha _{1}^{2}\alpha _{2}^{3}+\right . \end{aligned}$$
(17b)
$$\begin{aligned} &\left .3\alpha _{1}^{3}+25\alpha _{1}^{2}\alpha _{2}^{2}+13\alpha _{1}^{2} \alpha _{2}+20\alpha _{1}\alpha _{2}^{3}+20\alpha _{1}\alpha _{2}^{2}+10 \alpha _{2}^{3}\right ) \\ &m_{1}=\frac{2(1+\alpha _{1})}{\alpha _{1}}\left (5\alpha _{1}^{3} \alpha _{2}^{2}+8\alpha _{1}^{3}\alpha _{2}+3\alpha _{1}^{3}-5\alpha _{1}^{2} \alpha _{2}^{3}+\right . \end{aligned}$$
(17c)
$$\begin{aligned} &\left .\alpha _{1}^{2}\alpha _{2}^{2}+4\alpha _{1}^{2}\alpha _{2}-7 \alpha _{1}\alpha _{2}^{3}-\alpha _{1}\alpha _{2}^{2}-2\alpha _{2}^{3} \right ) \\ &m_{2}=-m_{0}-m_{1} \end{aligned}$$
(17d)
$$\begin{aligned} &n_{0}=\frac{(1+\alpha _{1})}{(\alpha _{1}+\alpha _{2})^{2}}\left (5 \alpha _{1}^{3}\alpha _{2}^{2}+8\alpha _{1}^{3}\alpha _{2}+3\alpha _{1}^{3}+11 \alpha _{1}^{2}\alpha _{2}^{2}\right . \end{aligned}$$
(17e)
$$\begin{aligned} &\left .+10\alpha _{1}^{2}\alpha _{2}+\alpha _{1}^{2}+7\alpha _{1} \alpha _{2}^{2}+2\alpha _{1}\alpha _{2}+\alpha _{2}^{2}\right ) \\ &n_{1}=\frac{1}{\alpha _{1}}\left (5\alpha _{1}^{3}\alpha _{2}^{2}+8 \alpha _{1}^{3}\alpha _{2}+3\alpha _{1}^{3}+12\alpha _{1}^{2}\alpha _{2}^{2}+ \right . \end{aligned}$$
(17f)
$$\begin{aligned} &\left .12\alpha _{1}^{2}\alpha _{2}+2\alpha _{1}^{2}+9\alpha _{1} \alpha _{2}^{2}+4\alpha _{1}\alpha _{2}+2\alpha _{2}^{2}\right ) \\ &n_{2}= \frac{\alpha _{2}^{3}(1+\alpha _{1})}{\alpha _{1}(\alpha _{1}+\alpha _{2})^{2}} \left (2\alpha _{1}+2\alpha _{2}+7\alpha _{1}\alpha _{2}+5\alpha _{1}^{2} \alpha _{2}+4\alpha _{1}^{2}\right ) \end{aligned}$$
(17g)

In terms of rotations, the orientation and angular velocity of each node used for spatial modelling in MBDyn are stored in the orientation matrix \(\mathbf{R}\), and vector \(\boldsymbol{\omega }\), respectively. To predict the orientation at \(t_{N}\), the Cayley–Gibbs–Rodriguez (CGR) orientation parameters are assumed to be zero at the last point \(t_{N-1}\), namely \(\boldsymbol{g}_{k-1} \equiv \boldsymbol{0}\), and those of the other previous steps, if needed, are extracted from the respective orientation matrices relative to that at time \(t_{N-1}\), namely \(\boldsymbol{g}_{N-j} = \boldsymbol{g}(\mathbf{R}_{N-j} \mathbf{R}_{N-1}^{T})\), \(j \geq 2\). This procedure resembles typical approaches to Lie group integration (e.g., [14]), and was inspired by the spatial interpolation of finite rotations on 1D domains, originally formulated for geometrically exact beam analysis.

The CGR parameter derivatives are evaluated accordingly: \(\dot{\boldsymbol{g}}_{N-1} \equiv \boldsymbol{\omega }_{N-1}\), since \(\boldsymbol{g}_{N-1} \equiv \boldsymbol{0}\), and \(\dot{\boldsymbol{g}}_{N-j} = \mathbf{G}_{N-j}^{-1} \boldsymbol{\omega }_{N-j}\), \(j \geq 2\), where the matrix \(\mathbf{G}(\boldsymbol{g})\) expresses the transformation from the rotation parameter derivatives to the angular velocity, \(\boldsymbol{\omega } = \mathbf{G} \dot{\boldsymbol{g}}\). For the detailed expressions of \(\boldsymbol{g}(\mathbf{R})\) and \(\mathbf{G}(\boldsymbol{g})\) please refer to [24].

The single-step integrators must additionally prepare the auxiliary variables \(\dot{\boldsymbol{g}}_{N-1}^{p}\) (\(1\leq p\leq r-1\)), but they do not have the corresponding CGR parameters \(\boldsymbol{g}_{N-1}^{p}\). To simplify the computation, the approximation \(\boldsymbol{g}_{N-1}^{p}\approx \boldsymbol{g}_{N-1}\equiv \boldsymbol{0}\) is used, such that \(\dot{\boldsymbol{g}}_{N-1}^{p}\equiv \boldsymbol{\omega }_{N-1}^{p}\). After obtaining the final solutions at \(t_{N-1}\), \(\boldsymbol{\omega }_{N-1}^{p}\) are updated according to the integration scheme. From Eqs. (4a)–(4e), SS2 uses

$$\begin{aligned} \boldsymbol{\omega }_{N-1}^{1}=\frac{1-\gamma _{2}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-2}+ \frac{\gamma _{2}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-1}- \frac{1-\gamma _{1}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-2}^{1} \end{aligned}$$
(18)

SS3 uses

$$\begin{aligned} &\boldsymbol{\omega }_{N-1}^{1}=\frac{1-\gamma _{4}}{\gamma _{3}}{\boldsymbol{\omega }}_{N-2}+ \frac{\gamma _{4}}{\gamma _{3}}{\boldsymbol{\omega }}_{N-1}- \frac{1-\gamma _{3}}{\gamma _{3}}{\boldsymbol{\omega }}_{N-2}^{1} \end{aligned}$$
(19a)
$$\begin{aligned} &\boldsymbol{\omega }_{N-1}^{2}=\frac{1-\gamma _{2}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-2}^{1}+ \frac{\gamma _{2}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-1}^{1}- \frac{1-\gamma _{1}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-2}^{2} \end{aligned}$$
(19b)

SS4 uses

$$\begin{aligned} &\boldsymbol{\omega }_{N-1}^{1}=\frac{1-\gamma _{6}}{\gamma _{5}}{\boldsymbol{\omega }}_{N-2}+ \frac{\gamma _{6}}{\gamma _{5}}{\boldsymbol{\omega }}_{N-1}- \frac{1-\gamma _{5}}{\gamma _{5}}{\boldsymbol{\omega }}_{N-2}^{1} \end{aligned}$$
(20a)
$$\begin{aligned} &\boldsymbol{\omega }_{N-1}^{2}=\frac{1-\gamma _{4}}{\gamma _{3}}{\boldsymbol{\omega }}_{N-2}^{1}+ \frac{\gamma _{4}}{\gamma _{3}}{\boldsymbol{\omega }}_{N-1}^{1}- \frac{1-\gamma _{3}}{\gamma _{3}}{\boldsymbol{\omega }}_{N-2}^{2} \end{aligned}$$
(20b)
$$\begin{aligned} &\boldsymbol{\omega }_{N-1}^{3}=\frac{1-\gamma _{2}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-2}^{2}+ \frac{\gamma _{2}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-1}^{2}- \frac{1-\gamma _{1}}{\gamma _{1}}{\boldsymbol{\omega }}_{N-2}^{3} \end{aligned}$$
(20c)

Certainly, other derivatives involved in \(\dot{\boldsymbol{y}}_{N-1}\) must be updated in the same way before computing at \(t_{N}\). The auxiliary variables of SS3 and SS4 may be complex numbers, so their real and imaginary parts are computed and stored separately. Due to the approximation of rotations, these single-step integrators are no longer exactly equivalent to the corresponding multi-step methods, but their solutions in numerical experiments are still very close, as shown in Sect. 5. This indicates that the approximation does not cause any obvious reduction in accuracy.

Having obtained the required \(\boldsymbol{g}_{N-j}\), \(\dot{\boldsymbol{g}}_{N-j}\) (\(j \geq 1\)) and \(\boldsymbol{g}_{N-1}^{p}\) (\(1\leq p\leq r-1\)), the CGR parameters and their derivatives at time \(t_{N}\), \(\boldsymbol{g}_{N}^{(0)}\) and \(\dot{\boldsymbol{g}}_{N}^{(0)}\), are predicted using the previously illustrated schemes. Then, the predicted orientation matrix and angular velocity are computed as \(\mathbf{R}_{\Delta}= \mathbf{R}(\boldsymbol{g}_{N}^{(0)})\), \(\mathbf{R}_{N}^{(0)} = \mathbf{R}_{\Delta}\mathbf{R}_{N-1}\) and \(\mathbf{G}_{\Delta}= \mathbf{G}(\boldsymbol{g}_{N}^{(0)})\), \(\boldsymbol{\omega }^{(0)} = \mathbf{G}_{\Delta}\dot{\boldsymbol{g}}_{N}^{(0)}\).

Of course, the relative rotation between the involved time steps is assumed limited to avoid the indeterminacies and singularities inherent in all three-parameter parameterizations, specifically those related to the CGR parameters (the magnitude of the relative rotations must be significantly smaller than \(\pi \)). Such an assumption is considered acceptable when the time step of the integration is dictated by accuracy requirements.

3.2 Correction

After the prediction phase, by a Newton-like iteration method, \(\boldsymbol{y}_{N}\) and \(\boldsymbol{\dot{y}}_{N}\) are corrected according to

$$\begin{aligned} &\left [\frac{\partial {\boldsymbol{y}}_{N}}{\partial \dot{\boldsymbol{y}}_{N}}\boldsymbol{r}_{ \boldsymbol{y}}\left (\boldsymbol{y}_{N}^{(l)},\boldsymbol{\dot{y}}_{N}^{(l)},t_{N}\right )+ \boldsymbol{r}_{\boldsymbol{\dot{y}}}\left (\boldsymbol{y}_{N}^{(l)},\boldsymbol{\dot{y}}_{N}^{(l)},t_{N} \right )\right ]\Delta \boldsymbol{\dot{y}} \end{aligned}$$
(21a)
$$\begin{aligned} &=-\boldsymbol{r}\left (\boldsymbol{y}_{N}^{(l)},\boldsymbol{\dot{y}}_{N}^{(l)},t_{N}\right ) \\ &\boldsymbol{\dot{y}}_{N}^{(l+1)}=\boldsymbol{\dot{y}}_{N}^{(l)}+\Delta \boldsymbol{\dot{y}} \end{aligned}$$
(21b)
$$\begin{aligned} &\boldsymbol{y}_{N}^{(l+1)}=\boldsymbol{y}_{N}^{(l)}+ \frac{\partial {\boldsymbol{y}}_{N}}{\partial \dot{\boldsymbol{y}}_{N}}\Delta \boldsymbol{\dot{y}} \end{aligned}$$
(21c)

where \(\boldsymbol{r}_{\boldsymbol{y}}\) and \(\boldsymbol{r}_{\dot{\boldsymbol{y}}}\) are the partial derivatives of \(\boldsymbol{r}\) with respect to \(\boldsymbol{y}\) and \(\dot{\boldsymbol{y}}\), respectively; \({\partial {\boldsymbol{y}}_{N}}/{\partial \dot{\boldsymbol{y}}_{N}}=\beta _{0}\Delta t\) for the multi-step integrators, \({\partial {\boldsymbol{y}}_{N}}/{\partial \dot{\boldsymbol{y}}_{N}}=\gamma _{0} \gamma _{2}\Delta t/\gamma _{1}\) for SS2, \({\partial {\boldsymbol{y}}_{N}}/{\partial \dot{\boldsymbol{y}}_{N}}=\gamma _{0} \gamma _{2}\gamma _{4}\Delta t/(\gamma _{1}\gamma _{3})\) for SS3, \({\partial {\boldsymbol{y}}_{N}}/{\partial \dot{\boldsymbol{y}}_{N}}=\gamma _{0} \gamma _{2}\gamma _{4}\gamma _{6}\Delta t/(\gamma _{1}\gamma _{3} \gamma _{5})\) for SS4, and \({\partial {\boldsymbol{y}}_{N}}/{\partial \dot{\boldsymbol{y}}_{N}}=\gamma \Delta t\) for the ESDIRKs; \(l\) denotes the number of iterations, and \(l=0\) at the initial.

In the correction phase, at each iteration, \(\boldsymbol{g}_{N}^{(l)}\) and \(\dot{\boldsymbol{g}}_{N}^{(l)}\) are obtained through Eqs. (21a)–(21c). The orientation is recast as \(\mathbf{R}_{N}^{(l)}=\mathbf{R}_{\Delta}\mathbf{R}_{N}^{(0)}\) with \(\mathbf{R}_{\Delta}=\mathbf{R}(\boldsymbol{g}_{N}^{(l)})\). The angular velocity is expressed as \(\boldsymbol{\omega }_{N}^{(l)}=\mathbf{G}_{\Delta}\dot{\boldsymbol{g}}_{N}^{(l)}+ \mathbf{R}_{\Delta}\boldsymbol{\omega }_{N}^{(0)}\) with \(\mathbf{G}_{\Delta}=\mathbf{G}(\boldsymbol{g}_{N}^{(l)})\).

The final solution at \(t_{N}\) is obtained when the prescribed convergence condition is satisfied. Then the procedure moves on to the solution for the next time point.

3.3 Generalization and extension

All previously described methods, which are summarized in Fig. 1, are available in MBDyn’s public source code repository.Footnote 2 Other time integration schemes can be easily added using the provided class templates.

Fig. 1
figure 1

Inheritance tree of the StepNIntegrator class, generated using Doxygen

To define a new integrator that belongs to the families of linear multi-step, equivalent single-step, or multi-stage methods, one simply needs to derive a new class from the corresponding template class, define the number of steps or stages (an integer template value), and overload the virtual methods that provide the coefficients for the prediction of state and derivative.

The implementation of these methods in MBDyn granted the possibility to evaluate their performance when applied to non-trivial, general-purpose multibody system dynamics problems. Some examples taken from the literature are investigated in Sect. 5.

4 Linear analysis

The dissipation and dispersion accuracy as well as the degree of algorithmic dissipation of the employed methods are compared in this section considering the single degree-of-freedom problem \(\ddot{x}+\omega ^{2}x=0\), an undamped oscillator. The numerical solution of the problem at time \(t_{k}\) can be expressed as

$$\begin{aligned} &x_{k}={\mathrm{{e}}}^{-\overline{\xi }\overline{\omega }t_{k}}\left (c_{1} \cos ({\overline{\omega }_{d}t_{k}})+c_{2}\sin ({\overline{\omega }_{d}t_{k}}) \right ), \quad\overline{\omega }_{d}=\overline{\omega }\sqrt{1- \overline{\xi }^{2}} \end{aligned}$$
(22)

where \(c_{1}\) and \(c_{2}\) are constants determined by the initial conditions, and \(\overline{\omega }\) and \(\overline{\xi }\) are the numerical natural frequency and damping ratio, respectively. Here \(\overline{\xi }\) and \((\overline{T}-T)/T=\omega /\overline{\omega }-1\) are known as the amplitude decay ratio and period elongation ratio, respectively. They are typically used to measure the dissipation and dispersion accuracy in the low-frequency domain. They can be obtained from the characteristic roots of the method, as in [37]. Besides, the spectral radius of the method is used to measure the degree of algorithmic dissipation.

Figures 2, 3 and 4 summarize the percentage amplitude decay (AD(%)), percentage period elongation (PE(%)) and spectral radius (\(\rho \)) of methods with tunable algorithmic dissipation, respectively. Considering the intrinsic spectral equivalence of the single-step methods and the corresponding multi-step methods, only the results of the multi-step methods are shown. Figures 5, 6 and 7 show AD(%), PE(%) and \(\rho \) of the higher-order ESDIRKs with \(\rho _{\infty }=0.0\). Because the \(s\)-stage ESDIRKs perform \(s-1\) implicit stages per step, to compare the results under similar computational cost, the abscissa is set as \(\Delta t/(nT)\) in the figures, where \(n=1\) for the multi-step methods, and \(n=s-1\) for the \(s\)-stage ESDIRKs.

Fig. 2
figure 2

Percentage amplitude decay of the methods with tunable algorithmic dissipation

Fig. 3
figure 3

Percentage period elongation of the methods with tunable algorithmic dissipation

Fig. 4
figure 4

Spectral radius of the methods with tunable algorithmic dissipation

Fig. 5
figure 5

Percentage amplitude decay of the higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 6
figure 6

Percentage period elongation of the higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 7
figure 7

Spectral radius of the higher-order methods with \(\rho _{\infty }=0.0\)

The employed methods all have A-stability and can provide algorithmic dissipation. Among them, LMS2, LMS3, LMS4, Bathe, MSSTC(\(3,4,5\)) are second-order accurate, and other ESDIRKs have higher-order accuracy. From the comparison, one can observe that the second-order methods, especially LMS3, LMS4, MSSTC(\(3,4,5\)), are really superior in preserving the frequency content. They show very small numerical damping ratios and spectral radii very close to 1 when \(\Delta t/(nT)\leq 0.1\).

As the number of steps or stages used increases, both dissipation and dispersion accuracy improve for second-order methods, so LMS4 and MSSTC(5) have better accuracy, and can retain more frequency content. As \(\rho _{\infty }\) grows, these second-order methods also show higher accuracy, and when \(\rho _{\infty }=1.0\), they all have the same characteristics as the trapezoidal rule. Compared to the multi-step methods, the second-order multi-stage ones show better filtering ability for high-frequency content, since their spectral radii drop to \(\rho _{\infty }\) faster and earlier.

Compared to the second-order methods, the higher-order ESDIRKs exhibit higher dispersion accuracy, which gives them some accuracy advantage in transient simulations. On the other hand, the excessive algorithmic dissipation of MSSTH(\(3,4,5\)) and ESDIRK3(2)4L[2]SA dissipates most of the frequency content in long-term simulations. With \(\rho _{\infty }=0.0\), MSSTH(5), ESDIRK3(2)5L[2]SA and ESDIRK4(3)6L[2]SA2 show very small period elongation for \(\Delta t/(nT)\leq 0.05\), whereas MSSTH(4) exhibits period shortening. MSSTH(3) with \(\rho _{\infty }=0.0\) has spectral characteristics almost identical to those of ESDIRK3(2)4L[2]SA. Even though MSSTH(\(3,4,5\)) have tunable algorithmic dissipation, their accuracy cannot be improved when \(\rho _{\infty }\) increases, and when \(\rho _{\infty }=1.0\) they exhibit unexpected algorithmic dissipation at intermediate frequencies. For these reasons, a small \(\rho _{\infty }\), like 0.0, is recommended for MSSTH(\(3,4,5\)) to improve stability of the algorithm.

From the linear analysis, it appears that the second-order methods are very effective in preserving the amplitude, while the higher-order methods have better phase accuracy. Among second-order methods, the use of more steps or stages or a larger \(\rho _{\infty }\) helps to improve the dissipation and dispersion accuracy. Multi-step methods can retain more frequency content than multi-stage ones with the same \(\rho _{\infty }\). Except for ESDIRK4(3)6L[2]SA2 and ESDIRK3(2)5L[2]SA, the employed other higher-order methods show excessive algorithmic dissipation in the low-frequency domain.

5 Numerical experiments

The performance of the previously discussed integrators is illustrated in this Section by solving some benchmark problems in MBDyn.Footnote 3 Two values of \(\rho _{\infty }\), 0.0 and 0.6, are used for second-order methods, and \(\rho _{\infty }=0.0\) is used in MSSTH(\(3,4,5\)). In all examples, the integrators use the same \(\Delta t/n\) to predict the results under comparable computational cost. The results of the second-order integrators with \(\rho _{\infty }=0.0\), the second-order integrators with \(\rho _{\infty }=0.6\), and the higher-order integrators, are presented separately. Table 1 lists the line and symbol of different integrators used in the result figures in this Section. The accuracy and stability of the numerical results as well as the calculation efficiency of the methods, are discussed.

Table 1 Line and symbol of different methods used in the figures in Sect. 5

5.1 Andrew’s squeezer mechanism

Problem description

Andrew’s squeezer mechanism [29], as shown in Fig. 8, is a planar system composed of seven rigid links. The coordinates of noteworthy points in the local reference frame, the mass, and the moment of inertia of each part are listed in Table 2. The origin of each local reference frame is placed in the first point with the name of each link. For links with only two points, the local \(x\)-axis is along the line connecting the points. For the link \(E\)-\(B\)-\(D\), the local \(y\)-axis is aligned with \(E\)-\(B\), pointing towards \(B\). The coordinates of the center of mass \((x_{C},y_{C})\) are described in the local reference frame, and the rotational inertia \(I_{z}\) of each body is expressed about its centre of mass. In the global reference frame \(Oxy\), the coordinates of points \(A\), \(B\), \(C\) are \((-0.06934~\text{m},-0.00227~\text{m})\), \((-0.03635~\text{m},0.03273~\text{m})\) and \((0.01400~\text{m},0.07200~\text{m})\), respectively. The point \(D\) is connected to the point \(C\) by a spring, whose stiffness characteristic is \(k=4530~\text{N/m}\) and whose natural length is \(l_{0}=0.07785~\text{m}\). The link \(O\)-\(F\) is driven with a constant torque \(T=0.033~\text{N}\cdot \text{m}\), starting from an initial angle \(\beta _{0}=-0.0620~\text{rad}\). Gravity is not considered.

Fig. 8
figure 8

Andrew’s squeezer mechanism (adapted from [29])

Table 2 Coordinates of the points in the local reference system, mass and inertia properties of the links

Numerical results

This example is used to check how the methods employed can preserve the mechanical energy of the system. The total energy balance equation of the system can be expressed as

$$\begin{aligned} \Delta E=E-E_{0}-T(\beta -\beta _{0}) \end{aligned}$$
(23)

since the torque \(T\) is constant, where \(E\) collects the kinetic and potential energy of the system. Without physical damping, \(\Delta E\) should be zero throughout the simulation. With \(\Delta t/n=10^{-4}~\text{s}\), Figs. 9 and 10 show, respectively, the angular velocity \(\omega \) of bar \(O\)-\(F\), and \(\Delta E\) as obtained from the numerical solutions within the \([0,0.05]~\text{s}\) interval. Figures 11 and 12 show the same results but with a smaller step size \(\Delta t/n=10^{-5}~\text{s}\). The results given by the second-order methods with \(\rho _{\infty }=0.0\) and 0.6, as well as the higher-order methods with \(\rho _{\infty }=0.0\), are presented separately. The reference solutions in Figs. 9 and 11 are obtained by LMS4 with \(\rho _{\infty }=0.6\) and \(\Delta t=10^{-6}~\text{s}\).

Fig. 9
figure 9

Angular velocity \(\omega \) of bar \(O\)-\(F\) within \([0,0.05]~\text{s}\) using \(\Delta t/n=10^{-4}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 10
figure 10

Energy balance \(\Delta E\) within \([0,0.05]~\text{s}\) using \(\Delta t/n=10^{-4}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 11
figure 11

Angular velocity \(\omega \) of bar \(O\)-\(F\) within \([0,0.05]~\text{s}\) using \(\Delta t/n=10^{-5}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 12
figure 12

Energy balance \(\Delta E\) within \([0,0.05]~\text{s}\) using \(\Delta t/n=10^{-5}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

From Fig. 9, with \(\Delta t/n=10^{-4}~\text{s}\), the results computed using MSSTH(5) with \(\rho _{\infty }=0.0\) depart from the reference solution after about \(0.01~\text{s}\), and those obtained using MSSTH(\(3,4\)) with \(\rho _{\infty }=0.0\), ESDIRK3(2)4L[2]SA, and Bathe with \(\rho _{\infty }=0.6\) show observable differences. From Fig. 10, in this case, the results of \(\Delta E\) given by MSSTC(5) with \(\rho _{\infty }=0.0\), MSSTH(\(3,4\)) with \(\rho _{\infty }=0.0\), and ESDIRK3(2)4L[2]SA, show an increasing trend, indicating that their results are likely to become unstable over time. LMS2 and SS2 with \(\rho _{\infty }=0.6\), LMS3, SS3, LMS4, SS4, MSSTC(3) and MSSTC(5) with \(\rho _{\infty }=0.6\), can mostly preserve energy, although with oscillations, while LMS2 and SS2 with \(\rho _{\infty }=0.0\), Bathe, MSSTC(4) and the remaining higher-order integrators show an obvious drop in energy.

With \(\Delta t/n=10^{-5}~\text{s}\), Fig. 11 shows that all methods can predict accurate results of \(\omega \). However, from Fig. 12, it is clear that the energy instability, i.e. \(\Delta E>0\) [5], is still observed for some higher-order integrators, including MSSTH(\(3,4\)) with \(\rho _{\infty }=0.0\), ESDIRK3(2)4L[2]SA, ESDIRK4(3)6L[2]SA2. MSSTH(5) with \(\rho _{\infty }=0.0\) exhibits obvious energy drop. The second-order integrators perform well with the smaller step size.

From this example we can conclude that most of the higher-order integrators employed have worse stability in this type of problem, and are really not recommended for energy-conserving purpose. Among the second-order integrators, the linear analysis in Sect. 4 illustrates that they can preserve more modes as the number of steps or stages used increases, but the multi-stage methods do not follow this rule here. This is because they use the trapezoidal rule from the second to the \(n\)th stage, and the non-dissipative trapezoidal rule is likely to give unreliable or unstable results for nonlinear problems [33]. Therefore, the multi-step and single-step integrators, especially LMS3, SS3, LMS4 and SS4 with a large \(\rho _{\infty }\), such as 0.6, are better candidates in terms of energy conservation for general problems.

5.2 Flexible four-bar mechanism

Problem description

Some of the benchmark problems for flexible mechanisms proposed in [4] are solved. Figure 13 shows the configuration of a flexible four-bar mechanism. Bars \(A\)-\(B\), \(B\)-\(C\), \(C\)-\(D\) and the ground are connected through revolute joints. The initial angles between them are all \(90~\text{deg} \). The bars’ lengths are \(L_{1}=L_{3}=0.12~\text{m}\) and \(L_{2}=0.24~\text{m}\). The rotation axis of the revolute joint at point \(C\) is rotated by \(+5~\text{deg} \) about the \(y\) direction, to simulate an assembly defect that would lock the mechanism if the bars were rigid. The inertia and stiffness properties of the bars are listed in Table 3. Each bar is modeled in MBDyn using 5 three-node beam elements [15]. The angular velocity of the bar \(A\)-\(B\) at point \(A\) with respect to the frame is prescribed as \(\Omega =0.6~\text{rad/s}\) during the simulation.

Fig. 13
figure 13

Flexible four-bar mechanism (adapted from [4])

Table 3 Inertia and stiffness properties of bars \(A\)-\(B\), \(B\)-\(C\) and \(C\)-\(D\)

Numerical results

The simulation was run in the interval \([-2T,12~\text{s}]\), where \(T=2\pi/{\Omega }\) performs about three complete cycles of the bar \(A\)-\(B\). With \(\Delta t/n=4\times 10^{-3}~\text{s}\), Figs. 14 and 15 respectively show the rotation angle \(\theta \) and the angular velocity \(\omega _{1}\) about the \(x\) axis at the tip of bar \(B\)-\(C\) at point \(C\) within \([0, 12]~\text{s}\). Figure 16 plots the results of \(\omega _{1}\) with a smaller step size \(\Delta t=1\times 10^{-3}~\text{s}\).

Fig. 14
figure 14

Rotation angle \(\theta \) about the \(x\) axis at the tip of bar \(B\)-\(C\) at point \(C\) within \([0,12]~\text{s}\) using \(\Delta t/n=4\times 10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 15
figure 15

Angular velocity \(\omega _{1}\) about the \(x\) axis at the tip of bar \(B\)-\(C\) at point \(C\) within \([0,12]~\text{s}\) using \(\Delta t/n=4\times 10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 16
figure 16

Angular velocity \(\omega _{1}\) about the \(x\) axis at the tip of bar \(B\)-\(C\) at point \(C\) within \([0,12]~\text{s}\) using \(\Delta t/n=1\times 10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

From Fig. 14 it is seen that the rotation angles \(\theta \) computed by the methods used agree very well with each other. However, as shown in Figs. 15 and 16, since the angular velocity changes rapidly at certain moments, high-frequency oscillations can be observed, and the observable differences in the integrators employed are how fast they filter the oscillations. As shown in Figs. 15 and 16, the oscillations become more pronounced with a smaller time step size or a larger \(\rho _{\infty }\). LMS4 and SS4 with \(\rho_{\infty }=0.6\) and \(\Delta t=1\times 10^{-3}~\text{s}\) exhibit the most significant oscillations. This example shows the importance of algorithmic dissipation for problems containing high-frequency pollution, which often appears in the solutions of velocities, accelerations and forces. For such problems, Bathe and the higher-order integrators, which have strong algorithmic dissipation from linear analysis in Sect. 4, with \(\rho _{\infty }=0.0\) and a suitable \(\Delta t\), not too small, are recommended.

5.3 Lateral buckling of a thin beam

Problem description

Figure 17 shows the configuration of a beam actuated by a crank-link mechanism. The beam is clamped at one end; the other end is connected to the link by a spherical joint. To simulate an initial imperfection, the plane of the crank-link mechanism is offset from the plane of the beam by \(d=0.1~\text{mm}\) in the \(y\) direction. The end of the beam and the spherical joint are rigidly connected. The link, crank, and ground are connected via revolute joints. The lengths are \(L=1~\text{m}\), \(L_{l}=0.25~\text{m}\) and \(L_{c}=0.05~\text{m}\). The inertia and stiffness properties of the crank, link and beam are listed in Table 4. The beam is meshed with 5 three-node beam elements, and both the link and the crank are modelled with 1 three-node beam element each. The rotation angle of the crank is prescribed as

$$\begin{aligned} \phi =\left \{ \textstyle\begin{array}{l@{\quad }l} \cfrac{\pi }{2}\left (1-\cos {\cfrac{\pi t}{T}}\right ),& t\leq T\\ \pi ,&t>T \end{array}\displaystyle \right . \end{aligned}$$
(24)

where \(T=0.4~\text{s}\).

Fig. 17
figure 17

Crank actuated beam (adapted from [4])

Table 4 Inertia and stiffness properties of the crank, link and beam

Numerical results

The simulation was run in the interval \([0,0.8]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\). The rotation angle \(\theta \) and angular velocity \(\omega _{1}\) about the \(x\) axis, and the shear force \(F_{3}\) along the \(z\) axis at the mid-span of the beam are summarized in Figs. 18, 19 and 20, respectively. Driven by the crank-link mechanism, the beam buckled laterally rather quickly, before the crank reached the uppermost position, and then began to oscillate rapidly. In this case, the higher-order MSSTH(5) with \(\rho _{\infty }=0.0\), and ESDIRK3(3)5L[2]SA failed to complete the simulation.

Fig. 18
figure 18

Rotation angle \(\theta \) about the \(x\) axis at the beam’s mid-span within \([0,0.8]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 19
figure 19

Angular velocity \(\omega _{1}\) about the \(x\) axis at the beam’s mid-span within \([0,0.8]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 20
figure 20

Shear force \(F_{3}\) at the beam’s mid-span within \([0,0.8]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

As shown in Figs. 1820, the solutions of the employed methods almost overlap in the \([0, 0.4]~\text{s}\) interval. However, in the subsequent free oscillations, the solutions obtained with a few methods, including LMS2 and SS2 with \(\rho _{\infty }=0.0\), MSSTH(\(3,4\)), ESDIRK3(2)4L[2]SA, exhibit a significant amplitude decay and phase shift compared to the solutions obtained with the remaining methods. These schemes cannot reflect the participation of high-frequency contributions in the response, because of their strong algorithmic dissipation. The results are consistent with the comparisons in Sect. 4. LMS2 and SS2 with \(\rho _{\infty }=0.0\) and most of the higher-order schemes have larger algorithmic dissipation than the other schemes. Therefore, when the contribution of high-frequencies needs to be considered in the solution, the second-order methods, especially LMS3, SS3, LMS4, SS4 with a large \(\rho _{\infty }\), such as 0.6, are recommended.

5.4 Rotating shaft

Problem description

Figure 21 shows the configuration of a rotating shaft. Its end \(R\) is connected to the ground by a revolute joint, whereas the other end \(T\) is connected to the ground by a cylindrical joint that allows rotation about and displacement along the shaft’s axis. A rigid disk is attached to the shaft at the mid-span; its center of mass is offset from the reference axis of the shaft by \(d=0.05~\text{m}\) in the \(z\) direction, thus inertially unbalancing the system. The shaft length is \(L=6~\text{m}\); its other properties are listed in Table 5. It is modelled with 16 three-node beam elements. The disk has mass \(m_{d}= 70.573~\text{kg}\), radius \(r_{d} =0.24~\text{m}\), and thickness \(t_{d}=0.05~\text{m}\). Its inertial tensor with respect to the center of mass is \(\operatorname{diag}(2.0325, 1.0163, 1.0163)~\text{g}\cdot \text{m}^{2}\). The angular velocity of the revolute joint at the point \(R\) is prescribed as

$$\begin{aligned} \Omega =\left \{ \textstyle\begin{array}{l@{\quad }l} \cfrac{1}{2}A_{1}\omega \left (1-\cos \cfrac{\pi t}{T_{1}}\right ),& 0 \leq t\leq T_{1} \\ A_{1}\omega ,& T_{1}< t\leq T_{2} \\ A_{1}\omega +\cfrac{1}{2}(A_{2}-A_{1})\omega \left (1-\cos \cfrac{\pi (t-T_{2})}{T_{3}-T_{2}}\right ), &T_{2}< t\leq T_{3} \\ A_{2}\omega ,& t>T_{3} \\ \end{array}\displaystyle \right . \end{aligned}$$
(25)

where \(A_{1}=0.8\), \(A_{2}=1.2\), \(T_{1}=0.5~\text{s}\), \(T_{2}=1~\text{s}\), \(T_{3}=1.25~\text{s}\), \(\omega =60~\text{rad/s}\), i.e., it gently grows to an amplitude slightly below \(\omega \), pauses there for some time, and then gently grows again above \(\omega \), which corresponds roughly to a characteristic frequency of the system.

Fig. 21
figure 21

Rotating shaft with unbalanced disk (adapted from [4])

Table 5 Inertia and stiffness properties of the shaft

Numerical results

The simulation was run in the interval \([-1,2.5]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\). Figures 22, 23 and 24 show, respectively, the displacement \(u_{3}\), velocity \(v_{3}\) and acceleration \(a_{3}\) along the \(z\) axis at the shaft’s mid-span within \([0, 2.5]~\text{s}\). In this case, LMS4 with \(\rho _{\infty }=0.6\) failed to complete the solution. Excellent agreement can be observed between the results computed by the other employed methods, since the time step is sufficient to accurately describe the participating modes regardless of the algorithmic dissipation.

Fig. 22
figure 22

Displacement \(u_{3}\) at the shaft’s mid-span within \([0,2.5]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 23
figure 23

Velocity \(v_{3}\) at the shaft’s mid-span within \([0,2.5]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Fig. 24
figure 24

Acceleration \(a_{3}\) at the shaft’s mid-span within \([0,2.5]~\text{s}\) using \(\Delta t/n=10^{-3}~\text{s}\) (a) Second-order methods with \(\rho _{\infty }=0.0\); (b) Second-order methods with \(\rho _{\infty }=0.6\); (c) Higher-order methods with \(\rho _{\infty }=0.0\)

Convergence

Based on this example, the convergence rates of the employed methods are investigated. Figures 25, 26 and 27 plot the relative errors of \(u_{3}\), \(v_{3}\) and \(a_{3}\) versus \(\Delta t/n\) of the employed methods. The relative error RE is defined as

$$\begin{aligned} {\mathrm{{RE}}}(x)=\sqrt{ \frac{\sum _{j=1}^{N}(x(t_{j})-x_{j})^{2}}{\sum _{j=1}^{N}x(t_{j})^{2}}} \end{aligned}$$
(26)

where \(N\) is the number of total steps, \(x(t_{j})\) and \(x_{j}\) denote the exact and numerical solutions at time \(t_{j}\), respectively. Since no exact solution can be obtained analytically for problems like this, it is replaced by the reference solution obtained using ESDIRK4(3)6L[2]SA2 with a very small step size, \(\Delta t=10^{-5}~\text{s}\).

Fig. 25
figure 25

Convergence rates of displacement \(u_{3}\) at the shaft’s mid-span for: (a) second-order methods; (b) higher-order methods (the value of \(\rho _{\infty }\) is placed in brackets in the legend)

Fig. 26
figure 26

Convergence rates of velocity \(v_{3}\) at the shaft’s mid-span for: (a) second-order methods; (b) higher-order methods (the value of \(\rho _{\infty }\) is placed in brackets in the legend)

Fig. 27
figure 27

Convergence rates of acceleration \(a_{3}\) at the shaft’s mid-span for: (a) second-order methods; (b) higher-order methods (the value of \(\rho _{\infty }\) is placed in brackets in the legend)

As can be seen, the second-order methods all exhibit a second-order convergence rate for displacement, velocity, and acceleration. The multi-step and equivalent single-step schemes have very similar relative errors. Accuracy improves with increasing number of steps or stages or with a large \(\rho _{\infty }\). LMS2 and SS2 with \(\rho _{\infty }=0.0\) show larger errors than the other schemes. These conclusions are consistent with the analysis in Sect. 4.

Among the higher-order methods, the third-order MSSTH(3) and ESDIRK3(2)4L[2]SA show a third-order convergence rate, and the third-order ESDIRK3(3)5L[2]SA shows a convergence rate exceeding the third-order. The fourth-order MSSTH(4) and ESDIRK4(3)6L[2]SA2 show a convergence rate of about fourth-order when \(\Delta t/n\) is close to \(0.001~\text{s}\), but when \(\Delta t/n\) becomes smaller, their orders of convergence rate decrease, especially in \(a_{3}\). We think that this is because the reference solution, obtained using a very small step size, includes the contribution of a very large frequency range that contains many high frequencies not included in the numerical results. The treatment of these high-frequencies brings additional errors, which become more significant in the accelerations and in the cases where the error of the integrator in the frequency domain that it can retain is already quite small, such as the higher-order integrators with a small step size.

However, the fifth-order MSSTH(5) was never able to reach the fifth-order convergence rate. Regarding the reason, we think it may be related to the smoothness of the problem itself. Since the accuracy order is obtained from the Taylor expansion results, the higher-order methods have higher requirements on the smoothness of the problems. If the smoothness does not meet the requirements, the order reduction may occur.

From the relative errors, ESDIRK3(3)5L[2]SA and ESDIRK4(3)6L[2]SA2 are more accurate than other methods. The design of MSSTH(\(3,4,5\)) considers the minimization of the local truncation error, but these methods do not perform as expected. It indicates that a small local truncation error does not necessarily mean higher accuracy. The amplitude and period accuracy, as shown in Figs. 56, can better represent the accuracy of an integrator. Therefore, for high-accuracy purpose, ESDIRK3(3)5L[2]SA and ESDIRK4(3)6L[2]SA2 are more recommended.

5.5 Average number of iterations

Since the same \(\Delta t/n\) is used in the examples, the number of steps or sub-steps required for all methods is the same. However, as discussed in Sect. 2, the scheme used for prediction also plays an important role in computational efficiency. Therefore, the average number of iterations required for each step/sub-step in all examples solved in this section is listed in Fig. 28, to illustrate the cost of the employed methods. Two time step sizes are considered here for each example.

Fig. 28
figure 28

Average number of iterations required in each step/sub-step \(S/N\) of the integrators in all examples (\(S\) is the total number of iterations, and \(N\) is the total number of steps/sub-steps)

As shown in Fig. 28, the average number of iterations decreases with a smaller step size in all cases. The number of iterations spent by each integrator does not differ significantly. However, it can be observed that each single-step method always requires more iterations than the corresponding multi-step method. As discussed in Sect. 3, single-step methods use constant prediction, while multi-step methods use an explicit second-order scheme for prediction. Therefore, this observation supports the conclusion that the use of an explicit second-order prediction scheme in these second-order methods helps to improve computational efficiency.

Besides, also the higher-order methods require more iterations than the remaining second-order methods in most cases. This may also be explained by the consideration that the accuracy of the prediction scheme is not close enough to that of the time integration scheme. The second-order multi-step and multi-stage methods usually require the least number of iterations of all methods. The data from Fig. 28 seem to support the consideration that a suitable prediction scheme, which must be explicit and have accuracy close to that of the integration scheme, is helpful in saving computational costs.

6 Conclusions

In this work, the performance of several representative implicit, A-stable time integration methods is discussed in view of their application to multibody system dynamics. The employed methods include linear two-, three-, and four-step methods, referred to as LMS2, LMS3, LMS4, their equivalent single-step methods, indicated as SS2, SS3, SS4, and several explicit first-stage, singly diagonally-implicit Runge–Kutta methods (ESDIRKs), indicated as Bathe, MSSTC(\(3,4,5\)), MSSTH(\(3,4,5\)), ESDIRK3(2)4L[2]SA, ESDIRK3(3)5L[2]SA, and ESDIRK4(3)6L[2]SA2. These methods have been developed in [21, 35, 36], but the parameters of MSSTH(\(3,4,5\)) are modified here to satisfy the overall and stage order conditions. The formulations of the employed methods, and their implementation in the free general-purpose multibody solver MBDyn are presented.

In terms of properties, the linear multi-step, single-step, Bathe and MSSTC(\(3,4,5\)) methods have second-order accuracy and tunable algorithmic dissipation, whereas the other ESDIRKs can achieve higher-order accuracy. Several general conclusions can be drawn from the linear analysis and numerical experiments:

  • with a suitable step size, all employed methods can predict accurate solutions.

  • LMS3, SS3, LMS4 and SS4 with a large \(\rho _{\infty }\), such as 0.6, show robust stability and good energy-conserving properties, making them suitable for long-term simulations and other cases where a large range of modes must be preserved, but these methods are not as good as others at filtering out high-frequency oscillations.

  • LMS2 and SS2 with \(\rho _{\infty }=0.0\) (namely the second-order Backward Difference Formula) as well as most of the employed higher-order methods show a strong algorithmic dissipation even in the low-frequency range, so that their solutions are more likely to exhibit obvious amplitude decay and consequently a loss of accuracy at the large time steps.

  • Bathe and the higher-order integrators with \(\rho _{\infty }=0.0\) can filter out high-frequency dynamics faster, so they are more useful for problems with high-frequency pollution.

  • among the employed methods, ESDIRK3(3)5L[2]SA and ESDIRK4(3)6L[2]SA2 have an obvious accuracy advantage over the other when the time step size is small enough to correctly integrate the participating dynamics, so they are recommended for high-accuracy purposes.

  • the prediction scheme affects the number of iterations and thus the computational efficiency. It should be explicit, preferably if its order of accuracy is close to that of the time integration scheme.