1
0
Fork 0

Bug fix for JSBSim SF bug #115: P51D crashes when advance ratio goes through zero

This commit is contained in:
Bertrand Coconnier 2016-05-23 20:02:36 +02:00
parent 013770b3f8
commit adeb0241ae

View file

@ -50,7 +50,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGAerodynamics.cpp,v 1.58 2016/05/22 17:02:13 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGAerodynamics.cpp,v 1.59 2016/05/23 17:23:36 bcoconni Exp $");
IDENT(IdHdr,ID_AERODYNAMICS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -147,6 +147,13 @@ bool FGAerodynamics::Run(bool Holding)
unsigned int axis_ctr;
const double twovel=2*in.Vt;
// Calculate lift coefficient squared
// Make sure that aero/cl-squared is computed with the current qbar
if ( in.Qbar > 0) {
clsq = (vFw(eLift) + vFwAtCG(eLift))/ (in.Wingarea*in.Qbar);
clsq *= clsq;
}
RunPreFunctions();
// calculate some oft-used quantities for speed
@ -248,12 +255,6 @@ bool FGAerodynamics::Run(bool Holding)
exit(-1);
}
// Calculate lift coefficient squared
if ( in.Qbar > 0) {
clsq = (vFw(eLift) + vFwAtCG(eLift))/ (in.Wingarea*in.Qbar);
clsq *= clsq;
}
// Calculate lift Lift over Drag
if ( fabs(vFw(eDrag) + vFwAtCG(eDrag)) > 0.0)
lod = fabs( (vFw(eLift) + vFwAtCG(eLift))/ (vFw(eDrag) + vFwAtCG(eDrag)));