Chapter 02:Properties of Fluids

Example 2.2-1, Page Number 41

In [15]:
import math
 
#Variable Decleration
l=6 #Length in m
b=4 #Breadth in m
h=5 #Height in m
R=0.287 #Gas Constant in kPa.m^3/kg.K
P=100 # pressure in kPa
T=25 # Temperature in degree Centigrade
To=273.15 #Temperature conversion in Kelvin
rho_H2O=1000 #Density of water

#Calculations
rho=P/(R*(T+To)) #Density in kg/m^3
SG=rho/rho_H2O #Specific Gravity of Air
V=l*b*h #Volume of the room in m^3
m=rho*V #mass of air in kg

#Results
print"The density of Air is", round(rho,2), "kg/m^3"
print"The Specific Gravity of Air is",round(SG,5)
print"The mass of air is",round(m),"kg"
The density of Air is 1.17 kg/m^3
The Specific Gravity of Air is 0.00117
The mass of air is 140.0 kg

Example 2.2-2, Page Number 42

In [5]:
import math

#Variable Decleration
T=30 #Temperature in the System in Degree Centigrade
#Value from the table for corresponding Temperature
P=4.25 #Pressure in kPa

#Calculations
Pmin=P #Minimum Pressure to avoid Cavitation in kPa

#Result
print"The minimum pressure required to avoid cavitation is",Pmin,"kPa"
The minimum pressure required to avoid cavitation is 4.25 kPa

Example 2.2-3, Page No:47

In [16]:
import math
#The variables repeat hence a different notation has been used to code the following example
#Variable Decleration
T1=20 #Temperature of water Initially in Degree Centigrade
P1=1 #Pressure initially in atm
T2=50 #Temperature of water after heating in Degree Centigrade
P2=100 #Pressure after Compression in atm
rho=998 # density of water at 1 atm in kg/m^3
alpha=4.8*10**-5 #isothermal compressibility of water in atm^-1
beta=0.337*10**-3 #Coefficient of volume expansion at avg temp in K^-1

#Calculations

#Part (a)
deltarho1=-beta*rho*(T2-T1) #Change in density in kg/m^3
rho2a=deltarho1+rho #density of water at 50 degrees in kg/m^3

#Part(b)
deltarho2=alpha*rho*(P2-P1) #Change in density in kg/m^3
rho2b=rho+deltarho2 #density of water at 100atm and 20 degrees in kg/m^3

#Result
print"The density changes to", round(rho2a),"kg/m^3 when heated to 50 degrees"
print"The density changes to",round(rho2b,1),"kg/m^3 when compressed to 100atm isothermally"
The density changes to 988.0 kg/m^3 when heated to 50 degrees
The density changes to 1002.7 kg/m^3 when compressed to 100atm isothermally

Example 2.2-4, Page No: 50

In [2]:
import math

#Variable Decleration
V=200 #Speed of air in m/s
T=30 #Temperature in degree centigrade
k=1.4 #Specific Heat Ratio
R=0.287 #Gas Constant in kJ/kg K
To=273.15 #Temperature conversion factor
f=1000 #conversion factor in m^2/s^2

#Calculations

#Part(a)
c=(k*R*(T+To)*(f))**0.5 #Speed of sound in m/s

#Part(b)
Ma=V/c #Mach Number

#Result
print"The speed of sound in air at 30degrees is",round(c),"m/s"
print"The mach number is",round(Ma,3)," which is subsonic since Ma<1"
The speed of sound in air at 30degrees is 349.0 m/s
The mach number is 0.573  which is subsonic since Ma<1

Example 2.2-5, Page No:55

In [18]:
import math

#Variable Decleration
L=0.4 #Length of viscometer in m
T=1.8 #Torque measured in N.m
l=0.0015 #Gap between the two cylinders in m
R=0.06 #Radius if inner shaft in m
ndot=300/60 #speed of the shaft

#Calculations
mu=(T*l)/(4*pi**2*R**3*ndot*L) #Viscosity in s/m^2

#Result
print"The viscosity of the liquid is",round(mu,3),"s/m^2"
The viscosity of the liquid is 0.158 s/m^2

Example 2.2-6, Page No:59

In [21]:
import math

#Variable Decleration
R=0.3*10**-3 #Radius of glass tube in m
sigma_s=0.073 #Surface Tension in water at 20 degrees in N/m
phi=0 #Angle made by the water surface in degrees
g=9.81 #Acceleration due to gravity in m/s^2
rho=1000 #Density of water in kg/m^3

#Calculations
h_m=(2*sigma_s*cos(phi))/(rho*g*R) #Capillary rise in m
h=h_m*100 #Capillary rise in cm

#Result
print"The capillary rise is",round(h),"cm"
The capillary rise is 5.0 cm

Example No:2.2-7, Page No:60

In [23]:
import math

#Variable Decleration
rho_water=1000 #Density of water in kg/m^3
g=9.81 #Acceleration due to gravity in m/s^2
h=0.05 #Capillary Rise in m

#Calculations
deltaP=(rho_water*g*h)/(1000*100) #Pressure difference in atm

#Result
print"The pressure difference is",round(deltaP,3),"atm"
The pressure difference is 0.005 atm