Skip to content

Commit

Permalink
Update fit_coeffs.py
Browse files Browse the repository at this point in the history
Minor bug catch
  • Loading branch information
tsikes committed Aug 9, 2021
1 parent 0d89b68 commit 82ee3a1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/calculate/optimize/fit_coeffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 82ee3a1

Please sign in to comment.