In [ ]:

```
#It is proposed to obtain a power from the hot surface water of tropical seas
#using the cold water from the depths as a sink for heat rejection. The surface
#water is 85 F the deep water is at 50 F. In the light of the second law is such
#scheme possible? If so, what is the max. thermal efficiency possible under law?
#initialisation of variables
T1= 85. #F
T2= 50. #F
#CALCULATIONS
n= (T1-T2)/(T1+460) #Max. efficiency
n1= n*100 #percentage
#RESULTS
print '%s %.2f' %('Maximum thermal efficiency (percent) = ',n1)
raw_input('press enter key to exit')
```

In [1]:

```
#A proposed steam power plant will provide for supplying heat to steam at temp
#upto 1050F. The temperature of heat rejection is about 90 F. It is stated that
#the efficiency of the plant will approach 34%. Does this seem reasonable per law?
#initialisation of variables
T1= 1050. #F
T2= 90. #F
#CALCULATIONS
n= (T1-T2)/(T1+460) #Efficiency
n1= n*100 #Percentage
#RESULTS
print '%s %.2f' %('Maximum thermal efficiency (percent) = ',n1)
raw_input('press enter key to exit')
```

Out[1]:

In [2]:

```
#How much does te entropy of a pound if air change when the air is heated
#irreversibly from 1 atm pressure, 50 F to 1 atm, 150 F if the Cp=0.240?
import math
#initialisation of variables
m= 1 #lb
cp= 0.240 #btu/lb F
T2= 150 #F
T1= 50 #F
#CALCULATIONS
S= m*cp*(math.log(460.+T2)-math.log(460.+T1)) #Entropy
#RESULTS
print '%s %.4f' %('Entropy change (Btu/Fabs) = ',S)
raw_input('press enter key to exit')
```

Out[2]:

In [4]:

```
#If in the previous example, the process is adiabatic with work against friction
#How much the entropy change during this process
import math
#initialisation of variables
m= 1 #lb
cp= 0.240 #btu/lb F
T2= 150 #F
T1= 50 #F
#CALCULATIONS
S= m*cp*(math.log(460.+T2)-math.log(460.+T1)) #Entropy
#RESULTS
print '%s %.4f' %('Entropy change (Btu/Fabs) = ',S)
#This result is same as the above since change in entropy does not depend on the process involved
# but only on the initial and final states
raw_input('press enter key to exit')
```

Out[4]:

In [3]:

```
#In a steam boiler, hot gases from a fire transfer heat to water which evaporates
#at const. temp. In certain case the gases are cooled from 2000 F to 1000F while
#the water evaportates to 400 F. the Cp=0.24 and L=826. No wastage. How much does
#the entropy increase as a result of the irreversible heat transfer.?
import math
#initialisation of variables
Q= 826 #Btu/lb
T= 400. #F
T1= 1000. #F
T2= 2000. #F
#CALCULATIONS
Sw= Q/(T+460.) #Entropy change for water
Sg= (Q/T1)*(math.log(T1+460)-math.log(T2+460)) #Entropy change for gas
S= Sw+Sg #Total entropy change
#RESULTS
print '%s %.3f' %('Total Entropy change (Btu/R) = ',S)
raw_input('press enter key to exit')
```

Out[3]:

In [5]:

```
#For the above example find the increase in unavailable energy due to the
#irreversible heat transfer. Assume the temperature of the surroundings is 80 F?
import math
#initialisation of variables
Q= 826. #Btu/lb
T= 400. #F
T1= 1000. #F
T2= 2000. #F
T3= 80. #F
#CALCULATIONS
Sw= Q/(T+460.) #Entropy change for water
Sg= (Q/T1)*(math.log(T1+460)-math.log(T2+460)) #Entropy change for gas
S= Sw+Sg #Total entropy change
Q1= (T3+460.)*S #Heat generated
Q2= Q+(T3+460.)*Sg #Total heat
n= Q1/Q2 #Efficiency
n1= n*100 #Loss percent
#RESULTS
print '%s %d' %('Loss percent = ',n1)
raw_input('press enter key to exit')
```

Out[5]: