Skip to content

Commit b72a606

Browse files
committed
ENH: Fixing parachute maximum radius limit
1 parent 1e635ae commit b72a606

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

rocketpy/simulation/flight.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,12 @@ def __check_overshootable_parachute_triggers(
14081408
"parachute_added_mass_coefficient",
14091409
added_mass_coefficient,
14101410
),
1411+
lambda self, initial_volume=parachute.initial_volume: setattr(
1412+
self,
1413+
"parachute_volume",
1414+
initial_volume,
1415+
),
1416+
lambda self: delattr(self, "__t0") if hasattr(self, "__t0") else None,
14111417
]
14121418
self.flight_phases.add_phase(
14131419
overshootable_node.t + parachute.lag,
@@ -2724,16 +2730,18 @@ def u_dot_parachute(self, t, u, post_processing=False):
27242730
free_stream_speed = (freestream_x**2 + freestream_y**2 + freestream_z**2) ** 0.5
27252731

27262732
# Initialize parachute geometrical parameters
2727-
inflated_radius = (
2733+
inflated_radius = min(self.parachute_radius, (
27282734
(3 * self.parachute_volume * self.parachute_radius)
27292735
/ (4 * math.pi * self.parachute_height)
2730-
) ** (1 / 3)
2736+
) ** (1 / 3))
27312737
inflated_height = (
27322738
inflated_radius * self.parachute_height / self.parachute_radius
27332739
)
27342740

27352741
# Calculate the surface area of the parachute
2736-
if self.parachute_radius > self.parachute_height:
2742+
if self.parachute_radius == self.parachute_height:
2743+
surface_area = math.pi * inflated_radius**2 * 4
2744+
elif self.parachute_radius > self.parachute_height:
27372745
e = math.sqrt(1 - (inflated_height**2) / (inflated_radius**2))
27382746
surface_area = (
27392747
math.pi * inflated_radius**2 * (1 + (1 - e**2) / e * math.atanh(e))
@@ -2761,7 +2769,8 @@ def u_dot_parachute(self, t, u, post_processing=False):
27612769
dt = t1 - self.__t0
27622770

27632771
# Integrating parachute volume
2764-
self.parachute_volume += volume_flow * dt
2772+
max_volume = (4 / 3) * math.pi * self.parachute_radius**2 * self.parachute_height
2773+
self.parachute_volume = min(self.parachute_volume + volume_flow * dt, max_volume)
27652774

27662775
# Dragged air mass
27672776
ma = self.parachute_volume * rho

0 commit comments

Comments
 (0)