BUG: Fix hard-coded radius value for parachute added mass calculation#889
BUG: Fix hard-coded radius value for parachute added mass calculation#889
Conversation
|
@copilot remind to add the PR to the CHANGELOG file |
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Added the CHANGELOG entry in commit 314ca47. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #889 +/- ##
===========================================
+ Coverage 80.27% 81.08% +0.80%
===========================================
Files 104 107 +3
Lines 12769 13897 +1128
===========================================
+ Hits 10250 11268 +1018
- Misses 2519 2629 +110 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ArthurJWH
left a comment
There was a problem hiding this comment.
The PR seems reasonable and correct, although it will introduce breaking changes to current simulations that relies on the previously hard coded radius. If this PR proceeds, I would suggest first changing the add_parachute default radius value for consistency in rocket class.
@copilot please solve the backwards compatibility issue here. |
Updated |
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
24eb9a8 to
77903d8
Compare
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
601ba5d to
e41f227
Compare
Calculate radius from cd_s using a typical hemispherical parachute drag coefficient (1.4) when radius is not explicitly provided. This fixes drift distance calculations for smaller parachutes like drogues. Formula: R = sqrt(cd_s / (Cd * π)) Closes #860 Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Changed the default radius from 1.5 to None in the add_parachute method to match the Parachute class behavior. This ensures consistent automatic radius calculation from cd_s across both APIs. Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
…uce drag_coefficient parameter for radius estimation
3489a70 to
9c43855
Compare
|
@copilot please fix the pylint error by extracting a few definitions from the init method, just like this: Skip to content |
…n Parachute.__init__ Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Extracted noise initialization into a |
| if radius is None: | ||
| self.radius = np.sqrt(cd_s / (drag_coefficient * np.pi)) | ||
| else: | ||
| self.radius = radius |
There was a problem hiding this comment.
Maybe can be rewritten as self.radius = radius or np.sqrt(cd_s / (drag_coefficient * np.pi))
I am not sure if that reduces the number of statements
| canopy area), in [0, 1]. Affects only the added-mass scaling | ||
| during descent; it does not change `cd_s` (drag). The default | ||
| value of 0.0432 yields an `added_mass_coefficient` of | ||
| approximately 1.0. |
There was a problem hiding this comment.
Should we keep the "neutral behavior" description to keep it consistent with the description in Parachute class?
| - BUG: Fix hard-coded radius value for parachute added mass calculation [#889](https://github.com/RocketPy-Team/RocketPy/pull/889) | ||
| - DOC: Fix documentation build [#908](https://github.com/RocketPy-Team/RocketPy/pull/908) | ||
| - BUG: energy_data plot not working for 3 dof sims [[#906](https://github.com/RocketPy-Team/RocketPy/issues/906)] | ||
| - BUG: Fix parallel Monte Carlo simulation showing incorrect iteration count [#806](https://github.com/RocketPy-Team/RocketPy/pull/806) |
There was a problem hiding this comment.
Why is this showing as an addition in this PR?
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCHANGELOG.mdhas been updated (if relevant)Current behavior
Hard-coded
radius=1.5inParachute.__init__andRocket.add_parachutecauses incorrect added mass calculations for smaller parachutes. For drogue chutes (cd_s ≈ 1.0), the added mass was overestimated by ~31x, resulting in excessive drift distances.New behavior
Radius is now computed from
cd_swhen not explicitly provided:Using a
drag_coefficientof 1.4 by default (typical hemispherical parachute drag coefficient, per NASA SP-8066).Changes:
radiusparameter changed from1.5toNonein bothParachuteclass andRocket.add_parachutemethoddrag_coefficientparameter (default 1.4) to allow users to specify the canopy shape; radius is auto-calculated fromcd_sanddrag_coefficientwhen not explicitly provideddrag_coefficientvaluesfrom_dictto handle new defaults__init_noiseprivate method to resolve pylinttoo-many-statementswarning inParachute.__init__make formatpasses cleanly with no changesExample results:
Users can still explicitly set
radiusto override auto-calculation.Breaking change
Existing code providing explicit
radiusvalues is unaffected. Code relying on the implicit default will now get physically appropriate values based oncd_s.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.