h1=60 #The heat transfer in the process in kJ
h2=-8 #The heat transfer in the process in kJ
h3=-34 #The heat transfer in the process in kJ
h4=6 #The heat transfer in the process in kJ
#Calculations
Q=h1+h2+h3+h4 #Net work transfer in a cycle in kJ
#Output
print'Net work transfer in a cycle is',round(Q,2),"KJ"
Q=-300 #Heat transfer in the system consisting of the gas in kJ
u=0 #Internal energy is constant
#Calculations
W=Q-u #Work done of the system in kJ
#Output
print'The work done of the system W = %3.0f kJ ',round(W,1),"KJ"
v1=1.5 #Initial volume of the process in m**3
v2=4.5 #Final volume of the process in m**3
Q=2000 #Amount of heat added in kJ
#Calculations
W=100*((3.5*math.log(v2/v1))+(3*(v2-v1))) #Amount of work done in kJ
U=Q-W #The change in internal energy in kJ
#Output
print'The change in internal energy is',round(U,2),"KJ"
h1=35 #Enthalpy of water entering the boiler in kJ/kg
h2=705 #Enthalpy of steam leaving the boiler in kJ/kg
C=0 #Change in kinetic energy is neglected
Z=0 #Change in potential energy is neglected
#Calculations
q=h2-h1 #The heat transfer per kg of steam in kJ/kg
#Output
print'The heat transfer per kg of steam is',round(q,1),"kJ/kg"
Q=-170 #Sum of all heat transfers per cycle in kJ
N=100 #Total number of cycles per min in cycles/min
Q1=0 #Heat developed in a-b process in kJ/min
Q2=21000 #Heat developed in b-c process in kJ/min
Q3=-2100 #Heat developed in c-d process in kJ/min
W1=2170 #Work done in the process a-b in kJ/min
W2=0 #Work done in the b-c process in kJ/min
E3=-36600 #Change in energy in the process in kJ/min
#Calculations
E1=Q1-W1 #Change in energy in process a-b in kJ/min
E2=Q2-W2 #Change in energy in b-c process in kJ/min
W3=Q3-E3 #Work done in the c-d process in kJ/min
Qt=Q*N #Total heat transfer per min in kJ/min
Q4=Qt-Q1-Q2-Q3 #Heat developed in the process d-a in kJ/min
Et=0 #Total change in energy of the cycle
E4=Et-E1-E2-E3 #Energy in the process d-a in kJ/min
W4=Q4-E4 #Work done in the d-a process in kJ/min
Wn=Qt/60.0 #Net rate of work output in kW
#Output
print'(a)Change in energy in a-b process is',round(E1,2),"kJ/min"
print'(b)Change in energy in b-c process is',round(E2,2),"kJ/min"
print'(c)Work done in the c-d process is',round(W3,2),"kJ/min"
print'(d)Heat developed in the process d-a is',round(Q4,2),"kJ/min"
print'(e)Energy in the process d-a is',round(E4,2),"kJ/min"
print'(f)Work done in the d-a process is',round(W4,2),"kJ/min"
print'(g)Net rate of work output is',round(Wn,2),"kW"
Q1=50 #Heat developed in the 1-2 process in kJ/kg
U1=20 #Change in energy in the 1-2 process in kJ/kg
Q2=-30 #Heat developed in the 2-3 process in kJ/kg
W2=-40 #Work done in the 2-3 process in kj/kg
U3=-30 #Change in energy in the 3-1 process in kJ/kg
Wt=30 #Net work done per kg of fluid in kJ/kg
m=0.1 #Mass of fluid in the cycle in kg
N=10 #Number of cycles per sec in cycles/sec
#Calculations
W1=Q1-U1 #Work done in the 1-2 process in kJ/kg
U2=Q2-W2 #Change in energy in the 2-3 process in kJ/kg
W3=Wt-W1-W2 #Work done in the 3-1 process in kJ/kg
Q3=W3+U3 #Heat developed in the process in kJ/kg
m1=m*N #mass flow rate per sec in kg/sec
P=Wt*m1 #Rate of power in kW
#Output
print'(a)Work done in the 1-2 process is',round(W1,1),"kJ/kg"
print'(b)Change in energy in the 2-3 process is',round(U2,1),"kJ/kg"
print'(c)Work done in the 3-1 process is',round(W3,1),"kJ/kg"
print'(d)Heat developed in the processis',round(Q3,1),"kJ/kg"
print'(e)mass flow rate per sec ',round(m1,1), "kg/sec "
print'(f)Rate of power is',round(P,2),"kW"
m=3.0 #Mass of substance in the system in kg
P1=500.0 #Initial pressure of the system in kPa
P2=100.0 #Final pressure of the system in kPa
V1=0.22 #Initial volume of the system in m**3
n=1.2 #Polytropic index
Q1=30.0 #Heat transfer for the another process
#Calculations
V2=V1*(P1/P2)**(1/1.2) #Final volume of the system in m**3
U=3.56*(P2*V2-P1*V1) #Total change in internal energy in kJ
W1=(P2*V2-P1*V1)/(1-n) #Work done for the 1-2 process in kJ
Q=U+W1 #Heat developed in the process in kJ
W2=Q1-U #Work done for the another process in kJ
#Output
print'(a)Total change in internal energy is',round(U,0), "kJ"
print'(b)Work done for the 1-2 process is',round(W1,2), "kJ"
print'(c)Heat developed in the process is',round(Q,0), "kJ"
print'(d)Work done for the another process is',round(W2,0), "kJ"
m=5 #Mass of the substance in the system in kg
P1=500 #Initial pressure of the system in kPa
P2=100 #Final pressure of the system in kPa
V1=0.22 #Initial volume of the system in m**3
n=1.2 #Polytropic index
#Calculations
V2=V1*(P1/P2)**(1/1.2) #Final volume of the system in m**3
U=3.5*(P2*V2-P1*V1) #Change in the internal energy of the system in kJ
W=(P1*V1-P2*V2)/(n-1) #Work developed in the process in kJ
Q=U+W #Heat transfer in the process in kJ
#Output
print'Total change in Internal Energy is',round(U,0),"KJ"
print'Non flow work in the process is',round(W,2),"KJ"
print'Heat transfer of the process is',round(Q,0),"KJ"
p1=170 #Initial pressure of the fluid in kPa
p2=400 #Final pressure of the fluid in kPa
v1=0.03 #Initial volume in m**3
v2=0.06 #Final volume in m**3
#Calculations
dU=3.15*((p2*v2)-(p1*v1)) #The change in internal energy of the fluid in kJ
#P=a+b*V #Given relation
A = array([[1,v1],
[1,v2]])
b = array([p1,p2])
X = solve(A, b)
W=(X[0]*(v2-v1))+(X[1]*((v2**2-v1**2)/2.0)) #The work done during the process in kJ
Q=U+W #The heat transfer in kJ
#Output
print'(a)The direction and magnitude of work is',round(W,2),"KJ"
print'(b)The direction and magnitude of heat transfer is',round(Q,2),"KJ"
E1=4000 #Enthalpy at entrance in kJ/Kg
E2=4100 #Enthalpy at exit in kJ/kg
V1=50 #Velocity at entrance in m/s
V2=20 #Velocity at exit in m/s
h1=50 #Height at the entrance
h2=10 #Height at the exit
m=1 #mass flow rate to the system in kJ/s
Q=200 #Heat transfer rate to the system in kJ/s
g=9.8 #Gravitational constant in m/s**2
#Calculations
P=m*(((V1**2-V2**2)/(2000.0))+(g*(h2-h1)/1000.0)+(E1-E2))+Q
print'Power capacity of the system ',round(P,0),"KW"
W=135 #Work done by the system in kJ/kg
V1=0.37 #Specific volume of fluid at inlet in m**3/kg
V2=0.62 #Specific volume of fluid at outlet in m**3/kg
P1=600 #Pressure at the inlet in kPa
P2=100 #Pressure at the outlet in kPa
C1=16 #Velocity at the inlet in m/s
C2=270 #Velocity at the outlet in m/s
Z1=32 #Inlet height from floor level in m
Z2=0 #Outlet height from floor level in m
q=-9 #Heat loss between inlet and discharge in kJ/kg
g=9.81 #Gravitational constant in m/s**2
#Calculations
U=((C2**2-C1**2)/2000.0)+(g*(Z2-Z1))/1000.0+(P2*V2-P1*V1)+W-q
#Output
print'Specific Internal Energy decreases by ',round(U,2),"kJ/kg"
m=5 #Rate of fluid flow in the system in kg/s
P1=620 #Pressure at the entrance in kPa
P2=130 #Pressure at the exit in kPa
C1=300 #Velocity at the entrance in m/s
C2=150 #Velocity at the exit in m/s
U1=2100 #Internal energy at the entrance in kJ/kg
U2=1500 #Internal energy at the exit in kJ/kg
V1=0.37 #Specific volume at entrance in m**3/kg
V2=1.2 #Specific volume at exit in m**3/kg
Q=-30 #Heat loss in the system during flow in kJ/kg
Z=0 #Change in potential energy is neglected in m
g=9.81 #Gravitational constant in m/s**2
#Calculations
W=((C1**2-C2**2)/(2*1000))+(g*Z)+(U1-U2)+(P1*V1-P2*V2)+Q
P=W*m#Power capacity of the system in kW
#Output
print'(a)Total work done in the system ',round(W,1),"kJ/kg"
print'(b)Power capacity of the system',round(P,1),"KW"
P1=100 #Pressure at Inlet in kPa
P2=500 #Pressure at Exit in kPa
V1=0.6 #Specific volume at Inlet in m**3/kg
V2=0.15 #Specific volume at Exit in m**3/kg
U1=50 #Specific internal energy at inlet in kJ/kg
U2=125 #Specific internal energy at Exit in kJ/kg
C1=8 #Velocity of air at Inlet in m/s
C2=4 #Velocity of air at Exit in m/s
m=5 #Mass flow rate of air in kg/s
Q=-45 #Heat rejected to cooling water in kW
Z=0 #Change in potential energy is neglected in m
g=9.81 #Gravitational constant in m/s**2
#Calculations
P=m*(((C1**2-C2**2)/(2*1000.0))+(g*Z)+(U1-U2)+(P1*V1-P2*V2))+Q
P1=-P
#Output
print'The power required to drive the compressor',round(-P1,2),"kW"
m1=5000 #Steam flow rate in kg/hr
Q1=-250 #Heat loss from the turbine insulation to surroundings in kj/min
C1=40 #Velocity of steam at entrance in m/s
h1=2500 #Enthalpy of the steam at entrance in kJ/kg
C2=90 #Velocity of the steam at the Exit in m/s
h2=2030 #Enthalpy of the steam at exit in kj/kg
Z=0 #Change in potential energy is neglected in m
g=9.81 #Gravitational constant in m/s**2
#Calculations
m=m1/3600.0 #Steam flow rate in kg/s
Q=Q1/60.0 #Heat loss from the turbine to the surroundings
P=m*(((C1**2-C2**2)/(2*1000))+(g*Z)+(h1-h2))+Q
#Output
print'The power developed by the turbine is',round(P,1),"KW"
c1=16 #Velocity of steam at entrance in m/s
c2=37 #Velocity of steam at exit in m/s
h1=2990 #Specific enthalpy of steam at entrance in kJ/kg
h2=2530 #Specific enthalpy of steam at exit in kJ/kg
Q=-25 #Heat lost to the surroundings in kJ/kg
m1=360000 #The steam flow rate in kg/hr
#Calculations
m=m1/3600.0 #The steam flow rate in kg/s
W=(c1**2-c2**2)/2000.0+(h1-h2)+Q #Total work done in the system in kJ/kg
P=m*W #Power developed by the turbine in kW
#Output
print'The work output from the turbine is',round(P,1),"kW "
print'NOTE: In the book there is Calculation mistake'
p1=720 #Pressure at the entrance in kPa
t1=850 #Temperature at the entrance in degree centigrade
c1=160 #Velocity of the gas at entrance in m/s
Q=0 #Insulation (adiabatic turbine)
P2=115 #Pressure at the exit in kPa
t2=450 #Temperature at the exit in degree centigrade
c2=250 #Velocity of the gas at exit in m/s
cp=1.04 #Specific heat of gas at constant pressure in kJ/kg-K
#Calculations
H=cp*(t1-t2) #Change in Enthalpy of the gas at entrance and exit in kJ/kg
W=((c1**2-c2**2)/(2*1000))+(H) #External work output of the turbine in kJ/kg
#Output
print'The external work output of the turbine is',round(W,0),"kJ/kg"
p=5000 #Power output of an adiabatic steam turbine in kW
p1=2000 #Pressure at the inlet in kPa
p2=0.15 #Pressure at the exit in bar
t1=400 #temperature at the inlet in degree centigrade
x=0.9 #Dryness at the exit
c1=50 #Velocity at the inlet in m/s
c2=180 #Velocity at the exit in m/s
z1=10 #Elevation at inlet in m
z2=6 #Elevation at exit in m
h1=3248.7 #Enthalpy at the inlet from the steam table corresponding to and 20 bar in kJ/kg
hf=226 #Enthalpy at exit at 0.15 bar from steam tables in kJ/kg
hfg=2373.2 #Enthalpy at exit at 0.15 bar from steam tables in kJ/kg
g=9.81 #Gravitational constant in m/s**2
#Calculations
h2=hf+(x*hfg) #Enthalpy at the exit in kJ/kg
W=(h1-h2)+((c1**2-c2**2)/(2*1000))+((g*(z1-z2))/1000.0)
m=p/W
#Output
print'(a)The work done per unit mass of the steam flowing through turbine is',round(W,1),"kJ/kg"
print'(b)The mass flow rate of the steam is',round(m,1),"kg/s"
p1=1000.0 #Pressure at the inlet in kPa
t1=750.0 #Temperature at the inlet in K
c1=200.0 #Velocity at the inlet in m/s
p2=125.0 #Pressure at the exit in kPa
c2=40.0 #Velocity at the exit in m/s
m1=1000.0 #Mass flow rate of air in kg/hr
cp=1.053 #Specific heat at constant pressure in kJ/kgK
k=1.375 #Adiabatic index
Q=0 #The turbine is adiabatic
#Calculations
m=m1/3600.0 #The mass flow rate of air in kg/s
P=p2/p1 #Ratio of the pressure
t2=t1*((p2/p1)**((k-1)/k)) #Temperature of air at exit in K
h=cp*(t2-t1) #Change in enthalpy of the system in kJ
p=m*(((c2**2-c1**2)/(2*1000))+h) #Power output of the turbine in kW
p1=-p #Power output of the turbine in kW
#Output
print'(a)Temperature of air at exit is',round(t2,2)," K "
print'(b)The power output of the turbine is',round(p1,1),"kW"
c1=7 #Velocity of air at entrance in m/s
c2=5 #Velocity of air at exit in m/s
p1=100 #Pressure at the entrance in kPa
p2=700 #Pressure at the exit in kPa
v1=0.95 #Specific volume at entrance in m**3/kg
v2=0.19 #Specific volume at exit in m**3/kg
u=90 # Change in internal energy of the air entering and leaving in kJ/kg
z=0 #Potential energy is neglected
Q=-58 #Heat rejected to the surroundings in kW
m=0.5 #The rate at which air flow in kg/s
g=9.81 #Gravitational constant in m/s**2
#Calculations
P=m*(((c1**2-c2**2)/(2000.0))+(p1*v1-p2*v2)-u)+(Q)
A=(v1*c2)/(v2*c1) #From continuity equation the ratio of areas
D=A**(1/2.0) #The ratio of inlet pipe diameter to the outlet pipe diameter
#Output
print'(a)The rate of work input to the air is ',round(P,2),"kW"
print'(b)The ratio of inlet pipe diameter to the outlet pipe diameter is ',round(D,2)
h1=3000 #Enthalpy of the fluid passing at inlet in kJ/kg
h2=2757 #Enthalpy of the fluid at the discharge in kJ/kg
c1=60 #Velocity of the fluid at inlet in m/s
A1=0.1 #Inlet area of the nozzle in m**2
v1=0.187 #Specific volume at inlet in m**3/kg
v2=0.498 #Specific volume at the outlet in m**3/kg
q=0 #Heat loss during the flow is negligable
z=0 #The nozzle is horizontal so change in PE is constant
w=0 #The work done is also negligable
#Calculations
c2=(2*1000*((h1-h2)+(c1**2/2000.0)))**(1/2.0) #Velocity at the exit in m/s
m=(A1*c1)/v1 #The mass flow rate in kg/s
A2=(m*v2)/c2 #Area at the exit of the nozzle in m**3
#Output
print'(a)The velocity at the exit is',round(c2,1),"m/s"
print'(b)The mass flow rateis',round(m,1),"kg/s"
print'(c)Area at the exit is',round(A2,3),"m**2"
h1=3000 #Specific enthalpy of steam at inlet in kJ/kg
h2=2762 #Specific enthalpy of steam at the outlet in kJ/kg
v1=0.187 #Specific volume of steam at inlet in m**3/kg
v2=0.498 #Specific volume of steam at the outlet in m**3/kg
A1=0.1 #Area at the inlet in m**2
q=0 #There is no heat loss
z=0 #The nozzle is horizontal ,so no change in PE
c1=60 #Velocity of the steam at the inlet in m/s
#Calculations
c2=((2*1000)*((h1-h2)+(c1**2/2000.0)))**(1/2.0) #Velocity of the steam at the outlet in m/s
m=(A1*c1)/v1 #Mass flow rate of steam in kg/s
A2=(m*v2)/c2 #Area at the nozzle exit in m**2
#Output
print'(a)Velocity of the steam at the outlet is ',round(c2,2), "m/s "
print'(b)Mass flow rate of steam is ',round(m,2),"kg/s "
print'(c)Area at the nozzle exit is',round(A2,3),"m**2"
c1=40 #Velocity of air at the inlet of nozzle in m/s
h=180 #The decrease in enthalpy in the nozzle in kJ/kg
w=0 #Since adiabatic
q=0 #Since adiabatic
z=0 #Since adiabatic
#Calculations
c2=((2*1000)*((h)+(c1**2/(2*1000))))**(1/2.0) #The exit velocity of air in m/s
#Output
print'The exit velocity of the air is',round(c2,1),"m/s"
#Input data
p1=100 #Pressure at the inlet of the compressor in kPa
p2=500 #Pressure at the outlet of the compressor in kPa
v1=3 #Volume of the air at the inlet of the compressor in m**3/kg
v2=0.8 #Volume of the air at the outlet of the compressor in m**3/kg
c1=25 #The velocity of air at the inlet of the compressor in m/s
c2=130 #The velocity of air at the outlet of the compressor in m/s
z=12 #The height of delivery connection above the inlet in m
g=9.81 #Gravitational constant in m/s**2
n=1.3 #Polytropic index
#Calculations
W=((n)*(p1*v1-p2*v2))/(n-1) #Workdone for open system polytropic process in kJ/kg
K=((c2**2-c1**2)/2000.0) #Change in kinetic energy of the system in kJ/kg
P=g*(z)/1000.0 #Change in potential energy of the system in kJ/kg
w=W-K-P #The shaft work of the compressor in kJ/kg
#Output
print'The Shaft work of the compressor ',round(w,1),"kj/kgIt is the power absorbing system"
if w<0:
print'It is the power absorbing system'
else:
print'It is not power absorbing system'
#Input data
m=10 #The rate of fluid compressed adiabatically in kg/s
p1=500 #Initial pressure of the process in kPa
p2=5000 #Final pressure of the process in kPa
v=0.001 #The specific volume of the fluid in m**3/kg
#Calculations
P=m*v*(p2-p1) #The power required in kW
#Output
print'The power required is',round(P,2),"kW"
#Input data
m=2.0 #Mass flow rate of air in kg/s
t1=20 #Initial temperature of the air in degree centigrade
P=-30 #The amount of power consumed in kW
c1=100 #The inlet velocity of air in m/s
c2=150 #The outlet velocity of air in m/s
R=0.287 #The gas constant for air in kJ/kg-K
g=1.4 #It is the adiabatic index
cp=1.005 #Specific heat at constant pressure in kJ/kg-K
q=0 #Heat developed as it is adiabatic condition
z=0 #The change in potential energy is neglected
#Calculations
h=(P/m)+((c2**2-c1**2)/(2*1000)) #The change in enthalpy of the system in kJ/kg
t=h/cp #The change in temperature of the system in degree centigrade
t2=t1-t #The exit air temperature in degree centigrade
#Output
print'The exit air temperature is is',round(t2,2),"C"
#Input data
m=0.6 #Mass flow rate of air in kg/s
W=40 #Power required to run the compressor in kW
p1=100 #Initial pressure at the inlet of the compressor in kPa
t1=30 #Initial temperature at the inlet of the compressor in degree centigrade
z=0 #Change in potential energy is neglected
c=0 #Change in kinetic energy is neglected
q=0.4 #Heat lost to the cooling water ,bearings and frictional effects is 40% of input
cp=1.005 #Specific heat at constant pressure in kJ/kg-K
#Calculations
Q=q*W #Net heat losses from the system in kW
H=W-Q #Change in total enthalpy of the system in kW
t2=(H/(m*cp))+t1 #The exit air temperature in degree centigrade
#Output
print'The exit air temperature is',round(t2,0),"C"
#Input data
m1=100 #Air flow rate in kg/hr
q1=600 #The heat generated by each person in kJ/hr
h1=85 #The enthalpy of air entering the room in kJ/kg
h2=60 #The enthalpy of air leaving the room in kJ/kg
Q1=0.2 #The heat added by each lamp in the room in kW
P1=0.2 #The power consumed by each fan in kW
#Calculations
q=(5*q1)/3600.0 #The heat generated by 5 persons in the room in kW
Q=3*Q1 #The heat added by three lamps in the room in kW
P=2*P1 #The power consumed by two fans in the room in kW
m=m1/3600.0 #Mass flow rate of air in kg/s
H=(q+Q+P)+(m*(h1-h2)) #Heat to be removed by the cooler in kW
#Output
print'The rate at which the heat is to be removed by cooler X is',round(H,1),"kJ/sec"
#Input data
p1=1000 #Pressure at the inlet of the system in kPa
p2=15 #Pressure at the outlet of the system in kPa
v1=0.206 #Specific volume at the inlet of the system in m**3/kg
v2=8.93 #Specific volume at the outlet of the system in m**3/kg
h1=2827 #Specific enthalpy at the inlet of the system in kJ/kg
h2=2341 #Specific enthalpy at the outlet of the system in kJ/kg
c1=20 #Velocity at the inlet of the system in m/s
c2=120 #Velocity at the outlet of the system in m/s
z1=3.2 #Elevation at the inlet of the system in m
z2=0.5 #Elevation at the outlet of the system in m
m=2.1 #The fluid flow rate in kg/s
W=750 #The work output of the device in kW
g=9.81 #Gravitational constant in m/s**2
#Calculations
Q=m*(((c2**2-c1**2)/(2*1000))+((g*(z2-z1)/(1000.0)))+(h2-h1))+W #The heat loss/gain by the system in kW
#Output
print'The Heat loss by the system is',round(Q,1),"kW"
#Input data
t1=15 #The inlet temperature of the air passing through the heat exchanger in degree centigrade
c1=30 #The inlet velocity of air in m/s
t2=800 #The outlet temperature of the air from heat exchanger in degree centigrade
c2=30 #The inlet velocity of air to the turbine in m/s
t3=650 #The outlet temperature of the air from the turbine in degree centigrade
c3=60 #The outlet velocity of the air from turbine in m/s
t4=500 #The temperature at the outlet of the nozzle in degree centigrade
m=2 #Air flow rate in kg/s
cp=1.005 #Specific heat at constant pressure in kJ/kgK
#Calculations
Qh=m*cp*(t2-t1) #Rate of heat transfer to the air in the heat exchanger in kJ/s
P=m*((cp*(t2-t3))+((c2**2-c3**2)/2000.0)) #Power output from the turbine in kW
c4=((2*1000)*(cp*(t3-t4))+c3**2)**(1/2.0) #Velocity of air at exit from nozzle in m/s
#Output
print'(a)Rate of heat transfer to the air in the heat exchanger is',round(Qh,1),"kJ/s"
print'(b)Power output from the turbine is',round(P,1),"kW"
print'(c)Velocity of air at exit from nozzle is',round(c4),"m/s"
#Input data
p1=400.0 #Initial pressure of the gas in a turbine in kPa
t1=573.0 #Initial temperature of the gas in a turbine in K
p2=100.0 #Final pressure of the gas in a turbine in kPa
V=2.5 #It is the ratio of final volume to the inlet volume
c2=50.0 #Velocity of the gas at exit in m/s
P=1000.0 #Power developed by the turbine in kW
cp=5.193 #Specific heat of the helium at constant pressure in kJ/kg K
G=8.314 #Gas constant in kNm/kgK
M=4.0 #Molecular weight of the helium
#Calculations
import math
R=G/M #Characteristic gas constant in kNm/kgK
v1=(R*t1)/p1 #Specific volume at the inlet in m**3/kg
v2=V*v1 #Specific volume at the outlet in m**3/kg
n=math.log(p2/p1)/math.log(v1/v2) #Polytropic index
t2=((t1)*((p2/p1)**((n-1)/n))) #Final temperature of the gas in a turbine in K
w=(n/(n-1))*(R*(t1))*(1-((p2*v2)/(p1*v1))) #Specific work in kJ/kg
K=c2**2/(2*1000) #Change in kinetic energy in kJ/kg
Ws=w-K #Work done by the shaft in kJ/kg
q=Ws+(cp*(t2-t1))+K #The heat transfer during the process in kJ/kg
m=P/Ws #Mass flow rate of gas required in kg/s
A2=(m*v2)/c2 #Exit area of the turbine in m**2
#Output
print'(a)The mass flow rate of the gas required is',round(m,3),"kg/s"
print'(b)The heat transfer during the process is',round(q,1), "kJ/kg"
print'(c)Exit area of the turbine is ',round(A2,3),"m**2"