{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "8bec74cc", "metadata": {}, "outputs": [], "source": [ "import si_units as si\n", "import feos\n", "\n", "parameters = feos.Parameters.from_json(\n", " substances=['methanol', '1-propanol'], \n", " pure_path='../../parameters/pcsaft/gross2002.json'\n", ")\n", "ideal_gas_parameters = feos.Parameters.from_json(\n", " substances=['methanol', '1-propanol'], \n", " pure_path='../../parameters/ideal_gas/poling2000.json'\n", ")\n", "eos = feos.EquationOfState.pcsaft(parameters).dippr(ideal_gas_parameters)" ] }, { "cell_type": "markdown", "id": "0ace1cfd", "metadata": {}, "source": [ "## Tp-flash" ] }, { "cell_type": "code", "execution_count": null, "id": "e11fa945", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " dew point pressure: 0.6356 bar\n", "bubble point pressure: 0.9245 bar\n" ] }, { "data": { "text/markdown": [ "||temperature|density|molefracs|\n", "|-|-|-|-|\n", "|phase 1|350.00000 K|28.75751 mol/m³|[0.59847, 0.40153]|\n", "|phase 2|350.00000 K|14.29164 kmol/m³|[0.28954, 0.71046]|\n" ], "text/plain": [ "phase 0: T = 350.00000 K, ρ = 28.75751 mol/m³, x = [0.59847, 0.40153]\n", "phase 1: T = 350.00000 K, ρ = 14.29164 kmol/m³, x = [0.28954, 0.71046]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x1 = 0.4\n", "temperature = 350*si.KELVIN\n", "\n", "p_bubble = feos.PhaseEquilibrium.bubble_point(eos, temperature, x1).liquid.pressure()\n", "p_dew = feos.PhaseEquilibrium.dew_point(eos, temperature, x1).vapor.pressure()\n", "print(f\"bubble point pressure: {p_bubble/si.BAR:.4} bar\")\n", "print(f\" dew point pressure: {p_dew/si.BAR:.4} bar\")\n", "\n", "feos.PhaseEquilibrium.tp_flash(eos, temperature, 0.8*si.BAR, x1)" ] }, { "cell_type": "markdown", "id": "73c81e37", "metadata": {}, "source": [ "## ph-flash" ] }, { "cell_type": "code", "execution_count": null, "id": "b3acf88f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bubble point\ttemperature: 352.06 K\tenthalpy: -36.5900 kJ/mol\n", " dew point\ttemperature: 361.09 K\tenthalpy: 3.9800 kJ/mol\n" ] }, { "data": { "text/markdown": [ "||temperature|density|molefracs|\n", "|-|-|-|-|\n", "|phase 1|360.47941 K|34.58586 mol/m³|[0.42362, 0.57638]|\n", "|phase 2|360.47941 K|13.28059 kmol/m³|[0.17482, 0.82518]|\n" ], "text/plain": [ "phase 0: T = 360.47941 K, ρ = 34.58586 mol/m³, x = [0.42362, 0.57638]\n", "phase 1: T = 360.47941 K, ρ = 13.28059 kmol/m³, x = [0.17482, 0.82518]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x1 = 0.4\n", "pressure = si.BAR\n", "bubble = feos.PhaseEquilibrium.bubble_point(eos, pressure, x1, 300*si.KELVIN).liquid\n", "dew = feos.PhaseEquilibrium.dew_point(eos, pressure, x1, 300*si.KELVIN).vapor\n", "print(f\"bubble point\\ttemperature: {bubble.temperature/si.KELVIN:.2f} K\\tenthalpy: {bubble.molar_enthalpy()/(si.KILO*si.JOULE/si.MOL):8.4f} kJ/mol\")\n", "print(f\" dew point\\ttemperature: {dew.temperature/si.KELVIN:.2f} K\\tenthalpy: {dew.molar_enthalpy()/(si.KILO*si.JOULE/si.MOL):8.4f} kJ/mol\")\n", "\n", "feos.PhaseEquilibrium.ph_flash(eos, pressure, 0*si.JOULE/si.MOL, x1, 356*si.KELVIN)" ] } ], "metadata": { "kernelspec": { "display_name": "feos_devel", "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.14.0" } }, "nbformat": 4, "nbformat_minor": 5 }