Python - Net Thrust of a Rocket Engine

by matt392 in Circuits > Software

62 Views, 1 Favorites, 0 Comments

Python - Net Thrust of a Rocket Engine

NetThrustRocket.jpg
RocketTestFire.png
NasaNetThrustGraphic.jpeg
FormulaNetThrustRocketEngine.png
print ("This program will calculate the net thrust of a rocket engine.")

import math

###  Formula for calculating the net thrust of a rocket engine:
#  NetThrustRocketEngine = ((ExhaustGasMassFlow / Time) * (ActualJetVelocityNozzleExit)) + ((FlowAreaNozzleExit)
# * (StaticPressureNozzleExit - AtmosphericPressure))
###########################################

# Enter the ExhaustGasMassFlow, Time, ActualJetVelocityNozzleExit, FlowAreaNozzleExit,
# StaticPressureNozzleExit, AtmosphericPressure

def SolveForNetThrustRocketEngine():
    print ("Solving for the net thrust of rocket engine.")

    # Enter the Exhaust Gas Mass Flow 
    ExhaustGasMassFlow = float(input("Enter the Exhaust Gas Mass Flow: ") )
    # Enter the Time 
    Time = float(input("Enter the Time: ") )
    # Enter the Actual Jet Velocity Nozzle Exit
    ActualJetVelocityNozzleExit = float(input("Enter the Actual Jet Velocity Nozzle Exit: ") )
    # Enter the Flow Area Nozzle Exit
    FlowAreaNozzleExit = float(input("Enter the Flow Area Nozzle Exit: ") )
    #  Enter the Static Pressure Nozzle Exit
    StaticPressureNozzleExit = float(input("Enter the Static Pressure Nozzle Exit: ") )
    #  Enter the Atmospheric Pressure
    AtmosphericPressure = float(input("Enter the Atmospheric Pressure: ") )
    
    # Calculate the fraction
    FractionCalculated = (ExhaustGasMassFlow/Time)
    print("The fraction is: ", FractionCalculated)
    # Calculate the difference in pressure
    DifferenceInPressure = (StaticPressureNozzleExit - AtmosphericPressure)
    print("The difference in pressure is: ", DifferenceInPressure)
    # Calculate the left side of the equation
    LeftSideOfEquation = (FractionCalculated * ActualJetVelocityNozzleExit)
    print("The left side of the equation is: ", LeftSideOfEquation)
    # Calculate the right side of the equation
    RightSideOfEquation = ActualJetVelocityNozzleExit * DifferenceInPressure
    print("The right side of the equation is: ", RightSideOfEquation)
    # Add both sides together to get net thrust
    NetThrustRocketEngine = LeftSideOfEquation + RightSideOfEquation
    print("The net thrust of a rocket engine is: ", NetThrustRocketEngine, " Newtons.")
        
ContinueCalculations = "y"

# Check to see if the user wants to continue to calculate the net thrust of a rocket engine
while (ContinueCalculations=="y"):
    SolveForNetThrustRocketEngine()
    ContinueCalculations = input("Would like to do another calculation for the net thrust of a rocket engine? (y/n): ")

print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")