Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
id: setup-python

- name: Install Python dependencies
run: pip install --upgrade build pytest
run: pip install --upgrade build pytest numpy scipy

- name: Install VTK
run: |
Expand Down
203 changes: 0 additions & 203 deletions docs/angles.svg

This file was deleted.

49 changes: 11 additions & 38 deletions docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,17 @@ The main difference between MoorDyn-C and MoorDyn-F is that MoorDyn-C uses quate
Orientation of 6 DOF objects:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Euler angles – MoorDyn-F
""""""""""""""""""""""""

In the following figure the 6DOF object orientation angles convention is depicted:

.. figure:: angles.svg
:alt: Angles criteria schematic view

The roll and yaw angles, :math:`\phi` and :math:`\psi`, follow the
right hand criteria, while the pitch angle, :math:`\theta`, follows the left
hand criteria.
This way the classic rotation matrices can be considered,

.. math::
\begin{alignat}{1}
R_x(\phi) &= \begin{bmatrix}
1 & 0 & 0 \\
0 & \cos \phi & -\sin \phi \\[3pt]
0 & \sin \phi & \cos \phi \\[3pt]
\end{bmatrix} \\[6pt]
R_y(\theta) &= \begin{bmatrix}
\cos \theta & 0 & \sin \theta \\[3pt]
0 & 1 & 0 \\[3pt]
-\sin \theta & 0 & \cos \theta \\
\end{bmatrix} \\[6pt]
R_z(\psi) &= \begin{bmatrix}
\cos \psi & -\sin \psi & 0 \\[3pt]
\sin \psi & \cos \psi & 0 \\[3pt]
0 & 0 & 1 \\
\end{bmatrix}
\end{alignat}


Quaternions – MoorDyn-C
"""""""""""""""""""""""

The latest MoorDyn-C internally uses quaternions to describe the location and orientation of 6 DOF objects. Externally MoorDyn-C behaves the same as MoorDyn-F, using Euler angles for both inputs and outputs. Quaternions are a common alternative to Euler angles for describing orientations of 3D objects.
Further description of quaternions can be found in PR #90 in the MoorDyn repository, put together by Alex Kinley of Kelson Marine: https://github.com/FloatingArrayDesign/MoorDyn/pull/90#issue-1777700494
MoorDyn-C, MoorDyn-F and `MoorPy <https://github.com/NREL/MoorPy>`_ share the
same Intrinsic Euler-XYZ (Tait-Bryan) angles criteria to compute orientations.
You can learn more about this on
`Hall M. Generalized Quasi-Static Mooring System Modeling with Analytic Jacobians. Energies. 2024; 17(13):3155. https://doi.org/10.3390/en17133155 <https://www.mdpi.com/1996-1073/17/13/3155>`_

However, while on MoorDyn-F this is handled by considering orientation
matrices, on MoorDyn-C quaternions are considered to describe the location and
orientation of 6 DOF objects.
Further description of quaternions can be found in PR #90 in the MoorDyn
repository, put together by Alex Kinley of Kelson Marine:
https://github.com/FloatingArrayDesign/MoorDyn/pull/90#issue-1777700494

References
----------
Expand Down
16 changes: 13 additions & 3 deletions source/Body.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,17 @@ class Body final : public io::IO, public SuperCFL
* @throw moordyn::invalid_value_error If the body is of type
* moordyn::Body::FREE
*/
void initializeUnfreeBody(vec6 r = vec6::Zero(), vec6 rd = vec6::Zero(), vec6 rdd = vec6::Zero());
void initializeUnfreeBody(vec6 r = vec6::Zero(),
vec6 rd = vec6::Zero(),
vec6 rdd = vec6::Zero());

/** @brief Get the last setted velocity for an unfree body
*
* For free bodies the behaviour is undetermined
*
* @return The velocity (6 dof)
*/
inline vec6 getUnfreeVel() const { return rd_ves; }

/** @brief Initialize the FREE point state
* @return The 6-dof position (first) and the 6-dof velocity (second)
Expand Down Expand Up @@ -349,11 +359,11 @@ class Body final : public io::IO, public SuperCFL
* boundary conditions (body kinematics) for the proceeding time steps
* @param r The input position
* @param rd The input velocity
* @param rdd The input velocity
* @param rdd The input acceleration
* @throw moordyn::invalid_value_error If the body is not of type
* moordyn::Body::COUPLED or moordyn::Body::FIXED
*/
void initiateStep(vec6 r_in, vec6 rd_in, vec6 rdd_in);
void initiateStep(vec6 r, vec6 rd, vec6 rdd);

/** @brief Sets the kinematics based on the position and velocity of the
* fairlead.
Expand Down
9 changes: 5 additions & 4 deletions source/Misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ EqualRealNos(const real a1, const real a2)
return std::abs(a1 - a2) <= fraction * tol;
}


inline vec3
inline vec3
canonicalEulerAngles(const quaternion& quat, int a0, int a1, int a2)
{
// From issue #163: https://github.com/FloatingArrayDesign/MoorDyn/issues/163
// From issue #163:
// https://github.com/FloatingArrayDesign/MoorDyn/issues/163
mat3 coeff = quat.normalized().toRotationMatrix();
vec3 res{};
using Index = int;
Expand Down Expand Up @@ -255,7 +255,8 @@ canonicalEulerAngles(const quaternion& quat, int a0, int a1, int a2)
inline vec3
Quat2Euler(const quaternion& q)
{
return canonicalEulerAngles(q, 0, 1, 2); // 0, 1, 2 correspond to axes leading to XYZ rotation
// 0, 1, 2 correspond to axes leading to XYZ rotation
return canonicalEulerAngles(q, 0, 1, 2);
}

inline quaternion
Expand Down
Loading