Skip to content

Fixing major bug in calculation of projected surface area, added stability and so on#149

Merged
jellepoland merged 4 commits intomainfrom
develop
Oct 8, 2025
Merged

Fixing major bug in calculation of projected surface area, added stability and so on#149
jellepoland merged 4 commits intomainfrom
develop

Conversation

@jellepoland
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings October 8, 2025 14:27
@jellepoland jellepoland merged commit 0da2961 into main Oct 8, 2025
1 check failed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +156 to +161
return {
"trim_angle": trim_alpha,
"dCMy_dalpha": derivative,
"is_stable": bool(derivative < 0.0),
"notes": "closest to zero",
}
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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",
}]

Copilot uses AI. Check for mistakes.
Comment on lines +211 to +218
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]]
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +271 to +273
print(
f"\n --> Computed c_MAC = {c_mac:.3f} m from S={S:.3f} m² and b={b:.3f} m."
)
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug print statements should not be in production code. Consider using a logging framework or removing this print statement.

Copilot uses AI. Check for mistakes.
@@ -48,7 +48,7 @@ def main():
PROJECT_DIR = Path(__file__).resolve().parents[2]

### 2. defining settings
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
### 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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant