<jupyter_start><jupyter_text>Example 12.1: Clapeyron Equation*<NAME>, Ph.D., P.E.University of Kentucky - Paducah CampusME 321: Engineering Thermodynamics II*  Problem StatementDetermine the enthalpy of vaporization for water at 100 kPa using:* (a) the Clapeyron equation* (b) the Clapeyron-Clausius equation* (c) the steam tables  Solution__[Video Explanation](https://uky.yuja.com/V/Video?v=3074201&node=10465100&a=2106948292&autoplay=1)__  Python InitializationWe'll start by importing the libraries we will use for our analysis and initializing dictionaries to hold the properties we will be usings.<jupyter_code>from kilojoule.templates.default import *
fluid = realfluid.Properties('Water')

p[1] = Quantity(100,'kPa')
x[1] = 0
states.fix(1,fluid)

p[2] = Quantity(125,'kPa')
x[2] = 0
states.fix(2,fluid)

p[3] = Quantity(75,'kPa')
x[3] = 0
states.fix(3,fluid)

p[4] = p[1]
x[4] = 1
states.fix(4,fluid)

states.display();<jupyter_output><empty_output><jupyter_text>(a) Clapeyron equationThe Clapeyron equation relates the enthalpy of vaporization to easily measureable properties, $T$, $p$, and $v$$$ \left( \frac{\partial p}{\partial T} \right)_{sat} = \frac{h_{fg}}{T_{sat}v_{fg}}$$This can be solved for the enthalpy$$ h_{fg} = Tv_{fg}\left(\frac{\partial P}{\partial T}\right)_{sat} $$The application of this equation depends on knowing the partial derivative of the pressure with respect to the temperature during phase change.  This can be visualized as the slope of the saturation curve on a $p$-$T$ diagram at the pressure of interest<jupyter_code>%%showcalc
v_fg = v[4]-v[1]
pT = fluid.property_diagram(x="T",y="p",saturation=False)
pT.ax.set_ylim(bottom=50,top=150)
# pT.ax.set_xlim(left=80,right=120)

# Label phases
pT.plot_iso_line("x",0,y_range=[50,150]*units('kPa'),label='saturated',ycoor=55,color='gray')
pT.text(0.1,.9,'liquid',axcoor=True)
pT.text(0.9,.1,'vapor',axcoor=True)

# Plot states
pT.plot_state(states[1],label_loc='north west',gridlines=True)
pT.plot_state(states[2],label_loc='north west')
pT.plot_state(states[3],label_loc='north west')<jupyter_output><empty_output><jupyter_text>Forward Difference<jupyter_code>%%showcalc
dPdT_forward = (p[2]-p[1])/(T[2]-T[1])
h_fg_forward = T[1].to('K')*v_fg*dPdT_forward
h_fg_forward.ito('kJ/kg')
x = Quantity(pT.xlim,'degC')
y = dPdT_forward*(x-T[1]) + p[1]
pT.plot(x,y,color='green',linewidth=.5,label='forward')
pT.fig.legend()
pT.show()<jupyter_output><empty_output><jupyter_text>Backward Difference<jupyter_code>%%showcalc
dPdT_backward = (p[1]-p[3])/(T[1]-T[3])
h_fg_backward = T[1].to('K')*v_fg*dPdT_backward
h_fg_backward.ito('kJ/kg')
y = dPdT_backward*(x-T[1]) + p[1]
pT.ax.plot(x,y,color='blue',linewidth=.5,label='backward')
pT.fig.legend()
pT.show()<jupyter_output><empty_output><jupyter_text>Central Difference<jupyter_code>%%showcalc
dPdT_central = (p[2]-p[3])/(T[2]-T[3])
h_fg_central = T[1].to('K')*v_fg*dPdT_central
h_fg_central.ito('kJ/kg')
y = dPdT_central*(x-T[1]) + p[1]
pT.ax.plot(x,y,color='red',linewidth=.5,label='central')
pT.fig.legend()
pT.show()<jupyter_output><empty_output><jupyter_text>(b) Clapeyron-Clausius equation$$\ln\left(\frac{p_B}{p_A}\right) = \frac{h_{fg}}{R}\left(\frac{1}{T_A}-\frac{1}{T_B}\right)$$<jupyter_code>%%showcalc
from math import log
R = fluid.R
h_fg = (R*log(p[3]/p[2]))/(1/T[2].to('K')-1/T[3].to('K'))
h_fg.ito('kJ/kg')<jupyter_output><empty_output><jupyter_text>(c) Steam Tables<jupyter_code>%%showcalc
h_fg = h[4]-h[1]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.188110281447444, 'fraction_numerical': 0.035324526134405516, 'mean_word_length': 7.817721518987342, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '15288', 'license': 'MIT', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1454, 'n_words': 237, 'path': 'examples/ME321-Thermodynamics_II/05 - Chapter 12 Thermodynamic Property Relations/Ex12.1 Clapeyron Equation.ipynb', 'repo_name': 'johnfmaddox/kilojoule', 'size': '3490'}