# Free flight simulation in OpenVOGEL

One of the most recent features developed in the OpenVOGEL suit is the free flight simulation module. This module combines the unsteady aeroelastic solver (which provides air loads for a given flow field) with the numerical integration of the rigid body equations of motion (in 6 degrees of freedom). It resembles in some aspects the aeroelastic module, but here the flow field is directly manipulated from the outcome of the equations (in the aeroelastic module, the variation of the flow field is a consequence of the repositioning if the shedding edges).

## Coupling algorithm

The free flight simulation consists of an algorithm that couples the air loads and the motion. The air-loads are first computed using the instantaneous flow field at the beginning of each time step using the previous state. Based on these air loads, the motion is predicted (through numerical integration) for the next time step and the result is translated into a new flow field. The air loads are then recomputed in the new state and the motion is corrected in a cycle that is repeated until convergence is reached. Once the convergence criteria are met, the time is advanced by one step.

## Equations of motion

If we attempt to write the equations of motion of a rigid body in an inertial reference frame, the inertial properties of the body become time dependent. So to reduce the complexity of the equations, the motion can better be described from the point of view of the body itself (a non inertial reference frame), where the inertia tensor is an invariant. Additionally, to avoid having the kinetic moment being coupled to the momentum, it is convenient to take the reference point for the moments as the center of gravity. Finally, to avoid a complex coupling of the angular velocities in the angular momentum equations, it is much simpler to align the axes with the main axes of inertia.
With all this said, the equations of motion for the rigid aircraft model including the external forces and gravity field can be written as follows:
${\frac {^{R}d}{dt}}{\mathbf {G}}={\mathbf {F}}+m{\mathbf {g}}$
${\frac {^{R}d}{dt}}{\mathbf {H}}={\mathbf {M}}$
Note that we have used Tenembaum's notation, in which the superscript R at the left of the differential operator means that the derivatives are taken with respect to the inertial reference frame (for the sake of simplicity, the earth in our case).
To convert the derivatives to the non inertial reference frame A (the moving aircraft), we use the reference frame transformation formula:
${\frac {^{R}d}{dt}}{\mathbf {a}}={\frac {^{A}d}{dt}}{\mathbf {a}}+{\mathbf {\omega }}\times {\mathbf {a}}$
where ${\mathbf {a}}$ is a generic vector.
The equations turn now to be:
${\frac {^{A}d}{dt}}{\mathbf {v}}+{\mathbf {\omega }}\times {\mathbf {v}}={\frac {1}{m}}{\mathbf {F}}+{\mathbf {g}}$
$II.{\frac {^{A}d}{dt}}{\mathbf {\omega }}+{\mathbf {\omega }}\times II.{\mathbf {\omega }}={\mathbf {M}}$
Tenembaum would accurately write the angular velocity vector as ${^{R}}{\mathbf {\omega }}^{A}$, however, to simplify the notation (and because we only have two reference frames here) we simply write ${\mathbf {\omega }}$ to refer to the angular velocity of the aircraft with respect to the earth. The matrix $II$ is the tensor of inertia, which for us is an identity matrix with $I_{xx}$, $I_{yy}$ and $I_{zz}$ in the main diagonal and 0's anywhere else.
In order to use the equations for numerical computations, it is necessary to write them in scalar form and to leave the derivatives alone at the left side:
These six equations are not sufficient to describe the motion, since the gravity acceleration vector ${\mathbf {g}}$ also varies with time in the non inertial reference frame A. So we need to add the next three kinematic equations to the set:
${\frac {^{R}d}{dt}}{\mathbf {g}}={\mathbf {0}}\Rightarrow {\frac {^{A}d}{dt}}{\mathbf {g}}=-{\mathbf {\omega }}\times {\mathbf {g}}$
and thus, in scalar form:
Finally, if we want to output the position of the aircraft, then we need to integrate it in parallel also:
Note that this position will be relative to the aircraft reference coordinates, so to make it mean full, all points should be remapped to the global reference frame. The program does this when loading the results using the last orientation of the model.

### Numerical integration

All the equations derived above form an initial value problem with 12 variables that can be solved using an appropriate numerical integration algorithm. One would probably think of the Runge-Kutta methods as first option, however they are not a good option since they require evaluating the forces at an intermediate time step, creating a complex scheme in our case (the UVLM method is quite heavy to be called continuously). Therefore, probably the best option is to use some kind of predictor corrector method that uses a fixed time step.
The numerical algorithm programmed in OpenVOGEL follows an scheme from Preidikman. This scheme is self-starting. It starts with the Euler method, then it switches to two Adams-Bashford and Adams-Moulton steps of increasing grade, and from the fourth step on it uses the Hamming method only.
In the next frames, vector X is the array (or better said, the record) containing all independent variables of the equations, and vector DX is the array containing the associated derivatives.

#### Validation

Our VB.NET implementation of the algorithm has been validated for a simple 1-D harmonic oscillator. In such a system the force is a linear function of the position and the velocity:
$F_{x}=-K.P_{x}-C.v_{x}$
The analytic solution for the displacement considering only an initial velocity is:
$P_{x}(t)=e^{-\xi \omega t}v_{x}(0)sin(\omega _{d}t)$
where:
$\omega ={\sqrt {\frac {K}{M}}}$
$C_{c}=2{\sqrt {KM}}$
$\xi ={\frac {C}{C_{c}}}$
$\omega _{d}=\omega {\sqrt {1-\xi ^{2}}}$
The agreement of the numerical solution for this problem is excellent, as can be seen on the previous graphic. With 400 time steps and a time inteval of 0.025s, the simulation time was 10 seconds. Along the complete integration domain, the error could be maintained under 0.5%.

## Reference

* ↑ "Fundamentals of applied dynamics", Roberto A. Tenembaum
* ↑ "Introducción a la dinámica estructural", Julio Massa
* ↑ "Física I", Marcelo Alonso, Edward J. Finn