Hi LGS,
There is a bit of a catch here for cases where you want to override the update_state behavior, caused by the normally clever behavior where accessing the reactor.thermo property automatically syncs the thermo object with the reactor’s state. In this case, I think what you want to do is use a different member variable to also reference the same Solution object but without triggering these automatic updates, for example naming this MyReactor.gas.
If you are replacing the update_state method, you should be sure to call MyReactor.update_connected so the new state is saved internally.
Also, note that there is no meaningful way to set a single mass fraction — you need to set the full mass fraction vector for the Solution object. The Reactor.Y property is just a shorthand accessor for Reactor.thermo.Y (which will trigger the same automatic updates).
Regards,
Ray
Hi,
Sorry, I misspoke. There is no way to call the update_connected method from Python, so I don’t think it’s currently possible to modify the state that’s internally held by the reactor and used to set the state of the ThermoPhase object at the start of the default version of eval. If you’re implementing a replace_eval method, this doesn’t matter, since you can set the gas state however you like, but it does limit the ability to use overrides of update_state effectively.
I have been planning on some updates to simplify the evaluation logic for Reactor governing equations. If you could share the code that you were expecting should work, or at least an outline of the modifications to the governing equations that you were interested in making, it would be useful to me to make sure that such changes are possible in the future.
Regards,
Ray