--
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/1518d353-422f-4aef-95ae-e5a856342743n%40googlegroups.com.
Hi all,
This ends up being a fairly subtle error, but one where at least related versions have come up before. The issue is that when a Solution
object is used inside a ReactorNet
, there is no guarantee that the state of the Solution
after a call to ReactorNet.advance
or ReactorNet.step
corresponds exactly to the state of the system at the time indicated by the ReactorNet
. The CVODES integrator underlying the ReactorNet
just uses the attached Solution
objects as “calculators”, and can leave them in arbitrary states that do not correspond to the state of the system at the ReactorNet
‘s current time.
One case where this occurs is when using the advance
method, where CVODES takes arbitrary internal timesteps, governed only by the absolute and relative tolerances on the solution, and then uses interpolation to determine the state at the specified output time. In this case, the Solution
objects will never be automatically set to the state corresponding to the output time, but instead will have a state related to the last time reached by the integrator.
Cantera provides accessors for the Solution
objects that will automatically synchronize the state to the correct values determined by CVODES, specifically the Reactor.thermo
property for bulk phases and the ReactorSurface.kinetics
property for interfaces. This problem is exacerbated in the case of surface phases, where the reaction rates are a function of both the bulk and surface states, which may end up in an inconsistent state if only one of the two is correctly synchronized. The recommendation I would make that once a Solution
object has been used to construct a Reactor
or ReactorSurface
, it should not be accessed directly anymore, but only accessed via these properties of the reactor classes, to ensure that the state is set correctly.
A more general solution that would prevent such an error from being made would possibly require changing a feature of the current reactor network model, which is that a single Solution
object may be used to represent multiple reactors within a reactor network. However, given the number of times that problems like this have arisen, re-evaluating this concept may be worth it.
Regards,
Ray