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: Generic Surfaces and Generic Linear Surfaces #680

Open
wants to merge 71 commits into
base: develop
Choose a base branch
from

Conversation

MateusStano
Copy link
Member

@MateusStano MateusStano commented Sep 5, 2024

Pull request type

  • Code changes (bugfix, features)

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 tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Description

  • Added the GenericSurface class that takes in coefficients defined by either a function or a .csv

  • Added the LinearGenericSurface class that takes in coefficients derivatives and calculates the total coefficients assuming linearity

  • Changed all add_surfaces position arguments to be 3 dimensional

  • Improved Flight class structure to be indifferent to the type of AeroSurface

  • There is an example simulation in coeff_testing.ipynb of calisto using coefficients that were extracted directly from rocketpy's standard model (Barrowman's). It uses the .csvs that have been committed. These .csvs have a LOT of points, this is due to the shepard interpolation in the Function class, which makes the interpolated values used in the simulation extremely noisy. The files are this big for validation purposes. We should reduce them and create tests with them

Breaking change

  • Yes
  • No

Remaining Tasks

  • 1. Add a representation of GenericSurface in the Drawing.
  • 2. Create Plots and Prints classes for both GenericSurface and LinearGenericSurface
  • 3. Add sideslip and partial angle of attack to flight plots and/or prints
  • 4. Create a method in the Rocket class to define the coefficients of the entire rocket. The method should receive a GenericSurface or LinearGenericSurface and use its coefficients for simulation, overwriting any other added aerodynamic surface. The aerodynamic surfaces should still be used for the drawing though. The received generic surface should be positioned in the center of the dry mass of the rocket for the desired behavior
  • 5. Currently, we receive cL, cD, cQ, however, user's might prefer to input the coefficients relating to the body axes directly (cX, cY, cZ). This should be an optional parameter in the instantiation of the class.
  • 6. Pylint
  • 7. Tests
  • 8. Doc pages

It would be truly great to get some help on these minor tasks

Future Tasks

  1. Create an axisymmetric surface class that needs only cD, cL, either center of pressure or cm, and cl (roll moment coefficient)
  2. The Rocket class should have total coefficient attributes: cL, cQ, cD, cm, cn, cl. They should be included in Plots or Prints
  3. Add lateral stability analysis. The current center of pressure, static, and stability margins only works for axisymmetric configurations. GenericSurfaces and LinearGenericSurfaces are currently not included in those analysis.

Contributors

Special thanks to @kevin-alcaniz and Faraday Rocketry UPV for their contributions!!

@MateusStano MateusStano added Enhancement New feature or request, including adjustments in current codes Aerodynamics Any problem to be worked on top of RocketPy's Aerodynamic labels Sep 5, 2024
@MateusStano MateusStano requested a review from a team as a code owner September 5, 2024 18:03
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 56.57568% with 175 lines in your changes missing coverage. Please review.

Project coverage is 74.80%. Comparing base (dca3a84) to head (e9a8274).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/rocket/aero_surface/generic_surface.py 16.48% 76 Missing ⚠️
...etpy/rocket/aero_surface/linear_generic_surface.py 23.91% 35 Missing ⚠️
rocketpy/simulation/flight.py 69.23% 28 Missing ⚠️
rocketpy/prints/aero_surface_prints.py 30.00% 14 Missing ⚠️
rocketpy/environment/fetchers.py 0.00% 6 Missing ⚠️
rocketpy/rocket/rocket.py 86.48% 5 Missing ⚠️
rocketpy/environment/environment_analysis.py 0.00% 2 Missing ⚠️
rocketpy/plots/aero_surface_plots.py 66.66% 2 Missing ⚠️
rocketpy/rocket/aero_surface/nose_cone.py 60.00% 2 Missing ⚠️
rocketpy/sensitivity/sensitivity_model.py 0.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #680      +/-   ##
===========================================
- Coverage    75.40%   74.80%   -0.61%     
===========================================
  Files           96       98       +2     
  Lines        10832    11036     +204     
===========================================
+ Hits          8168     8255      +87     
- Misses        2664     2781     +117     

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

@Lucas-Prates
Copy link
Contributor

I get the following error from Scipy when trying to load the coefficients using a csv file with insufficient data. Maybe it's worth checking the number of rows on the csv?

image

Comment on lines +315 to +326
def _compute_from_coefficients(
self,
rho,
stream_speed,
alpha,
beta,
mach,
reynolds,
pitch_rate,
yaw_rate,
roll_rate,
):
Copy link
Contributor

@Lucas-Prates Lucas-Prates Sep 20, 2024

Choose a reason for hiding this comment

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

When I used all arguments as 0 (or null vectors/tuples, depending on the type) on the GenericSurfaces class, the function worked and returned 0 for all its return values. For this function here in LinearGenericSurfaces, I got a division by zero error.

@Lucas-Prates Lucas-Prates mentioned this pull request Sep 20, 2024
10 tasks
Comment on lines 358 to 365
dyn_pressure_area = 0.5 * rho * stream_speed**2 * self.reference_area
dyn_pressure_area_damping = (
dyn_pressure_area * self.reference_length / (2 * stream_speed)
)
dyn_pressure_area_length = dyn_pressure_area * self.reference_length
dyn_pressure_area_length_damping = (
dyn_pressure_area_length * self.reference_length / (2 * stream_speed)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dyn_pressure_area = 0.5 * rho * stream_speed**2 * self.reference_area
dyn_pressure_area_damping = (
dyn_pressure_area * self.reference_length / (2 * stream_speed)
)
dyn_pressure_area_length = dyn_pressure_area * self.reference_length
dyn_pressure_area_length_damping = (
dyn_pressure_area_length * self.reference_length / (2 * stream_speed)
)
dyn_pressure_area = 0.5 * rho * stream_speed**2 * self.reference_area
if stream_speed == 0:
dyn_pressure_area_length = 0
dyn_pressure_area_length_damping = 0
else:
dyn_pressure_area_damping = (
dyn_pressure_area * self.reference_length / (2 * stream_speed)
)
dyn_pressure_area_length = dyn_pressure_area * self.reference_length
dyn_pressure_area_length_damping = (
dyn_pressure_area_length * self.reference_length / (2 * stream_speed)
)

Possible division by 0. Since the numerator has stream_speed**2 and the denominator stream_speed, the limit is 0 when stream_speed goes to 0, so it could be a good idea to just set these variables to 0 when stream_speed is zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aerodynamics Any problem to be worked on top of RocketPy's Aerodynamic Enhancement New feature or request, including adjustments in current codes
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

5 participants