Liquid Motor#

Here we describe how to set a liquid motor using the rocketpy.motors.LiquidMotor class.

The LiquidMotor class was introduced in v1.0.0 of RocketPy, and therefore the number of possible errors can be higher than other classes of the library.

We encourage you to check the documentation of the class. In case you have any doubt, please contact us at rocketpy.org

[ ]:
from math import exp

from rocketpy.motors import CylindricalTank, Fluid, LiquidMotor
from rocketpy.motors.Tank import MassFlowRateBasedTank

Setting the fluids#

[ ]:
# help(Fluid)
[ ]:
oxidizer_liq = Fluid(name="N2O_l", density=1220, quality=1)
oxidizer_gas = Fluid(name="N2O_g", density=1.9277, quality=1)
fuel_liq = Fluid(name="ethanol_l", density=789, quality=1)
fuel_gas = Fluid(name="ethanol_g", density=1.59, quality=1)

Setting the tanks#

[ ]:
tanks_shape = CylindricalTank(0.1, 1, True)
[ ]:
tanks_shape.radius.plot(equal_axis=True)
tanks_shape.inverse_volume.plot()
[ ]:
oxidizer_tank = MassFlowRateBasedTank(
    name="oxidizer tank",
    geometry=tanks_shape,
    flux_time=5,
    initial_liquid_mass=32,
    initial_gas_mass=0.1,
    liquid_mass_flow_rate_in=0,
    liquid_mass_flow_rate_out=lambda t: 32 / 3 * exp(-0.25 * t),
    gas_mass_flow_rate_in=0,
    gas_mass_flow_rate_out=0,
    liquid=oxidizer_liq,
    gas=oxidizer_gas,
)

fuel_tank = MassFlowRateBasedTank(
    name="fuel tank",
    geometry=tanks_shape,
    flux_time=5,
    initial_liquid_mass=21,
    initial_gas_mass=0.01,
    liquid_mass_flow_rate_in=0,
    liquid_mass_flow_rate_out=lambda t: 21 / 3 * exp(-0.25 * t),
    gas_mass_flow_rate_in=0,
    gas_mass_flow_rate_out=lambda t: 0.01 / 3 * exp(-0.25 * t),
    liquid=fuel_liq,
    gas=fuel_gas,
)

Setting the motor#

Now we can finally create the motor.

You can use whatever you want as thrust curve. Usually, users input a .eng file, but many other formats are supported. Check the documentation for more information.

In this case, we are using a lambda function. This is a very simple way to create a curve and will work just fine for this example.

[ ]:
liquid_motor = LiquidMotor(
    thrust_source=lambda t: 4000 - 100 * t**2,
    center_of_dry_mass=0,
    dry_inertia=(0, 0, 0),
    nozzle_radius=0.15,
    dry_mass=0,
    burn_time=5,
)

liquid_motor.add_tank(tank=oxidizer_tank, position=0.6)
liquid_motor.add_tank(tank=fuel_tank, position=1.8)

After defining the motor, we can plot basic attributes using the info() method.

[ ]:
liquid_motor.info()

Other plots can also be done, in order to check if the motor is behaving as expected. For example:

  • Propellant mass

  • Mass flow rate

  • Motor center of mass

  • Inertial moment

  • Exhaust velocity

[ ]:
liquid_motor.propellant_mass.plot(0, 5)
liquid_motor.mass_flow_rate.plot(0, 5)
[ ]:
liquid_motor.center_of_mass.plot(0, 5)
[ ]:
liquid_motor.I_11.plot(0, 5)
[ ]:
liquid_motor.exhaust_velocity.plot(0, 5)