Exemplo n.º 1
0
    def test_liquidInputReading(self):
        """
        Check if constant concentration condition is well handled. 
        From input file reading to information storage in liquid reactor object.
        """
        rmg = RMG()
        rmg.inputFile = os.path.join(os.path.dirname(rmgpy.__file__), 'solver',
                                     'files', 'liquid_phase_constSPC',
                                     'input.py')
        rmg.initialize()

        for index, reactionSystem in enumerate(rmg.reactionSystems):
            self.assertIsNotNone(
                reactionSystem.constSPCNames,
                'Reactor should contain constant species name and indices after few steps'
            )
            self.assertIsNotNone(
                reactionSystem.constSPCIndices,
                'Reactor should contain constant species indices in the core species array'
            )
            self.assertIs(
                reactionSystem.constSPCNames[0],
                rmg.reactionModel.core.species[
                    reactionSystem.constSPCIndices[0]].label,
                'The constant species name from the reaction model and constantSPCnames should be equal'
            )
Exemplo n.º 2
0
 def test_liquidInputReading(self):
     """
     Check if constant concentration condition is well handled. 
     From input file reading to information storage in liquid reactor object.
     """
     rmg = RMG()
     rmg.inputFile = os.path.join('rmgpy', 'solver', 'files', 'liquid_phase_constSPC', 'input.py')
     rmg.initialize()
         
     for index, reactionSystem in enumerate(rmg.reactionSystems):
         self.assertIsNotNone(reactionSystem.constSPCNames,
                              'Reactor should contain constant species name and indices after few steps')
         self.assertIsNotNone(reactionSystem.constSPCIndices,
                              'Reactor should contain constant species indices in the core species array')
         self.assertIs(reactionSystem.constSPCNames[0],
                       rmg.reactionModel.core.species[reactionSystem.constSPCIndices[0]].label,
                       'The constant species name from the reaction model and constantSPCnames should be equal')
Exemplo n.º 3
0
    def test_liquidInputReading(self):
        """
        Check if constant concentration condition is well handled. 
        From input file reading to information storage in liquid reactor object.
        """
        rmg = RMG()

        ##use the liquid phase example to load every input parameters
        inp = os.path.join("examples","rmg","liquid_phase_constSPC","input.py") #In order to work on every system, use of os.path
        rmg.inputFile = inp

        rmg.initialize()
            
        if rmg.solvent is not None:
            ##call the function to identify indices in the solver
            for index, reactionSystem in enumerate(rmg.reactionSystems):
                    if reactionSystem.constSPCNames is not None: #if no constant species provided do nothing
                        reactionSystem.get_constSPCIndices(rmg.reactionModel.core.species)        
                   
        for index, reactionSystem in enumerate(rmg.reactionSystems):
            self.assertIsNotNone(reactionSystem.constSPCNames,"""this input \"{0} \" contain constant SPC, reactor should contain its name and its indices after few steps""")
            self.assertIsNotNone(reactionSystem.constSPCIndices,"""this input \"{0} \" contain constant SPC, reactor should contain its corresponding indices in the core species array""")
            self.assertIs(reactionSystem.constSPCNames[0],rmg.reactionModel.core.species[reactionSystem.constSPCIndices[0]].label,"The constant species name from reaction model and constantSPCnames has to be equals")