Exemplo n.º 1
0
    def test_simple_reactor_mole_fractions_ranged(self):
        """Test that SimpleReactor ranged mole fractions are not normalized"""
        inp.simple_reactor(
            temperature=[(1000, 'K'), (2000, 'K')],
            pressure=[(1, 'atm'), (10, 'atm')],
            initialMoleFractions={
                'A': [5, 8],
                'B': 3,
                'C': 2,
            },
            terminationTime=(1, 's'),
        )

        global rmg
        reactor = rmg.reaction_systems[0]
        self.assertEqual(reactor.initial_mole_fractions['A'], [5, 8])
        self.assertEqual(reactor.initial_mole_fractions['B'], 3)
        self.assertEqual(reactor.initial_mole_fractions['C'], 2)
Exemplo n.º 2
0
    def test_simple_reactor_mole_fractions(self):
        """Test that SimpleReactor mole fractions are set properly"""
        inp.simple_reactor(
            temperature=(1000, 'K'),
            pressure=(1, 'atm'),
            initialMoleFractions={
                'A': 0.5,
                'B': 0.3,
                'C': 0.2,
            },
            terminationTime=(1, 's'),
        )

        global rmg
        reactor = rmg.reaction_systems[0]
        self.assertEqual(reactor.initial_mole_fractions['A'], 0.5)
        self.assertEqual(reactor.initial_mole_fractions['B'], 0.3)
        self.assertEqual(reactor.initial_mole_fractions['C'], 0.2)
Exemplo n.º 3
0
    def test_simple_reactor_mole_fractions_normalize_2(self, mock_logging):
        """Test that SimpleReactor mole fractions are normalized properly"""
        inp.simple_reactor(
            temperature=[(1000, 'K'), (2000, 'K')],
            pressure=[(1, 'atm'), (10, 'atm')],
            initialMoleFractions={
                'A': 5,
                'B': 3,
                'C': 2,
            },
            terminationTime=(1, 's'),
        )

        global rmg
        reactor = rmg.reaction_systems[0]
        self.assertEqual(reactor.initial_mole_fractions['A'], 0.5)
        self.assertEqual(reactor.initial_mole_fractions['B'], 0.3)
        self.assertEqual(reactor.initial_mole_fractions['C'], 0.2)

        mock_logging.warning.assert_called_with(
            'Initial mole fractions do not sum to one; normalizing.')