print ("This program will calculate the cross sectional area of a de Laval/convergent-divergent nozzle.")
import math
### Formula for calculating the cross sectional area of a de Laval/convergent-divergent nozzle:
# CrossSectionalArea = (ChangeOfCrossSectionalArea/( ((MachNumber**2)-1) * (ChangeOfVelocity/FlowVelocity) ) )
###########################################
# Enter the MachNumber, ChangeOfVelocity, FlowVelocity, ChangeOfCrossSectionalArea
def SolveForCrossSectionalAreaDeLaval():
print ("Solving for the cross sectional area.")
# Enter the Mach Number
MachNumber = float(input("Enter the Mach Number: ") )
# Enter the change of velocity
ChangeOfVelocity = float(input("Enter the change of velocity: ") )
# Enter the flow velocity
FlowVelocity = float(input("Enter the flow velocity: ") )
# Enter the change of cross sectional area
ChangeOfCrossSectionalArea = float(input("Enter the change of cross sectional area: ") )
# Calculate the Mach Number section
MachNumberSection = ((MachNumber**2) - 1)
print("The mach number section is: ", MachNumberSection)
# Calculate the velocity section
VelocitySection = (ChangeOfVelocity/FlowVelocity)
print("The velocity section is: ", VelocitySection)
# Calculate the bottom of the equation
BottomOfEquation = (MachNumberSection * VelocitySection)
print("The bottom of the equation is: ", BottomOfEquation)
# Divide the change of the cross sectional area with the bottom of the equation
CrossSectionalArea = ChangeOfCrossSectionalArea/BottomOfEquation
print("The cross sectional area is: ", CrossSectionalArea, " meters squared.")
ContinueCalculations = "y"
# Check to see if the user wants to continue to calculate the cross sectional area of a de Laval/convergent-divergent nozzle
while (ContinueCalculations=="y"):
SolveForCrossSectionalAreaDeLaval()
ContinueCalculations = input("Would like to do another calculation for the the cross sectional area of a de Laval/convergent-divergent nozzle? (y/n): ")
print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")