1 Introduction

A considerable number of methods and algorithms for the simulation and analysis of multibody system (MBS) dynamics have been proposed since the early developments in this area were first published [1, 16, 21, 22]. The performance of each approach depends on the characteristics of the problems to which it is applied, and so methods that are effective in the simulation of a certain type of mechanical system may be inefficient when applied to mechanisms with a different topology or subjected to other kinds of physical phenomena. Fully recursive methods [9], for instance, may become ineffective in the solution of heavily constrained multibody systems; mechanisms that feature redundant constraints or singular configurations pose a problem for solution algorithms that expect the Jacobian matrix of the constraints to have a full row rank throughout the motion [11, 17]. Moreover, implementation techniques, third-party software libraries, e.g. for the linear algebra routines required by most MBS codes, and the hardware platform used to execute the code, as well as the interaction between them, have a critical impact on the time elapsed in computations [13, 24]. For these reasons, selecting an appropriate MBS formalism for its application to a particular problem may prove challenging in some cases, particularly when efficiency constraints are imposed as a requirement.

Benchmark problems represent a useful tool to evaluate the accuracy and efficiency of MBS codes, as well as their ability to handle particular kinds of problems. Ideally, benchmarks should be simple enough to enable their exact reproduction by any researcher or team interested in using them. At the same time, they must be nontrivial problems that provide interesting information about some aspect of the behaviour of the solution method [14]. In recent years, several initiatives have been put forward by MBS researchers to propose meaningful test problems that can be generally accepted as benchmarks by the community. The IFToMM Library of Computational Benchmark Problems [15] is a well-known collection of such examples, which includes test problems for forward- and inverse-dynamics, as well as linearization. These examples illustrate the performance of MBS formulations and implementations when dealing with complex issues such as redundant constraints, singular configurations, stiff problems, and contacts, to mention just a few. Another instance of collection of benchmark problems can be found in [2], which puts forward a series of cases for the validation of flexible multibody dynamics algorithms. Benchmark problems for contact dynamics were introduced in [19]. In the case of MBS dynamics, benchmarking is not limited to the algorithms for the integration of the equations of motion, but has also been extended to applications in which the multibody part is a necessary component, like estimators based on Kalman filters [20]. Benchmark problems for particular applications of MBS dynamics can be found in the areas of railway vehicles [5] and co-simulation [25].

The benchmark problem discussed in this paper, a variation of the well-known slider-crank linkage, is geared towards the evaluation of the ability of MBS methods to successfully perform the forward-dynamics simulation of mechanical systems with singular configurations and dead centres. This can be challenging, in particular, when the system dynamics is expressed in terms of a set of nonminimal generalised coordinates, thus requiring the use of kinematic constraints to formulate the equations of motion [11]. Two versions of the linkage were defined, with and without singular configurations, and both were subjected to the action of a force that varied over time to prevent a periodic system motion.

The paper puts forward a systematic approach for the formulation of benchmark problems, including the definition of relevant metrics and criteria for the comparison of different solution approaches. These are presented in Sect. 2, together with the description of the mechanical model of the slider crank used here. The use of the benchmark problem is demonstrated in Sect. 3 in the evaluation of different simulation codes in which the system is defined using kinematic constraints. These were solved using both fixed- and variable-step integration algorithms. Results showed that the combination of singular configurations and externally applied forces with constant frequency made the proposed example a challenging problem for most solution methods. Section 4 summarises the conclusions of the study.

2 Methods

There exist three components that should always be present in the definition of a benchmark problem for MBS dynamics algorithms:

  • A definition of the problem to be solved. This must include the specification of the properties and initial state of the mechanical system, as well as information about the manoeuvre to be simulated, such as duration in time and input forces and torques.

  • A reference solution which, for the purposes of benchmarking, can be considered correct. This reference solution may be obtained from experimental results, an analytical solution of the problem at hand, or upon the convergence of several simulation processes.

  • Appropriate error metrics and comparison criteria. These enable the assessment of the solutions obtained with different simulation methods [12].

Moreover, other optional components can be added too, such as reference implementations of the simulation code or data structures, to enable the efficient collection and processing of simulation results.

In order to be useful, benchmark examples should be clearly defined problems that are easy to replicate. They should also represent nontrivial scenarios that are meaningful or challenging in at least one respect. Ideally, they should also be representative of a wider class of systems. For instance, a slider-crank that undergoes singular configurations can be defined in a straightforward way with a reduced set of kinematic and kinetic parameters. In spite of being a relatively simple mechanical system, it poses a problem for simulation algorithms that cannot deal with rank-deficient Jacobian matrices; even some solution methods that can handle them need to be carefully adjusted to deliver correct results [11], as is the case of augmented Lagrangian algorithms. Results obtained with this linkage can then be used to assess the general ability of solution methods to carry out the simulation of systems with singularities.

In some cases, it is possible to find an analytical solution for the motion of simple mechanical systems. Generally, this is not the case. In benchmark problems that do not represent a physical system, for which experimental results are not available, physical magnitudes can be used as indicators instead. For instance, the variation of the mechanical energy can be used to quantify the accuracy of a given simulation method if the benchmark problem represents a conservative system. These indicators should be used with precaution as a precise energy conservation does not necessarily guarantee the correctness of the obtained results. Arriving at a reference solution through the convergence of several simulation methods is advisable when analytical and experimental solutions are not available.

Error metrics and criteria are also an important component of a benchmark problem. First, it is necessary to select the variables that will be selected to evaluate the accuracy of a solution. These may include kinematic variables, such as positions, velocities, and accelerations, or kinetic magnitudes like forces or energies. Usually \(n\) variables of interest can be selected and will suffice to measure the precision of the results. It is also necessary to specify at what points in time these variables will be evaluated. When using fixed-step integrators this is relatively simple, as data can be gathered regularly during the simulation. With variable-step simulators, usually interpolation methods have to be used. Second, a metric to quantify the deviation of the results obtained with a particular method with respect to the reference solution is necessary. The local error at time point \(t_{i}\) for variable \(y_{j}\) can be evaluated as

$$ \varepsilon _{j}(t_{i}) = y_{j}(t_{i})- y_{j}^{\mathrm{ref}}(t_{i}), $$
(1)

where \(y_{j}^{\mathrm{ref}}\) denotes the value that corresponds to the reference solution. Relative definitions of the error can be used too [12]. Absolute errors, however, show a better behaviour when the variables of interest approach zero. The total error of a simulation can be calculated as

$$ \varepsilon _{\mathrm{T}} \;=\; \sqrt{ \dfrac{1}{n} \displaystyle \sum _{j=1}^{n} {\dfrac{w_{j}}{m} \displaystyle \sum _{i=1}^{m} { \left ( \varepsilon _{j} \left ( t_{i} \right ) \right ) ^{2}} } } $$
(2)

where \(m\) is the total number of time points collected during the simulation and \(w_{j}\) is a weight factor that represents the contribution of variable \(j\) to the total error. Factor \(w_{j}\) can also be used to make errors dimensionless so that variables with different units can be added together in a single error indicator. Besides the total error in Eq. (2), it is also possible to select other indicators, such as the maximum or minimum absolute error for a single variable or group of variables.

The existence of a metric like the one in Eq. (2) makes it possible to establish a validity criterion that determines whether a simulation is accurate enough or not. A criterion like this is particularly important if the benchmark problem is to be used to compare several solution approaches in terms of efficiency, because that comparison should be carried out requesting the same accuracy level from every method.

Finally, comparison criteria can be defined to quantify the differences between the different solution methods. The elapsed time in computations is a commonly used criterion to rank algorithms and implementations, but other metrics, such as energy balances and satisfaction of kinematic constraints, can be used too [18].

2.1 Problem description

The benchmark problem used in this paper is a variation of the well-known slider-crank linkage, already included in the IFToMM benchmark library [15] and shown in Fig. 1. This planar mechanical system is composed of two rods, links 1 and 2, with uniformly distributed mass \(m_{1}\) and \(m_{2}\) and length \(L_{1}\) and \(L_{2}\), respectively. The slider, link 3, has mass \(m_{3}\) and moves without friction along the \(x\) axis. The mechanism moves under gravity effects with \(g=9.81~\text{m}/\text{s}^{2}\) acting along the negative \(y\) axis. The system has one degree of freedom; at time \(t=0\), rod 1 is at an angle \(\theta _{1,0}\) with respect to the \(x\) axis and the velocity of point \(\mathsf{ Q } \) is \(\dot{x}_{ \mathsf{ Q } ,0}\). A horizontal external force \(f\) acts on point \(\mathsf{ Q } \) during motion.

Fig. 1
figure 1

Slider-crank mechanism used as a benchmark problem

In spite of its simplicity, the slider-crank linkage is a challenging problem for MBS dynamics algorithms due to the existence of singularities in the system motion under certain conditions. A slider-crank with \(L_{1} = L_{2}\) will feature a singular configuration when \(\theta _{1} = \pm \pi /2\), i.e. when both rods are aligned on the \(y\) axis. This configuration represents a bifurcation point, from which the linkage can continue its motion either as a slider-crank mechanism or as a pendulum with point \(\mathsf{ Q } \) motionless at the location of point \(\mathsf{ O } \), as shown in Fig. 2. In theory, switching between these two branches of motion is only possible when the velocity of the slider is zero. However, some MBS dynamics formulations with explicit modelling of the kinematic constraints may predict a change of branch also with a nonzero velocity. From a mathematical point of view, the Jacobian matrix of the kinematic constraints suddenly loses rank at these points. Dynamics formulations unable to deal with rank-deficient Jacobian matrices cannot carry out the simulation of such systems; moreover, some methods which can handle this situation experience numerical difficulties in the proximity of these points as well. This is usually caused by poor conditioning of the algorithm leading matrices and by the accumulation of constraint violations. The resulting changes of branch introduce large impact forces in the simulation and instantaneous drops in the mechanical energy of the system [3, 11].

Fig. 2
figure 2

From a singular configuration (a), a slider-crank linkage with \(L_{1}=L_{2}\) can either keep its slider-crank motion (b) or continue as a single pendulum (c)

A different kind of numerical difficulty is present when both links, 1 and 2, regardless of their relative lengths, are aligned on the horizontal \(x\) axis, i.e. \(\theta _{1} = 0\) or \(\theta _{1} = \pi \). In this situation, a horizontal force exerted on point \(\mathsf{ Q } \) of the slider should not have any effect on the system motion and will only increase the reaction force at point \(\mathsf{ O } \). Poor matrix conditioning and the accumulation of position errors in the proximity of this point may result into the motion of the mechanism towards a position with either a positive or a negative angle \(\theta _{1}\) (Fig. 3). It must be noted that, here, a change of branch does not occur as the system continues moving as a slider-crank linkage regardless of the sign of \(\theta_{1}\).

Fig. 3
figure 3

The application of a horizontal force \(f\) in configuration (a) should not cause the motion of the linkage. A misalignment of the links in the predicted system position will move the mechanism towards configurations (b) or (c)

To illustrate these difficulties, we consider now a model of the slider-crank linkage in which the generalised coordinates \({\mathbf{q}} = \left [ x_{ \mathsf{ P } }, y_{ \mathsf{ P } }, x_{ \mathsf{ Q } } \right ] {^{\mathrm{T}}}\) are the \(x\) and \(y\) coordinates of point \(\mathsf{ P } \) and the distance \(x\) from point \(\mathsf{ Q } \) to origin \(\mathsf{ O } \). Because links 1 and 2 are rigid, two kinematic constraints enforcing a constant distance between points \(\mathsf{ O } \) and \(\mathsf{ P } \) and \(\mathsf{ P } \) and \(\mathsf{ Q } \) have to be introduced to describe the motion correctly:

$$ {{\boldsymbol {\Phi}} }= \left [ \textstyle\begin{array}{ c } x_{ \mathsf{ P } }^{2} + y_{ \mathsf{ P } }^{2} - L_{1}^{2}\\ \left ( x_{ \mathsf{ P } }- x_{ \mathsf{ Q } } \right ) ^{2} + y_{ \mathsf{ P } }^{2} - L_{2}^{2} \end{array}\displaystyle \right ] = {\mathbf{0}}. $$
(3)

The velocity- and acceleration-level expressions of Eq. (3) are

$$ \dot{ {{\boldsymbol {\Phi}} }} = {{\boldsymbol {\Phi}}_{\mathbf{q}} } {\dot{\mathbf{q}} }= { \mathbf{0}}\, \quad{\text{ and}} \quad \ddot{ {{\boldsymbol {\Phi}} }} = {{ \boldsymbol {\Phi}}_{\mathbf{q}} } {\ddot{\mathbf{q}} }+ {\dot{\boldsymbol {\Phi}}_{\mathbf{q}} } { \dot{\mathbf{q}} }= {\mathbf{0}}, $$
(4)

where \({{\boldsymbol {\Phi}}_{\mathbf{q}} }\) is the Jacobian matrix of the constraints,

$$ {{\boldsymbol {\Phi}}_{\mathbf{q}} }= \left [ \textstyle\begin{array}{ c@{\quad}c@{\quad}c } 2x_{ \mathsf{ P } }&2y_{ \mathsf{ P } }&0 \\ 2 \left ( x_{ \mathsf{ P } }-x_{ \mathsf{ Q } } \right ) &\;2y_{ \mathsf{ P } }\; &2 \left ( x_{ \mathsf{ Q } }-x_{ \mathsf{ P } } \right ) \end{array}\displaystyle \right ] $$
(5)

whose expression does not explicitly depend on the lengths of links 1 and 2.

For a slider-crank mechanism with \(L_{1} = L_{2} = L\), when the system reaches a singular configuration, e.g. \(\theta _{1} = \pi /2\), the Jacobian matrix becomes

$$ {{\boldsymbol {\Phi}}_{\mathbf{q}} }= \left [ \textstyle\begin{array}{ c@{\quad}c@{\quad}c } 0 &2L &0 \\ 0 &2L &0 \end{array}\displaystyle \right ] . $$
(6)

The Jacobian matrix loses rank instantaneously, and the constraints are compatible with both a slider-crank and a simple-pendulum motion simultaneously. This gives rise to the failure of multibody formulations that are unable to handle rank-deficient Jacobian matrices and may also cause numerical problems to others that can negotiate this situation.

The extreme-point configuration shown in Fig. 3 takes place when \(\theta _{1} = 0\), and so \(y_{ \mathsf{ P } }= 0\). In this case the Jacobian matrix becomes

$$ {{\boldsymbol {\Phi}}_{\mathbf{q}} }= \left [ \textstyle\begin{array}{ c@{\quad}c@{\quad}c } 2x_{ \mathsf{ P } }&0 &0 \\ 2 \left ( x_{ \mathsf{ P } }-x_{ \mathsf{ Q } } \right ) &\;0\; &2 \left ( x_{ \mathsf{ Q } }-x_{ \mathsf{ P } } \right ) \end{array}\displaystyle \right ] . $$
(7)

Together with the system dynamics equations, the acceleration-level constraint equation in (4) shows that, if the mechanism is at rest at \(\theta _{1} = 0\) and the only applied force is a horizontal action \(f\) acting on point \(\mathsf{ Q } \), then the system accelerations are zero. However, small perturbations in the system position will give rise to finite acceleration values. During a forward-dynamics simulation, a lack of accuracy in the solution methods might result in the prediction of an incorrect system motion at these extreme points.

The simulation cases selected for the present benchmark problem intend to test the ability of MBS formulations to correctly handle problems with these difficulties.

2.1.1 Simulation cases

Three simulation cases are considered as shown in Table 1, which details the values of the physical parameters of the system, its initial state and the externally applied actions.

Table 1 Simulation cases

Case 1 corresponds to the slider-crank benchmark problem in [15]. In this case, rods 1 and 2 have the same length (\(L_{1} = L_{2}\)), and this causes the linkage to pass through a singular configuration when \(\theta _{1} = \pm \pi /2\). The slider is massless and the externally applied force \(f\) in this case is zero during motion.

In case 2, rods 1 and 2 have different lengths, and so the linkage motion is not affected by singular configurations. The externally applied force follows now a sinusoidal expression, \(f=100\sin{({\pi}t)}\). The introduction of this force gives rise to numerical difficulties in the solution of the problem. The system ceases to be conservative, and its motion is no longer periodic. Moreover, the extreme positions of the motion, reached when both rods are aligned on the \(x\) axis and, thus, with the external force \(f\), become challenging from the point of view of numerical simulation. There, depending on the value of the force \(f\) and the accuracy of the integration process, the motion can continue following one of two possible branches, namely those that correspond to \(\dot{\theta}_{1} >0\) and to \(\dot{\theta}_{1} < 0\).

Case 3 uses the same physical parameters as case 1, but the externally applied force \(f\) follows the sinusoidal expression from case 2. The resulting problem is subjected to both singular configurations and numerical difficulties at the extreme points of the motion.

2.1.2 Variables of interest and metrics

The mechanical system under study has one degree of freedom and a single variable should be enough to keep track of its motion. However, in cases 1 and 3 singular configurations exist, and these give rise to the existence of two branches of motion. For this reason, two variables will be monitored and used to evaluate the error in Eq. (2): angle \(\theta _{1}\) between link 1 and the \(x\) axis, and the \(x\) coordinate of point \(\mathsf{ Q } \) on the slider.

The sampling interval for error evaluation was set to \(10~\text{ms}\); a total simulation length of \(10~\text{s}\) was used in all cases. The total errors associated with variables \(\theta _{1}\) and \(x_{ \mathsf{ Q } }\) were aggregated into a single error indicator using Eq. (2) with weights \(w_{\theta }= 1~\text{rad}^{-2}\) and \(w_{x_{ \mathsf{ Q } }} = 1~\text{m}^{-2}\), intended to make the final metric dimensionless. Case 1 is a conservative system, and so the total mechanical energy was used there as additional metric.

When using variable step-size integrators, the variables of interest are usually not evaluated exactly at the sampling points. This also happens when constant integration steps are used, but they are not exact dividers of the sampling interval. In these cases, data need to be interpolated; a linear polynomial interpolation has been used here to determine the necessary values.

Two levels of accuracy have been established for the defined cases. In case 1, a high-precision simulation corresponds to a maximum admissible total error \(\varepsilon _{\mathrm{{T}}}=2\cdot 10^{-4}\). This is roughly equivalent to the energy criterion set in the IFToMM benchmark, which accepted simulations with maximum energy errors below \(0.001~\text{J}\). The admissibility threshold for low-precision simulation in this case was increased up to \(\varepsilon _{\mathrm{{T}}}=2\cdot 10^{-3}\). The same values were used for case 2. Case 3 is more challenging from a computational point of view, and its thresholds were relaxed. The selected thresholds are shown in Table 2.

Table 2 Maximum admissible errors for each simulation case

In general, the selection of the threshold depends on factors like the time scale of the dynamics and the difficulty of the problem.

2.2 Solution methods

Several solution methods were used to carry out the forward-dynamics simulation of the benchmark example. Their main characteristics are summarised on Table 3. Unless otherwise specified, MATLAB implementations were used to perform the simulation.

Table 3 Summary of the methods employed to solve the slider-crank benchmark problem

The first method (AL) uses the index-1 augmented Lagrangian algorithm with position and velocity projections presented in [4], integrated with the trapezoidal rule (TR) in fixed-point iteration form. Method ALi3p stands for the index-3 augmented Lagrangian algorithm with projections of velocities and accelerations [6, 7]. Algorithm ALi3pvs is the variable-step version of ALi3p introduced in [8]. Different sets of coordinates could be selected to model the mechanism with these formulations; here we use three-dimensional natural coordinates [16], consisting in the \(x\), \(y\) and \(z\) coordinates of points \(\mathsf{ P } \) and \(\mathsf{ Q } \) and two unit vectors perpendicular to links 1 and 2 respectively. The computational model was built using a 3D multibody software library developed by the authors; kinematic constraints describing the rigid-body nature of the links and the joints that connect them were subsequently added. The resulting model consists of 12 variables and 12 redundant kinematic constraints. Besides, methods mAL (MATLAB augmented Lagrange) and mNS (MATLAB null-space) were also assessed, in which MATLAB ode45 integration formula is used. The first one uses a stabilised augmented Lagrangian algorithm, while the second adopts a null-space formulation similar to the one in [23]. These methods describe the system with reference point (Cartesian) coordinates, namely the \(x\) and \(y\) coordinates of the centre of mass of each body (the ground is treated as another body in the assembly) and its orientation angle with respect to the \(x\) axis, and impose on them 11 independent constraint equations. In cases 1 and 3, the Jacobian matrix of these constraints loses rank and, as expected, the mNS method was unable to successfully complete the simulation. For the purpose of comparing fixed- and variable-step integrators, methods mAL and mNS were also combined with a fourth order, fixed-step Runge–Kutta integration formula in its classical form, denoted in the text as ode4. The ode15s integration formula, designed for stiff systems, was also used in the evaluation in combination with the mAL formulation.

2.3 Reference solutions

Reference solutions for each case were obtained by convergence of the different methods summarised in Sect. 2.2. Figures 4, 5, and 6 show the slider displacement \(x_{ \mathsf{ Q } }\) that corresponds to the reference solutions of cases 1–3. The way to refine the results depended on the numerical integrator used by each method. For those that used constant integration step-sizes, the step was reduced to increase the precision. In the case of methods with variable-step integration, the tolerances were made more stringent. The convergence towards a reference solution in all cases was additionally verified integrating the system dynamics expressed as a single unconstrained degree-of-freedom equation of motion with MATLAB’s ode15i method. This solution, upon convergence, was used to provide the values of \(y_{j}^{\mathrm{ref}}(t_{i})\) required by Eq. (1).

Fig. 4
figure 4

Reference solution: displacement \(x_{ \mathsf{ Q } }\) of the slider in case 1

Fig. 5
figure 5

Reference solution: displacement \(x_{ \mathsf{ Q } }\) of the slider in case 2

Fig. 6
figure 6

Reference solution: displacement \(x_{ \mathsf{ Q } }\) of the slider in case 3

Upon convergence, the differences in the monitored variables across the solutions delivered by the methods remained below \(3\cdot 10^{-5}~\text{m} \) for \(x_{ \mathsf{ Q } }\) and \(2.5\cdot 10^{-5}~\text{rad}\) for \(\theta _{1}\) in case 1, \(7\cdot 10^{-4}~\text{m} \) for \(x_{ \mathsf{ Q } }\) and \(8\cdot 10^{-4}~\text{rad}\) for \(\theta _{1}\) in case 2, and \(4\cdot 10^{-3}~\text{m} \) for \(x_{ \mathsf{ Q } }\) and \(6\cdot 10^{-3}~\text{rad}\) for \(\theta _{1}\) in case 3, at every sampling point. Additionally, for case 1, the error in the mechanical energy of the reference solution was lower than \(10^{-6}~\text{J}\).

3 Results

The benchmark scenarios defined in Sect. 2 were used to evaluate and compare the performance of the simulation solutions in Table 3. The computations were performed on an Intel Core i7-7700HQ at 2.80 GHz with 16 GB of RAM, running Windows 64-bit and MATLAB R2020b. For the purposes of this study, and considering the particular characteristics of the simulation environment, besides the precision thresholds in Table 2, a maximum admissible elapsed time in computations of \(2000~\text{s}\) was established for all simulations.

In the case of the constant-step AL, ALi3p, mAL-ode4 and mNS-ode4 methods, the integration step-size \(h\) was found to be the parameter that had the greatest impact on the efficiency and accuracy of the simulation.

For the trapezoidal rule in ALi3pvs, this role corresponded to the maximum admissible increment of the variables between iterations in each step \(\varphi _{\mathrm{max}}\) selected as a stopping criterion for the convergence of the integration formula. In the case of the mAL and mNS methods, integrated with ode45, the most critical factors were the absolute and relative tolerances of the integrator \(\varphi _{\mathrm{abs}}\) and \(\varphi _{\mathrm{rel}}\). This was also the case with ode15s.

It is worth mentioning that tuning the ALi3pvs method to each particular problem introduced an additional complexity as its performance depended as well on parameters like the maximum number of iterations \(\gamma \) allowed during the Newton–Raphson iteration and the upper and lower limits \(h_{\mathrm{max}}\) and \(h_{\mathrm{min}}\) for the integration step-size. Tuning these parameters was not a straightforward process, because the impact of a given selection on the simulation performance is highly nonlinear. Moreover, because the algorithm adjusts the step-size based on its previously used value, the initially used step-size \(h_{0}\) must also be considered a parameter of the simulation. It is difficult to provide general recommendations on the selection of the these parameters. In general, it seems advisable to decrease the limit of admissible iterations per step \(\gamma \) and regulate the error of the simulation by tuning the convergence criterion \(\varphi _{\mathrm{max}}\). When using ode45-methods, \(\varphi _{\mathrm{abs}}\) and \(\varphi _{\mathrm{rel}}\) can be selected independently from each other introducing, also in this case, an additional complexity in the tuning process. Regarding the mAL-ode15s method, adjusting its parameters and tolerances was even more complicated as its convergence trends were not as clear as with ode45.

All the augmented Lagrangian formulations are, in principle, able to deal with singular configurations, which is required by cases 1 and 3. Figure 7, however, confirms that the parameters of the augmented Lagrangian formulations also need to be tuned appropriately to arrive at correct results. The penalty factor \(\alpha \) required by these methods has an admissible range of validity. For a constant step-size \(h=1~\text{ms}\), \(10^{7} \leq \alpha \leq 10^{15}\) for the ALi3p method and \(1 \leq \alpha \leq 10^{6}\) for the AL formulation. Within this range, both methods correctly predict the system motion, delivering plot ‘AL’ in Fig. 7. An incorrect tuning of \(\alpha \) leads to an invalid simulation, as is the case of the ‘AL pen.’ plot, in which the penalty of the AL method was set to \(\alpha =10^{7}\). Moreover, it is noteworthy that, even though these formulations are able to handle rank-deficient Jacobian matrices, branch changes can affect the predicted motion in some cases, even when the system velocity is not zero. Plot ‘AL np’ in Fig. 7 corresponds to the case in which position and velocity projections have been disabled in the AL formulation; the resulting method is theoretically able to perform the simulation of the system motion as a slider-crank, but it switches to a pendulum motion around \(t=0.45~\text{s}\).

Fig. 7
figure 7

Case 1: effect on displacement \(x_{ \mathsf{ Q } }\) of the slider of the parameter selection of augmented Lagrangian formulations

The benchmarking results obtained in the simulation of case 1 are shown in Tables 4 and 5 for the low and high precision thresholds specified in Table 2, respectively. Numerical experiments confirmed that methods mNS and mNS-ode4 were unable to deal with the singular configurations of the mechanism, which resulted in the failure of the simulation. The augmented Lagrangian methods, on the other hand, completed the simulation successfully. The elapsed times reported correspond to the average of five different simulation runs. For the low-precision case, all the successful methods delivered comparable results in terms of efficiency. As expected, times increased in the high-precision scenario, particularly for the methods that modelled the system with natural coordinates and used the trapezoidal rule as an integration routine. The use of a variable step-size in ALi3pvs resulted in an improvement of the efficiency with respect to its fixed-step counterpart, especially in the high-precision case.

Table 4 Best results in the solution of case 1 (low precision)
Table 5 Best results in the solution of case 1 (high precision)

Case 2 is not subjected to singular configurations, but its simulation is challenging for a different reason. Some methods, like the AL and ALi3p used in this study, introduce numerical dissipation in the solution of the dynamics equations [10]. This dissipation may slow down slightly the predicted motion of the system. The external, time-dependent force \(f\) that acts on the slider is then applied to the mechanism at a configuration that differs from that of the reference solution at each particular time. In some cases, this eventually leads to the departure of the system motion from theoretically correct values, as shown in Fig. 8. The augmented Lagrangian formulations deliver results that match the reference solution provided that small enough integration step-sizes are used (‘AL’), but might follow a different path otherwise, as can be seen for plot ‘AL dt’, which corresponds to the AL formulation integrated with a step-size \(h=5~\text{ms}\). This issue imposes an important limitation on the efficiency of these formulations.

Fig. 8
figure 8

Case 2: effect on displacement \(x_{ \mathsf{ Q } }\) of the slider of the parameter selection of augmented Lagrangian methods

Tables 6 and 7 summarise the results obtained with the different methods in the solution of case 2 for low and high precision, respectively. All the methods were able to meet the low-precision threshold in the simulation of this case, although augmented Lagrangian algorithms with projections required more time to complete the integration, as a consequence of the energy dissipation mentioned in the previous paragraph. This effect was particularly noticeable for the AL algorithm, which required a step size of \(h=0.004~\text{s}\) to achieve correct results. The issue was still more critical in the high-precision run, which the AL method was unable to complete below the \(2000~\text{s}\) limit.

Table 6 Best results in the solution of case 2 (low precision)
Table 7 Best results in the solution of case 2 (high precision)

Two interesting facts can be remarked. The first is that the null-space formulations delivered the most efficient simulation execution. Case 2 does not feature singular configurations, and so these methods can be used to effectively solve the system dynamics. The second is that the use of variable-step integrators resulted in significant time savings with respect to their fixed-step counterparts. The computational improvement became more relevant as the precision required from the execution increased. This was clear in the case of the ALi3p and ALi3pvs methods, but could also be observed for mAL and mNS formulations. Figure 9 shows the times elapsed by these methods in the solution of Case 2 for different precision levels and confirms the computational advantage of variable-step integration for higher precision requirements.

Fig. 9
figure 9

Elapsed time in the solution of case 2 as a function of the precision \(\varepsilon _{\mathrm{T}}\) delivered by mAL and mNS methods

Finally, the simulation results that correspond to case 3 are summarised in Tables 8 and 9. The mNS formulations failed again in this case due to the existence of singular configurations. The AL algorithm was unable to meet the precision thresholds in less than \(2000~\text{s}\). Regarding the ALi3p method, it required an increased value of the penalty factor (\(\alpha =10^{15}\)) to deliver correct results in the low-precision run. The ALi3pvs delivered again a significant reduction of the elapsed time in computations by means of time-step adjustments even though its step-size was set to be always smaller than that of the fixed-step ALi3p. This is explained by a reduction in the number of iterations required by the method to attain convergence at each integration step. Decreasing the step size with ALi3p, conversely, did not result in performance improvements. The mAL and mAL-ode4 delivered the most efficient results. Regarding the high-precision threshold, we did not find any parameter combination by which ALi3p and ALi3pvs were able to meet the simulation requirements. It must be pointed out that these formulations are known to suffer from numerical issues for very small integration steps [6]. Moreover, tuning the parameters of these methods, especially the variable-step ALi3pvs, is not straightforward, and it was not possible to determine a standardised protocol to adjust them.

Table 8 Best results in the solution of case 3 (low precision)
Table 9 Best results in the solution of case 3 (high precision)

The presented simulation results confirm the ability of the proposed benchmark problem to help discriminate between several solution methods for MBS dynamics under different precision requirements and execution conditions. This can be useful to assess the capabilities of newly proposed formalisms and software implementations in the simulation of mechanical systems with singular configurations and time-dependent inputs.

4 Conclusions

In this work, a benchmark example for the evaluation of multibody dynamics formulations with kinematic constraints has been introduced. The selected example consists of three variations of a planar slider-crank linkage with different physical parameters and applied external forces. The combination of these forces with the existence of singular configurations in the mechanism resulted in a challenging problem for the majority of the tested solution methods. Indeed, the simulation software needs to be able to accurately describe the system motion both in the proximity of the singularities and at the extreme points of the motion, which becomes more complicated when an external force is acting on the mechanism.

The slider-crank linkage example also served to highlight relevant aspects of the definition of benchmark problems, such as the necessity of an available reference solution and suitable metrics to compare the performance of different solution methods.

The three proposed cases of this benchmark problem were used to assess the ability of different formulations in combination with fixed- and variable-step integration methods for multibody system dynamics. Results showed that the performance of each approach depends on the precision requirements and the characteristics of the problem being solved and confirmed the usefulness of the proposed example for benchmarking MBS dynamics solution methods.