Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -43,6 +43,7 @@ Attention: The newest changes should be on top -->

### Fixed

- BUG: Zero Mass Flow Rate in Liquid Motors breaks Exhaust Velocity [#677](https://github.com/RocketPy-Team/RocketPy/pull/677)
- DOC: Fix documentation dependencies [#651](https://github.com/RocketPy-Team/RocketPy/pull/651)
- DOC: Fix documentation warnings [#645](https://github.com/RocketPy-Team/RocketPy/pull/645)
- BUG: Rotational EOMs Not Relative To CDM [#674](https://github.com/RocketPy-Team/RocketPy/pull/674)
Expand Down
10 changes: 5 additions & 5 deletions rocketpy/motors/liquid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@ def exhaust_velocity(self):
"""
times, thrusts = self.thrust.source[:, 0], self.thrust.source[:, 1]
mass_flow_rates = self.mass_flow_rate(times)
exhaust_velocity = np.zeros_like(mass_flow_rates)

# Compute exhaust velocity only for non-zero mass flow rates
valid_indices = mass_flow_rates != 0
valid_times = times[valid_indices]
valid_thrusts = thrusts[valid_indices]
valid_mass_flow_rates = mass_flow_rates[valid_indices]

ext_vel = -valid_thrusts / valid_mass_flow_rates
exhaust_velocity[valid_indices] = (
-thrusts[valid_indices] / mass_flow_rates[valid_indices]
)

return np.column_stack([valid_times, ext_vel])
return np.column_stack([times, exhaust_velocity])

@funcify_method("Time (s)", "Propellant Mass (kg)")
def propellant_mass(self):
Expand Down
3 changes: 2 additions & 1 deletion rocketpy/motors/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ def total_mass_flow_rate(self):
rate should not be greater than `total_mass_flow_rate`, otherwise the
grains mass flow rate will be negative, losing physical meaning.
"""
return -1 * self.thrust / self.exhaust_velocity
average_exhaust_velocity = self.total_impulse / self.propellant_initial_mass
return self.thrust / -average_exhaust_velocity

@property
@abstractmethod
Expand Down
Loading