def test_mb_sampled_reactor_mole_fractions(self): """Test that MBSampledReactor mole fractions are set properly""" inp.mb_sampled_reactor( temperature=(1000, 'K'), pressure=(1, 'atm'), initialMoleFractions={ 'A': 0.5, 'B': 0.3, 'C': 0.2, }, mbsamplingRate=3500, terminationTime=(1, 's'), constantSpecies=['B', 'C'], ) 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)
def test_mb_sampled_reactor_mole_fractions_normalize_1(self, mock_logging): """Test that MBSampledReactor mole fractions are normalized properly""" inp.mb_sampled_reactor( temperature=(1000, 'K'), pressure=(1, 'atm'), initialMoleFractions={ 'A': 5, 'B': 3, 'C': 2, }, mbsamplingRate=3500, terminationTime=(1, 's'), constantSpecies=['B', 'C'], ) 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.')