Skip to content

Commit

Permalink
Revert to use of cos^2 in LiftDrag plugin (#2273)
Browse files Browse the repository at this point in the history
The changes in #2189 have caused a regression for our upstream users.
This fix disables moment calculations by defaulting Cma to zero. It
should help mitigate some of the regression. There is also an [ongoing
discussion](#2189 (comment)) as to whether the cos term should be cos^2 or cos.


Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Co-authored-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
arjo129 and srmainwaring authored Jan 8, 2024
1 parent 4eb9484 commit 2bba478
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/systems/lift_drag/LiftDrag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,10 @@ void LiftDragPrivate::Update(EntityComponentManager &_ecm)
double sinSweepAngle = math::clamp(
spanwiseI.Dot(velI), minRatio, maxRatio);

// get cos from trig identity
double cosSweepAngle = sqrt(1.0 - sinSweepAngle * sinSweepAngle);
// The sweep adjustment depends on the velocity component normal to
// the wing leading edge which appears quadratically in the
// dynamic pressure, so scale by cos^2 .
double cos2SweepAngle = 1.0 - sinSweepAngle * sinSweepAngle;
double sweep = std::asin(sinSweepAngle);

// truncate sweep to within +/-90 deg
Expand Down Expand Up @@ -390,20 +392,20 @@ void LiftDragPrivate::Update(EntityComponentManager &_ecm)
{
cl = (this->cla * this->alphaStall +
this->claStall * (alpha - this->alphaStall)) *
cosSweepAngle;
cos2SweepAngle;
// make sure cl is still great than 0
cl = std::max(0.0, cl);
}
else if (alpha < -this->alphaStall)
{
cl = (-this->cla * this->alphaStall +
this->claStall * (alpha + this->alphaStall))
* cosSweepAngle;
* cos2SweepAngle;
// make sure cl is still less than 0
cl = std::min(0.0, cl);
}
else
cl = this->cla * alpha * cosSweepAngle;
cl = this->cla * alpha * cos2SweepAngle;

// modify cl per control joint value
if (controlJointPosition && !controlJointPosition->Data().empty())
Expand All @@ -421,16 +423,16 @@ void LiftDragPrivate::Update(EntityComponentManager &_ecm)
{
cd = (this->cda * this->alphaStall +
this->cdaStall * (alpha - this->alphaStall))
* cosSweepAngle;
* cos2SweepAngle;
}
else if (alpha < -this->alphaStall)
{
cd = (-this->cda * this->alphaStall +
this->cdaStall * (alpha + this->alphaStall))
* cosSweepAngle;
* cos2SweepAngle;
}
else
cd = (this->cda * alpha) * cosSweepAngle;
cd = (this->cda * alpha) * cos2SweepAngle;

// make sure drag is positive
cd = std::fabs(cd);
Expand All @@ -444,20 +446,20 @@ void LiftDragPrivate::Update(EntityComponentManager &_ecm)
{
cm = (this->cma * this->alphaStall +
this->cmaStall * (alpha - this->alphaStall))
* cosSweepAngle;
* cos2SweepAngle;
// make sure cm is still great than 0
cm = std::max(0.0, cm);
}
else if (alpha < -this->alphaStall)
{
cm = (-this->cma * this->alphaStall +
this->cmaStall * (alpha + this->alphaStall))
* cosSweepAngle;
* cos2SweepAngle;
// make sure cm is still less than 0
cm = std::min(0.0, cm);
}
else
cm = this->cma * alpha * cosSweepAngle;
cm = this->cma * alpha * cos2SweepAngle;

// Take into account the effect of control surface deflection angle to cm
if (controlJointPosition && !controlJointPosition->Data().empty())
Expand Down

0 comments on commit 2bba478

Please sign in to comment.