# Chapter 8 - Second and third law topics¶

## Example 1 - Pg 125¶

In :
#calculate the value of dp/ds at constant volume
#Initialization of variables
P=500 #psia
T=700. #F
J=778.
#calculations
dpds=1490 *144/J
#results
print '%s %d %s' %("dp by ds at constant volume =",dpds," F/ft^3/lbm")
print '%s' %("The answer is a bit different due to rounding off error in textbook")

dp by ds at constant volume = 275  F/ft^3/lbm
The answer is a bit different due to rounding off error in textbook


## Example 2 - Pg 131¶

In :
#calculate the thermal efficiency
#Initialization of variables
import math
cp=0.25 #Btu/lbm R
T0=520. #R
T1=3460. #R
#calculations
dq=cp*(T0-T1)
ds=cp*math.log(T0/T1)
dE=dq-T0*ds
eta=dE/dq*100.
#results
print '%s %.1f %s' %("Thermal efficiency =",eta,"percent")

Thermal efficiency = 66.5 percent


## Example 3 - Pg 134¶

In :
#calculate the Loss of available energy
#Initialization of variables
import math
cp=0.25 #Btu/lbm R
T0=520. #R
T1=3460. #R
dG=21069. #Btu/lbm
dH=21502. #Btu/lbm
#calculations
dq=cp*(T0-T1)
ds=cp*math.log(T0/T1)
dE=dq-T0*ds
eta=dE/dq
dw=eta*dH
de=-dG+dw
#results
print '%s %d %s' %("Loss of available energy =",de,"Btu/lbm")

Loss of available energy = -6774 Btu/lbm