예제 #1
0
 def testGetEffectiveRate3to2(self):
     """
     Tests that the effective rate is limited for a 3 -> 2 reaction
     """
     effective_rate = diffusionLimiter.getEffectiveRate(self.tri_bi_reaction, self.T)
     self.assertTrue(effective_rate < self.intrinsic_rates[self.tri_bi_reaction])
     self.assertTrue(effective_rate >= 0.2 * self.intrinsic_rates[self.tri_bi_reaction])
예제 #2
0
 def testGetEffectiveRateUnimolecular(self):
     """
     Tests that the effective rate is the same as the intrinsic rate for
     unimiolecular reactions.
     """
     effective_rate = diffusionLimiter.getEffectiveRate(self.uni_reaction, self.T)
     self.assertEqual(effective_rate, self.intrinsic_rates[self.uni_reaction])
예제 #3
0
 def testGetEffectiveRate2to1(self):
     """
     Tests that the effective rate is limited in the forward direction for
     a 2 -> 1 reaction
     """
     effective_rate = diffusionLimiter.getEffectiveRate(self.bi_uni_reaction, self.T)
     self.assertTrue(effective_rate < self.intrinsic_rates[self.bi_uni_reaction])
     self.assertTrue(effective_rate >= 0.2 * self.intrinsic_rates[self.bi_uni_reaction])
예제 #4
0
 def getRateCoefficient(self, T, P=0):
     """
     Return the overall rate coefficient for the forward reaction at
     temperature `T` in K and pressure `P` in Pa, including any reaction
     path degeneracies.
     
     If diffusionLimiter is enabled, the reaction is in the liquid phase and we use
     a diffusion limitation to correct the rate. If not, then use the intrinsic rate
     coefficient.
     """
     if diffusionLimiter.enabled:
         try:
             k = self.__k_effective_cache[T]
         except KeyError:
             k = diffusionLimiter.getEffectiveRate(self, T)
             self.__k_effective_cache[T] = k
         return k
     else:
         return  self.kinetics.getRateCoefficient(T, P)
예제 #5
0
 def getRateCoefficient(self, T, P=0):
     """
     Return the overall rate coefficient for the forward reaction at
     temperature `T` in K and pressure `P` in Pa, including any reaction
     path degeneracies.
     
     If diffusionLimiter is enabled, the reaction is in the liquid phase and we use
     a diffusion limitation to correct the rate. If not, then use the intrinsic rate
     coefficient.
     """
     if diffusionLimiter.enabled:
         try:
             k = self.__k_effective_cache[T]
         except KeyError:
             k = diffusionLimiter.getEffectiveRate(self, T)
             self.__k_effective_cache[T] = k
         return k
     else:
         return  self.kinetics.getRateCoefficient(T, P)
예제 #6
0
    def fixDiffusionLimitedA(self, T):
        """
        Decrease the pre-exponential factor (A) by the diffusion factor
        to account for the diffusion limit at the specified temperature.
        """
        if not diffusionLimiter.enabled:
            return
        # Obtain effective rate
        try:
            k = self.k_effective_cache[T]
        except KeyError:
            k = diffusionLimiter.getEffectiveRate(self, T)
            self.k_effective_cache[T] = k

        # calculate diffusion factor
        diffusionFactor = k / self.kinetics.getRateCoefficient(T, P=0)
        # update preexponential factor
        self.kinetics.A = self.kinetics.A * diffusionFactor
        # Add a comment to self.kinetics.comment
        self.kinetics.comment.append(
            ("Pre-exponential factor A has been decreased by the "
             "diffusion factor {0.2g} evaluated at {1} K.").format(
                diffusionFactor, T))