%%
%% This is file `thermodynamics-examples.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% thermodynamics.dtx  (with options: `example')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2022-2023 by Karl D. Hammond
%% 
%% Karl D. Hammond,
%% Department of Chemical Engineering
%% University of Missouri
%% Contact: hammondkd@missouri.edu
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%^^A            = C_i \gammamol_i \Henrymol_i
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{thermodynamics}
\title{Examples to Accompany the \textsf{thermodynamics} Package}
\author{Karl D. Hammond}
\date{}
\begin{document}
\NewThermodynamicProperty{B}{B}
\maketitle\noindent
The combined laws:
\begin{align*}
  d\Et &= d\Ut + d\left(\frac12 m v^2\right) - d(m\phi) \\
  d\Ut &= \dbar\Qt + \dbar\Wt + \Um d\Nt
        = \dbar\Qt - P d\Vt + \Hm d\Nt
    \\ &= \Partial*{\Ut}{\St}{\Vt,\allNs} d\St
        + \Partial*{\Ut}{\Vt}{\St,\allNs} d\Vt
        + \sumall_i \Partial*{\Ut}{\Nt_i}{\Vt,\St,\allNsbut{i}} d\Nt_i
    \\ &= T d\St - P d\Vt + \sumall_i \mu_i d\Nt_i
\end{align*}
With surfaces present:
\begin{gather*}
   d\Ut = T d\St - P d\Vt  + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Ht = T d\St + \Vt dP  + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Ft = -\St dT - P d\Vt + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Gt = -\St dT + \Vt dP + \sigma d\At + \sumall_i \mu_i d\Nt_i \\
   d\Lt = -\St dT - P d\Vt + \sigma d\At - \sumall_i \Nt_i d\mu_i \\
    \Bt = \Ut + P\Vt - T\St - \sigma\At \\
   d\Bt = -\St dT + \Vt dP - \At d\sigma + \sumall_i \mu_i d\Nt_i \\
   \mu_i = \Bpm_i = \Gpm_i + \sigma \Apm_i
\end{gather*}
Some Maxwell reciprocity relations:
\begin{gather*}
  \Partial*{\Vt}{T}{P,\allNs}
    = \PartialMixSecond*{\Gt}{T}{P}{\allNs}
    = \PartialMixSecond*{\Gt}{P}{T}{\allNs}
    = -\Partial{\St}{P}{T,\allNs}
\\
    \Partial*{\Gpm_i}{T}{P,\allXs}
    = \PartialMixSecond*{\Gt}{T}{\Nt_i}{P,\allNsbut{i}}
    = \PartialMixSecond*{\Gt}{\Nt_i}{T}{P,\allNsbut{i}}
    = -\Partial*{\St}{\Nt_i}{T,P,\allNsbut{i}}
    = -\Spm_i
\end{gather*}
Temporary changes of derivative delimiters:
\begin{gather*}
  \begin{thermobrackets}
    \Partial*{\Vt}{T}{P,\allNs}
  \end{thermobrackets}
  \begin{thermobar}
    = \PartialMixSecond*{\Gt}{T}{P}{\allNs}
  \end{thermobar}
  \begin{thermomolesrange}
    = \PartialMixSecond*{\Gt}{P}{T}{\allNs}
  \end{thermomolesrange}
  \begin{thermobraces}
      = -\Partial*{\St}{P}{T,\allNs}
    \begin{thermoNOsubscripts}
      \begin{thermomolesrange}
        = -\Partial{\St}{P}{T,\allNs}
      \end{thermomolesrange}
    \end{thermoNOsubscripts}
  \end{thermobraces}
\end{gather*}
Inline derivatives:
\begin{gather*}
  \mu_i = \Partialinline{\Gt}{\Nt_i}{T,P,\allNsbut{i}}
        = \Partialinline{\Ft}{\Nt_i}{T,\Vt,\allNsbut{i}}
        = \Partialinline{\Ht}{\Nt_i}{\St,P,\allNsbut{i}}
        = \Partialinline{\Ut}{\Nt_i}{\St,\Vt,\allNsbut{i}}
\end{gather*}
The heat capacities:
\begin{gather*}
  \cV = T \Partial*{\Sm}{T}{\Vm,\allXs} = \Partial*{\Um}{T}{\Vm,\allXs}
      = -T\PartialSecond{\Fm}{T}{\Vm,\allXs}
  \\
  \cP^\IGM = T \Partial*{\Sm^\IGM}{T}{P,\allYs}
           = \Partial*{\Hm^\IGM}{T}{P,\allYs}
    \begin{thermobrackets}
      = -T\PartialSecond{\Gm^\IGM}{T}{P,\allYs}
    \end{thermobrackets}
  \\
  \cVt = T \Partial*{\St}{T}{\Vt,\allNs} = \Partial*{\Ut}{T}{\Vt,\allNs}
    \begin{thermobraces}
       = -T\PartialSecond{\Ft}{T}{\Vm,\allNs}
    \end{thermobraces}
  \\
    \begin{thermobar}
  \cPt = T \Partial*{\St}{T}{P,\allNs} = \Partial*{\Ht}{T}{P,\allNs}
       = -T\PartialSecond{\Gt}{T}{P,\allNs}
    \end{thermobar}
  \\
  \cVs = T \Partial*{\Ss}{T}{\Vs,\allWs} = \Partial*{\Us}{T}{\Vs,\allWs}
    \begin{thermoplain}
       = -T\PartialSecond{\Fs}{T}{\Vs,\allWs}
    \end{thermoplain}
  \\
  \cPs = T \Partialbigg*{\Ss}{T}{P,\allWs} = \Partialbigg*{\Hs}{T}{P,\allWs}
       = -T\PartialSecondbigg{\Gs}{T}{P,\allWs}
  \\
\begin{split}
  \cPpm_i &= \Partial*{\cPt}{\Nt_i}{T,P,\allNsbut{i}}
           = T \PartialMixSecond*{\St}{\Nt_i}{T}{P,\allNsbut{i}}
           = T \PartialMixSecond*{\St}{T}{\Nt_i}{P,\allNsbut{i}}
       \\ &= T \Partial*{\Spm_i}{T}{P,\allXs}
           = \Partial*{\Hpm_i}{T}{P,\allXs}
           = \PartialMixSecond*{\Ht}{T}{\Nt_i}{P,\allNsbut{i}}
           = \PartialMixSecond*{\Ht}{\Nt_i}{T}{P,\allNsbut{i}}
       \\ &= -T\PartialSecond*{\Gpm_i}{T}{P,\allXs}
           = -T\Partial{{}^3 \Gt}{T^2\partial \Nt_i}{P,\allNsbut{i}}
\end{split}
\end{gather*}
Other measurable quantities:
\begin{align*}
  \alphaS &= \frac{1}{\Vm} \Partial{\Vm}{T}{\Sm} &
  \alphaP &= \frac{1}{\Vm} \Partial{\Vm}{T}{P} \\
  \kappaS &= -\frac{1}{\Vm} \Partial{\Vm}{P}{\Sm} &
  \kappaT &= -\frac{1}{\Vm} \Partial{\Vm}{P}{T}
\end{align*}
The chemical potential, fugacity, and activity:
\[ \mu_i = \Gpm_i = \Gm_i^\std + RT \ln a_i
         = \Gm_i^\std + RT\ln\left(\frac{\fmix_i}{\fstd_i}\right) \]
Equilibrium in a chemical reaction:
\[ \sumall_i \nu_i \mu_i = 0
    \Rightarrow
    \exp\left(\frac{-\Delta\Gm^\std}{RT}\right) = K = \prodall_i a_i^{\nu_i} \]
Partial molar quantities:
\begin{align*}
  \Hpm{i} &= \Partial*{\Ht}{\Nt_i}{T,P,\allNsbut{i}}
           = \Hm + \Nt \Partial*{\Hm}{\Nt_i}{T,P,\allNsbut{i}}
       \\ &= \Hm + \Partial*{\Hm}{x_i}{T,P,\allXsbut{i}}
                 - \sumallbutlast_j x_j \Partial*{\Hm}{x_j}{T,P,\allXsbut{j}}
           = \Partial*{\Hm}{x_i}{T,P,\allXsbut{i}} + \Hpm_\ncomponents
\end{align*}
\[ \Vpm_i = \Partial{\Vt}{\Nt_i}{T,P,\allNsbut{i}} \]
Fugacity and related properties:
\begin{gather*}
  \Gpm_i = \mu_i
         = \Gm_i^\std(T) + RT\ln a_i
         = \Gm_i^\std(T) + RT\ln\left(\frac{\fmix_i}{\fstd_i}\right)
  \\
  a_i = \frac{\fmix_i}{\fstd_i}
      = x_i \gamma_i
                \exp\left(\frac{1}{RT} \int_{\Pstd}^P \Vm_i(T,p)\,dp\right)
      \approx x_i \gamma_i
  \\
  \begin{split}
  \fmix_i &= x_i \phimix_i P
           = x_i \gamma_i \fpure_i = x_i \gamma_i \phipure_i P
           = x_i \gammarat_i \Henryrat_i
           = C_i \gammamol_i \Henrymol_i
           = x_i \gamma_i \fsat_i
                 \exp\left(\frac{1}{RT} \int_{\Psat_i}^P \Vm_i(T,p)\,dp\right)
       \\ &= x_i \gamma_i \Psat_i \phisat_i
                \exp\left(\frac{1}{RT} \int_{\Psat_i}^P \Vm_i(T,p)\,dp\right)
          \approx x_i \gamma_i \Psat_i
  \end{split}
\end{gather*}
Chemical Equilibria:
\begin{gather*}
  \Deltarxn\Hm^\std = \sumall_i \nu_i \Deltaf\Hm_i^\std \\
  \Deltarxn\Gm^\std = \sumall_i \nu_i \Deltaf\Gm_i^\std
                    = \sumall_i \nu_i \mu_i^\std \\
  \Deltarxn\cP^\std = \sumall_i \nu_i \cP_i^\std \\
  \mu_i = \mu_i^\std + RT\ln a_i \\
  a_i = \begin{cases}
\displaystyle
     \frac{y_i \phimix_i P}{\Pstd} \approx \frac{y_i P}{\Pstd}
        & \text{(gases)} \\
\rule{0pt}{5ex}%
\displaystyle
     x_i \gamma_i \exp\left(\frac{1}{RT} \int_{\Pstd}^P \Vm_i(T,p)\,dp\right)
     \approx
     x_i \gamma_i \exp\left(\frac{\Vm_i(P-\Pstd)}{RT}\right)
     \approx x_i \gamma_i \approx 1
        & \text{(solids, solvents)} \\
\displaystyle
\rule{0pt}{5ex}%
     \frac{C_i \gammamol_i}{C_i^\std}
        \exp\left(\frac{1}{RT}
        \int_{\Pstd}^P \Vpm_i^\infty(T,p,\allXs)\,dp\right)
     \approx
     \frac{C_i \gammamol_i}{C_i^\std} \approx \frac{C_i}{C_i^\std}
        & \text{(solutes)}
        \end{cases}
\end{gather*}
Phase change properties:
\begin{gather*}
  \Deltafus\Sm = \Sm^L - \Sm^S \\
  \Deltasub\Vm = \Vm^V - \Vm^S \\
  \Deltavap\Gm = \Gm^V - \Gm^L
\end{gather*}
Specific properties:
\newcommand*{\Btilde}[2][]{\widetilde{B}_{#2}^{#1}}
\[ \Btilde{j} \equiv \Partial{\Bt}{m_j}{T,\Vs,\allMsbut[i]{j}} \]
and thus
\[ \Btilde{i}
    = \frac{\Bpm{i}}{M_i}
        + \Biggl(\Vs - \frac{\Vpm_i}{M_i}\Biggr)
          \Partial*{\Bs}{\Vs}{T,\allMs}
    = \frac{\Bpm{i}}{M_i}
        + \Biggl(\Vs - \frac{\Vpm_i}{M_i}\Biggr)
          \Partial{\Bs}{\Vs}{T,m,\allWs} \]
and
\[ \Bs = \sumall_i w_i \Btilde{i}. \]
Excess and Residual (Departure) Properties:
\begin{align*}
  \HR &= \Hm - \Hm^\IG &
  \FR &= \Fm - \Fm^\IGM \\
  \SE &= \Sm - \Sm^\IS &
  \VRpm_k &= \Vpm_k - \Vpm_k^\IGM
\end{align*}
Jacobians:
\begin{gather*}
  \Jacobian{\St,\Vt}{T,P} = \Jacobiandet{\St,\Vt}{T,P} \\
  \Jacobian{f,g,h}{x,y,z} = \Jacobiandet[\displaystyle]{f,g,h}{x,y,z} \\
  \Jacobian{h_1,\dots,h_k}{z_1,\dots,z_k} =
      \Jacobiandet{h_1,\dots,h_k}{z_1,\dots,z_k} \\
  \cP = T\Partial{\Sm}{T}{P}
      = T\Jacobian{\Sm,P}{T,P}
      = -T\Jacobian{\Sm,P}{T,\Vm} \Jacobian{T,\Vm}{T,P}
      = -T\Jacobian{P,\Sm}{\Vm,\Sm} \Jacobian{\Vm,\Sm}{T,\Vm}
          \Jacobian{T,\Vm}{T,P}
      = \gamma \cV
\end{gather*}
\end{document}
\endinput
%%
%% End of file `thermodynamics-examples.tex'.
