\section{PV tutorial: butane in a domestic gas lighter} \label{sec:tutorial-butane-pv} This tutorial uses a rigid lighter reservoir containing liquid and vapour butane to build a reproducible LuaCoolProp teaching sequence. The statement, graphical reasoning, and numerical checks are presented in English; every diagram is generated from CoolProp data. The four tasks are to identify phase regions, recognize the ideal-gas limit, locate the initial state, and predict the effect of heating the closed rigid reservoir. A separate mechanical ignition analysis is outside this PV tutorial. \begin{LCPNote}[What the five generated pages show] The executable file \texttt{tutorial/butane-pv.tex} produces one five-page PDF. Page~1 is the unannotated student worksheet. Page~2 identifies the phase regions and critical isotherm. Page~3 overlays the ideal-gas prediction on the $515\,\mathrm K$ isotherm. Page~4 obtains the initial tank state from a TikZ intersection and reports its pressure, specific volume, and mass. Page~5 draws the isochoric heating path and obtains the new vapour quality from the same process call. \end{LCPNote} \subsection{Translate the exercise into thermodynamic data} The working fluid is pure normal butane. CoolProp accepts \texttt{Butane} for this fluid. The tank dimensions and initial state are \[ V=(4\,\mathrm{cm})(1\,\mathrm{cm})(1\,\mathrm{cm}) =4.0\times10^{-6}\,\mathrm{m^3}, \qquad T_A=305\,\mathrm K, \] and $70\%$ of the butane mass is liquid. LuaCoolProp and CoolProp use vapour mass quality, so the remaining $30\%$ gives \[ x_A=0.30. \] For a pure substance the liquid and vapour contain the same molecular species, but \key{quality} should still be read as a mass fraction in the package API. The exercise can be assigned progressively: \begin{enumerate} \item delimit compressed liquid, liquid--vapour equilibrium, and superheated vapour; identify the critical isotherm; \item use the shape of the $515\,\mathrm K$ isotherm to identify where the ideal-gas approximation becomes credible; \item locate $A$ from $T_A$ and $x_A$, then read $p_A$ and $v_A$ and calculate $m=V/v_A$; and \item deduce the path followed when the sealed rigid tank is heated and the direction in which its vapour quality changes. \end{enumerate} This is an especially useful introduction to PV coordinates because every piece of graphical geometry has a direct physical interpretation: an isotherm has a horizontal two-phase plateau, an isochore is vertical, and the dilute-gas limit is a straight line of slope $-1$ on logarithmic axes. \subsection{Keep one executable source for all five stages} The tutorial consists of a thin multi-page driver and one shared graphical implementation: \begin{center} \begin{tabularx}{\textwidth}{@{}>{\raggedright\arraybackslash\ttfamily}p{.42\textwidth}>{\raggedright\arraybackslash}X@{}} \toprule File & Responsibility \\ \midrule tutorial/butane-pv.tex & Selects the standalone multi-picture document.\\ tutorial/source/butane-pv-diagrams.tex & Defines the common background, annotations, named construction paths, state exports, and five stages.\\ \bottomrule \end{tabularx} \end{center} The driver contains no thermodynamic value: \begin{LCPExample}{Five-page standalone driver} \documentclass[tikz,border=5mm,multi={tikzpicture}]{standalone} \input{tutorial/source/butane-pv-diagrams.tex} \end{LCPExample} Keeping the diagram in one implementation means that a changed pressure range, fluid model, or quality grid updates both the worksheet and every solution stage. No correction is drawn on top of a stale imported image. \subsection{Step 1: build a readable log--log worksheet} The worksheet uses pascals, while LuaCoolProp's default PV pressure coordinate is bar. Set \key{pressure scale=1} on every generated family and label the Y axis in pascals. Specific volume already uses $\mathrm{m^3\,kg^{-1}}$, so its default scale remains one. \begin{LCPExample}{Common PV axis in SI units} \LCPSetup{fluid=Butane} \begin{tikzpicture} \begin{loglogaxis}[ lcp fluid=Butane, width=17cm,height=11cm, xmin=.001,xmax=1.4, ymin=50000,ymax=15000000, xlabel={Specific volume $v$ (\si{\cubic\metre\per\kilogram})}, ylabel={Pressure $p$ (\si{\pascal})}, grid=both,clip mode=individual, auto node placement, auto node algorithm=repair, auto node bbox mode=oriented, auto node failure mode=hide-low-priority ] % Quality curves and isotherms go here. \end{loglogaxis} \end{tikzpicture} \end{LCPExample} The range spans roughly three orders of magnitude in specific volume and two and a half in pressure. A linear plot would compress the liquid states into an unreadable strip. In a \texttt{loglogaxis}, equal distances represent equal ratios and positive coordinates are mandatory. Add the saturated boundaries and interior qualities in blue. Explicit values make the pedagogical interpolation grid reproducible: \begin{LCPExample}{Butane quality grid} \LCPAddPVQuality[ fluid=Butane, pressure min=50000,pressure max=15000000, pressure scale=1, quality values={0,0.1,0.2,0.3,0.4,0.5, 0.6,0.7,0.8,0.9,1}, quality symbol=x, quality color=blue,quality boundary color=blue, interior style={line width=.38pt}, boundary style={line width=.9pt}, labels=true,quality label pos=.2, quality label sloped=true ] \end{LCPExample} The red isotherm family is specified in kelvin to match the exercise. Below the critical temperature, LuaCoolProp generates the compressed-liquid branch, the exact saturation-pressure plateau, and the superheated-vapour branch as one named curve. \begin{LCPExample}{Butane isotherm grid in kelvin} \LCPAddPVIsotherms[ fluid=Butane, pressure min=50000,pressure max=15000000, pressure scale=1, temperature unit=K, temperature values={275,285,295,305,315,335, 365,415,425.125,515,615,715}, isotherm color=red, isotherm style={line width=.42pt}, curve style for={lcp-pv-T-425p125-K}{ densely dashed,line width=.9pt}, labels=true,isotherm label pos=.76, isotherm label sloped=true ] \end{LCPExample} Both families use adaptive sampling in log--log display coordinates. The executable source tightens \key{tolerance}, increases \key{max depth}, and increases \key{log x weight} so that the critical neighbourhood and narrow liquid branch remain smooth at worksheet size. Label placement is still entirely delegated to \pkg{pgfplots-autonode}. \begin{center} \includegraphics[page=1,width=.96\textwidth]{tutorial/butane-pv.pdf} \end{center} The first page is ready to place in an exercise statement. It contains the data needed for graphical reasoning but no phase names, selected state, or heating arrow. \subsection{Step 2: read phase regions and the critical isotherm} The $x=0$ and $x=1$ branches bound the liquid--vapour coexistence region and meet at the critical point. Compressed liquid lies to the left, superheated vapour to the right, and two-phase equilibrium lies between them. Intermediate quality curves are meaningful only inside this coexistence region. Butane's critical constants can be queried instead of copied from a drawing: \begin{LCPExample}{Critical coordinates from the fluid macros} \LCPDeclareFluid{Butane} \pgfmathsetmacro{\ButaneCriticalVolume}{1/\LCPFluidRhocritSI} % Critical point in an SI-scaled PV axis: \fill (axis cs:\ButaneCriticalVolume,\LCPFluidPcritSI) circle[radius=2pt]; \end{LCPExample} For the CoolProp release used to build this manual, \[ T_c=425.125\,\mathrm K=151.975\,{}^\circ\mathrm C, \qquad p_c=3.796\,\mathrm{MPa}. \] The dashed curve at $425.125\,\mathrm K$ is therefore the critical isotherm $\mathcal C$ requested by the exercise. \begin{center} \includegraphics[page=2,width=.96\textwidth]{tutorial/butane-pv.pdf} \end{center} \begin{LCPWarning}[Use ``supercritical'' precisely] Crossing above $T_c$ removes the liquid--vapour phase transition, but a state is strictly in the supercritical region when both $T>T_c$ and $p>p_c$. At $T>T_c$ and $p