# Free Motion Model

In panMARE free motions of rigid bodies can be calculated based on Newton's law. Thereby, the body's motions are calculated in six degrees of freedom.

The governing equations, which this technique is based on, are presented below.

##### Theory

All forces and moments are calculated with respect to the center of gravity of the body. Two coordinate systems are introduced $$K\{O,i_x,i_y,i_z\}$$ and $$\hat{K}\{\hat{O},i_\xi,i_\eta,i_\zeta\}$$ with the origins $$O$$ and $$\hat{O}$$, respectively. Both systems are are right-handed trihedrons. System $$K$$ is the inertial frame, so not accelerated and system $$\hat{K}$$ is moved arbitrarily but fixed to the body. The orientation of the $$\xi$$, $$\eta$$, $$\zeta$$ axes is identical with the principal axes of the body. To give a unique description of the position of any point on the body, it is enough to know the translation, the rotation of the local system to the global system and the local coordinates. The rotation of $$\hat{K}$$ to $$K$$ is specified by the rotation matrix $$\mathbf{S}$$. For $$O=\hat{O}$$ the position vector of the Point $$P$$ can be described in coordinates $$\mathbf{x}'=(x' \; y' \; z')^T$$ of the $$\hat{K}$$-system as well as in coordinates $$\mathbf x =(x \; y \; z)^T$$ of the $$K$$-system. For the relation between $$\mathbf x$$ and $$\mathbf x'$$ it applies $\mathbf{x} = \mathbf{S} \cdot \mathbf{x}'$ Since $$\mathbf{S}$$ is an orthogonal matrix it follows: $\mathbf{x}'=\mathbf{S}^T \cdot \mathbf{x}$ To describe the position and orientation of the motion model, a generalized state vector is used: $\mathbf{q} = \begin{pmatrix} \vec{r} \\ \vec{\omega} \end{pmatrix}$

##### Hydrodynamic Mass Calculation

For the motion of a rigid body in a fluid of substantial density like water, there is a linear dependence of the fluid force $$\mathbf{F}$$ on the acceleration $$\ddot{\mathbf{r}}$$ respectively $$\dot{\mathbf{\omega}}'$$. $\mathbf{F} = \bar{\mathbf{F}} - \mathbf{m}_{\text{Hydro}}\ddot{\mathbf{r}}$ where $$\bar{\mathbf{F}}$$ does not depend on the acceleration. Subsequently, Newton's equation can be rewritten as $(\mathbf{m}_{\text{Body}} + \mathbf{m}_{\text{Hydro}})\ddot{\mathbf{r}} = \mathbf{F} + \mathbf{m}_{\text{Hydro}} \cdot \ddot{\mathbf{r}} = \bar{\mathbf{F}}$ where $$\mathbf{m}_{\text{Hydro}} \in \mathbb{R}^{6\times6}$$ is the added mass matrix. However, because $$\mathbf{m}_{\text{Hydro}}$$ is usually unknown, it is often tried to apply numerical integration schemes directly to $$\mathbf{F} = \mathbf{m} \cdot \ddot{\mathbf{r}}$$. As can be shown like in [23] , explicit Euler integration methods become unstable if the added mass exceeds the real mass of the body. For implicit integration schemes the iteration converges slowly (for small relaxation factors) or is not robust (for larger relaxation factors). A robust and economic method requires to determine an approximation of the added mass matrix $$\mathbf{m}_{\text{Hydro}}$$ so that the rewritten version of Newton's equation can be used. The hydrodynamic mass can be calculated on two ways.

###### Estimating mass from force and acceleration

Based on the formula for the hydrodynamic mass force/moment $$\mathbf{F}_{\text{Hydro}}$$ $\mathbf{F}_{\text{Hydro}}' = \mathbf{m}_{\text{Hydro}}' \cdot \mathbf{\ddot{r}}'$ Hence the hydrodynamic mass $$\mathbf{m}_{\text{Hydro}}'$$ is given by $\mathbf{m}_{\text{Hydro}}' = \mathbf{F}_{\text{Hydro}}' \cdot \mathbf{\ddot{r}}'^T \cdot \left( \mathbf{\ddot{r}}' \cdot \mathbf{\ddot{r}}'^T + \underbrace{\mathbf{I} \cdot 1\mathrm{e}{-6}}_{\text{Stabilit Term}} \right)^{-1}$

###### Estimating mass from body shape and time derivative

The other way requires the calculation of the potential time derivative. If it is activated, the hydrodynamic mass is calculated using the information of the discretized body shape. The right hand side of the system of equation of the potential time derivative is extended by 6 columns with the following boundary conditions: \begin{eqnarray*} \textbf{1:} && n_x\\ \textbf{2:} && n_y\\ \textbf{3:} && n_z\\ \textbf{4:} && (r \times n)_x\\ \textbf{5:} && (r \times n)_y\\ \textbf{6:} && (r \times n)_z\\ \end{eqnarray*}

##### Translation

For the translatory motion of the body's center of gravity Newtons 2nd law applies $\mathbf{F} = \mathbf{m} \ddot{\mathbf{r}}$ with the external force $$\mathbf{F}$$ acting on the center of gravity, the body mass $$m$$ and the absolute acceleration $$\ddot{\mathbf{r}}$$.

##### Rotation

Generally speaking, the time rate of change of the angular momentum $$\mathbf{L}$$ equals the external moment acting on the body. With the inertia tensor $$\mathbf{J}$$ and the angular velocity $$\mathbf{\omega}$$ the angular momentum $$\mathbf{L}$$ yields: $\mathbf{L} = \mathbf{J} \cdot \mathbf{\omega}$ and subsequently $\frac{d \mathbf{L}}{d t} = \frac{d (\mathbf{J} \cdot \mathbf{\omega})}{dt} = \mathbf{m}$ When writing this equation in local body-fixed coordinates with the local mass moment of inertia, the inertia tensor $$\hat{\mathbf{J}}'$$ is constant and the equation yields $\hat{\mathbf{J}}' \cdot \dot{\mathbf{\omega}}' + \mathbf{\omega}' \times (\hat{\mathbf{J}}' \cdot \mathbf{\omega}') = \mathbf{m}'$ with the local moment $$\mathbf{m}'$$ and the local angular velocity $$\mathbf{\omega}'$$. By writing out, one gets the so-called Euler equations: \begin{eqnarray*} &\hat{J}_{11}' \dot{\omega}_1' + (\hat{J}_{33}'-\hat{J}_{22}')\omega_2' \omega_3' = m_1'\\ &\hat{J}_{22}' \dot{\omega}_2' + (\hat{J}_{11}'-\hat{J}_{33}')\omega_3' \omega_1' = m_2'\\ &\hat{J}_{33}' \dot{\omega}_3' + (\hat{J}_{22}'-\hat{J}_{11}')\omega_1' \omega_2' = m_3' \end{eqnarray*}

##### Computation of the accelerations

Giving the local force/moment vector $$\mathbf{F}' \in \mathbb{R}^6$$ the local translational and angualar acceleration are calculated using the mass/inertia matrix $$\mathbf{m}' \in \mathbb{R}^{6\times6}$$: $\mathbf{m}' = \mathbf{m}_{\text{Body}}' + \mathbf{m}_{\text{Hydro}}' = \begin{pmatrix} \mathbf{I}_3 \cdot m_{\text{Body}} & \mathbf{0} \\ \mathbf{0} & \hat{\mathbf{J}}'_{\text{Body}} \end{pmatrix} + \mathbf{m}_{\text{Hydro}}'$ The local force/moment vector is given with the local force $$\vec{F}_{\text{total}}'$$, local moment $$\vec{M}_{\text{total}}'$$ and damping matrices $$\mathbf{D}$$: $\mathbf{F}' = \begin{pmatrix} \vec{F}_{\text{total}}' \\ \vec{M}' \end{pmatrix} = \begin{pmatrix} \vec{F}_{\text{total}}' \\ \vec{M}_{\text{total}}' \end{pmatrix} + \begin{pmatrix} \mathbf{0} \\ \vec{\omega}_{\text{total}}' \times \left( \hat{\mathbf{J}}' \cdot \vec{\omega}_{\text{total}}' \right) \end{pmatrix} + \dot{\mathbf{m}}_{\text{Body}} \cdot \dot{\mathbf{q}}'_{total}$ $+ \mathbf{D} \cdot \dot{\mathbf{q}}'_{total} + \mathbf{D}_{quadratic} \cdot \left( \left| \dot{\mathbf{q}}'_{total} \right| \otimes \dot{\mathbf{q}}'_{total} \right)$ Then, all non free dimensions are set to zero and the acceleration is given by $\mathbf{\ddot{q}}' = \mathbf{m}'^{-1} \cdot \mathbf{F}'$

##### Integration

One goal of the equations of motion ist the determination of the time-dependent position of the body. Its accelerations can be determined with Newtons law and the Euler equations. Velocities and positions follow from integrating the accelerations. The acceleration $$\ddot{\mathbf{r}}$$ is directly given by solving the equations above and induces a change of the velocity $$\dot{\mathbf{r}}$$: $\dot{\mathbf{r}}_{t + \Delta t} = \dot{\mathbf{r}}_{t} + \ddot{\mathbf{r}} \cdot \Delta t$ The translations are directly integrated from the velocity: $\vec{r}_{t + \Delta t} = \vec{r}_{t} + \dot{\vec{r}} \cdot \Delta t$ The rotations are integrated using quaternions formulation.