Commit 45a7369
ENH: Add multi-dimensional drag coefficient support (Cd as function of M, Re, α) (#875)
* Add grid interpolation support to Function class with from_grid() method
Co-authored-by: Gui-FernandesBR <[email protected]>
* Add multi-dimensional drag coefficient support to Flight class and integration tests
Co-authored-by: Gui-FernandesBR <[email protected]>
* Run ruff format on modified files
Co-authored-by: Gui-FernandesBR <[email protected]>
* MNt: refactoring get_drag_coefficient in flight.py
- MNT: velocity_body was not being used in get_drag_coefficient, removed it as an input
* MNT: refactoring in flight.py and lint corrections to function.py and test_multidim_drag.py
-MNT: removed unused velocity in body frame parameter requirement from all instances of get_drag_coefficient in flight.py
- MNT: corrected docstring for get_value_opt_grid in function.py
- MNT: shifted import of classes before the definition of functions in test_multidim_drag.py
* MNT: refactoring flight.py to remove unused parameters
* MNT: correction of docstring function.py
- MNT: rearranged the docstring of from_grid in function.py to match the expected output of doctest
* MNT: make format and lint corrections to function.py
- MNT: reran make format and lint on function.py to correct after previous changes to from_grid
* MNT: pylint adjustments for new methods in function.py
- MNT: disables pylint unused private member for get_value_opt_grid as it is called upon dynamically by from_grid
- MNT: disabled pylint too many statement for from_grid for now and added a to-do to refactor it into smaller methods/helper functions
- MNT: updated .pylintrc to record Re as good name
* MNt: make format after previous change to function.py
* MNT: removed Re where unused in test_multidim_drag.py
- MNT: Re variable was unused in test_3d_drag_with_varying_alpha thus replaced it
* TST: Add tests for shepard_fallback in test_function_grid.py (#879)
* Add tests for shepard_fallback in test_function_grid.py
Co-authored-by: aZira371 <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: aZira371 <[email protected]>
* TST: test_multidim_drag.py
- TST: Added integration-level check to verify the flight simulation actually uses alpha when evaluating multi dim drag coeff.
- TST: utilized pytest fixtures where possible.
* MNT: addition of is_multidimensional to function.py
- MNT: Function.is_multidimensional property in function.py. It returns True when the function's internal domain dimension is greater than 1 and safely returns False on errors.
- MNT: Replaced the ad-hoc hasattr/len check in flight.py with a clearer check:
if isinstance and drag_function.is_multidimensional
* MNT: Added validation in from_grid in function.py to raise a ValueError when an unsupported extrapolation value is provided.
* ENH: Added alpha-sensitive flight fixtures to flight_fixtures.py
ENH: Used shared flight fixtures and simplify multi-drag integration tests in test_multidim_drag.py
ENH: Exposes multidimensionality and validated grid extrapolation in function.py
* MNT: renamed linear_grid to regular_grid for easy to understand nomenclature
- MNT: added a fallback to reynolds calculation in flight.py to avoid mu is zero case
- MNT: updated test_shepard_fallback_warning name and docstring to match implementation in test_function_grid.py
* MNT: replaced the broad except Exception: with except (TypeError, ValueError, OverflowError): in get_drag_coefficient of flight.py
* TST: added from_grid unit tests to cover constructor-level validation and the explicit API.
* MNT: format and lint update to test_function_from_grid.py
* DOC: changelog.md update for multidim drag
* Address review feedback: add unsorted axis warning, flatten_for_compatibility parameter, and early return guard clause
Co-authored-by: aZira371 <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Gui-FernandesBR <[email protected]>
Co-authored-by: Ishan <[email protected]>
Co-authored-by: Ishan <[email protected]>1 parent 607af52 commit 45a7369
File tree
9 files changed
+1179
-28
lines changed- rocketpy
- mathutils
- rocket
- simulation
- tests
- fixtures/flight
- integration
- unit/mathutils
9 files changed
+1179
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| 232 | + | |
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
358 | 366 | | |
359 | 367 | | |
360 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
1394 | 1478 | | |
1395 | 1479 | | |
1396 | 1480 | | |
| |||
1427 | 1511 | | |
1428 | 1512 | | |
1429 | 1513 | | |
1430 | | - | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1431 | 1540 | | |
1432 | 1541 | | |
1433 | 1542 | | |
| |||
1597 | 1706 | | |
1598 | 1707 | | |
1599 | 1708 | | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
1600 | 1725 | | |
1601 | 1726 | | |
1602 | 1727 | | |
1603 | | - | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
1604 | 1734 | | |
1605 | | - | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1606 | 1741 | | |
1607 | 1742 | | |
1608 | 1743 | | |
| |||
1624 | 1759 | | |
1625 | 1760 | | |
1626 | 1761 | | |
1627 | | - | |
1628 | | - | |
1629 | | - | |
1630 | | - | |
1631 | 1762 | | |
1632 | 1763 | | |
1633 | 1764 | | |
| |||
1992 | 2123 | | |
1993 | 2124 | | |
1994 | 2125 | | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
1995 | 2132 | | |
1996 | 2133 | | |
1997 | 2134 | | |
1998 | 2135 | | |
1999 | 2136 | | |
2000 | 2137 | | |
2001 | 2138 | | |
2002 | | - | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
2003 | 2145 | | |
2004 | 2146 | | |
2005 | | - | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
2006 | 2153 | | |
2007 | 2154 | | |
2008 | 2155 | | |
| |||
2020 | 2167 | | |
2021 | 2168 | | |
2022 | 2169 | | |
2023 | | - | |
2024 | | - | |
2025 | 2170 | | |
2026 | 2171 | | |
2027 | 2172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | | - | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
0 commit comments