aerodynamic_analysis: reactivate adapt polars to cruise Mach number
Feature Request
Adapt calculated polars to initial cruise Mach number
Summary
In UNICADO2.1 we had the feature, that the calculated polars are adapted to the given cruise Mach number in aircraft_exchange_file; this functionality should be reincluded in a way that the following polars are calculated:
- Ma = 0.2 / Alt = 0 m
- Ma = 0.5 / Alt = 3048 m
- Ma = 0.6 / Alt = 6096 m
- Ma = Ma_Cr - 0.2 / Alt = average_cruise_altitude
- Ma = Ma_Cr - 0.1 / Alt = average_cruise_altitude
- Ma = Ma_Cr - 0.05 / Alt = average_cruise_altitude
- Ma = Ma_Cr - 0.02 / Alt = average_cruise_altitude
- Ma = Ma_Cr / Alt = average_cruise_altitude
- Ma = Ma_Cr + 0.01 / Alt = average_cruise_altitude
- Ma = Ma_Cr + 0.05 / Alt = average_cruise_altitude
Why?
If doing a parameter_study with the initial_cruise_mach number in aircraft_exchange_file, the polars currently have to be adapted to the cruise_mach_number by the user to avoid that aerodynamic_analysis aborts. (cf. #95); this feature would be an automatization to get the module more robust in terms of changes
Acceptance Criteria
-
Stable adaption of aerodynamic_analysis polars to initial_cruise_mach number
Additional Notes
Here is the code as it was before:
if (!adaptMachDistribution) { numberOfFlightConditions = flightConditionNode.at("numberFlightConditions"); } else { /* Creation of Mach number range */ // Low Speed if (this->cruiseMach > 0.2) { lowSpeed_Mach.push_back(0.2); } if (this->cruiseMach > 0.5) { lowSpeed_Mach.push_back(0.5); } else if (this->cruiseMach > 0.3) { lowSpeed_Mach.push_back(0.3); } else {} for (size_t i(0); i < lowSpeed_Mach.size(); ++i) { machDistr.push_back(lowSpeed_Mach.at(i)); } // High Speed if (this->cruiseMach > 0.7) { highSpeed_Mach_Deltas.push_back(-0.2); } if (this->cruiseMach > 0.6) { highSpeed_Mach_Deltas.push_back(-0.1); } if (this->cruiseMach > 0.55) { highSpeed_Mach_Deltas.push_back(-0.05); } if (this->cruiseMach > 0.52) { highSpeed_Mach_Deltas.push_back(-0.02); } highSpeed_Mach_Deltas.push_back(0.); highSpeed_Mach_Deltas.push_back(0.01); if (!this->q3DMethod) highSpeed_Mach_Deltas.push_back(0.05); for (size_t i(0); i < highSpeed_Mach_Deltas.size(); ++i) { machDistr.push_back(this->cruiseMach + highSpeed_Mach_Deltas.at(i)); } numberOfFlightConditions = static_cast<int>(machDistr.size()); } for (int i = 0; i < numberOfFlightConditions; i++) { flightConditions.push_back(flightCondition()); string str_id = num2Str(i + 1); if (!adaptMachDistribution) { flightConditions.back().extrapolationMargin = flightConditionNode.at("FlightCondition@" + str_id).getDoubleAttrib("ExtrapolationMargin"); flightConditions.back().allowGridChange = flightConditionNode.at("FlightCondition@" + str_id).getBoolAttrib("AllowGridChange"); flightConditions.back().Mach = flightConditionNode.at("FlightCondition@" + str_id + "/Mach"); flightConditions.back().Altitude = convertUnit(FOOT, METER, static_cast<double>(flightConditionNode.at("FlightCondition@" + str_id + "/Altitude"))); } else { flightConditions.back().extrapolationMargin = flightConditionNode.at("PolarAttributes/ExtrapolationMargin"); flightConditions.back().allowGridChange = flightConditionNode.at("PolarAttributes/AllowGridChange"); flightConditions.back().Mach = machDistr.at(i); if (i == 0 && lowSpeed_Mach.size() > 0) flightConditions.back().Altitude = 0.; else if (i == 1 && lowSpeed_Mach.size() > 1 && this->designAltitude > 10000.) flightConditions.back().Altitude = convertUnit(FOOT, METER, 10000.); else if (i == 2 && this->designAltitude > 20000.) flightConditions.back().Altitude = convertUnit(FOOT, METER, 20000.); else flightConditions.back().Altitude = convertUnit(FOOT, METER, this->designAltitude); } if (flightConditions.back().Mach == this->cruiseMach) { this->cruiseMach_ID = i; } if (flightConditions.back().Mach < 0 || flightConditions.back().Mach > 0.951) { myRuntimeInfo->err << "Mach number out of range!" << endl; myRuntimeInfo->err << "Mach >= 0 & Mach <= 0.95 - Predefined Mach number: " << flightConditions.back().Mach << endl; exit(1); } if (flightConditions.back().Altitude < 0. || flightConditions.back().Altitude > 20000.) { myRuntimeInfo->err << "Altitude out of range!" << endl; myRuntimeInfo->err << "Altitude >= 0 m & Altitude <= 20000 m - Predefined altitude: " << flightConditions.back().Altitude << endl; exit(1); } }