Coverage for backend/ahuora-compounds/ahuora_property_packages/milk/milk_modular.py: 100%
12 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-07-22 05:22 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-07-22 05:22 +0000
1"""
2Ideal Modular PP for waer and milk solids (liquid aprroxiamtion for milk solids)
3"""
4# Import Python libraries
5import logging
7from pyomo.environ import units as pyunits
9# Import IDAES cores
10from idaes.core import LiquidPhase, VaporPhase, Component, PhaseType as PT
12from idaes.models.properties.modular_properties.state_definitions import FTPx
13from idaes.models.properties.modular_properties.eos.ideal import Ideal
14from idaes.models.properties.modular_properties.phase_equil import SmoothVLE
15from idaes.models.properties.modular_properties.phase_equil.bubble_dew import (
16 IdealBubbleDew,
17)
18from idaes.models.properties.modular_properties.phase_equil.forms import fugacity
20from idaes.models.properties.modular_properties.pure.Perrys import Perrys
21from idaes.models.properties.modular_properties.pure.NIST import NIST
23# Set up logger
24_log = logging.getLogger(__name__)
27# ---------------------------------------------------------------------
28# Configuration dictionary for an ideal CO2-H2O system
29# Assumptions
30# 1. Ideal gas-liquid system
31# 2. CO2 conc. negligible in liquid phase, at equilibrium
32# 3. Properties are applicable at standard pressure (1 atm)
34# Reference Temperature : 298.15 K
35# Reference Pressure : 101325 Pa
37# Data Sources:
39# [1] NIST Webbook, https://webbook.nist.gov/
40# Retrieved 27th November, 2020. Converted from bar to Pa
41# [2] Perry's Chemical Engineers' Handbook 7th Ed.
43# Initial temperature and pressure reference:
44# Measurement and Modeling of the Phase Behavior of the
45# (Carbon Dioxide + Water) Mixture at Temperatures From 298.15 K to 448.15
46# KShu-Xin Hou, Geoffrey C. Maitland, and J. P. Martin Trusler*
47# Qatar Carbonates and Carbon Storage Research Centre
48# Department of Chemical Engineering Imperial College London,
49# South Kensington Campus, London SW7 2AZ. U.K
51milk_configuration = {
52 # Specifying components
53 "components": {
54 "water": {
55 "type": Component,
56 "dens_mol_liq_comp": Perrys,
57 "enth_mol_liq_comp": Perrys,
58 "enth_mol_ig_comp": NIST,
59 "entr_mol_ig_comp": NIST,
60 "entr_mol_liq_comp": Perrys,
61 "pressure_sat_comp": NIST,
62 "phase_equilibrium_form": {("Vap", "Liq"): fugacity},
63 "parameter_data": {
64 "mw": (18.0153e-3, pyunits.kg / pyunits.mol), # [1]
65 "pressure_crit": (220.64e5, pyunits.Pa), # [1]
66 "temperature_crit": (647, pyunits.K), # [1]
67 "dens_mol_liq_comp_coeff": {
68 "eqn_type": 1,
69 "1": (
70 5.459,
71 pyunits.kmol * pyunits.m**-3,
72 ), # [2] pg. 2-98, temperature range 273.16 K - 333.15 K
73 "2": (0.30542, None),
74 "3": (647.13, pyunits.K),
75 "4": (0.081, None),
76 },
77 "cp_mol_ig_comp_coeff": {
78 # https://webbook.nist.gov/cgi/cbook.cgi?Name=Water+&Units=SI&cTG=on&cTC=on&cTP=on
79 "A": (
80 30.09200,
81 pyunits.J / pyunits.mol / pyunits.K,
82 ), # [1] temperature range 500 K- 1700 K
83 "B": (
84 6.832514,
85 pyunits.J * pyunits.mol**-1 * pyunits.K**-1 * pyunits.kiloK**-1,
86 ),
87 "C": (
88 6.793435,
89 pyunits.J * pyunits.mol**-1 * pyunits.K**-1 * pyunits.kiloK**-2,
90 ),
91 "D": (
92 -2.534480,
93 pyunits.J * pyunits.mol**-1 * pyunits.K**-1 * pyunits.kiloK**-3,
94 ),
95 "E": (
96 0.082139,
97 pyunits.J * pyunits.mol**-1 * pyunits.K**-1 * pyunits.kiloK**2,
98 ),
99 "F": (-250.8810, pyunits.kJ / pyunits.mol),
100 "G": (202.3, pyunits.J / pyunits.mol / pyunits.K),
101 "H": (-241.83 - 45.6, pyunits.kJ / pyunits.mol),
102 },
103 "cp_mol_liq_comp_coeff": {
104 "1": (
105 2.7637e5,
106 pyunits.J / pyunits.kmol / pyunits.K,
107 ), # [2] pg 2-174, temperature range 273.16 K - 533.15 K
108 "2": (-2.0901e3, pyunits.J / pyunits.kmol / pyunits.K**2),
109 "3": (8.125, pyunits.J / pyunits.kmol / pyunits.K**3),
110 "4": (-1.4116e-2, pyunits.J / pyunits.kmol / pyunits.K**4),
111 "5": (9.3701e-6, pyunits.J / pyunits.kmol / pyunits.K**5),
112 },
113 # NIST ignores enth_mol_form_ig_comp_ref, and uses the H parameter instead.
114 "enth_mol_form_liq_comp_ref": (
115 0, # With "include_enthalpy_of_formation": False, Perrys actually ignores this.
116 pyunits.J / pyunits.mol,
117 ), # [1]
118 "entr_mol_form_liq_comp_ref": (
119 0,
120 pyunits.J / pyunits.mol / pyunits.K,
121 ), # [1]
122 "entr_mol_form_vap_comp_ref": (
123 0,# AGAIN, NIST doesn't use this
124 pyunits.J / pyunits.mol / pyunits.K,
125 ), # [1]
126 "pressure_sat_comp_coeff": {
127 "A": (4.6543, None), # [1], temperature range 255.9 K - 373 K
128 "B": (1435.264, pyunits.K),
129 "C": (-64.848, pyunits.K),
130 },
131 },
132 },
133 "milk_solid": {
134 "type": Component,
135 "valid_phase_types": PT.liquidPhase,
136 "dens_mol_liq_comp": Perrys,
137 "enth_mol_liq_comp": Perrys,
138 "entr_mol_liq_comp": Perrys,
139 "parameter_data": {
140 "mw": (232e-3, pyunits.kg / pyunits.mol), # F.Glasser et al Technical Note: Estimation of Milk Fatty Acid Yield from Milk Fat Data https://www.sciencedirect.com/science/article/pii/S0022030207717241#:~:text=The%20mean%20molecular%20weight%20of,%3D%209%20g%2Fmol).
141 "pressure_crit": (1332.96*1000, pyunits.Pa), # https://www.chemeo.com/cid/13-615-4/Oleic-Acid
142 "temperature_crit": (937.21, pyunits.K), ##https://www.chemeo.com/cid/13-615-4/Oleic-Acid aprrox as Oleic acid Joback method
143 "dens_mol_liq_comp_coeff": {
144 "eqn_type": 1,
145 "1": (
146 5.459,
147 pyunits.kmol * pyunits.m**-3,
148 ), # [2] pg. 2-98, temperature range 273.16 K - 333.15 K
149 "2": (0.30542, None),
150 "3": (647.13, pyunits.K),
151 "4": (0.081, None),
152 },
153 "cp_mol_liq_comp_coeff": {
154 "1": (
155 470599.7666604,
156 pyunits.J / pyunits.kmol / pyunits.K,
157 ), # [2] pg 2-174, temperature range 273.16 K - 533.15 K
158 "2": (-6423.9816705, pyunits.J / pyunits.kmol / pyunits.K**2),
159 "3": (32.8747223, pyunits.J / pyunits.kmol / pyunits.K**3),
160 "4": (-0.0747202, pyunits.J / pyunits.kmol / pyunits.K**4),
161 "5": (0.0000637, pyunits.J / pyunits.kmol / pyunits.K**5),
162 },
163 "enth_mol_form_liq_comp_ref": (
164 0,
165 pyunits.J / pyunits.mol,
166 ), # [1]
167 # formation is phase transition. Entropy associated with going from solid to liquid.
168 "entr_mol_form_liq_comp_ref": (
169 0,
170 pyunits.J / pyunits.mol / pyunits.K,
171 ),
172 },
173 },
174 },
175 # Specifying phases
176 "phases": {
177 "Liq": {"type": LiquidPhase, "equation_of_state": Ideal},
178 "Vap": {"type": VaporPhase, "equation_of_state": Ideal},
179 },
180 # Set base units of measurement
181 "base_units": {
182 "time": pyunits.s,
183 "length": pyunits.m,
184 "mass": pyunits.kg,
185 "amount": pyunits.mol,
186 "temperature": pyunits.K,
187 },
188 # Specifying state definition
189 "state_definition": FTPx,
190 "state_bounds": {
191 "flow_mol": (0, 10, 10000, pyunits.mol / pyunits.s),
192 "temperature": (273.15, 323.15, 1000, pyunits.K),
193 "pressure": (10000, 108900, 1e7, pyunits.Pa),
194 },
195 "pressure_ref": (612.5, pyunits.Pa),
196 "temperature_ref": (273.2, pyunits.K),
197 # Defining phase equilibria
198 "phases_in_equilibrium": [("Vap", "Liq")],
199 "phase_equilibrium_state": {("Vap", "Liq"): SmoothVLE},
200 "bubble_dew_method": IdealBubbleDew,
201 "include_enthalpy_of_formation": False,
202}