SLACKHA / pyJac

Creates C and CUDA analytical Jacobians for chemical kinetics ODE systems
http://slackha.github.io/pyJac/
MIT License
52 stars 23 forks source link

Error handling for incorrect Troe reaction data #11

Closed kahilah closed 7 years ago

kahilah commented 7 years ago

Hey!

I noticed that e.g. for the DME mechanism available: http://www.engr.uconn.edu/~tlu/mechs/mechs.htm

( particularly: http://www.engr.uconn.edu/~tlu/mechs/DME.zip and the skeletal one)

one gets an error:


.
.
.
  File "/.../pyjac/core/create_jacobian.py", line 1175, in get_pdep_dt
    jline += write_troe_dt(lang, rxn, beta_0minf, E_0minf, k0kinf)
  File "/.../pyjac/core/create_jacobian.py", line 1274, in write_troe_dt
    rxn.troe_par[2]) +
ZeroDivisionError: float division by zero

and this is due to a zero value in one of the troe parameters in the reaction file. When the zero is changed to 1e-30 as in others, pyjac creates the jacobian files without problems.

Not directly a problem on the pyjac side but maybe worth to consider a some sort of check-up routine and warning message for the user.

Cheers, -HK

skyreflectedinmirrors commented 7 years ago

@kahilah Thanks for the bug report!

Technically speaking, the reaction in that DME mechanism is undefined--it takes the form of 0 * exp(-T / 0).

I am looking into how Cantera / chemkin handle this reaction in order to figure out what we should do, but my inclination is to spit out an error / warning during parsing

kyleniemeyer commented 7 years ago

@arghdos it sounds like this is the same as commenting out the reaction—so perhaps we should just skip reactions with a pre-exponential factor of 0?

On Dec 5, 2016, at 8:27 AM, arghdos notifications@github.com wrote:

@kahilah Thanks for the bug report!

Technically speaking, the reaction in that DME mechanism is undefined--it takes the form of 0 * exp(T / 0). I am looking into how Cantera / chemkin handle this reaction in order to figure out what we should do

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

skyreflectedinmirrors commented 7 years ago

@kyleniemeyer this particular reaction still has a non-zero Fcent as:

Fcent = (1 - a) * exp(-T / T3) + a* exp(-T/ T1) + exp(-T2 / T)

For this given reaction it simplifies to:

Fcent = 1 * exp(-T / 570) + 0 * exp(-T / 0) + exp(-1e+30 / T)

Hence we still have contributions from the leading term, so the reaction won't simply dissappear

skyreflectedinmirrors commented 7 years ago

Handled by 7199be7, thanks again for the report!