From 60678fc85664c5126aad7b61abe2943863150259 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sun, 18 Jul 2010 20:36:47 +0000 Subject: [PATCH] doxygen updates for LatticePhase It's now complete --- Cantera/src/thermo/LatticePhase.cpp | 67 ++++++++++++++++++---- Cantera/src/thermo/LatticePhase.h | 88 ++++++++++++----------------- 2 files changed, 93 insertions(+), 62 deletions(-) diff --git a/Cantera/src/thermo/LatticePhase.cpp b/Cantera/src/thermo/LatticePhase.cpp index 1a93923c4..f86a26823 100644 --- a/Cantera/src/thermo/LatticePhase.cpp +++ b/Cantera/src/thermo/LatticePhase.cpp @@ -289,7 +289,48 @@ namespace Cantera { vbar[k] = vv; } } - + //======================================================================================================= + // Returns the vector of nondimensional Enthalpies of the reference state at the current temperature + // of the solution and the reference pressure for the phase. + /* + * @return Output vector of nondimensional reference state Enthalpies of the species. + * Length: m_kk + */ + const array_fp& LatticePhase::enthalpy_RT_ref() const { + _updateThermo(); + return m_h0_RT; + } + //======================================================================================================= + // Returns a reference to the dimensionless reference state Gibbs free energy vector. + /* + * This function is part of the layer that checks/recalculates the reference + * state thermo functions. + */ + const array_fp& LatticePhase::gibbs_RT_ref() const { + _updateThermo(); + return m_g0_RT; + } + //======================================================================================================= + // Returns a reference to the dimensionless reference state Entropy vector. + /* + * This function is part of the layer that checks/recalculates the reference + * state thermo functions. + */ + const array_fp& LatticePhase::entropy_R_ref() const { + _updateThermo(); + return m_s0_R; + } + //======================================================================================================= + // Returns a reference to the dimensionless reference state Heat Capacity vector. + /* + * This function is part of the layer that checks/recalculates the reference + * state thermo functions. + */ + const array_fp& LatticePhase::cp_R_ref() const { + _updateThermo(); + return m_cp0_R; + } + //======================================================================================================= void LatticePhase::initThermo() { m_kk = nSpecies(); m_mm = nElements(); @@ -306,8 +347,12 @@ namespace Cantera { m_s0_R.resize(leng); setMolarDensity(m_molar_density); } - - + //===================================================================================================== + // Update the species reference state thermodynamic functions + /* + * The polynomials for the standard state functions are only + * reevalulated if the temperature has changed. + */ void LatticePhase::_updateThermo() const { doublereal tnow = temperature(); if (fabs(molarDensity() - m_molar_density)/m_molar_density > 0.0001) { @@ -315,33 +360,33 @@ namespace Cantera { +fp2str(m_molar_density)+" to "+fp2str(molarDensity())); } if (m_tlast != tnow) { - m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0], - &m_s0_R[0]); + m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0], &m_s0_R[0]); m_tlast = tnow; - int k; - for (k = 0; k < m_kk; k++) { + for (int k = 0; k < m_kk; k++) { m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k]; } m_tlast = tnow; } } - + //===================================================================================================== void LatticePhase::setParameters(int n, doublereal* const c) { m_molar_density = c[0]; setMolarDensity(m_molar_density); } - + //===================================================================================================== void LatticePhase::getParameters(int &n, doublereal * const c) const { double d = molarDensity(); c[0] = d; n = 1; } - + //===================================================================================================== void LatticePhase::setParametersFromXML(const XML_Node& eosdata) { eosdata._require("model", "Lattice"); m_molar_density = getFloat(eosdata, "site_density", "toSI"); m_vacancy = getChildValue(eosdata, "vacancy_species"); } + //===================================================================================================== } - +//======================================================================================================= #endif + diff --git a/Cantera/src/thermo/LatticePhase.h b/Cantera/src/thermo/LatticePhase.h index 093caece3..b2622955a 100644 --- a/Cantera/src/thermo/LatticePhase.h +++ b/Cantera/src/thermo/LatticePhase.h @@ -1,7 +1,6 @@ /** * @file LatticePhase.h - * Header for a simple thermodynamics model of a bulk phase - * derived from ThermoPhase, + * Header for a simple thermodynamics model of a bulk phase derived from ThermoPhase, * assuming a lattice of solid atoms * (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink). * @@ -255,7 +254,7 @@ namespace Cantera { * @ingroup thermoprops * */ - class LatticePhase : public ThermoPhase { + class LatticePhase : public ThermoPhase { public: @@ -301,34 +300,33 @@ namespace Cantera { */ ThermoPhase *duplMyselfAsThermoPhase() const; - /* - * @param infile XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ + //! Import and initialize a %LatticePhase phase specification from an XML tree into the current object. + /*! + * @param phaseNode XML file containing the description of the phase + * + * @param idTarget Optional parameter identifying the name of the + * phase. If none is given, the first XML phase element is used. + */ void constructPhaseXML(XML_Node& phaseNode, std::string idTarget); - /* - * constructPhaseFile - * - * - * This routine is a precursor to constructPhaseXML(XML_Node*) - * routine, which does most of the work. - * - * @param inputFile XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ + //! Initialization of a %LatticePhase phase using an xml file + /*! + * + * This routine is a precursor to constructPhaseXML(XML_Node*) + * routine, which does most of the work. + * + * @param inputFile XML file containing the description of the phase + * + * @param id Optional parameter identifying the name of the + * phase. If none is given, the first XML + * phase element will be used. + */ void constructPhaseFile(std::string inputFile, std::string id); //! Equation of state flag. Returns the value cLattice - virtual int eosType() const { return cLattice; } + virtual int eosType() const { + return cLattice; + } /** * @name Molar Thermodynamic Properties of the Solution ------------------------ @@ -695,40 +693,28 @@ namespace Cantera { * Enthalpies of the species. * Length: m_kk */ - const array_fp& enthalpy_RT_ref() const { - _updateThermo(); - return m_h0_RT; - } + const array_fp& enthalpy_RT_ref() const; //! Returns a reference to the dimensionless reference state Gibbs free energy vector. /*! * This function is part of the layer that checks/recalculates the reference * state thermo functions. */ - const array_fp& gibbs_RT_ref() const { - _updateThermo(); - return m_g0_RT; - } + const array_fp& gibbs_RT_ref() const; //! Returns a reference to the dimensionless reference state Entropy vector. /*! * This function is part of the layer that checks/recalculates the reference * state thermo functions. */ - const array_fp& entropy_R_ref() const { - _updateThermo(); - return m_s0_R; - } + const array_fp& entropy_R_ref() const; //! Returns a reference to the dimensionless reference state Heat Capacity vector. /*! * This function is part of the layer that checks/recalculates the reference * state thermo functions. */ - const array_fp& cp_R_ref() const { - _updateThermo(); - return m_cp0_R; - } + const array_fp& cp_R_ref() const; //@} /// @name Utilities for Initialization of the Object @@ -827,29 +813,29 @@ namespace Cantera { doublereal m_p0; //! Current value of the temperature (Kelvin) - mutable doublereal m_tlast; + mutable doublereal m_tlast; //! Reference state enthalpies / RT - mutable array_fp m_h0_RT; + mutable array_fp m_h0_RT; //! Temporary storage for the reference state heat capacities - mutable array_fp m_cp0_R; + mutable array_fp m_cp0_R; //! Temporary storage for the reference state gibbs energies - mutable array_fp m_g0_RT; + mutable array_fp m_g0_RT; - //! Temporary storage for the reference state entropies - mutable array_fp m_s0_R; + //! Temporary storage for the reference state entropies at the current temperature + mutable array_fp m_s0_R; //! Current value of the pressure (Pa) - doublereal m_press; + doublereal m_press; //! String name for the species which represents a vacency //! in the lattice /*! * This string is currently unused */ - std::string m_vacancy; + std::string m_vacancy; //! Molar density of the lattice solid /*! @@ -857,7 +843,7 @@ namespace Cantera { * * units are kmol m-3 */ - doublereal m_molar_density; + doublereal m_molar_density; private: