Exemplo n.º 1
0
    def test_phase_of_matter(self):
        self.water.TP = 300, 101325
        self.assertEqual(self.water.phase_of_matter, "liquid")
        self.water.TP = 500, 101325
        self.assertEqual(self.water.phase_of_matter, "gas")
        self.water.TP = self.water.critical_temperature * 2, 101325
        self.assertEqual(self.water.phase_of_matter, "supercritical")
        self.water.TP = 300, self.water.critical_pressure * 2
        self.assertEqual(self.water.phase_of_matter, "supercritical")
        self.water.TQ = 300, 0.4
        self.assertEqual(self.water.phase_of_matter, "liquid-gas-mix")

        # These cases work after fixing GH-786
        n2 = ct.Nitrogen()
        n2.TP = 100, 1000
        self.assertEqual(n2.phase_of_matter, "gas")

        co2 = ct.CarbonDioxide()
        self.assertEqual(co2.phase_of_matter, "gas")
Exemplo n.º 2
0
 def test_temperature_limits(self):
     co2 = ct.CarbonDioxide()
     self.assertNear(co2.min_temp, 216.54)
     self.assertNear(co2.max_temp, 1500.0)
Exemplo n.º 3
0
@author: mohith_sai
"""
"""
Print the critical state properties for the fluids for which Cantera has
built-in liquid/vapor equations of state.
"""

import cantera as ct

fluids = {
    'water': ct.Water(),
    'nitrogen': ct.Nitrogen(),
    'methane': ct.Methane(),
    'hydrogen': ct.Hydrogen(),
    'oxygen': ct.Oxygen(),
    'carbon dioxide': ct.CarbonDioxide(),
    'heptane': ct.Heptane(),
    'hfc134a': ct.Hfc134a()
}

print('Critical State Properties')
print('%20s  %10s  %10s  %10s' % ('Fluid', 'Tc [K]', 'Pc [Pa]', 'Zc'))
for name in fluids:
    f = fluids[name]
    tc = f.critical_temperature
    pc = f.critical_pressure
    rc = f.critical_density
    mw = f.mean_molecular_weight
    zc = pc * mw / (rc * ct.gas_constant * tc)
    print('%20s   %10.4g   %10.4G  %10.4G' % (name, tc, pc, zc))