Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Spherical Caps Included in Total Length #455

Merged
merged 9 commits into from
Nov 18, 2023

Conversation

MateusStano
Copy link
Member

@MateusStano MateusStano commented Nov 7, 2023

Pull request type

  • Code changes (bugfix, features)
  • Code maintenance (refactoring, formatting, tests)
  • ReadMe, Docs and GitHub updates
  • Other (please describe):

Checklist

  • Tests for the changes have been added (if needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest --runslow) have passed locally

Current behavior

When creating a cylindrical tank with spherical caps, the height argument only refers to the height of the tank, excluding the tank. This is counterintuitive and just forces the user to measure/calculate impractical stuff.

Also, this was not explicit in the documentation

New behavior

The height argument now refers to the entire tank, with or without spherical caps

Breaking change

  • Yes
  • No

Additional information

Seems there was also a bug with some geometries due to numerical errors in the calculations of the spherical caps, so really long tanks could not be defined. This was fixed by adding an abs to the calculation of the spherical caps geometry

@MateusStano MateusStano changed the title Enh/change spherical caps ENH: Spherical Caps Included in Total Length Nov 7, 2023
@MateusStano MateusStano changed the base branch from master to develop November 7, 2023 19:05
@MateusStano MateusStano self-assigned this Nov 7, 2023
@MateusStano MateusStano added Bug Something isn't working Motors Every propulsion related issue or PR labels Nov 7, 2023
@MateusStano MateusStano added this to the Release v1.X.0 milestone Nov 7, 2023
@Gui-FernandesBR
Copy link
Member

I understand your motivation and it is fair enough to me.

However, this PR technically introduces a breaking change since the add_spherical_caps is not a private method and you're adding a new mandatory argument to it. I recommend removing the new total_height argument. but it would also be possible to set this argument as optional.

Also, the code is considering that the caps will have a perfect sphere at the its both tips. If you give a blind search, it's almost impossible to find a perfect sphere format (https://www.google.com/search?q=cylindrical+tank&sca_esv=581032301&tbm=isch&source=lnms&sa=X&ved=2ahUKEwiw-9vHl7iCAxUpJrkGHYFKBBIQ_AUoAXoECAIQAw&biw=1358&bih=642&dpr=1). Usually it has a height different than the tank radius. Shall we start considering this phenome as well?

rocketpy/motors/tank_geometry.py Outdated Show resolved Hide resolved
rocketpy/motors/tank_geometry.py Outdated Show resolved Hide resolved
@MateusStano
Copy link
Member Author

@Gui-FernandesBR @phmbressan added the warning as we talked

Please give a re-review here

Copy link

codecov bot commented Nov 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (develop@c7c3e2a). Click here to learn what that means.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #455   +/-   ##
==========================================
  Coverage           ?   69.51%           
==========================================
  Files              ?       55           
  Lines              ?     8999           
  Branches           ?        0           
==========================================
  Hits               ?     6256           
  Misses             ?     2743           
  Partials           ?        0           
Flag Coverage Δ
unittests 69.51% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@phmbressan phmbressan left a comment

Choose a reason for hiding this comment

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

Good, this way the object creation seems much more intuitive. The docstrings are also much clearer.

rocketpy/motors/tank_geometry.py Outdated Show resolved Hide resolved
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

Nice problem solving, the code is clearer now, I'm comfortable with its final state.

rocketpy/motors/tank_geometry.py Outdated Show resolved Hide resolved
@MateusStano MateusStano merged commit d86ac97 into develop Nov 18, 2023
13 checks passed
@MateusStano MateusStano deleted the enh/change-spherical-caps branch November 18, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Motors Every propulsion related issue or PR
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants