From 82ee3a198fd4d153f7877887aa710af4b7617714 Mon Sep 17 00:00:00 2001 From: tsikes <50559900+tsikes@users.noreply.github.com> Date: Sun, 8 Aug 2021 23:57:46 -0500 Subject: [PATCH] Update fit_coeffs.py Minor bug catch --- src/calculate/optimize/fit_coeffs.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/calculate/optimize/fit_coeffs.py b/src/calculate/optimize/fit_coeffs.py index b3a2711..da6537e 100644 --- a/src/calculate/optimize/fit_coeffs.py +++ b/src/calculate/optimize/fit_coeffs.py @@ -21,6 +21,8 @@ max_pos_system_value = (np.finfo(float).max*(1E-20))**(1/2) min_ln_val = np.log(min_pos_system_value) max_ln_val = np.log(max_pos_system_value) +min_log_val = np.log10(min_pos_system_value) +max_log_val = np.log10(max_pos_system_value) default_arrhenius_coefNames = ['activation_energy', 'pre_exponential_factor', 'temperature_exponent'] default_Troe_coefNames = ['activation_energy_0', 'pre_exponential_factor_0', 'temperature_exponent_0', @@ -755,6 +757,11 @@ def ln_Troe(self, T, *x): # LPL, HPL, Fcent try: P_r = k_0/k_inf*M log_P_r = np.log10(P_r) + + #log_P_r = np.log10(k_0) - np.log10(k_inf) + np.log10(M) + #log_P_r[log_P_r < min_log_val] = min_log_val + #log_P_r[log_P_r > max_log_val] = max_log_val + #P_r = np.power(10, log_P_r) except: return np.ones_like(M)*max_pos_system_value @@ -764,7 +771,11 @@ def ln_Troe(self, T, *x): # LPL, HPL, Fcent f1 = (log_P_r + C)/(N - 0.14*(log_P_r + C)) ln_F = np.log(Fcent)/(1 + f1**2) - ln_k_calc = np.log(k_inf*P_r/(1 + P_r)) + ln_F + with np.errstate(all='raise'): + try: + ln_k_calc = np.log(k_inf*P_r/(1 + P_r)) + ln_F + except: + return np.ones_like(M)*max_pos_system_value return ln_k_calc