betaFeedback

WorksPhysics and Astronomy

SPIRAL: An Efficient Algorithm for the Integration of the Equation of Rotational Motion

Abstract

We introduce Spiral, a third-order integration algorithm for the rotational motion of extended bodies. It requires only one force calculation per time step, does not require quaternion normalization at each time step, and can be formulated for both leapfrog and synchronous integration schemes, making it compatible with many particle simulation codes. The stability and precision of Spiral exceed those of state-of-the-art algorithms currently used in popular DEM codes such as Yade, MercuryDPM, LIGGGHTS, PFC, and more, at only slightly higher computational cost. Also, beyond DEM, we see potential applications in all numerical simulations that involve the 3D rotation of extended bodies.

Introduction

The efficient and robust integration of the equations of rotational motion is a fundamental requirement for the simulation of many-particle systems. Developers of popular programs for the Discrete Element Method (DEM), see Table 1, and Molecular Dynamics (MD), such as LAMMPS [45] and GROMACS [2] face the problem of compromising between simple algorithms that require small time steps to maintain stability and more efficient algorithms such as Runge-Kutta-4 [25], that can handle larger time steps, but at the cost of a higher number of force calculations per time step, which can be prohibitively expensive for larger systems.

algorithmDEM codes using it
Direct Euler [7]MFiX[42]EDEM[3]BlazeDEMGPU[13]MUSEN[10]
Velocity Verlet [52]LIGGGHTS[22]GranOO[4]EDEM[3]MercuryDPM[54]
Fincham [11]Yade[40]Esys Particle [1]WooDEM[55]
Buss [8]PFC7[18]
Johnson et al.[21]PFC7[18]
PFC4 [17, 30]MercuryDPM[54, 30]

Table 1. Popular algorithms for integrating the equation of rotational motion and DEM software that uses them. For a detailed discussion, see Appendix § 11.

When using quaternions to describe the particles’ orientations in numerical algorithms, care must be taken to preserve their unitarity [24, 19]. Unfortunately, many popular algorithms do not conserve the quaternion norm, thus requiring normalization at each time step. Table 1 provides a list of algorithms utilized in widespread DEM codes to integrate the rotational motions of particles. Among those, Buss’ algorithm [8] stands out as it is the only one that does not require subsequent quaternion normalization. All algorithms listed in Table 1 provide second-order accuracy per time step, despite having better algorithms at our disposal for decades. For instance, Omelyan [29] proposed a third-order algorithm that shows remarkable energy conservation performance, a critical factor in MD simulations. Neto and Bellucci [28] proposed an algorithm that slightly outperforms Omelyan’s in terms of energy conservation, albeit at the cost of higher complexity.

We introduce an algorithm for integrating the equations of rotational motion of extended bodies that offers several advantages: It does not need quaternion normalization and requires only one force calculation per time step. It provides third-order accuracy and excellent numerical stability, including energy conservation, allowing for larger time steps and, thus, reducing overall computational costs. The algorithm can be adapted to different code architectures and simulation frameworks, including leapfrog and non-leapfrog variants, making it flexible and compatible with most simulation setups.

In addition to mechanical many-body systems, numerical integration of the equation of rotational motion is used in many fields, including video game engines like Vulkan [53], Unity [49], and Unreal engine [50], animation and computer graphics [23, 20, 14, 41], robotics [47, 6], sensors [36, 43, 51, 36], navigation systems [56, 9], autonomous vehicles [35, 31, 38], and control systems [44, 27]. Remarkably, many control systems employ variational methods that result in a formulation similar to the one presented here, but they are much more complex [35, 31, 36] and generally provide only second-order accuracy.

We compared the new integration algorithm against the previously mentioned ones, assessing accuracy, stability, performance, and energy conservation. We find excellent results across all the evaluation criteria, highlighting its potential as an improved general method for integrating equations for rotational motion.

Spiral-an algorithm for the numerical integration of the equation of rotational motion

The third-order Spiral1 algorithm applies to leapfrog and non-leapfrog architectures. Here, we describe the leapfrog version. The non-leapfrog version is presented in Appendix § 10. We describe the 3D orientation of a rigid body at time tt by unit quaternions q(t)q(t) [15]. To derive an expression for q(t+Δt)q(t+\Delta t), we start with the quaternion’s time derivative [24, 19],

q˙=dqdt=12ω(t)q.(1)\dot{q}=\frac{dq}{dt}=\frac{1}{2}\omega(t)q . \tag*{(1)}

where ω={0,ωx,ωy,ωz}\omega=\{0,\omega_x,\omega_y,\omega_z\} is a pure imaginary quaternion representing the angular velocity ω⃗={ωx,ωy,ωz}\vec{\omega}=\{\omega_x,\omega_y,\omega_z\} in the reference frame of the rotating body. We assume that ω⃗\vec{\omega} depends only explicitly on time and solve the differential equation, (1) by separation of variables

∫tt+Δtdqq=12∫tt+Δtω(t′) dt′,(2)\int_t^{t+\Delta t}\frac{dq}{q}=\frac{1}{2}\int_t^{t+\Delta t}\omega(t')\,dt' , \tag*{(2)}

to obtain

q(t+Δt)=q(t)exp⁡(12∫tt+Δtω(t′) dt′).(3)q(t+\Delta t)=q(t)\exp\left(\frac{1}{2}\int_t^{t+\Delta t}\omega(t')\,dt'\right) . \tag*{(3)}

We expand the unknown ω(t′)\omega(t') in a Taylor series around aa,

ω(t′)=ω(a)+ω˙(a)(t′−a)+12ω¨(a)(t′−a)2+O[(t′−a)3].(4)\omega(t')=\omega(a)+\dot{\omega}(a)(t'-a)+\frac{1}{2}\ddot{\omega}(a)(t'-a)^2+O\left[(t'-a)^3\right] . \tag*{(4)}

Take a=t+Δt2a=t+\frac{\Delta t}{2} (leapfrog assumption), and insert it into Eq. (3), to obtain

q(t+Δt)=q(t)exp⁡[Δt2ω(t+Δt2)+O(Δt3)].(5)q(t+\Delta t)=q(t)\exp\left[\frac{\Delta t}{2}\omega\left(t+\frac{\Delta t}{2}\right)+O(\Delta t^3)\right] . \tag*{(5)}

The exponential of a purely imaginary quaternion θu^\theta\hat{u}, where θ\theta is a scalar and u^={0,ux,uy,uz}\hat{u}=\{0,u_x,u_y,u_z\}, a unit quaternion, reads [19]

eθu^=cos⁡θ+u⃗sin⁡θ,(6)e^{\theta\hat{u}}=\cos\theta+\vec{u}\sin\theta, \tag*{(6)}

with the unit vector u⃗={ux,uy,uz}\vec{u}=\{u_x,u_y,u_z\}. Then

q(t+Δt)=q(t)(cos⁡θ1+ω⃗(t+Δt2)∣ω⃗(t+Δt2)∣sin⁡θ1),withθ1≡Δt2∣ω⃗(t+Δt2)∣.(7)q(t+\Delta t)=q(t)\left(\cos\theta_1+\frac{\vec{\omega}\left(t+\frac{\Delta t}{2}\right)}{\left\lvert\vec{\omega}\left(t+\frac{\Delta t}{2}\right)\right\rvert}\sin\theta_1\right),\quad\text{with}\quad\theta_1\equiv\frac{\Delta t}{2}\left\lvert\vec{\omega}\left(t+\frac{\Delta t}{2}\right)\right\rvert. \tag*{(7)}

The shown transformations preserve the norm of the initial quaternion, thus eliminating the need for subsequent normalization. The approach is similar to the one by Buss [8], but Eq. (7) achieves a higher-order precision. Also, Seelen et al. [37] propose a predictor-corrector version of the Zhao and Van Wachem scheme [57] by using a similar formulation, but achieving only second-order accuracy as well.

The expression for q(t+Δt)q(t+\Delta t) is independent of the method chosen to compute ω⃗\vec{\omega}. Nevertheless, for optimal results, accurate angular velocity calculation is crucial and non-trivial given the highly nonlinear expressions for angular velocity. We employ a Strong-Stability Preserving Runge-Kutta-3 (SSPRK3) scheme [39], which is highly stable and requires fewer operations than Runge-Kutta-4 [25] and the iterative algorithm used by Omelyan [29]. Moreover, inspired by [21], we compute the torque M⃗(t)\vec{M}(t) only once per time step, assuming the torque constant during the time step. Using SSPRK3, we update the angular velocity through

ω⃗(t+Δt2)=ω⃗(t−Δt2)+16(K⃗1+K⃗2+4K⃗3),(8)\vec{\omega}\left(t+\frac{\Delta t}{2}\right)=\vec{\omega}\left(t-\frac{\Delta t}{2}\right)+\frac{1}{6}\left(\vec{K}_1+ \vec{K}_2+4\vec{K}_3\right), \tag*{(8)}

with

K⃗1=Δt ω⃗˙(ω⃗,M⃗(t)),K⃗2=Δt ω⃗˙(ω⃗+K⃗1,M⃗(t)),K⃗3=Δt ω⃗˙(ω⃗+14(K⃗1+K⃗2),M⃗(t)),(9)\begin{aligned} \vec{K}_1&=\Delta t\,\dot{\vec{\omega}}\left(\vec{\omega},\vec{M}(t)\right),\\ \vec{K}_2&=\Delta t\,\dot{\vec{\omega}}\left(\vec{\omega}+\vec{K}_1,\vec{M}(t)\right),\\ \vec{K}_3&=\Delta t\,\dot{\vec{\omega}}\left(\vec{\omega}+\frac{1}{4}\left(\vec{K}_1+\vec{K}_2\right),\vec{M}(t)\right), \tag*{(9)} \end{aligned}

where M⃗(t)\vec{M}(t) is the torque acting in the body’s principal axis reference frame. The acceleration ω⃗˙={ω˙x,ω˙y,ω˙z}\dot{\vec{\omega}}=\{\dot{\omega}_x,\dot{\omega}_y,\dot{\omega}_z\} is given by Euler’s equations of motion [12],

ω˙x=MxIx+ωyωzIy−IzIx,ω˙y=MyIy+ωzωxIz−IxIy,ω˙z=MzIz+ωxωyIx−IyIz,(10)\begin{aligned} \dot{\omega}_x&=\frac{M_x}{I_x}+\omega_y\omega_z\frac{I_y-I_z}{I_x},\\ \dot{\omega}_y&=\frac{M_y}{I_y}+\omega_z\omega_x\frac{I_z-I_x}{I_y},\\ \dot{\omega}_z&=\frac{M_z}{I_z}+\omega_x\omega_y\frac{I_x-I_y}{I_z}, \tag*{(10)} \end{aligned}

with the body’s principal moments of inertia IxI_x, IyI_y, and IzI_z. This SSPRK3 integration scheme for the angular velocity is an excellent choice for non-spherical particles; nevertheless, for spherical ones, we suggest using a normal leapfrog [16] as the non-linearities vanish. Incurring in performance improvements without losing precision.

Using the leapfrog scheme, ω⃗\vec{\omega} is updated before qq. Therefore, it is necessary to compute the angular velocity back by half a step before starting the simulation. This can be done with Eq. (8) with the argument −Δt2-\frac{\Delta t}{2} instead of Δt\Delta t.

Validation against an analytical solution

Consider a rigid body with principal moments of inertia IxI_x, IyI_y, IzI_z. For the special case Ix≠Iy=IzI_x \ne I_y=I_z we can solve the set of nonlinear differential equations, Eq. (10) analytically, provided a constant torque M⃗={Mx,0,0}\vec{M} = \{M_x,0,0\} with Mx≠0M_x \ne0 and ωx(t)≠0\omega_x(t) \ne0 at all times. The solution reads (see Appendix § 12 for the derivation)

ωx(t)=τ=ωx0+MxIxt,ωy(τ)=k1cos⁡(Ωτ)+k2sin⁡(Ωτ),ωz(τ)=ηΩ(k2cos⁡(Ωτ)−k1sin⁡(Ωτ)),(11)\begin{aligned} \omega_x(t) &= \sqrt{\tau} = \omega_x^0 + \frac{M_x}{I_x}t,\\ \omega_y(\tau) &= k_1\cos(\Omega\tau) + k_2\sin(\Omega\tau),\\ \omega_z(\tau) &= \eta\Omega\left(k_2\cos(\Omega\tau)-k_1\sin(\Omega\tau)\right), \tag*{(11)} \end{aligned}

with the initial angular velocity ω⃗(0)={ωx0,ωy0,ωz0}\vec{\omega}(0) = \{\omega_x^0,\omega_y^0,\omega_z^0\} and

Ω2≡−(Ix2Mx)2(Ix−Iy)(Iz−Ix)IzIy,η≡IyIz−Ix2MxIx,k1≡ωy0cos⁡(Ω(ωx0)2)−ωz0Ωηsin⁡(Ω(ωx0)2),k2≡ωy0sin⁡(Ω(ωx0)2)+ωz0Ωηcos⁡(Ω(ωx0)2).(12)\begin{aligned} \Omega^2 &\equiv-\left(\frac{I_x}{2M_x}\right)^2\frac{(I_x-I_y)(I_z-I_x)}{I_zI_y},\\ \eta&\equiv\frac{I_y}{I_z-I_x}\frac{2M_x}{I_x},\\ k_1 &\equiv\omega_y^0\cos\left(\Omega(\omega_x^0)^2\right)-\frac{\omega_z^0}{\Omega\eta}\sin\left(\Omega(\omega_x^0)^2\right),\\ k_2 &\equiv\omega_y^0\sin\left(\Omega(\omega_x^0)^2\right)+\frac{\omega_z^0}{\Omega\eta}\cos\left(\Omega(\omega_x^0)^2\right). \tag*{(12)} \end{aligned}

Note that this solution does not apply for Mx=0M_x = 0 (for this case, the solution is also given in Appendix § 12). Further analytically solvable special cases of the rigid body equation can be found in [26, 33, 48].

For subsequent comparison, we use the above analytical expression of the body’s angular velocity (which we call ω⃗′\vec{\omega}') to compute its orientation q′(t)q'(t) by numerical integration of (1) using the highly accurate DifferentialEquations.jl [32]. The orientation q′(t)q'(t) will serve as a reference to quantify the accuracy of q(t)q(t) as delivered by our algorithm compared to other algorithms from the literature.

To compute the error between the analytical solution and the solution from the different integration algorithms, we define the error metric:

∥v⃗−v⃗′∥:=∑i∣vi−vi′∣∑i∣vi′∣.(13)\lVert\vec{v}-\vec{v}'\rVert:= \frac{\sum_i \lvert v_i-v_i'\rvert}{\sum_i \lvert v_i'\rvert}. \tag*{(13)}

This metric is the vector’s relative L1L_1 norm. We use the L1L_1 norm instead of L2L_2 because L2L_2 measures the drift of the norm and the error in the direction; in contrast, the L1L_1 norm gives more weight to the error in individual components of the vector.

The analytic solution, Eq. (11), describes an object with two identical principal moments of inertia, e.g., a cylinder, subjected to a constant torque. Here, we consider a steel cylinder of radius 5 cm, height 15 cm, and density 7750 kg/m3^3. Then, the corresponding tensor of inertia in the cylinder’s principal axis frame is I⃗={Ix,Iy,Iz}={0.0114,0.0228,0.0228}\vec{I} = \{I_x,I_y,I_z\} = \{0.0114,0.0228,0.0228\} kg m2^2. We further assume the cylinder’s initial angular velocity, ω⃗0={0.3,−0.9,0.6}\vec{\omega}_0 = \{0.3,-0.9,0.6\} rad/s, its initial orientation q0={1,0,0,0}q_0 = \{1,0,0,0\}, and the time-independent torque, Mx=0.5M_x = 0.5 N m. Figure 1 shows the analytical solution for the specified parameters.

3D rotation of a cylinder subjected to a constant torque

Figure 1. 3D rotation of a cylinder subjected to a constant torque: (a) analytical solution for the angular velocity ω⃗′\vec{\omega}^{\prime}, (b) highly accurate numerical reference solution for the orientation q′(t)q^{\prime}(t). For the detailed set of parameters, see the text. The inset to (a) shows the cylinder’s orientation at t=15t = 15 s for the reference solution (red), our proposed Spiral algorithm (blue, nearly coinciding with red), and the direct Euler algorithm (grey).

The precision of various integration algorithms is depicted in Figure 2. It shows the error as defined in Eq. (13) at t=1t = 1 s between the numerically obtained values, qq and ω⃗\vec{\omega}, and the (semi-)analytical results, q′q^{\prime} and ω⃗′\vec{\omega}^{\prime}, respectively, as functions of the time step Δt\Delta t. We see that SPIRAL outperforms all other integration schemes studied over the entire range of time steps, some of them by several orders of magnitude. Only the Runge-Kutta-4-scheme [25] performs better; however, this algorithm requires four torque computations per time step compared to one for SPIRAL and, therefore, Runge-Kutta-4 is not suitable for large-scale simulations. More details on the compared algorithms can be found in Appendix § 11.

Comparison of various algorithms with the analytical solution at time $t = 1$ s

Figure 2. Comparison of various algorithms with the analytical solution at time t=1t = 1 s: (left) relative error of the predicted quaternion with respect to the semi-analytical solution as a function of the time step, (right) relative error of the angular velocity with respect to the analytical solution as a function of the time step. The errors were computed using Eq. (13).

While Figure 2 provides valuable insights into the accuracy of the integration algorithms, it does not explicitly demonstrate their numerical stability. To assess stability, Figure 3 shows the accumulated relative error as a function of the total simulation time. The time step is chosen Δt=10−5\Delta t = 10^{-5} s.

Comparison of various algorithms with the analytical solution; evolution of the error

Figure 3. Comparison of various algorithms with the analytical solution; evolution of the error. The time step is Δt=10−5\Delta t = 10^{-5} s: (left) relative error of the predicted quaternion with respect to the semi-analytical solution as a function of total simulation time, (right) relative error of the angular velocity with respect to the analytical solution as a function of the time step. The error was computed according to Eq. (13).

Again, we see that SPIRAL outperforms the other algorithms, except for Runge-Kutta-4 [25], which uses four torque calculations per time step. In contrast to SPIRAL, all other integration algorithms in the plot require quaternion normalization after each time step, except for the scheme by Buss [8]. We have noticed that the Omelyan algorithm [29], albeit not requiring quaternion normalization due to its mathematical formulation, tends to accumulate significant numerical errors over time. Therefore, periodic normalization of the quaternions is advised.

Performance analysis

Figure 4 shows the computer time of the algorithms for one time step, relative to the time employed by the Direct Euler algorithm when normalizing the quaternion [7].

Execution time per time step for the algorithms, normalized by Direct Euler

Figure 4. Execution time per time step relative to the time required by the Direct Euler algorithm [7]. Results with and without quaternion normalization. Note that SPIRAL does not require quaternion normalization.

The performance metrics were determined using BENCHMARKTOOLS.JL [5]. We see that quaternion normalization involves significant performance degradation. Therefore, it is a clear advantage that SPIRAL does not require normalization.

Although SPIRAL takes about 30 % more time to perform a single time step compared to the Direct Euler method [7], it ultimately allows for faster simulations. This is because SPIRAL requires fewer steps to achieve the same level of accuracy as other methods, as quantified in the previous Section. For a fair evaluation of the algorithms’ efficiency, we determine the appropriate time step that achieves a given error by using the data from Figure 2, with the bracketing algorithm from ROOTS.JL [34]. Measuring the total CPU time needed for each algorithm to integrate a particle’s motion for a period of 1 s with a predefined total error, we can asses their relative speedups. Figure 5 shows the speedup of each algorithm as the time spent with Direct Euler [7] divided by the time spent by that algorithm to reach the same target error after 1 s. The time step required for a list of specified target errors is reported in Table 2. Again, SPIRAL reveals much better than all other algorithms, around 10 times faster than Omelyan [29] and more than 100 times faster than Velocity Verlet [52]. Observe that all algorithms except Omelyan and SPIRAL are of the same order of accuracy than Direct Euler and, therefore, scale the same as Direct Euler when decreasing the target error.

Image not extracted

Figure 5. Speedup of several algorithms relative to the Direct Euler method. The speedup is computed by measuring the Computer time needed to simulate 1 s of the system specified in Figure 1 with a predefined target error of (∥q−q′∥+∥ω⃗−ω⃗′∥)/2(\lVert q-q' \rVert+\lVert\vec{\omega}-\vec{\omega}' \rVert)/2 at the end of the simulation. The shown speedup is the time required by the Direct Euler scheme [7] divided by the time required by each algorithm, and is shown for four values of the target errors: 10−210^{-2} (green), 10−310^{-3} (blue), 10−410^{-4} (orange) and 10−510^{-5} (red). The time step each algorithm requires to achieve the different target errors is provided in Table 2. The errors were computed by using Eq. (13).

algorithm10−510^{-5}10−410^{-4}10−310^{-3}10−210^{-2}
Spiral (this paper)3.044e-038.372e-032.329e-026.167e-02
Omelyan [29]2.943e-049.319e-042.952e-039.400e-03
Buss [8]2.650e-052.663e-042.890e-035.529e-02
Velocity Verlet [52]6.789e-066.852e-056.779e-043.527e-03
Fincham [11]3.069e-063.071e-053.091e-043.295e-03
Direct Euler [7]1.324e-061.325e-051.333e-041.421e-03
Johnson et al. [21]1.801e-061.801e-051.804e-041.824e-03
PFC4 [17, 30]1.662e-071.662e-061.663e-051.671e-04

Table 2. The time step Δt\Delta t required to achieve the average target error (∥q−q′∥+∥ω⃗−ω⃗′∥)/2(\lVert q-q' \rVert+\lVert\vec{\omega}-\vec{\omega}' \rVert)/2 after 1 s of simulation time for the problem described in § 3. The error was computed using Eq. (13).

Energy conservation of a many-particle system

To evaluate the performance of Spiral in a many-body environment, we simulated non-spherical particles in a box. The contacts between the particles and the box, as well as between the particles themselves, are described by the conservative Hertz law, ensuring energy conservation. Our focus was on studying energy conservation in a dynamic system of chess pieces, as illustrated in Figure 6.

Snapshot of a simulation of non-spherical particles, chess pieces modeled as multi-spheres, bouncing in a box

Figure 6. Snapshot of a simulation of non-spherical particles (chess pieces modeled as multi-spheres) bouncing in a box. The elastic Hertz contact force describes particle-particle and particle-wall collisions.

The sizes of the chess pieces follow FIDE recommendations (king: 9.5 cm, queen 8.5 cm, bishop 7 cm, knight 6 cm, rook 5.5 cm, pawn 5 cm). Material density of the pieces is 3200 kg/m3^{3}, the Young modulus, 60 GPa, and the Poisson ratio, 0.25. We used Yade [40] as a simulation framework. Initially, the positions of the objects were random, such that the particles were not in contact. Their initial velocity was 1 m/s in a random direction. Their initial angular velocity was π\pi rad/s, also in a random direction.

Figure 7 shows the deviation from the initial kinetic energy as a function of the time step size for three integration algorithms: Fincham, Omelyan and Spiral. To facilitate comparison, the dashed line in the figure represents the Rayleigh time step [46]. The Rayleigh time step, Δtc\Delta t_c is the time taken for a shear wave to propagate through a solid particle. It is common to use Δtc\Delta t_c as a criterion to select a time step Δt∼0.1Δtc\Delta t \sim0.1\Delta t_c to 0.3Δtc0.3\Delta t_c when looking for simulation stability.

Relative deviation of the kinetic energy as a function of the integration time step width

Figure 7. Relative deviation of the kinetic energy % energy from the initial value due to a simulation time of 1,5 s as a function of the integration time step width. The results are averaged about 250 random initial conditions. The graph shows several integration schemes. A dashed line indicates the Rayleigh time step.

The graph displays the relative change of energy in a total simulation time of 1.5 s. We see that SPIRAL conserves energy on the same level as the integration scheme by Omelyan [29], which is known to be very stable.

Conclusions

We introduced SPIRAL, a highly accurate and efficient third-order integration algorithm for rigid body rotational motion. The algorithm displays excellent numerical stability. We provide both leapfrog and non-leapfrog variants for easy adaptation to simulation frameworks. Our algorithm features remarkable accuracy and stability while incurring minimal performance penalties compared to other algorithms used in popular DEM software; see Table 1. By construction, our algorithm preserves the norm of the quaternion, thus removing the need for regular quaternion normalization in each time step. The stability and preservation of the quaternion norm also enable the use of larger time steps, which improves simulation performance while achieving the same level of accuracy as other integration schemes. In addition, SPIRAL employs a modified third-order Strong-Stability Preserving Runge-Kutta (SSPKR3) scheme to update the angular velocity, which computes the torques only once per time step. When combined, those integration schemes give SPIRAL an outstanding performance: 10 times faster than Omelyan [29] and 100 times faster than Velocity Verlet [52] to reach the same target error.

We tested the algorithm stability in two scenarios: first, by looking at the accumulation of errors against time for a single rotor with analytical solution (the same we used for studying accuracy) and, second, by testing for energy conservation on a realistic DEM scenario of non-spherical particles interacting with a conservative Hertz law. In the first test, our algorithm was superior to all other algorithms tested and, in the second one, it was on par with the Omelyan algorithm [29], which is known to reach excellent energy conservation.

As part of this work, we integrated SPIRAL algorithm into two major DEM simulation codes. Now, SPIRAL is an integral part of the YADE [40] and MERCURYDPM [54] distributions, ensuring that our algorithm’s benefits are accessible to a broad scientific community.

Acknowledgements

CAV thanks the Institute for Multiscale Simulation (MSS) at the Friedrich-Alexander-Universität Erlangen-Nürnberg for funding a visitor’s grant.

Data availability

The SPIRAL algorithm was implemented in two major DEM simulation systems YADE and MERCURYDPM. The implementation of SPIRAL as tested in this paper and the corresponding test scripts are available at https://github.com/cdelv/AlgorithmsForRotationalMotion.

Conflict of interest declaration

We declare we have no competing interests.

Non-leapfrog variant of Spiral

To derive a non-leapfrog variant of SPIRAL, we follow the steps in Sec. 2. With a=ta=t in Eq. (4) we obtain

q(t+Δt)=q(t)exp⁡[Δt2ω⃗(t)+Δt24ω⃗˙(t)+O(Δt3)],(14)q(t+\Delta t)=q(t)\exp\left[\frac{\Delta t}{2}\vec{\omega}(t)+\frac{\Delta t^2}{4}\dot{\vec{\omega}}(t)+\mathcal{O}(\Delta t^3)\right], \tag*{(14)}

which is the non-leapfrog version of Eq. (5). Using Eq. (6) we obtain

q(t+Δt)=q(t)(cos⁡θ2+ω⃗(t)∣ω⃗(t)∣sin⁡θ2)(cos⁡θ3+ω⃗˙(t)∣ω⃗˙(t)∣sin⁡θ3)(15)q(t+\Delta t)=q(t)\left(\cos\theta_2+\frac{\vec{\omega}(t)}{\lvert\vec{\omega}(t)\rvert}\sin\theta_2\right)\left(\cos\theta_3+\frac{\dot{\vec{\omega}}(t)}{\lvert\dot{\vec{\omega}}(t)\rvert}\sin\theta_3\right) \tag*{(15)}

with

θ2=Δt2∣ω⃗(t)∣,θ3=Δt24∣ω⃗˙(t)∣.(16)\theta_2=\frac{\Delta t}{2}\lvert\vec{\omega}(t)\rvert,\qquad\theta_3=\frac{\Delta t^2}{4}\lvert\dot{\vec{\omega}}(t)\rvert. \tag*{(16)}

The non-leapfrog variant does not need a backward step for initialization. At each time step, q(t)q(t) is updated before ω⃗(t)\vec{\omega}(t). This order is necessary as the torque is required to compute ω⃗˙\dot{\vec{\omega}} with Eq. (10), which is only known at time tt. Figs. A.8 and A.9 compare the leap-frog and non-leapfrog versions of SPIRAL with the scheme by Omelyan [29], which was the second best performing in Sec. 3, after SPIRAL. We observe that both versions of SPIRAL perform similarly in accuracy and error accumulation.

Figure A.8. Comparison of SPIRAL (leapfrog and non-leap frog variants) with the leapfrog scheme by Omelyan [29]: (left) relative error of the predicted quaternion with respect to the semi-analytical solution as a function of the time step, (right) relative error of the angular velocity with respect to the analytical solution as a function of the time step. The error was computed according to Eq. (13).

Figure A.9. Comparison of SPIRAL (leapfrog and non-leap frog variants) with the leapfrog scheme by Omelyan [29]; evolution of the error. The time step is Δt=10−5 s\Delta t = 10^{-5}\,\mathrm{s}. (left) Relative error of the predicted quaternion with respect to the semi-analytical solution as a function of total simulation time. (right) Relative error of the angular velocity with respect to the analytical solution as a function of the total simulation time. The error was computed according to Eq. (13).

Rotation Algorithms

This Appendix provides details of the algorithms listed in Table 1 and used for comparison in § 3, § 4, § 5, and Appendix § 10.

To prevent any confusion regarding the reference frames used in the algorithms, we establish the following notation: Quantities described in the principal axis reference frame of the rotating object appear like in the rest of this paper (the angular velocity ω⃗\vec{\omega}, for instance). Variables in the lab frame have a superscript, ω⃗lab\vec{\omega}^{\mathrm{lab}}. Furthermore, in the principal axis frame, the inertia tensor is represented as I⃗\vec{I}, and it is treated mathematically as a vector, because it is a diagonal matrix. In the lab frame, the inertia tensor is denoted as JJ and is a 3x3 symmetrical matrix. The quaternion representing the orientation is the same for both reference frames.

The angular velocity derivative, as described in Eq. (10), is formulated in the principal axis reference frame. This derivative is a function of the inertia tensor, the angular velocity, and the torque. Similarly, the quaternion derivative in Eq. (1) is also formulated in the principal axis frame. To calculate the derivative in the lab frame, you can use the equation q˙=12qω\dot{q}=\frac{1}{2}q\omega. It is important to recognize that this equation, along with Eq. (1), requires the angular velocity to be converted into an imaginary quaternion. Alternatively, the quaternion derivative can be expressed by using matrix-vector multiplication. Consequently, you can represent q˙\dot{q} as a function of the quaternion and the angular velocity vector [19]. For clarity, in the algorithm description, we show how to evaluate each derivative with brackets (for example, ω⃗˙[ω⃗,M⃗]\dot{\vec{\omega}}\left[\vec{\omega},\vec{M}\right]).

Direct Euler

The second-order Direct Euler algorithm [7] updates the angular velocities and the quaternions through

ω⃗(t+Δt)=ω⃗(t)+Δtω⃗˙[ω⃗(t),M⃗(t)]q(t+Δt)=q(t)+Δtq˙[q(t),ω⃗(t+Δt)].(17)\begin{aligned} \vec{\omega}(t+\Delta t) &= \vec{\omega}(t)+\Delta t\dot{\vec{\omega}}\left[\vec{\omega}(t),\vec{M}(t)\right] \\ q(t+\Delta t) &= q(t)+\Delta t\dot{q}\left[q(t),\vec{\omega}(t+\Delta t)\right]. \tag*{(17)} \end{aligned}

This algorithm requires normalization of the quaternions in each time step. All quantities are in the principal axis frame.

Velocity Verlet

The second-order Velocity Verlet algorithm [52] updates the angular velocities and the quaternions through

ω⃗(t+Δt2)=ω⃗(t)+Δt2ω⃗˙[ω⃗(t),M⃗(t)]q(t+Δt)=q(t)+Δtq˙[q(t),ω⃗(t+Δt)].(18)\begin{aligned} \vec{\omega}\left(t+\frac{\Delta t}{2}\right) &= \vec{\omega}(t)+\frac{\Delta t}{2}\dot{\vec{\omega}}\left[\vec{\omega}(t),\vec{M}(t)\right] \\ q(t+\Delta t) &= q(t)+\Delta t\dot{q}\left[q(t),\vec{\omega}(t+\Delta t)\right]. \tag*{(18)} \end{aligned}

Compute the torques, M⃗(t+Δt)\vec{M}(t+\Delta t), and then

ω⃗(t+Δt)=ω⃗(t+Δt2)+Δt2ω⃗˙[ω⃗(t+Δt2),M⃗(t+Δt)].(19)\vec{\omega}(t+\Delta t)=\vec{\omega}\left(t+\frac{\Delta t}{2}\right)+\frac{\Delta t}{2}\dot{\vec{\omega}}\left[\vec{\omega}\left(t+\frac{\Delta t}{2}\right),\vec{M}(t+\Delta t)\right]. \tag*{(19)}

This algorithm requires normalization of the quaternions in each time step. All quantities are in the principal axis frame.

Fincham Leapfrog

The second-order Fincham Leapfrog algorithm [11] uses angular momenta instead of angular velocities. It includes a mid-step interpolation of the quaternion to increase the stability. The update from tt to t+Δtt+\Delta t is performed in two steps. First, the angular momenta are updated as in Leapfrog schemes,

L⃗lab(t+Δt2)=L⃗lab(t−Δt2)+Δt M⃗lab(t).(20)\vec{L}^{\mathrm{lab}}\left(t+\frac{\Delta t}{2}\right)=\vec{L}^{\mathrm{lab}}\left(t-\frac{\Delta t}{2}\right)+\Delta t\,\vec{M}^{\mathrm{lab}}(t). \tag*{(20)}

In this algorithm, the torque and angular momentum are in the lab reference frame. Then, we update the quaternion with a predictor-corrector scheme. Here, we need the derivative of the quaternion at different angular velocities,

qa=q+Δt2q˙[q(t),ω⃗(t)]q(t+Δt)=q+Δt q˙[qa,ω⃗(t)].(21)\begin{aligned} q_a &= q+\frac{\Delta t}{2}\dot{q}[q(t),\vec{\omega}(t)]\\ q(t+\Delta t)&=q+\Delta t\,\dot{q}[q_a,\vec{\omega}(t)]. \tag*{(21)} \end{aligned}

The angular velocities in the rotating body-fixed frame can be calculated as

ω⃗(t)=A^[L⃗(t−Δt2)+Δt2M⃗(t)]ω⃗(t+Δt2)=A^L⃗(t+Δt2).(22)\begin{aligned} \vec{\omega}(t)&=\hat{A}\left[\vec{L}\left(t-\frac{\Delta t}{2}\right)+\frac{\Delta t}{2}\vec{M}(t)\right]\\ \vec{\omega}\left(t+\frac{\Delta t}{2}\right)&=\hat{A}\vec{L}\left(t+\frac{\Delta t}{2}\right). \tag*{(22)} \end{aligned}

where A^\hat{A} is the rotation matrix to translate from lab-fixed to body-fixed coordinates. The matrix can be calculated from the quaternion components. This algorithm requires normalization of the quaternion.

Buss Algorithm

Unlike the above-described algorithms, the second-order Buss algorithm [8] updates the inertia tensor and uses the quantities in the lab frame. Before the update, we compute

J(t)=A^−1(t)I⃗ω⃗lab(t)=J−1(t)L⃗lab(t)ω⃗˙lab(t)=J−1(t)[M⃗lab(t)−ω⃗lab(t)×L⃗lab(t)].(23)\begin{aligned} J(t)&=\hat{A}^{-1}(t)\vec{I}\\ \vec{\omega}^{\mathrm{lab}}(t)&=J^{-1}(t)\vec{L}^{\mathrm{lab}}(t)\\ \dot{\vec{\omega}}^{\mathrm{lab}}(t)&=J^{-1}(t)\left[\vec{M}^{\mathrm{lab}}(t)-\vec{\omega}^{\mathrm{lab}}(t)\times\vec{L}^{\mathrm{lab}}(t)\right]. \tag*{(23)} \end{aligned}

Here, A^\hat{A} is the rotation matrix for transforming lab-fixed into body-fixed coordinates, and JJ is the inertia tensor matrix in the lab frame, calculated from the inertia tensor in the principal axis frame I⃗\vec{I}. The rotation matrix can be computed from the quaternion components.

The update proceeds in two steps. First, let us compute

ω⃗=ω⃗lab(t)+Δt2ω⃗˙lab(t)+Δt212[ω⃗˙lab(t)×ω⃗lab(t)]θ=∣ω⃗∣Δt(24)\begin{aligned} \vec{\omega} &= \vec{\omega}^{\mathrm{lab}}(t) + \frac{\Delta t}{2}\dot{\vec{\omega}}^{\mathrm{lab}}(t) + \frac{\Delta t^{2}}{12}\left[\dot{\vec{\omega}}^{\mathrm{lab}}(t) \times\vec{\omega}^{\mathrm{lab}}(t)\right] \\ \theta&= \lvert\vec{\omega}\rvert\Delta t \tag*{(24)} \end{aligned}

and then

q(t+Δt)=[cos⁡θ2+ω⃗∣ω⃗∣sin⁡θ2]q(t)L⃗lab(t+Δt)=L⃗lab(t)+ΔtM⃗lab(t).(25)\begin{aligned} q(t+\Delta t) &= \left[\cos\frac{\theta}{2}+\frac{\vec{\omega}}{\lvert\vec{\omega}\rvert}\sin\frac{\theta}{2}\right]q(t) \\ \vec{L}^{\mathrm{lab}}(t+\Delta t) &= \vec{L}^{\mathrm{lab}}(t)+\Delta t\vec{M}^{\mathrm{lab}}(t). \tag*{(25)} \end{aligned}

The version of the Buss algorithm presented here is the same as the one in PFC7 documentation [18]. Buss’ original version [8] uses rotation matrices instead of quaternions.

Omelyan Algorithm

Omelyan’s third-order Advance Leapfrog algorithm [29] proceeds as follows:

ω⃗(t+Δt2)=ω⃗(t−Δt2)+Δtω⃗˙[ω⃗(t),M⃗(t)]q(t+Δt)=(1−Δt216∣ω⃗(t+Δt2)∣2)1+Δtq˙[q(t),ω⃗(t+Δt2)]1+Δt216∣ω⃗(t+Δt2)∣2q(t),(26)\begin{aligned} \vec{\omega}\left(t+\frac{\Delta t}{2}\right) &= \vec{\omega}\left(t-\frac{\Delta t}{2}\right)+\Delta t\dot{\vec{\omega}}\left[\vec{\omega}(t),\vec{M}(t)\right] \\ q(t+\Delta t) &= \frac{\left(1-\frac{\Delta t^{2}}{16}\left\lvert\vec{\omega}\left(t+\frac{\Delta t}{2}\right)\right\rvert^{2}\right)\mathbb{1}+\Delta t\dot{q}\left[q(t),\vec{\omega}\left(t+\frac{\Delta t}{2}\right)\right]}{1+\frac{\Delta t^{2}}{16}\left\lvert\vec{\omega}\left(t+\frac{\Delta t}{2}\right)\right\rvert^{2}}q(t), \tag*{(26)} \end{aligned}

where 1\mathbb{1} is the identity quaternion. Eq. (B.10) uses the derivative of the angular velocity at time tt. Comparison with Eq. (10) reveals that the computation of ω⃗˙(t)\dot{\vec{\omega}}(t) would require the angular velocity at time tt, which is yet unknown. To solve this problem, Omelyan proposed the approximation

ωα(t)ωβ(t)≈12[ωα(t−Δt2)ωβ(t−Δt2)+ωα(t+Δt2)ωβ(t+Δt2)].(27)\omega_{\alpha}(t)\omega_{\beta}(t)\approx\frac{1}{2}\left[\omega_{\alpha}\left(t-\frac{\Delta t}{2}\right)\omega_{\beta}\left(t-\frac{\Delta t}{2}\right)+\omega_{\alpha}\left(t+\frac{\Delta t}{2}\right)\omega_{\beta}\left(t+\frac{\Delta t}{2}\right)\right]. \tag*{(27)}

This approximation turns Eqs. (B.10) into a system of nonlinear equations that can be efficiently solved by iteration, with the initial guess

ω⃗(0)(t)=ω⃗(t−Δt2).(28)\vec{\omega}^{(0)}(t)=\vec{\omega}\left(t-\frac{\Delta t}{2}\right). \tag*{(28)}

Experience shows that - for a sufficiently small time step - about three iterations are enough to achieve convergence. In this paper, we always used three iterations.

By construction, this algorithm preserves the norm of the quaternions. As a result, renormalization shouldn’t be necessary; however, we found that the algorithm accumulates significant numerical errors over time and can become unstable. We suggest sporadically normalizing the quaternion when using this algorithm.

Johnson (2008) Algorithm

Johnson’s algorithm [21] is based on a Runge-Kutta-4 scheme for the update of the quaternion:

q(t+Δt)=q(t)+Δt6(k1+2k2+2k3+k4),(29)q(t+\Delta t)=q(t)+\frac{\Delta t}{6}(k_1+2k_2+2k_3+k_4), \tag*{(29)}

with

k1=q˙[q(t),ω⃗(t)]k2=q˙[q(t)+Δtk12,ω⃗(t)]k3=q˙[q(t)+Δtk22,ω⃗(t)]k4=q˙[q(t)+Δt k3,ω⃗(t)].(30)\begin{aligned} k_1&=\dot{q}\left[q(t),\vec{\omega}(t)\right]\\ k_2&=\dot{q}\left[q(t)+\Delta t\frac{k_1}{2},\vec{\omega}(t)\right]\\ k_3&=\dot{q}\left[q(t)+\Delta t\frac{k_2}{2},\vec{\omega}(t)\right]\\ k_4&=\dot{q}\left[q(t)+\Delta t\,k_3,\vec{\omega}(t)\right]. \tag*{(30)} \end{aligned}

Next, the angular momentum is updated as

L⃗lab(t+Δt)=L⃗lab(t)+ΔtM⃗lab(t).(31)\vec{L}^{\mathrm{lab}}(t+\Delta t)=\vec{L}^{\mathrm{lab}}(t)+\Delta t\vec{M}^{\mathrm{lab}}(t). \tag*{(31)}

Note that Johnson suggests to use a second-order predictor-corrector algorithm for evolving angular momentum [21]. This would require two force calculations and two quaternion updates per time step; nevertheless, for the tests in § 3 the algorithm wouldn’t have benefited from that predictor-corrector scheme, because the torque is given and constant. This algorithm requires the quaternion to be normalized.

PFC4/ MercuryDPM

The algorithm used by MercuryDPM [54] for non-spherical particles is described in the PFC4 manual [17] and [30]. It uses rotation matrices to represent the particle orientation. We are not aware of the algorithm’s name or its original reference. The current version of PFC [18] uses either the Buss [8] or the Johnson algorithm [21]. In PFC4 all the quantities are in the lab reference frame.

The algorithm proceeds as follows: First, the angular velocity and momentum are iteratively updated until convergence as

L⃗nlab=Jω⃗nlabω⃗n+1lab=ω⃗nlab+Δt J−1(M⃗lab−ω⃗nlab×L⃗nlab).(32)\begin{aligned} \vec{L}^{\mathrm{lab}}_n&=J\vec{\omega}^{\mathrm{lab}}_n\\ \vec{\omega}^{\mathrm{lab}}_{n+1}&=\vec{\omega}^{\mathrm{lab}}_n+\Delta t\,J^{-1}\left(\vec{M}^{\mathrm{lab}}-\vec{\omega}^{\mathrm{lab}}_n\times\vec{L}^{\mathrm{lab}}_n\right). \tag*{(32)} \end{aligned}

Then, the orientation is updated as

A^(t+Δt)=A^(t)+Δt A^˙(t),(33)\hat{A}(t+\Delta t)=\hat{A}(t)+\Delta t\,\dot{\hat{A}}(t), \tag*{(33)}

where A^\hat{A} is the rotation matrix representing the particle’s orientation. Its derivative reads

A^˙=εijkωjlabA^mk,(34)\dot{\hat{A}}=\varepsilon_{ijk}\omega^{\mathrm{lab}}_j\hat{A}_{mk}, \tag*{(34)}

where εijk\varepsilon_{ijk} is the Levi-Civita symbol. Einstein’s summation notation applies. In this paper, we used three iterations for convergence, as in MercuryDPM.

A special solution of Euler’s equations of motion

The case of constant driving, Mz=0M_z=0

We consider a rigid body with principal moments of inertia Ix≠Iy=IzI_x \ne I_y = I_z, driven by a constant torque M⃗={Mx,0,0}\vec{M} = \{M_x,0,0\} with Mx≠0M_x \ne0. Under these assumptions, Euler’s rigid body equations of motion in the principal axis frame, Eq. (10), reduces to

Ixω˙x=MxIyω˙y=ωzωx(Iz−Ix)Izω˙z=ωxωy(Ix−Iy).(35)\begin{aligned} I_x\dot{\omega}_x &= M_x \\ I_y\dot{\omega}_y &= \omega_z\omega_x\left(I_z-I_x\right) \\ I_z\dot{\omega}_z &= \omega_x\omega_y\left(I_x-I_y\right). \tag*{(35)} \end{aligned}

The solution of Eq. (C.1) is trivial,

ωx(t)=ωx0+MxIxt,(36)\omega_x(t)=\omega_x^0+\frac{M_x}{I_x}t, \tag*{(36)}

with ωx0≡ωx(0)\omega_x^0\equiv\omega_x(0). To solve Eqs. (C.2, C.3), take the time derivative of Eq. (C.2),

IyIz−Ixω¨y=ω˙zωx+ωzω˙x,(37)\frac{I_y}{I_z-I_x}\ddot{\omega}_y=\dot{\omega}_z\omega_x+\omega_z\dot{\omega}_x, \tag*{(37)}

and substitute ω˙z\dot{\omega}_z obtained from this equation into Eq. (C.3), to obtain

IzIx−Iy(IyIz−Ix1ωxω¨y−1ωxω˙xωz)=ωxωy.(38)\frac{I_z}{I_x-I_y}\left(\frac{I_y}{I_z-I_x}\frac{1}{\omega_x}\ddot{\omega}_y-\frac{1}{\omega_x}\dot{\omega}_x\omega_z\right)=\omega_x\omega_y. \tag*{(38)}

We also substitute ωz\omega_z as obtained from Eq. (C.2) into Eq. (C.6), to obtain

IzIx−Iy(IyIz−Ix1ωxω¨y−ω˙xωxIyIz−Ix1ωxω˙y)=ωxωy.(39)\frac{I_z}{I_x-I_y}\left(\frac{I_y}{I_z-I_x}\frac{1}{\omega_x}\ddot{\omega}_y-\frac{\dot{\omega}_x}{\omega_x}\frac{I_y}{I_z-I_x}\frac{1}{\omega_x}\dot{\omega}_y\right)=\omega_x\omega_y. \tag*{(39)}

Equation (C.7) is true if ωx≠0\omega_x\ne0. It can be written conveniently as

ω¨y−ω˙xωxω˙y=Bωx2ωy(40)\ddot{\omega}_y-\frac{\dot{\omega}_x}{\omega_x}\dot{\omega}_y=B\omega_x^2\omega_y \tag*{(40)}

with

B≡(Ix−Iy)(Iz−Ix)IzIy.(41)B\equiv\frac{(I_x-I_y)(I_z-I_x)}{I_zI_y}. \tag*{(41)}

According to our initial assumption, Ix≠Iy=IzI_x\ne I_y=I_z, we define I∗≡Iy=IzI_* \equiv I_y=I_z and, thus,

B=−(Ix−I∗I∗)2<0.(42)B=-\left(\frac{I_x-I_*}{I_*}\right)^2<0. \tag*{(42)}

Since ωx(t)\omega_x(t) is an explicit function of time (Eq. (C.4)), we can use ωx\omega_x as a time scale and replace derivatives d/dt\mathrm{d}/\mathrm{d}t by d/dωx\mathrm{d}/\mathrm{d}\omega_x. We obtain

dωydt=dωydωxdωxdt=MxIxdωydωxd2ωydt2=(MxIx)2d2ωydωx2.(43)\begin{aligned} \frac{\mathrm{d}\omega_y}{\mathrm{d}t} &= \frac{\mathrm{d}\omega_y}{\mathrm{d}\omega_x}\frac{\mathrm{d}\omega_x}{\mathrm{d}t} = \frac{M_x}{I_x}\frac{\mathrm{d}\omega_y}{\mathrm{d}\omega_x} \\ \frac{\mathrm{d}^2\omega_y}{\mathrm{d}t^2} &= \left(\frac{M_x}{I_x}\right)^2\frac{\mathrm{d}^2\omega_y}{\mathrm{d}\omega_x^2}. \tag*{(43)} \end{aligned}

Equation (C.8) reads, then,

d2ωydωx2−1ωxdωydωx=(IxMx)2Bωx2ωy,(44)\frac{\mathrm{d}^2\omega_y}{\mathrm{d}\omega_x^2}-\frac{1}{\omega_x}\frac{\mathrm{d}\omega_y}{\mathrm{d}\omega_x}=\left(\frac{I_x}{M_x}\right)^2B\omega_x^2\omega_y, \tag*{(44)}

provided Mx≠0M_x \ne0. Substituting τ≡ωx2\tau\equiv\omega_x^2 yields

dωydωx=dωydτdτdωx=2ωxdωydτd2ωydωx2=2dωydτ+2ωxddωxdωydτ=2dωydτ+4τd2ωydτ2,(45)\begin{aligned} \frac{\mathrm{d}\omega_y}{\mathrm{d}\omega_x} &= \frac{\mathrm{d}\omega_y}{\mathrm{d}\tau}\frac{\mathrm{d}\tau}{\mathrm{d}\omega_x}=2\omega_x\frac{\mathrm{d}\omega_y}{\mathrm{d}\tau} \\ \frac{\mathrm{d}^2\omega_y}{\mathrm{d}\omega_x^2} &= 2\frac{\mathrm{d}\omega_y}{\mathrm{d}\tau}+2\omega_x\frac{\mathrm{d}}{\mathrm{d}\omega_x}\frac{\mathrm{d}\omega_y}{\mathrm{d}\tau}=2\frac{\mathrm{d}\omega_y}{\mathrm{d}\tau}+4\tau\frac{\mathrm{d}^2\omega_y}{\mathrm{d}\tau^2}, \tag*{(45)} \end{aligned}

and Eq. (C.12) becomes

d2ωydτ2=(Ix2Mx)2Bωy.(46)\frac{\mathrm{d}^2\omega_y}{\mathrm{d}\tau^2}=\left(\frac{I_x}{2M_x}\right)^2B\omega_y. \tag*{(46)}

The last expression is the equation of motion for a harmonic oscillator, which we recast as

d2ωydτ2=−Ω2ωy,(47)\frac{\mathrm{d}^2\omega_y}{\mathrm{d}\tau^2}=-\Omega^2\omega_y, \tag*{(47)}

with

Ω2≡−(Ix2Mx)2B.(48)\Omega^2\equiv-\left(\frac{I_x}{2M_x}\right)^2B. \tag*{(48)}

(Recall that B<0B<0, see Eq. (C.10)). Its solution reads

ωy(τ)=k1cos⁡(Ωτ)+k2sin⁡(Ωτ),(49)\omega_y(\tau)=k_1\cos(\Omega\tau)+k_2\sin(\Omega\tau), \tag*{(49)}

whose coefficients k1k_1 and k2k_2 shall be determined from the initial conditions. We derive a corresponding equation from Eq. (C.2) by using Eqs. (C.11,C.13,C.14), obtaining

ωz=IyIz−Ix1ωxdωydt=IyIz−Ix1ωxMxIxdωydωx=IyIz−Ix2MxIxdωydτ=ηdωydτ,(50)\omega_z=\frac{I_y}{I_z-I_x}\frac{1}{\omega_x}\frac{\mathrm{d}\omega_y}{\mathrm{d}t}=\frac{I_y}{I_z-I_x}\frac{1}{\omega_x}\frac{M_x}{I_x}\frac{\mathrm{d}\omega_y}{\mathrm{d}\omega_x}=\frac{I_y}{I_z-I_x}\frac{2M_x}{I_x}\frac{\mathrm{d}\omega_y}{\mathrm{d}\tau}=\eta\frac{\mathrm{d}\omega_y}{\mathrm{d}\tau}, \tag*{(50)}

with

η=IyIz−Ix2MxIx.(51)\eta=\frac{I_y}{I_z-I_x}\frac{2M_x}{I_x}. \tag*{(51)}

Thus, from Eq. (C.17) we obtain

ωz(τ)=ηΩ(k2cos⁡(Ωτ)−k1sin⁡(Ωτ)).(52)\omega_z(\tau)=\eta\Omega\left(k_2\cos(\Omega\tau)-k_1\sin(\Omega\tau)\right). \tag*{(52)}

The set of Eqs. (C.4, C.17, C.20) form the complete solution of Euler’s Equations (C.1,C.2,C.3). For t=0t = 0, we find τ=(ωx0)2\tau= (\omega_x^0)^2, according to its definition. With this result on hand, we obtain ωy0≡ωy(t=0)\omega_y^0 \equiv\omega_y(t = 0) and ωz0≡ωz(t=0)\omega_z^0 \equiv\omega_z(t = 0) from Eqs. (C.17,C.20) as

ωy0=k1cos⁡(Ω((ωx0)2))+k2sin⁡(Ω((ωx0)2))ωz0=ηΩ[k2cos⁡(Ω((ωx0)2))−k1sin⁡(Ω((ωx0)2))].(53)\begin{aligned} \omega_y^0 &= k_1 \cos\left(\Omega\left((\omega_x^0)^2\right)\right) + k_2 \sin\left(\Omega\left((\omega_x^0)^2\right)\right) \\ \omega_z^0 &= \eta\Omega\left[k_2 \cos\left(\Omega\left((\omega_x^0)^2\right)\right) - k_1 \sin\left(\Omega\left((\omega_x^0)^2\right)\right)\right]. \tag*{(53)} \end{aligned}

By solving the linear set of Equations (C.21) we determine the parameters k1k_1 and k2k_2 from the initial velocities (ωx0,ωy0,ωz0)(\omega_x^0,\omega_y^0,\omega_z^0). With the definitions of Ω\Omega and η\eta (Eqs. (C.16) and (C.19)) we get

k1=ωy0cos⁡(Ω((ωx0)2))−ωz0Ωηsin⁡(Ω((ωx0)2))k2=ωy0sin⁡(Ω((ωx0)2))+ωz0Ωηcos⁡(Ω((ωx0)2)),(54)\begin{aligned} k_1 &= \omega_y^0 \cos\left(\Omega\left((\omega_x^0)^2\right)\right) - \frac{\omega_z^0}{\Omega\eta}\sin\left(\Omega\left((\omega_x^0)^2\right)\right) \\ k_2 &= \omega_y^0 \sin\left(\Omega\left((\omega_x^0)^2\right)\right) + \frac{\omega_z^0}{\Omega\eta}\cos\left(\Omega\left((\omega_x^0)^2\right)\right), \tag*{(54)} \end{aligned}

which concludes the analytical solution of Eqs. (C.1,C.2,C.3).

The undriven rotator, Mx=0M_x = 0

For this special case, we can see from (C.1) that

ωx(t)=ωx0.(55)\omega_x(t) = \omega_x^0. \tag*{(55)}

By inserting ω˙z\dot{\omega}_z from Eq. (C.3) into the time derivative of Eq. (C.2), we obtain

ω¨y=Iz−IxIyωx0ω˙z=(ωx0)2Iz−IxIyIx−IyIzωy.(56)\ddot{\omega}_y = \frac{I_z-I_x}{I_y}\omega_x^0\dot{\omega}_z = (\omega_x^0)^2\frac{I_z-I_x}{I_y}\frac{I_x-I_y}{I_z}\omega_y. \tag*{(56)}

This is again a harmonic oscillator equation,

ω¨y=−Γ2ωy,(57)\ddot{\omega}_y = -\Gamma^2\omega_y, \tag*{(57)}

with Γ>0\Gamma> 0 for Ix≠Iy=IzI_x \ne I_y = I_z. Using its formal solution for ωy(t)\omega_y(t), we can solve the equation

ωz(t)=IyIz−Ix1ωx0ω˙y=ζω˙y(58)\omega_z(t) = \frac{I_y}{I_z-I_x}\frac{1}{\omega_x^0}\dot{\omega}_y = \zeta\dot{\omega}_y \tag*{(58)}

and, thereafter, the set (C.23,C.25, C.26) can be solved in the same way as shown in the preceding subsection.

References

  1. [1]Abe S, D Place, & P Mora 2004 ‘A parallel implementation of the lattice solid model for the simulation of rock mechanics and earthquake dynamics’ Pure and Applied Geophysics 161:2265–2277 doi:10.1007/s00024-004-2562-x.DOI
  2. [2]Abraham MJ, T Murtola, R Schulz, S Páll, JC Smith, B Hess, & E Lindahl 2015 ‘GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers’ SoftwareX 1:19–25 doi:10.1016/j.softx.2015.06.001.DOI
  3. [3]Altair 2023 ‘EDEM - discrete element method (DEM) software’ URL https://altair.com/edem/ accessed: 21-06-2023.
  4. [4]Andre D, J Charles, & I Iordanoff 2015 3D Discrete Element Workbench for Highly Dynamic Thermo-mechanical Analysis: GranOO (Discrete Element Model and Simulation of Continuous Materials Behavior) Discrete Element Model and Simulation of Continuous Materials Behavior Wiley.
  5. [5]Benchmark 2023 ‘Benchmarktooks.jl’ URL https://juliaci.github.io/BenchmarkTools.jl/stable/ accessed: 17-03-2023.
  6. [6]Beeson P & B Ames 2015 ‘TRAC-IK: An open-source library for improved solving of generic inverse kinematics’ in 2015 IEEE-RAS 15th International Conference on Humanoid Robots (Humanoids) IEEE Press p. 928–935 doi:10.1109/HUMANOIDS.2015.7363472.DOI
  7. [7]Boyce W, R DiPrima, & D Meade 2017 Elementary Differential Equations and Boundary Value Problems Wiley.
  8. [8]Buss SR 2000 ‘Accurate and efficient simulation of rigid-body rotations’ Journal of Computational Physics 164:377–406 doi:10.1006/jcph.2000.6602.DOI
  9. [9]Chen CW, JS Kouh, & JF Tsai 2013 ‘Modeling and simulation of an AUV simulator with guidance system’ IEEE Journal of Oceanic Engineering 38(2):211–225 doi:10.1109/JOE.2012.2220236.DOI
  10. [10]Dosta M & V Skorych 2020 ‘MUSEN: An open-source framework for GPU-accelerated DEM simulations’ SoftwareX 12:100618 doi:10.1016/j.softx.2020.100618.DOI
  11. [11]Fincham D 1992 ‘Leapfrog rotational algorithms’ Molecular Simulation 8:165–178 doi: 10.1080/08927029208022474.DOI
  12. [12]Goldstein H 2002 Classical Mechanics Pearson Education.
  13. [13]Govender N, D Wilke, & S Kok 2016 ‘Blaze-DEMGPU: Modular high performance DEM framework for the GPU architecture’ SoftwareX 5:62–66 doi:10.1016/j.softx.2016.04.004.DOI
  14. [14]Grassia FS 1998 ‘Practical parameterization of rotations using the exponential map’ Journal of Graphics Tools 3:29–48 doi:10.1080/10867651.1998.10487493.DOI
  15. [15]Hamilton WR 1844 ‘LXXVIII. On quaternions; or on a new system of imaginaries in algebra’ The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science 25:489–495 doi:10.1080/14786444408645047.DOI
  16. [16]Hockney R & J Eastwood 1988 Computer Simulation Using Particles CRC Press doi: 10.1201/9780367806934.
  17. [17]Itasca Consulting Group I 2008 ‘(2008a) PFC3D — particle flow code in 3 dimensions, version 4.0, user’s manual.’ Minneapolis: Itasca.
  18. [18]Itasca Consulting Group I 2021 ‘(2021) PFC — particle flow code in 2 and 3 dimensions, version 7.0, documentation set of version 7.00.132’ Minneapolis: Itasca.
  19. [19]Jia YB 2017 ‘Quaternions: Com S 477/577 notes’ Technical report Iowa State University URL https://faculty.sites.iastate.edu/jia/files/inline-files/quaternion.pdf accessed: 17-03-2023.
  20. [20]Johnson MP 2003 Exploiting Quaternions to Support Expressive Interactive Character Motion Ph.D. thesis Massachusetts Institute of Technology.
  21. [21]Johnson SM, JR Williams, & BK Cook 2008 ‘Quaternion-based rigid body rotation integration algorithms for use in particle methods’ International Journal for Numerical Methods in Engineering 74:1303–1313 doi:10.1002/nme.2210.
  22. [22]Kloss C, C Goniva, A Hager, S Amberger, & S Pirker 2012 ‘Models, algorithms and validation for opensource DEM and CFD–DEM’ Progress in Computational Fluid Dynamics, an International Journal 12(2-3):140–152 doi:10.1504/PCFD.2012.047457.DOI
  23. [23]Kobilarov M, K Crane, & M Desbrun 2009 ‘Lie group integrators for animation and control of vehicles’ ACM Trans Graph 28 doi:10.1145/1516522.1516527.DOI
  24. [24]Kuipers J 1999 Quaternions and Rotation Sequences: A Primer with Applications to Orbits, Aerospace, and Virtual Reality Princeton paperbacks Princeton University Press.
  25. [25]Kutta W 1901 ‘Beitrag zur näherungsweisen integration totaler differentialgleichungen’ Zeit Math Phys 46:435–53.
  26. [26]Longuski JM & P Tsiotras 1993 ‘Analytical solutions for a spinning rigid body subject to time-varying body-fixed torques, Part I: Constant Axial Torque’ Journal of Applied Mechanics 60:970–975 doi:10.1115/1.2901010.DOI
  27. [27]Manchester ZR & MA Peck 2016 ‘Quaternion variational integrators for spacecraft dynamics’ Journal of Guidance, Control, and Dynamics 39:69–76 doi:10.2514/1.G001176.DOI
  28. [28]Neto N & L Bellucci 2006 ‘A new algorithm for rigid body molecular dynamics’ Chemical Physics 328:259–268 doi:10.1016/j.chemphys.2006.07.009.DOI
  29. [29]Omelyan IP 1998 ‘Algorithm for numerical integration of the rigid-body equations of motion’ Phys Rev E 58:1169–1172 doi:10.1103/PhysRevE.58.1169.DOI
  30. [30]Ostanin I, V Angelidakis, T Plath, S Pourandi, A Thornton, & T Weinhart 2023 ‘Rigid clumps in the MercuryDPM particle dynamics code’ .arxiv.org/abs/2310.05027
  31. [31]Pons A & F Cirak 2023 ‘Quaternion variational integration for inertial maneuvering in a bionimic unmanned aerial vehicle’ ASME Letters in Dynamic Systems and Control 3 doi:10.1115/1.4062685.DOI
  32. [32]Rackauckas C & Q Nie 2017 ‘Differentialequations.jl – a performant and feature-rich ecosystem for solving differential equations in Julia’ Journal of Open Research Software doi:10.5334/jors.151.DOI
  33. [33]Romano M 2008 ‘Exact analytic solution for the rotation of a rigid body having spherical ellipsoid of inertia and subjected to a constant torque’ Celestial Mechanics and Dynamical Astronomy 100:181–189 doi:10.1007/s10569-007-9112-7.DOI
  34. [34]Roots 2023 ‘Roots.jl’ URL https://juliamath.github.io/Roots.jl/dev/ accessed: 17-03-2023.
  35. [35]Rucker C 2018 ‘Integrating rotations using nonunit quaternions’ IEEE Robotics and Automation Letters 3:2979–2986 doi:10.1109/LRA.2018.2849557.DOI
  36. [36]Sabatini AM 2005 ‘Quaternion-based strap-down integration method for applications of inertial sensing to gait analysis’ Medical and Biological Engineering and Computing 43:94–101 doi:10.1007/BF02345128.DOI
  37. [37]Seelen LJH, JT Padding, & JAM Kuipers 2016 ‘Improved quaternion-based integration scheme for rigid body motion’ Acta Mechanica 227:3381–3389 doi:10.1007/s00707-016-1670-x.DOI
  38. [38]Shah S, D Dey, C Lovett, & A Kapoor 2018 ‘AirSim: High-fidelity visual and physical simulation for autonomous vehicles’ in M Hutter & R Siegwart (eds) Field and Service Robotics Cham: Springer International Publishing pp. 621–635.arxiv.org/abs/1705.05065
  39. [39]Shu CW & S Osher 1988 ‘Efficient implementation of essentially non-oscillatory shock-capturing schemes’ Journal of Computational Physics 77:439–471 doi:10.1016/0021-9991(88)90177-5.DOI
  40. [40]Smilauer V, V Angelidakis, E Catalano, R Caulk, B Chareyre, W Chèveremont, S Dorofeenko, J Duriez, N Dyck, J Elias, B Er, A Eulitz, A Gladky, N Guo, C Jakob, F Kneib, J Kozicki, D Marzougui, R Maurin, C Modenese, G Pekmezi, L Scholtès, L Sibille, J Stransky, T Sweijen, K Thoeni, & C Yuan 2021 Yade documentation The Yade Project doi:10.5281/zenodo.5705394.DOI
  41. [41]Su J, C Schroeder, & R Fedkiw 2009 ‘Energy stability and fracture for frame rate rigid body simulations’ in Proceedings of the 2009 ACM SIGGRAPH/Eurographics Symposium on Computer Animation New York, NY, USA: Association for Computing Machinery SCA ’09 p. 155–164 doi:10.1145/1599470.1599491.DOI
  42. [42]Syamal M, W Rogers, & TJ O’Brien 1993 ‘MFiX documentation theory guide’ Technical report USDOE Morgantown Energy Technology Center (METC), WV (United States)) doi:10.2172/10145548.
  43. [43]Tadano S, R Takeda, & H Miyagawa 2013 ‘Three dimensional gait analysis using wear-able acceleration and gyro sensors based on quaternion calculations’ Sensors 13:9321–9343 doi:10.3390/s130709321.DOI
  44. [44]Tayebi A & S McGilvray 2006 ‘Attitude stabilization of a VTOL quadrotor aircraft’ IEEE Transactions on Control Systems Technology 14:562–571 doi:10.1109/TCST.2006.872519.DOI
  45. [45]Thompson AP, HM Aktulga, R Berger, DS Bolintineanu, WM Brown, PS Crozier, PJ in ’t Veld, A Kohlmeyer, SG Moore, TD Nguyen, R Shan, MJ Stevens, J Tranchida, C Trott, & SJ Plimpton 2022 ‘LAMMPS - A flexible simulation tool for particle-based materials modeling at the atomic, meso, and continuum scales’ Computer Physics Communications 271:108171 doi:10.1016/j.cpc.2021.108171.DOI
  46. [46]Thornton C 2015 Granular Dynamics, Contact Mechanics and Particle System Simulations: A DEM study Particle Technology Series Springer International Publishing doi:10.1007/978-3-319-18711-2.DOI
  47. [47]Todorov E, T Erez, & Y Tassa 2012 ‘MuJoCo: A physics engine for model-based control’ in 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems pp. 5026–5033 doi:10.1109/IROS.2012.6386109.DOI
  48. [48]Tsiotras P & JM Longuski 1996 ‘Analytic solution of Euler’s equations of motion for an asymmetric rigid body’ Journal of Applied Mechanics 63:149–155 doi:10.1115/1.2787190.
  49. [49]unreal ‘Unity’ URL https://unity.com accessed: 28-07-2023.
  50. [50]unreal ‘Unreal engine’ URL https://www.unrealengine.com accessed: 28-07-2023.
  51. [51]Valenti RG, I Dryanovski, & J Xiao 2016 ‘A linear Kalman filter for MARG orientation estimation using the algebraic quaternion algorithm’ IEEE Transactions on Instrumentation and Measurement 65:467–481 doi:10.1109/TIM.2015.2498998.DOI
  52. [52]Verlet L 1967 ‘Computer ” experiments” on classical fluids. I. thermodynamical properties of Lennard-Jones molecules’ Phys Rev 159:98–103 doi:10.1103/PhysRev.159.98.DOI
  53. [53]vulkan 2023 ‘Vulkan’ URL https://www.vulkan.org/ accessed: 28-07-2023.
  54. [54]Weinhart T, L Orefice, M Post, MP van Schrojenstein Lantman, IF Denissen, DR Tunuguntla, J Tsang, H Cheng, MY Shaheen, H Shi, P Rapino, E Grannonio, N Losacco, J Barbosa, L Jing, JE Alvarez Naranjo, S Roy, WK den Otter, & AR Thornton 2020 ‘Fast, flexible particle simulations — an introduction to MercuryDPM’ Computer Physics Communications 249:107129 doi:10.1016/j.cpc.2019.107129.DOI
  55. [55]woodem 2023 ‘WooDEM’ URL https://woodem.eu/ accessed: 21-06-2023.
  56. [56]Wu Y, X Hu, D Hu, T Li, & J Lian 2005 ‘Strapdown inertial navigation system algorithms based on dual quaternions’ IEEE Transactions on Aerospace and Electronic Systems 41:110–132 doi:10.1109/TAES.2005.1413751.DOI
  57. [57]Zhao F & BGM van Wachem 2013 ‘A novel quaternion integration approach for describing the behaviour of non-spherical particles’ Acta Mechanica 224:3091–3109 doi: 10.1007/s00707-013-0914-2.DOI

Paper details

vlnc:W_tjevrjv5
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents