# Variables
B = 5.*10**(-5); # /K
K = 8.6*10**(-12); # m**2/N
v = 0.114*10**(-3); #m**3/kg
p2 = 800.*10**5; #Pa
p1 = 20.*10**5; #Pa
T = 288.; #K
# Calculations and Results
W = -v*K/2*(p2**2-p1**2);
print ("(i) Work done on the copper = %.3f")%(W),("J/kg")
ds = -v*B*(p2-p1);
print ("(ii) Change in entropy = %.3f")% (ds), ("J/kg K")
Q = T*ds;
print ("(iii) The heat transfer = %.3f")%(Q), ("J/kg")
du = Q-W;
print ("(iv) Change in internal energy = %.3f")%(du),("J/kg")
R = B**2*T*v/K;
print ("(v) cp – cv = %.3f")%(R),("J/kg K")
# Variables
vg = 0.1274; #m**3/kg
vf = 0.001157; #m**3/kg
# dp/dT = 32; #kPa/K
T3 = 473; #K
# Calculations
h_fg = 32*10**3*T3*(vg-vf)/10**3;
# Results
print (" enthalpy of vapourisation = %.3f")%(h_fg),("kJ/kg")
import math
# Variables
h_fg = 334.; #kJ/kg
v_liq = 1.; #m**3/kg
v_ice = 1.01; #m**3/kg
T1 = 273.; #K
T2 = 263.; #K
p1 = 1.013*10**5; #Pa
# Calculations
p2 = (p1+h_fg*10**3/(v_ice-v_liq)*math.log(T1/T2))/10**5;
# Results
print ("pressure = %.3f")%(p2),("bar")
# Variables
h_fg = 294.54; #kJ/kg
p = 0.1; #bar
T = 523; #K
# Calculations
vg = h_fg*10**3/T/(2.302*3276.6*p*10**5/T**2 - 0.652*p*10**5/T);
# Results
print ("specific volume = %.3f")%(vg),("m**3/kg")