FloatingArrayDesign / MoorDyn

a lumped-mass mooring line model intended for coupling with floating structure codes
BSD 3-Clause "New" or "Revised" License
64 stars 37 forks source link

Prevent body drag coeffs from being negative #206

Closed AlexWKinley closed 2 months ago

AlexWKinley commented 2 months ago

fixes #205

I think this should be a sufficient change to address the issue of getting negative drag coefficients in certain orientations.

The new body test fails without this change because its z drag coefficient is negative, causing the body to fly off the infinity. With the fix the test passes normally. Once others are happy with this change, I'll fix the merge conflict.

RyanDavies19 commented 2 months ago

@AlexWKinley I have talked with Matt about this and I think there is a better approach. The translational and rotational drag coefficients should each be converted to a 3x3 matrix, and then multiplied by the orientation matrix and it's transform. This should yield a 3x3 drag matrix that then is multiplied by the velocity to give our drag force. We would do this for both the translational and rotational drag. coefficients, giving us an end result of a 6 DOF drag force vector:

F \\
=
0.5 * \rho_w * \\
OrMat\\
\begin{bmatrix}
CdA_x & 0 & 0 \\
0 & CdA_y & 0 \\
0 & 0 & CdA_z  \\
\end{bmatrix}
OrMat^T *\\
(\vec v_i  * \\
|\vec v_i |)

I'll put together a PR for this and have it up soon.