diff --git a/Cantera/clib/src/ct.cpp b/Cantera/clib/src/ct.cpp index e3919abaa..28e66243e 100755 --- a/Cantera/clib/src/ct.cpp +++ b/Cantera/clib/src/ct.cpp @@ -88,6 +88,7 @@ static double pfprop(int n, int i, double v=0.0, double x=0.0) { } #endif + inline int nThermo() { return Storage::storage()->nThermo(); } @@ -101,6 +102,11 @@ namespace Cantera { */ extern "C" { + int DLL_EXPORT ct_appdelete() { + appdelete(); + return 0; + } + //--------------- Phase ---------------------// int DLL_EXPORT phase_nElements(int n) { diff --git a/Cantera/clib/src/ct.h b/Cantera/clib/src/ct.h index b23723ed9..a4f1aa34f 100755 --- a/Cantera/clib/src/ct.h +++ b/Cantera/clib/src/ct.h @@ -5,6 +5,7 @@ #include "cantera/config.h" extern "C" { + int DLL_IMPORT ct_appdelete(); int DLL_IMPORT phase_nElements(int n); int DLL_IMPORT phase_nSpecies(int n); diff --git a/Cantera/python/Cantera/__init__.py b/Cantera/python/Cantera/__init__.py index 244386d3e..055b03a3e 100755 --- a/Cantera/python/Cantera/__init__.py +++ b/Cantera/python/Cantera/__init__.py @@ -51,6 +51,12 @@ def addDirectory(dir): def writeLogFile(file): return _cantera.ct_writelogfile(file) + +def reset(): + """Release all cached Cantera data. Equivalent to + starting a fresh session.""" + _cantera.ct_appdelete() + # workaround for case problems in CVS repository file Mixture.py. On some # systems it appears as mixture.py, and on others as Mixture.py try: diff --git a/Cantera/python/src/methods.h b/Cantera/python/src/methods.h index 084232126..f52b8ce23 100644 --- a/Cantera/python/src/methods.h +++ b/Cantera/python/src/methods.h @@ -294,6 +294,8 @@ static PyMethodDef ct_methods[] = { {"mix_equilibrate", py_mix_equilibrate, METH_VARARGS}, {"mix_getChemPotentials", py_mix_getChemPotentials, METH_VARARGS}, + {"ct_appdelete", pyct_appdelete, METH_VARARGS}, + #ifdef INCL_USER_PYTHON #include "usermethods.h" #endif diff --git a/Cantera/python/src/pycantera.cpp b/Cantera/python/src/pycantera.cpp index d7ee7dcc3..d8c7baea5 100644 --- a/Cantera/python/src/pycantera.cpp +++ b/Cantera/python/src/pycantera.cpp @@ -63,6 +63,10 @@ static PyObject *ErrorObject; #include "ctuser_methods.cpp" #endif +static PyObject* +pyct_appdelete(PyObject *self, PyObject *args) { + return Py_BuildValue("i",ct_appdelete()); +} #include "methods.h" #include "pylogger.h" diff --git a/Cantera/src/base/ctml.cpp b/Cantera/src/base/ctml.cpp index 728d4ff50..cdfa11661 100755 --- a/Cantera/src/base/ctml.cpp +++ b/Cantera/src/base/ctml.cpp @@ -451,6 +451,7 @@ namespace ctml { } key.push_back(v[i].substr(0,icolon)); val.push_back(v[i].substr(icolon+1, v[i].size())); + //cout << "getPairs: " << key.back() << " " << val.back() << endl; } } diff --git a/Cantera/src/base/units.h b/Cantera/src/base/units.h index 02a609d99..be4952303 100644 --- a/Cantera/src/base/units.h +++ b/Cantera/src/base/units.h @@ -195,7 +195,7 @@ namespace Cantera { m_u["kJ"] = 1.0e3; m_u["cal"] = 4.184; m_u["kcal"] = 4184.0; - m_u["eV"] = 1.60217733e-19; + m_u["eV"] = Faraday; //1.60217733e-19; // quantity m_u["mol"] = 1.0e-3; @@ -223,7 +223,7 @@ namespace Cantera { m_u["hr"] = 3600.0; m_u["ms"] = 0.001; - m_act_u["eV"] = m_u["eV"]/m_u["molec"]; + m_act_u["eV"] = m_u["eV"]; // /m_u["molec"]; m_act_u["K"] = GasConstant; m_act_u["Kelvin"] = GasConstant; m_act_u["Dimensionless"] = (GasConstant * 273.15);