1
0
Fork 0

YASim: Fix to the Prandtl/Glauert and Wavedrag features. Simplifies the model and resolves NaNs and sim crashes in supersonic flight

This commit is contained in:
Daniel Meissner 2019-10-16 20:31:28 +02:00
parent 73b7e94358
commit 315d38566e
3 changed files with 18 additions and 6 deletions

View file

@ -601,7 +601,12 @@ void FGFDM::parseWing(const XMLAttributes* a, const char* type, Airplane* airpla
const char* flowregime = a->getValue("flow");
if (!strcmp(flowregime,"TRANSONIC")) {
w->setFlowRegime(FLOW_TRANSONIC);
w->setCriticalMachNumber(attrf(a, "mcrit", 0.6f));
const float mcrit = attrf(a,"mcrit", 0.6f);
if ( (mcrit > 0.0f) && (mcrit <= 1.0f)) {
w->setCriticalMachNumber(mcrit);
} else {
SG_LOG(SG_FLIGHT, SG_ALERT, "YASim warning: invalid input for critical mach number. Defaulting to mcrit=0.6.");
}
}
} else {
w->setFlowRegime(FLOW_SUBSONIC);

View file

@ -182,12 +182,20 @@ void Surface::calcForce(const float* v, const float rho, float mach, float* out,
float pg_correction {1};
float wavedrag {0};
if (_flow == FLOW_TRANSONIC) {
if (mach < 0.8f) {
pg_correction = 1.0f/sqrt(1.0f-(mach*mach));
}
if ((mach >= 0.8f) && (mach < 1.2f)) {
pg_correction = Math::polynomial(pg_coefficients, mach);
}
if (mach >= 1.2f) {
pg_correction = 2.0f/(((mach*mach)-1.0f)*YASIM_PI);
}
out[2] *= pg_correction;
// Add mach dependent wave drag (Perkins and Hage)
if (mach > _Mcrit) {
wavedrag = 9.5f * Math::pow(mach-_Mcrit, 2.8f) + 0.00193f;
wavedrag = 9.5f * Math::pow((mach > 1.0f ? 1.0f : mach)-_Mcrit, 2.8f) + 0.00193f;
out[0] += wavedrag;
}
}

View file

@ -135,10 +135,9 @@ private:
float _alpha {0};
FlowRegime _flow{FLOW_SUBSONIC};
float _Mcrit {1.0f};
float _Mcrit {0.6f};
std::vector<float> pg_coefficients {1, -0.163f, 5.877f, -39.157f, 104.694f,
-111.838f, 46.749f, -5.313f};
std::vector<float> pg_coefficients {-1.7671f, 0.4495f, 10.3423f, -6.9237f};
SGPropertyNode* _fxN;
SGPropertyNode* _fyN;