Skip to content

ENH: Add the Coriolis Force to the Flight class #799

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

Open
wants to merge 48 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9fe3a37
wind factor bug corrected
kevin-alcaniz Mar 14, 2025
f6efa81
BUG: StochasticModel visualize attributes of a uniform distribution
kevin-alcaniz Mar 15, 2025
04337ab
variable names corrections
kevin-alcaniz Mar 15, 2025
7f551c2
Merge branch 'develop' into develop
kevin-alcaniz Mar 15, 2025
18f8323
Corrections requested by the pylint test
kevin-alcaniz Mar 15, 2025
72c63b4
Merge branch 'develop' of https://github.com/kevin-alcaniz/RocketPy i…
kevin-alcaniz Mar 15, 2025
a46de46
ENH: add multiplication for 2D functions in rocketpy.function
kevin-alcaniz Mar 16, 2025
7181360
ENH: StochasticAirBrakes class created
kevin-alcaniz Mar 16, 2025
e1549e0
ENH: set_air_brakes function created
kevin-alcaniz Mar 18, 2025
89a83a6
Merge pull request #1 from kevin-alcaniz/enh/set-air-brakes-function
kevin-alcaniz Mar 18, 2025
b14ce09
Merge pull request #2 from kevin-alcaniz/enh/multiply_2D_functions
kevin-alcaniz Mar 18, 2025
2d2a0e8
ENH: add StochasticAirBrake to rocketpy.stochastic_rocket
kevin-alcaniz Mar 18, 2025
b206647
BUG: StochasticAirBrake object input in _Controller
kevin-alcaniz Mar 18, 2025
f0ebdda
Merge pull request #3 from kevin-alcaniz/bug/stochastic-airbrake-in-c…
kevin-alcaniz Mar 18, 2025
e45ae76
ENH: add time_overshoot option to rocketpy.stochastic_flight
kevin-alcaniz Mar 18, 2025
7f082d2
DOC: StochasticAirBrakes related documentation added
kevin-alcaniz Mar 18, 2025
1c4c791
ENH: pylint recommendations done
kevin-alcaniz Mar 18, 2025
85e82e6
ENH: Reformatted files to pass Ruff linting checks
kevin-alcaniz Mar 18, 2025
0eead44
Merge pull request #4 from kevin-alcaniz/enh/ruff-modifications
kevin-alcaniz Mar 18, 2025
a52ad3e
ENH: Update rocketpy/stochastic/stochastic_rocket.py
kevin-alcaniz Mar 19, 2025
7c68241
ENH: more intuitive uniform distribution display in StochasticModel
kevin-alcaniz Mar 22, 2025
91f83c8
DOC: improve drag curve factor definition in StochasticAirBrakes
kevin-alcaniz Mar 23, 2025
95a69fa
ENH: Change assert statement to if
kevin-alcaniz Mar 23, 2025
63b4af1
Merge branch 'develop' into develop
MateusStano Mar 23, 2025
6a47504
Merge branch 'RocketPy-Team:develop' into develop
kevin-alcaniz Mar 23, 2025
ac958d6
DOC: better explanation of __mul__ function
kevin-alcaniz Mar 23, 2025
d51f15b
ENH: delete set_air_brakes function for simplicity
kevin-alcaniz Mar 23, 2025
8e66319
Merge branch 'enh/stochastic-airbrakes-feature' of https://github.com…
kevin-alcaniz Mar 23, 2025
da71bf0
Merge branch 'develop' of https://github.com/kevin-alcaniz/RocketPy i…
kevin-alcaniz Mar 23, 2025
6d8c9b5
Merge branch 'develop' into enh/stochastic-airbrakes-feature
kevin-alcaniz Mar 23, 2025
3ecfba7
Merge branch 'enh/stochastic-airbrakes-feature' of https://github.com…
kevin-alcaniz Mar 23, 2025
db61325
Merge branch 'develop' of https://github.com/kevin-alcaniz/RocketPy i…
kevin-alcaniz Mar 23, 2025
2f42a50
ENH: inertial foreces added to u_dot_generalized
kevin-alcaniz Mar 25, 2025
299decc
ENH: define Earth's angular velocity vector in Environment
kevin-alcaniz Mar 25, 2025
54aeab8
ENH: some corrections to the Flight class
kevin-alcaniz Mar 25, 2025
653f0a6
ENH: modifications in the Flight class
kevin-alcaniz Mar 25, 2025
a138746
DOC: improving Environment documentation
kevin-alcaniz Mar 25, 2025
41977ba
DOC: more improvements in the Environment class
kevin-alcaniz Mar 25, 2025
38cad32
ENH: format changes done
kevin-alcaniz Mar 31, 2025
3d48221
DOC: env.earth_rotation_vector improved
kevin-alcaniz Apr 4, 2025
057e7fe
ENH: Coriolis acceleration added to u_dot
kevin-alcaniz Apr 7, 2025
6a6cc77
BUG: print left
kevin-alcaniz Apr 7, 2025
79ed52f
ENH: ruff changes
kevin-alcaniz Apr 7, 2025
01d981b
ENH: CHANGELOG updated
kevin-alcaniz Apr 7, 2025
2f0b128
Merge branch 'enh/add-coriolis-force' of https://github.com/RocketPy-…
kevin-alcaniz Apr 7, 2025
a5ef20d
Merge branch 'develop' into enh/add-coriolis-force
kevin-alcaniz Apr 7, 2025
f6e14e6
Merge branch 'develop' into enh/add-coriolis-force
Gui-FernandesBR Apr 23, 2025
3247d46
Merge branch 'develop' into enh/add-coriolis-force
Gui-FernandesBR Apr 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Attention: The newest changes should be on top -->
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
- ENH: Create a rocketpy file to store flight simulations [#800](https://github.com/RocketPy-Team/RocketPy/pull/800)
- ENH: Support for the RSE file format has been added to the library [#798](https://github.com/RocketPy-Team/RocketPy/pull/798)
- ENH: Add the Coriolis Force to the Flight class [#799](https://github.com/RocketPy-Team/RocketPy/pull/799)
- ENH: Introduce Net Thrust with pressure corrections [#789](https://github.com/RocketPy-Team/RocketPy/pull/789)

### Changed
Expand Down
20 changes: 20 additions & 0 deletions rocketpy/environment/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ class Environment:
Number of ensemble members. Only defined when using Ensembles.
Environment.ensemble_member : int
Current selected ensemble member. Only defined when using Ensembles.
Environment.earth_rotation_vector : list[float]
Earth's angular velocity vector in the Flight Coordinate System.

Notes
-----
Expand Down Expand Up @@ -353,6 +355,7 @@ def __init__(
self.set_location(latitude, longitude)
self.__initialize_earth_geometry(datum)
self.__initialize_utm_coordinates()
self.__set_earth_rotation_vector()

# Set the gravity model
self.gravity = self.set_gravity_model(gravity)
Expand Down Expand Up @@ -584,6 +587,23 @@ def __reset_wind_direction_function(self):
self.wind_direction.set_outputs("Wind Direction (Deg True)")
self.wind_direction.set_title("Wind Direction Profile")

def __set_earth_rotation_vector(self):
"""Calculates and stores the Earth's angular velocity vector in the Flight
Coordinate System, which is essential for evaluating inertial forces.
"""
# Sidereal day
T = 86164.1 # seconds

# Earth's angular velocity magnitude
w_earth = 2 * np.pi / T

# Vector in the Flight Coordinate System
lat = np.radians(self.latitude)
w_local = [0, w_earth * np.cos(lat), w_earth * np.sin(lat)]

# Store the attribute
self.earth_rotation_vector = w_local

# Validators (used to verify an attribute is being set correctly.)

def __validate_dictionary(self, file, dictionary):
Expand Down
28 changes: 25 additions & 3 deletions rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,27 @@ def u_dot(self, t, u, post_processing=False): # pylint: disable=too-many-locals
ax, ay, az = K @ Vector(L)
az -= self.env.gravity.get_value_opt(z) # Include gravity

# Coriolis acceleration
_, w_earth_y, w_earth_z = self.env.earth_rotation_vector
ax -= 2 * (
-a23 * vy * w_earth_y
+ a22 * vz * w_earth_y
- a33 * vy * w_earth_z
+ a32 * vz * w_earth_z
)
ay -= 2 * (
a23 * vx * w_earth_y
- a21 * vz * w_earth_y
+ a33 * vx * w_earth_z
- a31 * vz * w_earth_z
)
az -= 2 * (
-a22 * vx * w_earth_y
+ a21 * vy * w_earth_y
- a32 * vx * w_earth_z
+ a31 * vy * w_earth_z
)

# Create u_dot
u_dot = [
vx,
Expand Down Expand Up @@ -1776,7 +1797,7 @@ def u_dot_generalized(self, t, u, post_processing=False): # pylint: disable=too
_, _, z, vx, vy, vz, e0, e1, e2, e3, omega1, omega2, omega3 = u

# Create necessary vectors
# r = Vector([x, y, z]) # CDM position vector
# r = Vector([x, y, z]) # CDM position vector
v = Vector([vx, vy, vz]) # CDM velocity vector
e = [e0, e1, e2, e3] # Euler parameters/quaternions
w = Vector([omega1, omega2, omega3]) # Angular velocity vector
Expand Down Expand Up @@ -1935,8 +1956,9 @@ def u_dot_generalized(self, t, u, post_processing=False): # pylint: disable=too
# Angular velocity derivative
w_dot = I_CM.inverse @ (T21 + (T20 ^ r_CM))

# Velocity vector derivative
v_dot = K @ (T20 / total_mass - (r_CM ^ w_dot))
# Velocity vector derivative + Coriolis acceleration
w_earth = Kt @ Vector(self.env.earth_rotation_vector)
v_dot = K @ (T20 / total_mass - (r_CM ^ w_dot)) - 2 * (w_earth ^ v)

# Euler parameters derivative
e_dot = [
Expand Down
Loading