Skip to content

Body negative local drag coefficients #205

@AlexWKinley

Description

@AlexWKinley

Strictly speaking, this is a bug that I encountered on our internal MoorDyn fork, which is somewhat out of date. I don't see anything in the latest public code that would address this, but I haven't directly tested this behavior with the latest branch of this repo.

When bodies are in certain orientations, the computed global drag coefficients can end up having negative values.

The code at fault is

MoorDyn/source/Body.cpp

Lines 496 to 501 in 99cd2b6

// Rotational DOFs drag coefficients are also defined on bodyCdA
vec6 cda;
cda(Eigen::seqN(0, 3)) = OrMat.transpose() * bodyCdA.head<3>();
cda(Eigen::seqN(3, 3)) = OrMat.transpose() * bodyCdA.tail<3>();
F6net +=
0.5 * env->rho_w * vi.cwiseProduct(vi.cwiseAbs()).cwiseProduct(cda);

An example of a case where this fails to work is when the body's pitch is -90 degrees. The rotation matrix in this case will be

[  0.0,  0.0, -1.0;
   0.0,  1.0,  0.0;
   1.0,  0.0,  0.0 ]

The cda variable will look like bodyCda * [1, 1, -1, 1, 1, -1]. Which leads to a negative drag coefficient in the z axis, which is a destabilizing force that is both not physical and will eventually cause the simulation to error out.

I'm making this issue because I'm not sure what the correct solution to this issue is. I think it's valid to just take the absolute value of the rotated drag coefficients, but I'll defer to others for how they want to address this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions