# A Nonlinear CFD/Multibody Incremental-Dynamic Model for A Constrained Mechanism
## 2 Materials and Methods
### General Problem-Solving Algorithm  
The dynamic equations of motion of the bodies were obtained based on the inertial, centrifugal/Coriolis, gravitational, and aerodynamic forces acting on the center of gravity (COG) of the bodies. Then, the equations of motion are discretized, as displayed in Figure 1. The method of multibody system dynamics was used to analyze the dynamics of constrained bodies, and ANSYS Fluent(r) software employed for the aerodynamic analysis.  
Once the dynamic equations are derived, they can be introduced in the general form presented by Equation (1) as follows:  
\[\mathbf{M}(\mathbf{y})\ddot{\mathbf{y}}+\mathbf{C}(\mathbf{y},\dot{\mathbf{y}} )+\mathbf{G}(\mathbf{y})=\mathbf{R} \tag{1}\]  
where \(\mathbf{y}\) is the vector of generalized coordinates corresponding to the number of system degrees of freedom; \(\mathbf{M}(\mathbf{y})\) is the symmetric, positive, and definite mass matrix; \(\mathbf{C}(\mathbf{y},\dot{\mathbf{y}})\) is the vector of generalized centrifugal and Coriolis forces; \(\mathbf{G}(\mathbf{y})\) is the vector of generalized gravitational forces; and \(\mathbf{R}\) is the vector of generalized aerodynamic forces. Therefore, the system dynamics can be represented by the generalized coordinates (\(\mathbf{y}\)), their first and second derivatives (\(\ddot{\mathbf{y}},\ddot{\mathbf{y}}\)), and the external forces (\(\mathbf{R}\)), which are equal to the aerodynamic  
Figure 1: The general algorithm of problem-solving.  
forces. The equations were discretized by the Euler method and represented by the generalized coordinates at times of \(t_{n}\) and \(t_{n+1}\), and the aerodynamic forces at time of \(t_{n}\). Then, the new system of equations was solved for the generalized coordinates at the new time step (\(\mathbf{y}_{n+1}\)) and represented as a function of generalized coordinates and forces at the previous time step (\(\mathbf{y}_{n}\), \(\mathbf{R}_{n}\)). At the initial moment (\(n=0\)), the spatial position, velocity of the system, and aerodynamic forces are known, i.e., the initial condition is determined. Therefore, by replacing the initial condition in the new system of equations, it is possible to compute the generalized coordinates at the new time-step incrementally. The process continued until the desired time level was achieved. The coding of this algorithm was written in the UDF of ANSYS Fluent(r).  
To represent Equation (1) at the time-step of \(n+1\) as a function of previous time-step (\(n\)), the forward finite-difference has been used, as follows:  
\[\dot{\mathbf{y}}_{n}=\frac{\mathbf{y}_{n+1}-\mathbf{y}_{n}}{\Delta t}+O( \Delta t) \tag{2}\]  
\[\ddot{\mathbf{y}}_{n}=\frac{\mathbf{y}_{n+2}-2\mathbf{y}_{n+1}+\mathbf{y}_{n }}{\Delta t^{2}}+O(\Delta t) \tag{3}\]  
where \(\Delta t\) is the time interval. A more precise numerical solution requires smaller time intervals. Since the initial condition includes the initial position and velocities, at the time of \(t=0\), i.e., \(n=0\) the values of \(\mathbf{y}_{0}\) and \(\dot{\mathbf{y}}_{0}\) are known. Therefore, the value of \(\mathbf{y}_{1}\) can be computed by Equation (2). Finally, the values of generalized coordinates in the new time step (\(\mathbf{y}_{2}\)) can be computed by replacing Equations (2) and (3) into Equation (1) and solving Equation (1) for \(\mathbf{y}_{2}\). Similarly, the entire trajectory of the motion can be calculated.  
Since the discretization was implemented for the coding process in ANSYS Fluent(r) software, and the outputs of this software in the UDF environment are velocities and not positions, the discretization was carried out for the velocities of generalized coordinates, as follows:  
\[\ddot{\mathbf{y}}_{n}=\frac{\dot{\mathbf{y}}_{n+1}-\dot{\mathbf{y}}_{n}}{ \Delta t}+O(\Delta t) \tag{4}\]  
Therefore, Equation (1) should be solved for \(\ddot{\mathbf{y}}_{n+1}\) as a function of \(\mathbf{y}_{n}\), \(\dot{\mathbf{y}}_{n}\), and \(\mathbf{R}_{n}\); and the same incremental procedure was applied.