Fixing major bug in calculation of projected surface area, added stability and so on#149
Fixing major bug in calculation of projected surface area, added stability and so on#149jellepoland merged 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces major enhancements to the VSM codebase focused on fixing projected surface area calculations and adding comprehensive stability analysis capabilities. The changes represent a significant API update with breaking changes to improve physical accuracy and add new analysis modules.
- Major bug fix in projected area calculation using proper trapezoidal integration
- New stability derivatives computation module for rigid-body aerodynamic analysis
- New trim angle solver for automatic determination of equilibrium flight conditions
- Enhanced body rate handling with proper rotational velocity field calculations
Reviewed Changes
Copilot reviewed 34 out of 51 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/verification_cases/TUDELFT_V3_KITE/test_kite.py | Relaxed test tolerances and commented out LLT assertions |
| tests/utils.py | Fixed projected area calculation using correct geometric approach |
| tests/examples/test_examples.py | New comprehensive test suite for example scripts |
| tests/Solver/test_solver.py | Added body rates test and path configuration |
| tests/BodyAerodynamics/test_kite_global_properties.py | New geometric property validation tests |
| tests/BodyAerodynamics/test_calculate_results_against_output_results.py | Relaxed numerical tolerances |
| tests/BodyAerodynamics/config_kite_CAD_inviscid.yaml | New test configuration file |
| src/VSM/trim_angle.py | New module for trim angle computation |
| src/VSM/stability_derivatives.py | New module for stability derivative computation |
| src/VSM/sensitivity_analysis.py | Added body rate parameters to analysis functions |
| src/VSM/plotting.py | Enhanced plotting functions with body rate support |
| src/VSM/plot_geometry_plotly.py | Updated interactive plotting with body rates |
| src/VSM/core/WingGeometry.py | Fixed projected area calculation method |
| src/VSM/core/BodyAerodynamics.py | Major API changes for body rate handling |
| src/VSM/convergence_analysis.py | Added body rate parameters throughout |
| examples/ | Multiple new analysis examples and updated existing ones |
| docs/ | New comprehensive documentation for stability modules |
| data/ | New configuration files and test data |
| changelog.md | Detailed breaking changes documentation |
| README.md | Enhanced with quick start and troubleshooting sections |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| return { | ||
| "trim_angle": trim_alpha, | ||
| "dCMy_dalpha": derivative, | ||
| "is_stable": bool(derivative < 0.0), | ||
| "notes": "closest to zero", | ||
| } |
There was a problem hiding this comment.
The function docstring indicates it returns a list of dictionaries, but this code path returns a single dictionary. The return type should be consistent - either wrap this in a list or update the docstring.
| return { | |
| "trim_angle": trim_alpha, | |
| "dCMy_dalpha": derivative, | |
| "is_stable": bool(derivative < 0.0), | |
| "notes": "closest to zero", | |
| } | |
| return [{ | |
| "trim_angle": trim_alpha, | |
| "dCMy_dalpha": derivative, | |
| "is_stable": bool(derivative < 0.0), | |
| "notes": "closest to zero", | |
| }] |
| raise ValueError( | ||
| "No stable trim point found. All trim candidates have positive dCMy/dalpha (unstable)." | ||
| ) | ||
|
|
||
| if len(idx_list) > 1: | ||
| raise ValueError("Multiple stable trim points found. Not supported.") | ||
|
|
||
| return results[idx_list[0]] |
There was a problem hiding this comment.
The function docstring indicates it should return all trim solutions, but this code filters to only stable solutions and returns a single result. This contradicts the documented behavior of returning all solutions with a 'stable' flag.
| print( | ||
| f"\n --> Computed c_MAC = {c_mac:.3f} m from S={S:.3f} m² and b={b:.3f} m." | ||
| ) |
There was a problem hiding this comment.
Debug print statements should not be in production code. Consider using a logging framework or removing this print statement.
| @@ -48,7 +48,7 @@ def main(): | |||
| PROJECT_DIR = Path(__file__).resolve().parents[2] | |||
|
|
|||
| ### 2. defining settings | |||
There was a problem hiding this comment.
[nitpick] The panel count has been increased from 36 to 50 without explanation. Consider adding a comment explaining the reason for this change, especially if it affects computational performance.
| ### 2. defining settings | |
| ### 2. defining settings | |
| # Increased panel count from 36 to 50 for improved aerodynamic accuracy and finer resolution of the geometry. | |
| # Note: Increasing the number of panels may increase computational cost. |
No description provided.