-
-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save/restore ThermoPhase state assumes density is an independent variable #595
Comments
Hello! I would like to have a look on this issue. I think this could be handled parallel to this @todo entry commented in Phase.h: @todo So, possible overrides at derived classes will use their access methods for every other state variable, like voltage(). So, is just a virtual keyword enough here? And both methods can be overridden at the derived class. More specificly, I would like to ask if this requires any re-implementation of the overridden methods so that they handle the proper state variables (and, corresponding to the todo entry, to add any state variable to the state vector). |
The functions
Phase::saveState
andPhase::restoreState
assume that temperature and density are the independent thermodynamic variables, which is not true for several of Cantera's thermo models. For these models, the save/restore feature does not work correctly. For example (in Python):Here, the pressure is left at 2 atm, despite the call to
restoreState
. In other cases, therestoreState
call will fail because the derived class overrides thesetDensity
function to throw an exception.Among other things, this error contributes to making these phases difficult to use with the
Solution
class in Python and Matlab, where the default behavior of instantiating a dummyTransport
object triggers calls tosaveState
andrestoreState
, with the latter failing.This problem can be resolved by making the
saveState
andrestoreState
methods virtual and having them work with the appropriate set of independent variables for each phase type.The text was updated successfully, but these errors were encountered: