SolidMotor Class Usage

Here we explore different features of the SolidMotor class.

Let’s start by importing the rocketpy module.

[1]:
from rocketpy import *

If you are using Jupyter Notebooks, it is recommended to run the following line to make matplotlib plots which will be shown later interactive and higher quality.

[2]:
%matplotlib widget

Thrust Source

The thrust source is of most importance when analysing parameters such as out of rail velocity, thrust to weight ratio, apogee and many others. Let’s create a new motor called MOTOR and take a closer look at this funcionality.

Constant Thrust

When passing an int or float the thrust will be considered constant in time.

[3]:
MOTOR = SolidMotor(
    thrustSource=1500,
    burnOut=5.3,
    reshapeThrustCurve=False,
    grainNumber=6,
    grainSeparation=6 / 1000,
    grainOuterRadius=21.40 / 1000,
    grainInitialInnerRadius=9.65 / 1000,
    grainInitialHeight=120 / 1000,
    grainDensity=1707,
    nozzleRadius=21.642 / 1000,
    throatRadius=8 / 1000,
    interpolationMethod="linear",
)

Let’s call the info method to see what kind of information we get.

[4]:
MOTOR.info()

Motor Details
Total Burning Time: 5.3 s
Total Propellant Mass: 1.409 kg
Propellant Exhaust Velocity: 5643.542 m/s
Average Thrust: 1500.000 N
Maximum Thrust: 1500.0 N at 0.0 s after ignition.
Total Impulse: 7950.000 Ns

Plots

There is valuable information such as Propellant exhaust velocity and Total Impulse being also being displayed. In fact, there is another method called allInfo which outputs even more relevant physical quantities such as grain configuration. Let’s try that method also.

[5]:
MOTOR.allInfo()
Nozzle Details
Nozzle Radius: 0.021641999999999998 m
Nozzle Throat Radius: 0.008 m

Grain Details
Number of Grains: 6
Grain Spacing: 0.006 m
Grain Density: 1707 kg/m3
Grain Outer Radius: 0.0214 m
Grain Inner Radius: 0.00965 m
Grain Height: 0.12 m
Grain Volume: 0.000 m3
Grain Mass: 0.235 kg

Motor Details
Total Burning Time: 5.3 s
Total Propellant Mass: 1.409 kg
Propellant Exhaust Velocity: 5643.542 m/s
Average Thrust: 1500.000 N
Maximum Thrust: 1500.0 N at 0.0 s after ignition.
Total Impulse: 7950.000 Ns

Plots

Thrust From Static Firings (CSV Files)

Usually one has much more precise information about the motor and wishes to specify a directory containing a .csv file (the file shall contain no headers) which contains thrust (Newtons) as a function of time (seconds). That can be done as follows:

[6]:
MOTOR = SolidMotor(
    thrustSource=r"../../data/motors/keron/thrustCurve.csv",
    burnOut=5.274,
    reshapeThrustCurve=False,
    grainNumber=6,
    grainSeparation=6 / 1000,
    grainOuterRadius=21.40 / 1000,
    grainInitialInnerRadius=9.65 / 1000,
    grainInitialHeight=120 / 1000,
    grainDensity=1707,
    nozzleRadius=21.642 / 1000,
    throatRadius=8 / 1000,
    interpolationMethod="linear",
)
[13]:
MOTOR.info()

Motor Details
Total Burning Time: 10 s
Total Propellant Mass: 1.409 kg
Propellant Exhaust Velocity: 4259.277 m/s
Average Thrust: 600.000 N
Maximum Thrust: 2388.9401048267464 N at 2.8593098217671598 s after ignition.
Total Impulse: 6000.000 Ns

Plots

Eng Files Are Also Supported! (RASP)

Most rocket motors providers share the thrust curve from their motors using the RASP file format (.eng files). RocketPy can import such files as the thrust source. Furthermore, if you have a thrust curve in a .csvfile, RocketPy can also read your data and exported as a .eng file.

[ ]:
MOTOR = SolidMotor(
    thrustSource=r"../../data/motors/Cesaroni_7450M2505-P.eng",
    burnOut=3.0,
    grainNumber=6,
    grainSeparation=6 / 1000,
    grainOuterRadius=21.40 / 1000,
    grainInitialInnerRadius=9.65 / 1000,
    grainInitialHeight=120 / 1000,
    grainDensity=1707,
    nozzleRadius=21.642 / 1000,
    throatRadius=8 / 1000,
    interpolationMethod="linear",
)

One More Option…

There is also a fourth option where one specifies the thrust source parameter by passing a callable function like below.

[8]:
MOTOR = SolidMotor(
    thrustSource=lambda x: 1 / (x + 1),
    burnOut=5.274,
    reshapeThrustCurve=False,
    grainNumber=6,
    grainSeparation=6 / 1000,
    grainOuterRadius=21.40 / 1000,
    grainInitialInnerRadius=9.65 / 1000,
    grainInitialHeight=120 / 1000,
    grainDensity=1707,
    nozzleRadius=21.642 / 1000,
    throatRadius=8 / 1000,
    interpolationMethod="linear",
)
[9]:
MOTOR.allInfo()
Nozzle Details
Nozzle Radius: 0.021641999999999998 m
Nozzle Throat Radius: 0.008 m

Grain Details
Number of Grains: 6
Grain Spacing: 0.006 m
Grain Density: 1707 kg/m3
Grain Outer Radius: 0.0214 m
Grain Inner Radius: 0.00965 m
Grain Height: 0.12 m
Grain Volume: 0.000 m3
Grain Mass: 0.235 kg

Motor Details
Total Burning Time: 5.274 s
Total Propellant Mass: 1.409 kg
Propellant Exhaust Velocity: 1.304 m/s
Average Thrust: 0.348 N
Maximum Thrust: 1.0 N at 0.0 s after ignition.
Total Impulse: 1.837 Ns

Plots

Reshaping and interpolating the thrust curve

We know explore the reshape feature concerning the thrust curve and the interpolation method. Sometimes is useful to rescale a given curve to match new specifications when impulse and burn out time are expected to vary only slightly. That can be done how we know exemplify by setting the new burn out time in seconds to be ten and the new total impulse to be 6000 Ns.

[10]:
MOTOR = SolidMotor(
    thrustSource=r"../../data/motors/keron/thrustCurve.csv",
    burnOut=5.274,
    reshapeThrustCurve=[10, 6000],
    grainNumber=6,
    grainSeparation=6 / 1000,
    grainOuterRadius=21.40 / 1000,
    grainInitialInnerRadius=9.65 / 1000,
    grainInitialHeight=120 / 1000,
    grainDensity=1707,
    nozzleRadius=21.642 / 1000,
    throatRadius=8 / 1000,
    interpolationMethod="linear",
)

Pay close attention to the newly generated curve and be aware of the changes the rescale has produced regarding the physical quantities.

[11]:
MOTOR.info()

Motor Details
Total Burning Time: 10 s
Total Propellant Mass: 1.409 kg
Propellant Exhaust Velocity: 4259.277 m/s
Average Thrust: 600.000 N
Maximum Thrust: 2388.9401048267464 N at 2.8593098217671598 s after ignition.
Total Impulse: 6000.000 Ns

Plots
[12]:
MOTOR.allInfo()
Nozzle Details
Nozzle Radius: 0.021641999999999998 m
Nozzle Throat Radius: 0.008 m

Grain Details
Number of Grains: 6
Grain Spacing: 0.006 m
Grain Density: 1707 kg/m3
Grain Outer Radius: 0.0214 m
Grain Inner Radius: 0.00965 m
Grain Height: 0.12 m
Grain Volume: 0.000 m3
Grain Mass: 0.235 kg

Motor Details
Total Burning Time: 10 s
Total Propellant Mass: 1.409 kg
Propellant Exhaust Velocity: 4259.277 m/s
Average Thrust: 600.000 N
Maximum Thrust: 2388.9401048267464 N at 2.8593098217671598 s after ignition.
Total Impulse: 6000.000 Ns

Plots

Also one is able to specify a certain interpolation method. That can be done by simply changing the ‘interpolationMethod’ parameter to ‘spline’ , ‘akima’ or ‘linear’. Default is set to linear.

Key Assumptions and Grain Configurations

One might wonder how some parameters were calculated and what key assumptions were made. Regarding grain configuration one should pay close attention to the fact that only BATES grain configuration is supported.

Finally, another key physical assumption is that constant exhaust velocity is assumed to be the case at all times which is in fact equivalent to saying that specific impulse is constant.