Ejemplo 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")
Ejemplo n.º 2
0
    def test_ConstPressureReactor(self):
        phase = ct.Nitrogen()
        air = ct.Solution('air.xml')

        phase.TP = 75, 4e5
        r1 = ct.ConstPressureReactor(phase)
        r1.volume = 0.1

        air.TP = 500, 4e5
        env = ct.Reservoir(air)

        w2 = ct.Wall(env,r1, Q=250000, A=1)
        net = ct.ReactorNet([r1])

        states = ct.SolutionArray(phase, extra='t')
        for t in np.arange(0.0, 100.0, 10):
            net.advance(t)
            states.append(TD=r1.thermo.TD, t=t)

        self.assertEqual(states.X[1], 0)
        self.assertEqual(states.X[-2], 1)
        for i in range(3,7):
            self.assertNear(states.T[i], states.T[2])
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 20:07:38 2020

@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
Ejemplo n.º 4
0

def atm2Pa(P):
    P = P * 101325
    return P


mr = []
cst = []
ben = []
n_cc = []
prs = []
mdots = []

#Define Fluid States
airCompIn = ct.Nitrogen()
airCompOut = ct.Nitrogen()
airTurbIn = ct.Nitrogen()
airTurbOut = ct.Nitrogen()
airHrsgOut = ct.Nitrogen()
waterPumpIn = ct.Water()
waterPumpOut = ct.Water()
waterTurbIn = ct.Water()
waterTurbOut = ct.Water()

#Define Efficiencies
n_comp = 0.8
n_turb_a = 0.85
n_Hrsg = 0.86
n_pump = 0.9
n_turb_w = 0.9