diff --git a/Cantera/src/ThermoPhase.cpp b/Cantera/src/ThermoPhase.cpp index 1e523acb0..c93358527 100644 --- a/Cantera/src/ThermoPhase.cpp +++ b/Cantera/src/ThermoPhase.cpp @@ -178,7 +178,8 @@ namespace Cantera { // Newton iteration for (int n = 0; n < 50; n++) { - dt = (h - enthalpy_mass())/cp_mass(); + double h0 = enthalpy_mass(); + dt = (h - h0)/cp_mass(); // limit step size to 100 K if (dt > 100.0) dt = 100.0; else if (dt < -100.0) dt = -100.0; diff --git a/Cantera/src/ThermoPhase.h b/Cantera/src/ThermoPhase.h index 9838af4d7..d25ca8008 100755 --- a/Cantera/src/ThermoPhase.h +++ b/Cantera/src/ThermoPhase.h @@ -751,16 +751,18 @@ namespace Cantera { err("setToEquilState"); } - // called by function 'equilibrate' in ChemEquil.h to transfer - // the element potentials to this object + // Called by function 'equilibrate' in ChemEquil.h to transfer + // the element potentials to this object after every successful + // equilibration routine. void setElementPotentials(const vector_fp& lambda) { m_lambda = lambda; m_hasElementPotentials = true; } - void getElementPotentials(doublereal* lambda) { - if (m_hasElementPotentials) + bool getElementPotentials(doublereal* lambda) { + if (m_hasElementPotentials) copy(m_lambda.begin(), m_lambda.end(), lambda); + return (m_hasElementPotentials); } //@} @@ -1015,6 +1017,8 @@ namespace Cantera { /// Index number int m_index; doublereal m_phi; + /// Vector of element potentials. + /// -> length equal to number of elements vector_fp m_lambda; bool m_hasElementPotentials;