5353print ("\n 2. COMPARING EoS FOR NATURAL GAS" )
5454print ("-" * 40 )
5555
56+
5657# Define composition
5758def create_natural_gas (eos_name ):
5859 """Create a natural gas mixture with specified EoS."""
@@ -68,6 +69,7 @@ def create_natural_gas(eos_name):
6869 gas .setMixingRule ("classic" )
6970 return gas
7071
72+
7173# Conditions
7274temp_c = 25.0
7375pressure_bara = 100.0
@@ -85,16 +87,16 @@ def create_natural_gas(eos_name):
8587 TPflash (gas )
8688 gas .initThermoProperties ()
8789 gas .initPhysicalProperties ()
88-
90+
8991 z = gas .getZ ()
9092 rho = gas .getDensity ("kg/m3" )
9193 cp = gas .getCp ("J/molK" )
92-
94+
9395 if gas .hasPhaseType ("gas" ):
9496 sos = gas .getPhase ("gas" ).getSoundSpeed ()
9597 else :
9698 sos = gas .getPhase (0 ).getSoundSpeed ()
97-
99+
98100 print (f"{ eos :11} | { z :9.5f} | { rho :9.2f} | { cp :9.2f} | { sos :8.1f} " )
99101 except Exception as e :
100102 print (f"{ eos :11} | Error: { e } " )
@@ -106,6 +108,7 @@ def create_natural_gas(eos_name):
106108print ("-" * 40 )
107109print ("CPA handles hydrogen bonding (association) in water and alcohols" )
108110
111+
109112def create_wet_gas (eos_name ):
110113 """Create a wet gas mixture with specified EoS."""
111114 if eos_name == "cpa" :
@@ -114,13 +117,14 @@ def create_wet_gas(eos_name):
114117 else :
115118 gas = fluid (eos_name )
116119 gas .setMixingRule ("classic" )
117-
120+
118121 gas .addComponent ("methane" , 90.0 , "mol%" )
119122 gas .addComponent ("ethane" , 5.0 , "mol%" )
120123 gas .addComponent ("water" , 5.0 , "mol%" )
121124 gas .setMultiPhaseCheck (True )
122125 return gas
123126
127+
124128print (f"\n Conditions: T = 25°C, P = 50 bara" )
125129print ("Wet natural gas with 5 mol% water" )
126130print ("\n EoS | # Phases | Gas Density | Water in Gas Phase" )
@@ -134,9 +138,9 @@ def create_wet_gas(eos_name):
134138 gas .setPressure (50.0 , "bara" )
135139 TPflash (gas )
136140 gas .initThermoProperties ()
137-
141+
138142 n_phases = gas .getNumberOfPhases ()
139-
143+
140144 if gas .hasPhaseType ("gas" ):
141145 gas_phase = gas .getPhase ("gas" )
142146 rho = gas_phase .getDensity ("kg/m3" )
@@ -146,7 +150,7 @@ def create_wet_gas(eos_name):
146150 else :
147151 rho = gas .getPhase (0 ).getDensity ("kg/m3" )
148152 water_in_gas = 0.0
149-
153+
150154 print (f"{ eos :6} | { n_phases :8} | { rho :11.2f} | { water_in_gas :.6f} " )
151155 except Exception as e :
152156 print (f"{ eos :6} | Error: { e } " )
@@ -167,7 +171,7 @@ def create_wet_gas(eos_name):
167171 heptane .setPressure (1.01325 , "bara" )
168172 TPflash (heptane )
169173 heptane .initThermoProperties ()
170-
174+
171175 rho = heptane .getDensity ("kg/m3" )
172176 print (f"{ eos .upper ()} : { rho :.1f} kg/m³" )
173177
@@ -193,7 +197,7 @@ def create_wet_gas(eos_name):
193197 co2 .setPressure (80.0 , "bara" )
194198 TPflash (co2 )
195199 co2 .initThermoProperties ()
196-
200+
197201 rho = co2 .getDensity ("kg/m3" )
198202 z = co2 .getZ ()
199203 print (f"{ eos :13} | { rho :15.2f} | { z :.5f} " )
@@ -205,7 +209,8 @@ def create_wet_gas(eos_name):
205209# =============================================================================
206210print ("\n 6. EOS-CG FOR CO2 AND COMBUSTION GASES" )
207211print ("-" * 40 )
208- print ("""
212+ print (
213+ """
209214EOS-CG (Equation of State for Combustion Gases) is based on GERG-2008
210215but optimized for CO2-rich mixtures and combustion product gases.
211216
@@ -217,7 +222,8 @@ def create_wet_gas(eos_name):
217222 - Blue/green hydrogen with CO2
218223
219224Components: CO2, N2, O2, Ar, H2O, CO, H2, H2S, SO2, CH4
220- """ )
225+ """
226+ )
221227
222228# Create a typical flue gas / CCS mixture
223229print ("Example: CO2-rich CCS mixture" )
@@ -239,7 +245,7 @@ def create_wet_gas(eos_name):
239245 ccs_gas .setPressure (100.0 , "bara" )
240246 TPflash (ccs_gas )
241247 ccs_gas .initThermoProperties ()
242-
248+
243249 rho = ccs_gas .getDensity ("kg/m3" )
244250 z = ccs_gas .getZ ()
245251 print (f"{ eos :13} | { rho :15.2f} | { z :.5f} " )
@@ -254,7 +260,8 @@ def create_wet_gas(eos_name):
254260# =============================================================================
255261print ("\n 7. GUIDELINES FOR EoS SELECTION" )
256262print ("-" * 40 )
257- print ("""
263+ print (
264+ """
258265Application | Recommended EoS
259266-------------------------------------|----------------------
260267Natural gas properties | GERG-2008 (most accurate)
@@ -279,5 +286,6 @@ def create_wet_gas(eos_name):
279286Gas hydrates | CPA with hydrate model
280287 |
281288Electrolyte solutions (brine) | Electrolyte-CPA
282- """ )
289+ """
290+ )
283291print ("=" * 70 )
0 commit comments