diff --git a/rocketpy/rocket/parachute.py b/rocketpy/rocket/parachute.py index e27216e26..dbb98b493 100644 --- a/rocketpy/rocket/parachute.py +++ b/rocketpy/rocket/parachute.py @@ -209,7 +209,6 @@ def __init__( - 0.25975 * self.porosity**2 + 1.2626 * self.porosity**3 ) - alpha, beta = self.noise_corr self.noise_function = lambda: alpha * self.noise_signal[-1][ 1 diff --git a/rocketpy/simulation/flight.py b/rocketpy/simulation/flight.py index a38be7d93..9993ad58f 100644 --- a/rocketpy/simulation/flight.py +++ b/rocketpy/simulation/flight.py @@ -763,10 +763,12 @@ def __simulate(self, verbose): lambda self, parachute_cd_s=parachute.cd_s: setattr( self, "parachute_cd_s", parachute_cd_s ), - lambda self, parachute_radius=parachute.radius: setattr( + lambda self, + parachute_radius=parachute.radius: setattr( self, "parachute_radius", parachute_radius ), - lambda self, parachute_height=parachute.height: setattr( + lambda self, + parachute_height=parachute.height: setattr( self, "parachute_height", parachute_height ), lambda self, parachute_porosity=parachute.porosity: setattr( @@ -2003,7 +2005,6 @@ def u_dot_parachute(self, t, u, post_processing=False): # Get the mass of the rocket mp = self.rocket.dry_mass - # to = 1.2 # eta = 1 # Rdot = (6 * R * (1 - eta) / (1.2**6)) * ( @@ -2014,14 +2015,14 @@ def u_dot_parachute(self, t, u, post_processing=False): # tf = 8 * nominal diameter / velocity at line stretch # Calculate added mass - ma = ( - self.parachute_added_mass_coefficient - * rho - * (2 / 3) - * np.pi - * self.parachute_radius**2 - * self.parachute_height - ) + # ma = ( + # self.parachute_added_mass_coefficient + # * rho + # * (2 / 3) + # * np.pi + # * self.parachute_radius**2 + # * self.parachute_height + # ) # Calculate freestream speed freestream_x = vx - wind_velocity_x @@ -2029,6 +2030,43 @@ def u_dot_parachute(self, t, u, post_processing=False): freestream_z = vz free_stream_speed = (freestream_x**2 + freestream_y**2 + freestream_z**2) ** 0.5 + # Initialize parachute state parameters if necessary (wouldn't work for more than one parachute) + self.parachute_inflated_radius = getattr( + self, "parachute_inflated_radius", self.rocket.radius + ) + self.volume = getattr(self, "volume", 0) + + radius = self.parachute_radius + height = self.parachute_height + inflated_radius = self.parachute_inflated_radius + inflated_height = inflated_radius * height / radius + + # Calculate the surface area of the parachute + if radius > height: + e = math.sqrt(1 - (inflated_height**2) / (inflated_radius**2)) + surface_area = math.pi * inflated_radius**2 * (1 + (1 - e**2) / e * math.atanh(e)) + else: + e = math.sqrt(1 - (inflated_radius**2) / (inflated_height**2)) + surface_area = ( + math.pi * inflated_radius**2 * (1 + inflated_height / (e * inflated_radius) * math.asin(e)) + ) + + volume_flow = ( + rho + * freestream_z # considering parachute as vertical + * ( + (math.pi * inflated_radius**2) + - (self.parachute_porosity * surface_area) + ) + ) + self.volume += volume_flow # * time_step + self.inflated_radius = ((3 * self.volume * radius) / (4 * math.pi * height)) ** ( + 1 / 3 + ) + + # Dragged air mass + ma = self.volume * rho + # Determine drag force pseudo_drag = -0.5 * rho * self.parachute_cd_s * free_stream_speed # pseudo_drag = pseudo_drag - ka * rho * 4 * np.pi * (R**2) * Rdot