# Chapter 3 : The First Law of Thermodynamics¶

## Example 3.1 Page No : 91¶

In [1]:
#For a constant volume process, 10 Btu/lbm heat is added to the system
#We can consider thet a math.tank having a fixed volume has heat added to it
#Under these conditions,the mechanical work done on or by the system must be 0
#u2-u1 = q
print "Heat has been converted to internal energy of the working fluid";
#So,
print " So,Change in internal energy u2-u1 = 10 Btu/Lbm"

Heat has been converted to internal energy of the working fluid
So,Change in internal energy u2-u1 = 10 Btu/Lbm


## Example 3.4 Page No : 91¶

In [2]:
print "Solution For a";
m = 10; 			#Unit:lbm 			#mass of water
#delataU = U2-U1
Heat = 100.; 			#Unit:Btu 			#heat added
deltaU = Heat/m; 			#Change in internal energy  			#unit:Btu/lbm
print "Change in internal energy per pound of water is %.2f Btu/lbm"%(deltaU);

print "Solution For b";
print "In this process,energy crosses the boundary of the system by means of fractional work"
print "The contents of the math.tank will not distinguish between the energy if it is added as\
heat or the energy added as fraction work";

Solution For a
Change in internal energy per pound of water is 10.00 Btu/lbm
Solution For b
In this process,energy crosses the boundary of the system by means of fractional work
The contents of the math.tank will not distinguish between the energy if it is added as heat or the energy added as fraction work


## Example 3.5 Page No : 96¶

In [3]:
# Given value
P1 = 100 			#Unit:psia 			#Pressure at the entrance to a steady-flow device
Rho1 = 62.4 			#Unit:lbm/ft**3 			#the density of the fluid
A1V1 = 10000 			#Unit:ft**3/min 			#Entering fluid
A2 = 2 			#Unit:ft**2 			#Exit area

# Calculations and Results
m = Rho1*A1V1; 			#Unit:lbm/min 			#mass rate of flow per unit time
print "Mass flow rate is %.2f LBm/min"%(m);

Rho2 = Rho1; 			#Unit:lbm/ft**3 			#the density of the fluid
#m = Rho2*A2*V2
#So,
V2 = m/(Rho2*A2); 			#velocity at exit 			#Unit:ft/min
print "The exit velocity is %.2f ft/min"%(V2);

Mass flow rate is 624000.00 LBm/min
The exit velocity is 5000.00 ft/min


## Example 3.6 Page No : 97¶

In [4]:
# Given value
Rho1 = 1000. 			#Unit:kg/m**3 			#the density of the fluid at entrance
A1V1 = 2000 			#Unit:m**3/min 			#Entering fluid
A2 = 0.5 			#Unit:ft**2 			#Exit area

# Calculations and Results
m = Rho1*A1V1; 			#Unit:kg/min 			#mass rate of flow per unit time
print "Mass flow rate is %.2f kg/min"%(m);

Rho2 = Rho1; 			#Unit:kg/m**3 			#the density of the fluid at exit
#m = Rho2*A2*V2
#So,
V2 = m/(Rho2*A2); 			#The exit velocity 			#Unit:m/min
print "The exit velocity is %.2f m/min"%(V2);

Mass flow rate is 2000000.00 kg/min
The exit velocity is 4000.00 m/min


## Example 3.7 Page No : 97¶

In [5]:
import math

# Given value
Rho = 62.4 			#Unit:lbm/ft**3 			#the density of the fluid
V = 100 			#Unit:ft/s 			#Velocity of fluid
d = 1 			#Unit:in 			#Diameter

# Calculations
#1 ft**2 = 144 in**2 			#A = (math.pi/4)*d**2
A = (math.pi*d**2)/(4*144) 			#Unit:ft**2 			#area
m = Rho*A*V; 			#Unit:lbm/s 			#mass rate of flow per unit time

# Results
print "Mass flow rate is %.2f lbm/s"%(m);

Mass flow rate is 34.03 lbm/s


## Example 3.8 Page No : 98¶

In [6]:
import math

# Given value
m1 = 50000.; 			#Unit:LBm/hr 			#An inlet steam flow
v1 = 0.831 			#Unit:ft**3/LBm 			#Specific volume of inlet steam
d1 = 6.  			#Unit:in 			#Inlet diameter

# Calculations and Results
A1 = (math.pi*d1**2)/(4*144) 			#1 ft**2 = 144 in**2 			#Entering area
V1 = (m1*v1)/(A1*60*60) 			#(60 min/hr * 60 s/min) 			#To convert hours into seconds 			#velocity at inlet
print "The velocity at inlet is %.2f ft/s"%(V1);

m2 = m1; 			#Unit:LBm/hr 			#m2 = An outlet steam flow
v2 = 1.825 			#Unit:ft**3/LBm 			#Specific volume of outlet steam
d2 = 8  			#Unit:in 			#Outlet diameter
A2 = (math.pi*d2**2)/(4*144) 			#1 ft**2 = 144 in**2 			#Exit area
V2 = (m1*v2)/(A2*60*60) 			#(60 min/hr * 60 s/min) 			#To convert hours into seconds 			#velocity at outlet
print "The velocity at outlet is %.2f ft/s"%(V2);

The velocity at inlet is 58.78 ft/s
The velocity at outlet is 72.61 ft/s


## Example 3.9 Page No : 99¶

In [7]:
import math

# Given value
m1 = 10000; 			#Unit:kg/hr 			#An inlet steam flow
v1 = 0.05 			#Unit:m**3/kg 			#Specific volume of inlet steam
d1 = 0.1  			#Unit:m 			#Inlet diameter 			#100 mm  = 0.1 m

# Calculations and Results
A1 = (math.pi/4)*d1**2 			#Unit:m**2 			#Entering area
V1 = (m1*v1)/(A1*60*60) 			#(60 min/hr * 60 s/min) 			#To convert hours into seconds 			#velocity at inlet 			#Unit:m/s
print "The velocity at inlet is %.2f m/s"%(V1);

m2 = m1; 			#Unit:kg/hr 			#m2 = An outlet steam flow
v2 = 0.10 			#Unit:m**3/kg 			#Specific volume of outlet steam
d2 = 0.2  			#Unit:m 			#Outlet diameter 			#200 mm  =  0.2 m
A2 = (math.pi/4)*(d2**2) 			#Unit:m**2 			#Exit area
V2 = (m1*v2)/(A2*60*60) 			#(60 min/hr * 60 s/min) 			#To convert hours into seconds 			#velocity at outlet 			#Unit:m/s
print "The velocity at outlet is %.2f m/s"%(V2);

The velocity at inlet is 17.68 m/s
The velocity at outlet is 8.84 m/s


## Example 3.10 Page No : 105¶

In [8]:
# Given value
Cp = 0.22; 			#Unit:Btu/(LBm*R) 			#Specific heat for constant pressure process
Cv = 0.17; 			#Unit:Btu/(LBm*R) 			#Specific heat for constant volume process
q = 800./10; 			#data given:800 Btu as heat is added to 10 LBm 			#Unit:Btu/LBm
T1 = 100; 			#Unit:Fahrenheit 			#Initial temperature 			#T2 = Final temperature

# Calculations
#For a non-flow,constant pressure process
#q = deltah = h2-h1 = Cp(T2-T1) 			#deltah = change in enthalpy
#deltaT = T2-T1;
deltaT = q/Cp; 			#Fahrenheit  			#change in temperature
T2 = deltaT+T1; 			#Fahrenheit  			#final temperature
#For a constant volume pressure
#u2-u1 = Change in internal energy 			#w = workdone
#q-w = u2-u1
#-w = (u2-u1)-q  =  Cv*(T2-T1)-q
w = -(Cv*(T2-T1)-q); 			#Unit:Btu/lbm 			#workdone

# Results
print "%.2f Btu/lbm work is taken out of the system due to workdone by gas"%(w);
print "As there is 10 lbm in the system"
print "%.2f Btu work is taken out of the system due to workdone by gas"%(w*10);

18.18 Btu/lbm work is taken out of the system due to workdone by gas
As there is 10 lbm in the system
181.82 Btu work is taken out of the system due to workdone by gas


## Example 3.11 Page No : 111¶

In [14]:
#Given data
#                    Inlet     Outlet
#Pressure(psia)      1000      1
#Temperature(F)      1000      101.74
#Velocity(ft/s)      125       430
#Inlet position(ft)  +10       0
#Enthalpy(Btu/LBm)   1505.4    940.0
#Steam flow rate of 150000 LBm/hr

#From the table,
Z1 = 10;
V1 = 125;
h1 = 1505.4;
Z2 = 0;
V2 = 430;
h2 = 940.0;

#Energy equation is given by
#((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + h1 + q  =  ((Z2/J)*(g/gc)) + (V2**2/(2*gc*J)) + h2 + w/J
print "Solution for a ";
q = 0; 			#net heat
J = 778.; 			#Conversion factor
gc = 32.174; 			#Unit: (LBm*ft)/(LBf*s**2) 			#gc is constant of proportionality
g = gc; 			#Unit:ft/s**2 			#g = The local gravity
#W1 = w/J;
#Energy equation is given by
W1 = ((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + h1 + q - ((Z2/J)*(g/gc)) - (V2**2/(2*gc*J)) - h2; 			#Unit:Btu/LBm
print "If heat losses are negligible"
print "Total work of the turbine is %.2f Btu/LBm"%(W1);
print "Total work of the turbine is %.2f Btu/hr"%(W1*150000);
#(W*150000*778)/(60*33000) 			#in terms of horsepower  			#1 hr = 60 min 			#1 hp = 33000 (ft*LBf)
print "Total work of the turbine is %.2f hp "%(((W1*150000*778)/60*33000));
#1 hp  = 0.746 kW
print "Total work of the turbine is %.2f kW "%((((W1*150000*778)/60*33000))*0.746);

print "Solution for b ";
#Heat losses equal 50,000 Btu/hr
q = 50000./150000; 			#Unit:Btu/LBm 			#Heat loss
W2 = ((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + h1 - q - ((Z2/J)*(g/gc)) - (V2**2/(2*gc*J)) - h2; 			#Unit:Btu/LBm
print "If heat losses equal 50,000 Btu/hr , Total work of the turbine is %.2f Btu/LBm"%(W2);

Solution for a
If heat losses are negligible
Total work of the turbine is 562.03 Btu/LBm
Total work of the turbine is 84304739.48 Btu/hr
Total work of the turbine is 36073998024056.70 hp
Total work of the turbine is 26911202525946.29 kW
Solution for b
If heat losses equal 50,000 Btu/hr , Total work of the turbine is 561.70 Btu/LBm


## Example 3.12 Page No : 112¶

In [15]:
Z1 = 2; 			#Unit:m 			#Inlet position
g = 9.81 			#Unit:m/s**2 			#g = The local gravity
V1 = 40; 			#Unit:m/s 			#Inlet velocity
h1 = 3433.8; 			#Unit:kJ/kg 			#Inlet enthalpy
q = 1 			#Unit:kJ/kg 			#Heat losses
Z2 = 0; 			#Outlet position 			#unit:m
V2 = 162; 			#Unit:m/s 			#Outlet velocity
h2 = 2675.5; 			#Unit:kJ/kg 			#Outlet enthalpy

#Energy equation is given by
#((Z1*g)) + (V1**2/2) + h1 + q  =  ((Z2*g) + (V2**2/2) + h2 + w

w =  ((Z1*g)/1000) + ((V1**2/2)/1000) + h1 - q - ((Z2*g)/1000) - ((V2**2/2)/1000) - h2 ; 			#Unit:kJ/kg 			#Conersation: 1 kJ = 1000 J
print "The work output per kimath.logram is %.2f kJ/kg"%(w);

The work output per kimath.logram is 744.32 kJ/kg


## Example 3.13 Page No : 113¶

In [16]:
p1 = 150; 			#Unit:psia 			#Initial pressure
T1 = 1000; 			#Unit:R 			#Temperature at pressure p1
p2 = 15; 			#Unit:psia 			#Final pressure
T2 = 600; 			#Unit:R 			#Temperature at pressure p2
Cp = 0.24; 			#Unit:Btu/(LBm*R) 			#Specific heat for constant pressure process
v1 = 2.47; 			#Unit:ft**3/LBm 			#Specific volume at inlet conditions
v2 = 14.8; 			#Unit:ft**3/LBm 			#Specific volume at outlet conditions

#For a non-flow,constant pressure process
#w/J = deltah = h2-h1 = Cp(T2-T1) 			#deltah = change in enthalpy
#W = w/J
W = Cp*(T1-T2); 			#W = Work output 			#Unit:Btu/LBm

# Results
print "The work output of the turbine per pound of working fluid is %.2f Btu/LBm"%(W);

The work output of the turbine per pound of working fluid is 96.00 Btu/LBm


## Example 3.14 Page No : 114¶

In [17]:
#In problem 3.13 ,
p1 = 150.; 			#Unit:psia 			#Initial pressure
T1 = 1000.; 			#Unit:R 			#Temperature at pressure p1
p2 = 15.; 			#Unit:psia 			#Final pressure
T2 = 600.; 			#Unit:R 			#Temperature at pressure p2
Cp = 0.24; 			#Unit:Btu/(LBm*R) 			#Specific heat for constant pressure process
v1 = 2.47; 			#Unit:ft**3/LBm 			#Specific volume at inlet conditions
v2 = 14.8; 			#Unit:ft**3/LBm 			#Specific volume at outlet conditions

#For a non-flow,constant pressure process
#w/J = deltah = h2-h1 = Cp(T2-T1) 			#deltah = change in enthalpy
#W = w/J
W = Cp*(T1-T2); 			#W = Work output 			#Unit:Btu/LBm 			#h2-h1
print "In problem 3.13, The work output of the turbine per pound of working fluid is %.2f Btu/LBm  "%(W);

#Now,In problem 3.14 ,
q = 1.1; 			#Unit:Btu/LBm 			#Heat losses
#For a non-flow,constant pressure process
#q-w/J = deltah = h2-h1 = Cp(T2-T1) 			#deltah = change in enthalpy
#W1 = w/J
W1 = -q+W; 			#W = Work output 			#Unit:Btu/LBm 			#W = h2-h1 			#Because q  is out of the system,it is a negative quantity
print "In problem 3.14%(heat loss equal to 1.1 Btu/LBm"
print "The work output of the turbine per pound of working fluid is %.2f Btu/LBm "%(W1);

In problem 3.13, The work output of the turbine per pound of working fluid is 96.00 Btu/LBm
In problem 3.14%(heat loss equal to 1.1 Btu/LBm
The work output of the turbine per pound of working fluid is 94.90 Btu/LBm


## Example 3.15 Page No : 115¶

In [18]:
p1 = 100.; 			#Unit:psia 			#Initial pressure
t1 = 950.; 			#Unit:Fahrenheit 			#Temperature at pressure p1
p2 = 76.; 			#Unit:psia 			#Final pressure
t2 = 580.; 			#Unit:Fahrenheit 			#Temperature at pressure p2
v1 = 4.; 			#Unit:ft**3/LBm 			#Specific volume at inlet conditions
v2 = 3.86; 			#Unit:ft**3/LBm 			#Specific volume at outlet conditions
Cv = 0.32; 			#Unit:Btu/(LBm*R) 			#Specific heat for constant volume process

T1 = t1+460; 			#Unit:R 			#Temperature at pressure p1
T2 = t2+460; 			#Unit:R 			#Temperature at pressure p2
J = 778.; 			#J = Conversion factor

#Z1 = Inlet position 			#Unit:m
#V1 = Inlet velocity 			#Unit:m/s
#Z2 = Outlet position 			#Unit:m
#V2 = Outlet velocity Unit:m/s
#u1 = internal energy 			#energy in
#u2 = internal energy 			#energy out

#Energy equation is given by
#((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + u1 + ((p1*v1)/J) + q  =  ((Z2/J)*(g/gc)) + (V2**2/(2*gc*J)) + u2 + ((p2*v2)/J) + w/J; 			#Unit:Btu/LBm
#Because pipe is horizontal and velocity terms are to be neglected,
# Also no work crosses the boundaries of the system, the energy equation is reduced to
#u1 + ((p1*v1)/J) + q  =  u2 + ((p2*v2)/J)
#u2-u1 = Cv*(T2-T1) 			#For a constant volume process 			#u2-u1 = Chnage in internal energy
#So,
q = Cv*(T2-T1) + (p2*v2*144)/J - (p1*v1*144)/J;  			#q = heat transfer 			#1 ft**2 = 144 in**2 			#Unit:Btu/LBm

# Results
print "%.2f Btu/LBm heat is transferred from the gas "%(q);

-138.14 Btu/LBm heat is transferred from the gas


## Example 3.16 Page No : 116¶

In [19]:
#In problem 3.15,
p1 = 100; 			#Unit:psia 			#Initial pressure
t1 = 950; 			#Unit:Fahrenheit 			#Temperature at pressure p1
p2 = 76; 			#Unit:psia 			#Final pressure
t2 = 580; 			#Unit:Fahrenheit 			#Temperature at pressure p2
v1 = 4; 			#Unit:ft**3/LBm 			#Specific volume at inlet conditions
v2 = 3.86; 			#Unit:ft**3/LBm 			#Specific volume at outlet conditions
Cv = 0.32; 			#Unit:Btu/(LBm*R) 			#Specific heat for constant volume process

T1 = t1+460; 			#Unit:R 			#Temperature at pressure p1
T2 = t2+460; 			#Unit:R 			#Temperature at pressure p2
J = 778.; 			#J = Conversion factor
gc = 32.174; 			#Unit: (LBm*ft)/(LBf*s**2) 			#gc is constant of proportionality
g = gc; 			#Unit:ft/s**2 			#g = The local gravity

#Z1 = Inlet position 			#Unit:m
#V1 = Inlet velocity 			#Unit:m/s
#Z2 = Outlet position 			#Unit:m
#V2 = Outlet velocity Unit:m/s
#u1 = internal energy 			#energy in
#u2 = internal energy 			#energy out

#Energy equation is given by
#((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + u1 + ((p1*v1)/J) + q  =  ((Z2/J)*(g/gc)) + (V2**2/(2*gc*J)) + u2 + ((p2*v2)/J) + w/J; 			#Unit:Btu/LBm
#In 3.15, the elevation of the pipe at section 1 makes Z1  =  0
# Also no work crosses the boundaries of the system, the energy equation is reduced to
#u1 + ((p1*v1)/J) + q  =  u2 + ((p2*v2)/J) + ((Z2/J)*(g/gc))
#In problrm 3.16,
Z2 = 100; 			#Given 			#Unit:ft 			#Outlet position
#u2-u1 = Cv*(T2-T1) 			#For a constant volume process 			#u2-u1 = Chnage in internal energy
#So,
q = Cv*(T2-T1) + (p2*v2*144)/J - (p1*v1*144)/J + ((Z2/J)*(g/gc)) ;  			#q = heat transfer 			#1 ft**2 = 144 in**2 			#Unit:Btu/LBm

# Results
print "%.2f Btu/LBm heat is transferred from the gas "%(q);
#For this problem , neglecting the elevation term leads to an insignificant error

-138.01 Btu/LBm heat is transferred from the gas


## Example 3.17 Page No : 117¶

In [20]:
p1 = 1000; 			#Unit:psia 			#Initial pressure
t1 = 100;  			#Unit:Fahrenheit 			#Temperature at pressure p1
p2 = 1000; 			#Unit:psia 			#Final pressure
t2 = 1000; 			#Unit:Fahrenheit 			#Temperature at pressure p2
# feed in 10,000 LBm/hr
h1 = 70.68  			#Unit:Btu/LBm 			#Inlet enthalpy
h2 = 1505.9 			#Unit:Btu/LBm 			#Outlet enthalpy

T1 = t1+460; 			#Unit:R 			#Temperature at pressure p1
T2 = t2+460; 			#Unit:R 			#Temperature at pressure p2
#Energy equation is given by
J = 778; 			#J = Conversion factor

#Z1 = Inlet position 			#Unit:m
#V1 = Inlet velocity 			#Unit:m/s
#Z2 = Outlet position 			#Unit:m
#V2 = Outlet velocity Unit:m/s
#u1 = internal energy 			#energy in
#u2 = internal energy 			#energy out
#h = enthalpy

#Energy equation is given by
#((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + u1 + ((p1*v1)/J) + q  =  ((Z2/J)*(g/gc)) + (V2**2/(2*gc*J)) + u2 + ((p2*v2)/J) + w/J; 			#Unit:Btu/LBm

#we can consider this system as a math.single unit with feed water entering ans steam leaving.
#It well designed,this unit will be thoroughly insulated,and heat losse will be reduced to a negligible amount
#Alos,no work will be added to the fluid during the time it is pasmath.sing through the unit, and kinetic energy differences will be assumed to be negligibly small
#Differennces in elevation also be considered negligible
#So,the energy equation is reduced to
#u1 + ((p1*v1)/J) + q  =  u2 + ((p2*v2)/J)
#Because h = u+(p*v/J)
q = h2-h1; 			#q = net heat losses 			#Unit:Btu/LBm

# Results
print "Net heat losses is %.2f Btu/LBm "%(q);
print "For 10000 LBm/hr"
print "%.2f Btu/hr energy has been added to the water to convert it to steam"%(q*10000)

Net heat losses is 1435.22 Btu/LBm
For 10000 LBm/hr
14352200.00 Btu/hr energy has been added to the water to convert it to steam


## Example 3.18 Page No : 119¶

In [21]:
import math

h1 = 1220  			#Unit:Btu/LBm 			#Inlet enthalpy
h2 = 1100 			#Unit:Btu/LBm 			#Outlet enthalpy

#Z1 = Inlet position 			#Unit:m
#V1 = Inlet velocity 			#Unit:m/s
#Z2 = Outlet position 			#Unit:m
#V2 = Outlet velocity Unit:m/s
#u1 = internal energy 			#energy in
#u2 = internal energy 			#energy out
J = 778; 			#J = Conversion factor
gc = 32.174; 			#Unit: (LBm*ft)/(LBf*s**2) 			#gc is constant of proportionality

#Energy equation is given by
#((Z1/J)*(g/gc)) + (V1**2/(2*gc*J)) + u1 + ((p1*v1)/J) + q  =  ((Z2/J)*(g/gc)) + (V2**2/(2*gc*J)) + u2 + ((p2*v2)/J) + w/J; 			#Unit:Btu/LBm

#For this device,differences in elevation are negligible.No work is done on or by the fluid,friction is negligible
#And due to the speed of the fluid flowing and the short length of the nozzle,heat transfer to or from the surroundings is also negligible.
#So,the energy equation is reduced to
#u1 + ((p1*v1)/J) +(V1**2/(2*gc*J)   =  u2 + ((p2*v2)/J) + (V2**2/(2*gc*J)
# h1-h2  =  ((V2**2-V1**2)/(2*gc*J))

print "Solution for a";
#For neglegible entering velocity, V1 = 0
#So,
V2 = math.sqrt((2*gc*J)*(h1-h2)); 			#the final velocity  			#ft/s
print "It the initial velocity of the system is negligible, the final velocity is %.2f ft/s  "%(V2);

print "Solution for b";
#If the initial velocity is appreciable,
V1 = 1000; 			#Unit:ft/s 			#the initial velocity
V2 = math.sqrt(((h1-h2)*(2*gc*J)) + V1**2 ) ;
print "It the initial velocity of the system is appreciable, the final velocity is %.2f ft/s  "%(V2);

Solution for a
It the initial velocity of the system is negligible, the final velocity is 2451.03 ft/s
Solution for b
It the initial velocity of the system is appreciable, the final velocity is 2647.17 ft/s


## Example 3.19 Page No : 120¶

In [22]:
# Given value
h1 = 3450*1000 			#Unit:J/kg 			#Enthalpy of steam when it enters a nozzle
h2 = 2800*1000 			#Unit:J/kg 			#Enthalpy of steam when it leaves a nozzle

# Calculations
#V2**2/2 = h1-h2;
V2 = math.sqrt(2*(h1-h2)); 			#V2 = Final velocity 			#Unit:m/s

# Results
print "Final velocity  =  %.2f m/s"%(V2);

Final velocity  =  1140.18 m/s


## Example 3.21 Page No : 125¶

In [24]:
# Given value
m = 400; 			#Unit:LBm/min 			#mass of lubricating oil
Cp = 0.85; 			#Unit:Btu/LBm*R 			#Specific heat of the oil
T1 = 215; 			#Temperature when hot oil is entering 			#Unit:Fahrenheit
T2 = 125; 			#Temperature when hot oil is leaving 			#Unit:Fahrenheit

# Calculations and Results
DeltaT = T2-T1; 			#Unit:Fahrenheit  			#change in temperature
Qoil = m*Cp*DeltaT; 			#Heat out of oil 			#Btu/min
print "Heat out of oil is %.2f Btu/min Out of oil"%(Qoil);
#Heat out of oil is the heat into the water
#Mw = Water flow rate
#M*Cpw*DeltaTw = Qoil
Cpw = 1.0; 			#Unit:Btu/LBm*R 			#Specific heat of the water
T3 = 60.; 			#Temperature when water is entering 			#Unit:Fahrenheit
T4 = 90; 			#Temperature when water is leaving 			#Unit:Fahrenheit
DeltaTw = T4-T3; 			#Unit:Fahrenheit 			#change in temperature
Mw = Qoil/(Cpw*DeltaTw); 			#The Required water flow rate  			#Unit;lbm/Min
print "The Required water flow rate is %.2f lbm/Min"%(abs(Mw));

Heat out of oil is -30600.00 Btu/min Out of oil
The Required water flow rate is 1020.00 lbm/Min