{ "cells": [ { "cell_type": "markdown", "id": "4941b17f", "metadata": {}, "source": [ "# Ideal-gas properties \n", "\n", "See the appendix of https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=933725 for the mathematical representations. They can be summarized like so:\n", "\n", "$\n", "u_{\\rm ig} = RT\\left((1/T)\\left(\\frac{\\partial\\alpha_{\\rm ig}}{\\partial(1/T)}\\right)_{\\delta}\\right) = RT\\left(\\tau\\left(\\frac{\\partial\\alpha_{\\rm ig}}{\\partial\\tau}\\right)_{\\delta}\\right)\n", "$\n", "\n", "$\n", "h_{\\rm ig} = RT\\left(1+(1/T)\\left(\\frac{\\partial\\alpha_{\\rm ig}}{\\partial(1/T)}\\right)_{\\delta}\\right) = RT\\left(1+\\tau\\left(\\frac{\\partial\\alpha_{\\rm ig}}{\\partial\\tau}\\right)_{\\delta}\\right)\n", "$\n", "\n", "$\n", "s_{\\rm ig} = R\\left((1/T)\\left(\\frac{\\partial\\alpha_{\\rm ig}}{\\partial(1/T)}\\right)_{\\delta}-\\alpha_{\\rm ig}\\right) = R\\left(\\tau\\left(\\frac{\\partial\\alpha_{\\rm ig}}{\\partial\\tau}\\right)_{\\delta}-\\alpha_{\\rm ig}\\right)\n", "$\n", "\n", "The precise reference state used in Table A-22 of Moran and Shapiro is unknown, but they are based on the gas tables from the 1950s at the then National Bureau of Standards (now NIST). According to [a summary report from one year later](https://www.govinfo.gov/content/pkg/GOVPUB-C13-89baf9f9b4a43e5f25820bd51b0f3f11/pdf/GOVPUB-C13-89baf9f9b4a43e5f25820bd51b0f3f11.pdf), the enthalpy and Gibbs energy (and therefore also the entropy because $g=h-Ts$) are set to 0 at 0 K. This differs to the reference state used in [the pseudo-pure Air EOS](https://coolprop.org/fluid_properties/fluids/Air.html#fluid-air), but the offset is identical, as shown here:" ] }, { "cell_type": "code", "execution_count": 1, "id": "73e08117", "metadata": { "execution": { "iopub.execute_input": "2025-10-29T03:48:09.574902Z", "iopub.status.busy": "2025-10-29T03:48:09.574351Z", "iopub.status.idle": "2025-10-29T03:48:10.451559Z", "shell.execute_reply": "2025-10-29T03:48:10.451008Z" } }, "outputs": [], "source": [ "import CoolProp.CoolProp as CP" ] }, { "cell_type": "code", "execution_count": 2, "id": "b3b3722e", "metadata": { "execution": { "iopub.execute_input": "2025-10-29T03:48:10.453711Z", "iopub.status.busy": "2025-10-29T03:48:10.453271Z", "iopub.status.idle": "2025-10-29T03:48:10.458999Z", "shell.execute_reply": "2025-10-29T03:48:10.458560Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "T: 200 u: 268.7943717754444 h: 326.2041971329565 s: 1.8560457472717602 deltau: 126.2343717754444 deltah: 126.2341971329565 deltas: 0.5604557472717602\n", "T: 440 u: 441.7087305389626 h: 568.010346325489 s: 2.649670290945472 deltau: 126.40873053896257 deltah: 126.40034632548895 deltas: 0.5609702909454723\n", "T: 740 u: 670.468780219468 h: 882.8851340422626 s: 3.193835221127113 deltau: 126.44878021946806 deltah: 126.44513404226257 deltas: 0.561035221127113\n" ] } ], "source": [ "# Some check values from Moran & Shapiro, 6th edition, Table A-22\n", "Ts = [200, 440, 740]\n", "hs = [199.97, 441.61, 756.44]\n", "ss = [1.29559, 2.08870, 2.63280]\n", "us = [142.56, 315.30, 544.02]\n", "\n", "for T, h0, s0, u0 in zip(Ts, hs, ss, us):\n", " AS = CP.AbstractState(\"HEOS\", \"Air\")\n", " # Use the density obtained from Z=1\n", " rho = 101325/(CP.PropsSI('molemass','Air')*T)\n", " AS.update(CP.DmolarT_INPUTS, rho, T)\n", " R = AS.gas_constant()/AS.molar_mass()\n", " RT = R*T\n", " ucalc_kJkg = RT*(AS.tau()*AS.dalpha0_dTau())/1000 # kJ/kg\n", " hcalc_kJkg = RT*(1+AS.tau()*AS.dalpha0_dTau())/1000 # kJ/kg\n", " scalc_kJkgK = R*(AS.tau()*AS.dalpha0_dTau()-AS.alpha0())/1000 # kJ/kg/K\n", " print('T:', T, 'u:', ucalc_kJkg, 'h:', hcalc_kJkg, 's:', scalc_kJkgK, 'deltau:', ucalc_kJkg-u0, 'deltah:', hcalc_kJkg-h0, 'deltas:', scalc_kJkgK-s0)" ] }, { "cell_type": "markdown", "id": "2990c24c-5c54-4450-a6d1-871d166b1a1c", "metadata": {}, "source": [ "As of version 7.2, you can also get the ideal-gas properties directly from the model without additional work:" ] }, { "cell_type": "code", "execution_count": 3, "id": "f3f6353b-4fae-4ed6-8646-3604aed4d0a9", "metadata": { "execution": { "iopub.execute_input": "2025-10-29T03:48:10.460421Z", "iopub.status.busy": "2025-10-29T03:48:10.460261Z", "iopub.status.idle": "2025-10-29T03:48:10.464623Z", "shell.execute_reply": "2025-10-29T03:48:10.464246Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "T: 200 u: 268.7943717754444 h: 326.20419713295644 s: 1.85604574727176 deltau: 126.2343717754444 deltah: 126.23419713295644 deltas: 0.56045574727176\n", "T: 440 u: 441.7087305389625 h: 568.010346325489 s: 2.6496702909454717 deltau: 126.40873053896252 deltah: 126.40034632548895 deltas: 0.5609702909454719\n", "T: 740 u: 670.4687802194679 h: 882.8851340422626 s: 3.193835221127113 deltau: 126.44878021946795 deltah: 126.44513404226257 deltas: 0.561035221127113\n" ] } ], "source": [ "for T, h0, s0, u0 in zip(Ts, hs, ss, us):\n", " AS = CP.AbstractState(\"HEOS\", \"Air\")\n", "\n", " # Use the density obtained from Z=1\n", " rho = 101325/(CP.PropsSI('molemass','Air')*T)\n", " AS.update(CP.DmolarT_INPUTS, rho, T)\n", " R = AS.gas_constant()/AS.molar_mass()\n", " RT = R*T\n", " ucalc_kJkg = AS.umass_idealgas()/1000 # kJ/kg\n", " hcalc_kJkg = AS.hmass_idealgas()/1000 # kJ/kg\n", " scalc_kJkgK = AS.smass_idealgas()/1000 # kJ/kg/K\n", " print('T:', T, 'u:', ucalc_kJkg, 'h:', hcalc_kJkg, 's:', scalc_kJkgK, 'deltau:', ucalc_kJkg-u0, 'deltah:', hcalc_kJkg-h0, 'deltas:', scalc_kJkgK-s0)" ] }, { "cell_type": "markdown", "id": "456ee5f6-5939-4c02-8036-e2e099fc0065", "metadata": {}, "source": [ "Or with the high-level interface (less efficient computationally)" ] }, { "cell_type": "code", "execution_count": 4, "id": "086d4495-69b5-409b-bd5e-355b1356a21e", "metadata": { "execution": { "iopub.execute_input": "2025-10-29T03:48:10.466153Z", "iopub.status.busy": "2025-10-29T03:48:10.465989Z", "iopub.status.idle": "2025-10-29T03:48:10.470802Z", "shell.execute_reply": "2025-10-29T03:48:10.470389Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "T: 200 u: 268.7943717754444 h: 326.20419713295644 s: 1.85604574727176 deltau: 126.2343717754444 deltah: 126.23419713295644 deltas: 0.56045574727176\n", "T: 440 u: 441.7087305389625 h: 568.010346325489 s: 2.6496702909454717 deltau: 126.40873053896252 deltah: 126.40034632548895 deltas: 0.5609702909454719\n", "T: 740 u: 670.4687802194679 h: 882.8851340422626 s: 3.193835221127113 deltau: 126.44878021946795 deltah: 126.44513404226257 deltas: 0.561035221127113\n" ] } ], "source": [ "for T, h0, s0, u0 in zip(Ts, hs, ss, us):\n", " # Use the density obtained from Z=1\n", " rho = 101325/(CP.PropsSI('molemass','Air')*T)\n", " ucalc_kJkg = CP.PropsSI('Umass_idealgas','T|phase_gas',T,'Dmolar',rho,'Air')/1000 # kJ/kg\n", " hcalc_kJkg = CP.PropsSI('Hmass_idealgas','T|phase_gas',T,'Dmolar',rho,'Air')/1000 # kJ/kg\n", " scalc_kJkgK = CP.PropsSI('Smass_idealgas','T|phase_gas',T,'Dmolar',rho,'Air')/1000 # kJ/kg/K\n", " print('T:', T, 'u:', ucalc_kJkg, 'h:', hcalc_kJkg, 's:', scalc_kJkgK, 'deltau:', ucalc_kJkg-u0, 'deltah:', hcalc_kJkg-h0, 'deltas:', scalc_kJkgK-s0)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.3" } }, "nbformat": 4, "nbformat_minor": 5 }