--
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 on the web visit https://groups.google.com/d/msgid/cantera-users/a427cd56-53c2-4db1-b6c2-3345a3d76f6fn%40googlegroups.com.
Hi Jay and anant,
Hopefully I can demystify this a bit.
As the documentation for the set_equivalence_ratio method notes, it sets the equivalence ratio while holding T and P constant. In contrast, just setting the mole fractions alone with gas.X = ... hold the other intrinsic state variables of the phase constant. For the ideal gas phase, these are temperature and density, which means that setting the mole fractions will change the pressure. If you want to hold T and P constant while setting mole fractions, you can use syntax like the following:
gas.TPX = None, None, 'CH4:0.8, O2:0.2'Setting gas.TP = ... after using gas.X = ... also works, of course.
Regards,
Ray


Hi Jay,
What’s happening here is that the results of setting X, then T and P versus setting T and P then setting the equivalence ratio result in very small differences in the state, on the order of the rounding error for floating point calculations (relative differences of about 2e-16). However, during the time integration of the ignition delay problem, there are many threshold conditions, such that the solver may not take identical time steps even for conditions that are so close together. Further, the definition of the ignition delay used here (from some of the Cantera samples) is somewhat coarse — it can only be one of the discrete output times of the integrator.
One thing you can do to make this result more consistent would be to at least keep all the output from the integrator by changing the integration loop and removing the “if” condition here:
while t < estimated_ignition_delay_time: t = reactor_network.step() if not counter % 10: # We will save only every 10th value. Otherwise, this takes too long # Note that the species concentrations are mass fractions time_history.append(r.thermo.state, t=t) counter += 1I think that unless you have a very large
mechanism, the admonition here about saving all the state data "taking
too long" is probably not a significant concern.
Regards,
Ray