--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cantera-users/aef8e014-cd6f-4fc9-9a9f-5865f3b750f5n%40googlegroups.com.
Thanks for the reply!For 1. How do I set the concentrations to a minimum of zero? Is there somewhere I can specify this?For 2.I current set the state using gas.TPX. I assume this means cantera sets the state variable to mole fractions. Would I be correct in using set_unnormalized_mass_fractions() instead ?
On Friday, 11 July 2025 at 17:58:48 UTC+2 S. DeCaluwe wrote:
To view this discussion visit https://groups.google.com/d/msgid/cantera-users/3d5e61e9-e875-45b5-95a8-2d17dc0119f8n%40googlegroups.com.
Hi,
Your mechanism most certainly does have rate constants that exceed the collisional rate limit. At 300 K, the highest reverse rate constant is 7.14e162, and there are dozens of others in excess of 1.0e30.
One other problem, which might seem a bit paradoxical, is that the integration limits you are setting are too stringent. It is not really possible to solve using double precision arithmetic to a relative tolerance of 1e-16. If you stick to the default tolerances (rtol of 1e-9), the solver fares quite a bit better, though the divergent behavior does eventually become a problem.
To help set things back on course before they go too far astray, you can reset the negative species, as Steven suggested. Specifically, you can rewrite the integration loop as:
n_reset = 0 while r.thermo.T < T_max: net.step() states.append(TPX=r.thermo.TPX, t=net.time, normalize=False) state = net.get_state() Y = state[2:] print(f't = {net.time}, Ypos = {sum(Y >= 0)}, Yneg = {sum(Y < 0)}, Ymin = {min(Y)}') if min(Y) < -1e-10: print('Resetting negative mass fractions') gas.TPY = None, None, Y r.syncState() net.reinitialize() n_reset += 1Along with leaving the tolerances alone, I find that this gives a reasonable looking solution to the problem and only needs to reset the integrator once.
Regards,
Ray