diff --git a/Cantera/src/ThermoPhase.cpp b/Cantera/src/ThermoPhase.cpp index 9191f7204..62d1b80fd 100644 --- a/Cantera/src/ThermoPhase.cpp +++ b/Cantera/src/ThermoPhase.cpp @@ -92,7 +92,40 @@ namespace Cantera { throw CanteraError("ThermoPhase","Base class method " +msg+" called."); return 0; - } + } + + /** + * Returns the units of the standard and general concentrations + * Note they have the same units, as their divisor is + * defined to be equal to the activity of the kth species + * in the solution, which is unitless. + * + * This routine is used in print out applications where the + * units are needed. Usually, MKS units are assumed throughout + * the program and in the XML input files. + * + * On return uA contains the powers of the units (MKS assumed) + * of the standard concentrations and generalized concentrations + * for the kth species. + * + * uA[0] = kmol units - default = 1 + * uA[1] = m units - default = -nDim(), the number of spatial + * dimensions in the Phase class. + * uA[2] = kg units - default = 0; + * uA[3] = Pa(pressure) units - default = 0; + * uA[4] = Temperature units - default = 0; + * uA[5] = time units - default = 0 + */ + void ThermoPhase::getUnitsStandardConc(double *uA, int k, int sizeUA) { + for (int i = 0; i < sizeUA; i++) { + if (i == 0) uA[0] = 1.0; + if (i == 1) uA[1] = -nDim(); + if (i == 2) uA[2] = 0.0; + if (i == 3) uA[3] = 0.0; + if (i == 4) uA[4] = 0.0; + if (i == 5) uA[5] = 0.0; + } + } } diff --git a/Cantera/src/ThermoPhase.h b/Cantera/src/ThermoPhase.h index 3ec30174b..139ac3922 100755 --- a/Cantera/src/ThermoPhase.h +++ b/Cantera/src/ThermoPhase.h @@ -23,6 +23,8 @@ namespace Cantera { class XML_Node; + + /** * @defgroup thermoprops Thermodynamic Properties * @@ -54,7 +56,8 @@ namespace Cantera { virtual ~ThermoPhase() { delete m_spthermo; - delete m_speciesData; + // Taking this out because I think i don't own it + //delete m_speciesData; m_spthermo = 0; m_speciesData = 0; } @@ -287,13 +290,16 @@ namespace Cantera { return -1.0; } - /** The natural logarithm of the standard concentration. */ + /** + * + * Returns the natural logarithm of the standard + * concentration of the kth species + */ virtual doublereal logStandardConc(int k=0) const { err("logStandardConc"); return -1.0; } - /** Get the array of chemical potentials at unit activity \f$ * \mu^0_k \f$. */ @@ -301,6 +307,26 @@ namespace Cantera { err("getStandardChemPotentials"); } + /** + * Returns the units of the standard and general concentrations + * Note they have the same units, as their divisor is + * defined to be equal to the activity of the kth species + * in the solution, which is unitless. + * + * This routine is used in print out applications where the + * units are needed. Usually, MKS units are assumed throughout + * the program and in the XML input files. + * + * uA[0] = kmol units - default = 1 + * uA[1] = m units - default = -nDim(), the number of spatial + * dimensions in the Phase class. + * uA[2] = kg units - default = 0; + * uA[3] = Pa(pressure) units - default = 0; + * uA[4] = Temperature units - default = 0; + * uA[5] = time units - default = 0 + */ + virtual void getUnitsStandardConc(double *uA, int k = 0, + int sizeUA = 6); /** * Get the array of non-dimensional chemical potentials \f$