Exemple #1
0
    def test_equil(self):
        gas = ct.ThermoPhase('IdealSolidSolnPhaseExample.xml')
        gas.TPX = 500, ct.one_atm, 'C2H2-graph: 1.0'

        gas.equilibrate('TP', solver='element_potential')
        self.assertNear(gas['C-graph'].X[0], 2.0 / 3.0)
        self.assertNear(gas['H2-solute'].X[0], 1.0 / 3.0)
    def test_import_from_species(self):
        gas1 = ct.Solution('h2o2.xml')
        gas1.TPX = 350, 101325, 'H2:0.3, O2:0.7'
        gas1.equilibrate('HP')

        species = ct.Species.listFromFile('h2o2.xml')
        gas2 = ct.ThermoPhase(thermo='IdealGas', species=species)
        gas2.TPX = 350, 101325, 'H2:0.3, O2:0.7'
        gas2.equilibrate('HP')
        self.assertEqual(gas1.n_elements, gas2.n_elements)
        self.assertEqual(gas1.species_names, gas2.species_names)
        self.assertNear(gas1.T, gas2.T)
        self.assertArrayNear(gas1.X, gas2.X)
Exemple #3
0
 def setUp(self):
     self.gas = ct.ThermoPhase('h2o2.xml')
     self.gas.TPX = 450, 2e5, 'H2:1.0, O2:0.4, AR:3, H2O:0.1'
Exemple #4
0
 def test_empty_phase(self):
     with self.assertRaisesRegex(
             ValueError, "Arguments are insufficient to define a phase"):
         ct.ThermoPhase(thermo="ideal-gas")
Exemple #5
0
 def setUpClass(cls):
     utilities.CanteraTest.setUpClass()
     cls.gas = ct.ThermoPhase()
Exemple #6
0
 def setUp(self):
     self.gas = ct.ThermoPhase('h2o2.xml')