Merges from the Trunk.

This commit is contained in:
Harry Moffat 2009-12-06 19:25:59 +00:00
commit 2c712b8c56
25 changed files with 180 additions and 35 deletions

View file

@ -22,7 +22,6 @@
#include "numarray/arrayobject.h"
#else
#ifdef HAS_NUMPY
//#include "numpy/libnumarray.h"
#include "numpy/arrayobject.h"
#else
// Create a compilation error to cause the program to bomb

0
Cantera/src/base/Array.h Executable file → Normal file
View file

0
Cantera/src/base/config.h Executable file → Normal file
View file

0
Cantera/src/base/ct_defs.h Executable file → Normal file
View file

0
Cantera/src/base/ctexceptions.h Executable file → Normal file
View file

6
Cantera/src/base/ctml.cpp Executable file → Normal file
View file

@ -831,10 +831,12 @@ namespace ctml {
return x;
}
// This function reads a child node with the default name, "floatArray", with a value
// This function reads the current node or a child node of the current node
// with the default name, "floatArray", with a value field
// consisting of a comma separated list of floats
/*
* This function will read a child node to the current XML node, with the
* This function will read either the current XML node or a child node
* to the current XML node, with the
* name "floatArray". It will have a title attribute, and the body
* of the XML node will be filled out with a comma separated list of
* doublereals.

6
Cantera/src/base/ctml.h Executable file → Normal file
View file

@ -311,10 +311,12 @@ namespace ctml {
const std::string &valueString, const std::string typeString="");
//! This function reads a child node with the default name, "floatArray", with a value
//! This function reads the current node or a child node of the current node
//! with the default name, "floatArray", with a value field
//! consisting of a comma separated list of floats
/*!
* This function will read a child node to the current XML node, with the
* This function will read either the current XML node or a child node
* to the current XML node, with the
* name "floatArray". It will have a title attribute, and the body
* of the XML node will be filled out with a comma separated list of
* doublereals.

0
Cantera/src/base/global.h Executable file → Normal file
View file

0
Cantera/src/base/misc.cpp Executable file → Normal file
View file

0
Cantera/src/base/plots.cpp Executable file → Normal file
View file

0
Cantera/src/base/plots.h Executable file → Normal file
View file

0
Cantera/src/base/stringUtils.cpp Executable file → Normal file
View file

0
Cantera/src/base/stringUtils.h Executable file → Normal file
View file

0
Cantera/src/base/utilities.h Executable file → Normal file
View file

0
Cantera/src/base/vec_functions.h Executable file → Normal file
View file

0
Cantera/src/base/xml.cpp Executable file → Normal file
View file

0
Cantera/src/base/xml.h Executable file → Normal file
View file

View file

@ -12,7 +12,9 @@
#ifndef CT_RESID1D_H
#define CT_RESID1D_H
/*
* NOTE: I don't think this file is used any longer. Thus, this is deprecated.
*/
#include "../ctexceptions.h"
#include "../xml.h"
#include "refine.h"

View file

@ -65,8 +65,8 @@ namespace Cantera {
* but specifies the thermodynamics functions at all pressures.
*
* Class PDSS is the base class
* for a family of classes that compute properties of all
* species in a phase in their standard states, for a range of temperatures
* for a family of classes that compute properties of a single
* species in a phase at its standard states, for a range of temperatures
* and pressures.
*
* Phases which use the %VPSSMGr class must have their respective
@ -115,7 +115,7 @@ namespace Cantera {
* to complete the representation.
* .
*
* - PDSS_Water_
* - PDSS_Water
* - standardState model = "Water"
* - This model assumes that
* Species 0 is assumed to be water, and a real equation
@ -668,13 +668,13 @@ namespace Cantera {
//! State of the system - pressure
mutable doublereal m_pres;
//! reference state pressure of the species.
//! Reference state pressure of the species.
doublereal m_p0;
//! minimum temperature
//! Minimum temperature
doublereal m_minTemp;
//! maximum temperature
//! Maximum temperature
doublereal m_maxTemp;
//! Thermophase which this species belongs to.

View file

@ -96,7 +96,7 @@ namespace Cantera {
return (PDSS *) idg;
}
/**
/*
* constructPDSSXML:
*
* Initialization of a PDSS_SSVol object using an
@ -137,14 +137,14 @@ namespace Cantera {
int num = getFloatArray(*ss, TCoeff_, true, "", "volumeTemperaturePolynomial");
if (num != 4) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
" Didn't get 3 density polynomial numbers for species " + speciesNode.name());
" Didn't get 4 density polynomial numbers for species " + speciesNode.name());
}
} else if (model == "density_temperature_polynomial") {
volumeModel_ = cSSVOLUME_DENSITY_TPOLY;
int num = getFloatArray(*ss, TCoeff_, true, "", "densityTemperaturePolynomial");
if (num != 4) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
" Didn't get 3 density polynomial numbers for species " + speciesNode.name());
" Didn't get 4 density polynomial numbers for species " + speciesNode.name());
}
} else {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
@ -155,7 +155,7 @@ namespace Cantera {
}
/**
/*
* constructPDSSFile():
*
* Initialization of a PDSS_SSVol object using an
@ -237,7 +237,6 @@ namespace Cantera {
return (val);
}
doublereal
PDSS_SSVol::intEnergy_mole() const {
doublereal pVRT = (m_pres * m_Vss_ptr[m_spindex]) / (GasConstant * m_temp);

View file

@ -26,8 +26,141 @@ namespace Cantera {
//! Class for pressure dependent standard states that uses a standard state volume
//! model of some sort.
/*!
* Class PDSS_SSVol is an implementation class that compute the properties of a single
* species in a phase at its standard states, for a range of temperatures
* and pressures. This particular class assumes that the calculation of the
* thermodynamics functions can be separated into a temperature polynomial representation
* for thermo functions that can be handled bey a SimpleThermo object and
* a separate calculation for the standard state volume.
* The Models include a cubic polynomial in temperature for either
* the standard state volume or the standard state density.
* The manager uses a SimpleThermo object to handle the
* calculation of the reference state. This object then adds the
* pressure dependencies and the volume terms to these thermo functions
* to complete the representation.
*
* The class includes the following models for the representation of the
* standard state volume:
*
* - Constant Volume
* - This standard state model is invoked with the keyword "constant_incompressible"
* or "constant". The standard state volume is considered constant.
* \f[
* V^o_k(T,P) = a_0
* \f]
* .
*
* - Temperature polynomial for the standard state volume
* - This standard state model is invoked with the keyword "temperature_polynomial".
* The standard state volume is considered a function of temperature only.
* \f[
* V^o_k(T,P) = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
* \f]
* .
*
* - Temperature polynomial for the standard state density
* - This standard state model is invoked with the keyword "density_temperature_polynomial".
* The standard state density, which is the inverse of the volume,
* is considered a function of temperature only.
* \f[
* {\rho}^o_k(T,P) = \frac{M_k}{V^o_k(T,P)} = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4
* \f]
* .
* .
*
* <b> Specification of Species Standard %State Properties </b>
*
* The standard molar Gibbs free energy for species <I>k</I> is determined from the enthalpy
* and entropy expressions
*
* \f[
* G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P)
* \f]
*
* The enthalpy is calculated mostly from the %SpeciesThermo object's enthalpy evalulator. The
* dependence on pressure originates from the Maxwell relation
*
* \f[
* {\left(\frac{dH^o_k}{dP}\right)}_T = T {\left(\frac{dS^o_k}{dP}\right)}_T + V^o_k
* \f]
* which is equal to
*
* \f[
* {\left(\frac{dH^o_k}{dP}\right)}_T = V^o_k - T {\left(\frac{dV^o_k}{dT}\right)}_P
* \f]
*
* The entropy is calculated mostly from the %SpeciesThermo objects entropy evalulator. The
* dependence on pressure originates from the Maxwell relation:
*
* \f[
* {\left(\frac{dS^o_k}{dP}\right)}_T = - {\left(\frac{dV^o_k}{dT}\right)}_P
* \f]
*
* The standard state constant-pressure heat capacity expression is obtained from taking the
* temperature derivative of the Maxwell relation involving the enthalpy given above
* to yield an expression for the pressure dependence of the heat capacity.
*
* \f[
* {\left(\frac{d{C}^o_{p,k}}{dP}\right)}_T = - T {\left(\frac{{d}^2{V}^o_k}{{dT}^2}\right)}_T
* \f]
*
* The standard molar Internal Energy for species <I>k</I> is determined from the following
* relation.
*
* \f[
* U^o_k(T,P) = H^o_k(T,P) - p V^o_k
* \f]
*
* <b> XML Example </b>
*
* An example of the specification of a standard state for the LiCl molten salt
* which employs a constant molar volume expression.
*
@verbatim
<speciesData id="species_MoltenSalt">
<species name="LiCl(L)">
<atomArray> Li:1 Cl:1 </atomArray>
<standardState model="constant_incompressible">
<molarVolume> 0.02048004 </molarVolume>
</standardState>
<thermo>
<Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
<floatArray size="7">
73.18025, -9.047232, -0.316390,
0.079587, 0.013594, -417.1314,
157.6711
</floatArray>
</Shomate>
</thermo>
</species>
</speciesData>
@endverbatim
*
* An example of the specification of a standard state for the LiCl molten salt
* which has a temperature dependent standard state volume.
*
@verbatim
<speciesData id="species_MoltenSalt">
<species name="LiCl(L)">
<atomArray> Li:1 Cl:1 </atomArray>
<standardState model="density_temperature_polynomial">
<densityTemperaturePolynomial units="gm/cm3" >
1.98715, -5.890906E-4, 0.0, 0.0
</densityTemperaturePolynomial>
</standardState>
<thermo>
<Shomate Pref="1 bar" Tmax="2000.0" Tmin="700.0">
<floatArray size="7">
73.18025, -9.047232, -0.316390,
0.079587, 0.013594, -417.1314,
157.6711
</floatArray>
</Shomate>
</thermo>
</species>
</speciesData>
@endverbatim
*
*
* @ingroup pdssthermo
*/

View file

@ -52,7 +52,7 @@ namespace Cantera {
public:
//! Initialized to the type of parameterization
/*!
/*!A
* Note, this value is used in some template functions. For this object the
* value is SIMPLE.
*/

View file

@ -196,22 +196,22 @@ namespace Cantera {
return density()/meanMolecularWeight();
}
void State::setConcentrations(const doublereal* const c) {
void State::setConcentrations(const doublereal* const conc) {
int k;
doublereal sum = 0.0, norm = 0.0;
for (k = 0; k != m_kk; ++k) {
sum += c[k]*m_molwts[k];
norm += c[k];
sum += conc[k]*m_molwts[k];
norm += conc[k];
}
m_mmw = sum/norm;
setDensity(sum);
doublereal rsum = 1.0/sum;
for (k = 0; k != m_kk; ++k) {
m_ym[k] = c[k] * rsum;
m_ym[k] = conc[k] * rsum;
m_y[k] = m_ym[k] * m_molwts[k];
}
//! Call a routine to determin whether state has changed.
// Call a routine to determine whether state has changed.
stateMFChangeCalc();
}

View file

@ -215,28 +215,29 @@ namespace Cantera {
* @param k Index of species
*/
doublereal concentration(const int k) const;
//! Set the concentrations to the specified values within the
//! phase.
/*
/*!
* We set the concentrations here and therefore we set the
* overall density of the phase. We hold the temperature constant
* during this operation. Therefore, we have possibly changed
* the pressure of the phase by calling this routine.
*
* @param c The input vector to this routine is in dimensional
* units. For volumetric phases c[k] is the
* concentration of the kth species in kmol/m3.
* For surface phases, c[k] is the concentration
* in kmol/m2. The length of the vector is the number
* of species in the phase.
* @param conc The input vector to this routine is in dimensional
* units. For volumetric phases c[k] is the
* concentration of the kth species in kmol/m3.
* For surface phases, c[k] is the concentration
* in kmol/m2. The length of the vector is the number
* of species in the phase.
*/
virtual void setConcentrations(const doublereal* const c);
virtual void setConcentrations(const doublereal* const conc);
/**
* Returns a read-only pointer to the start of the
* massFraction array
//! Returns a read-only pointer to the start of the
//! massFraction array
/*!
* The pointer returned is readonly
* @return returns a pointer to a vector of doubles of length m_kk.
*/
const doublereal* massFractions() const {
return &m_y[0];

View file

@ -169,6 +169,13 @@ int main(int argc, char** argv) {
printf("Kc[0] = %g\n", kc[0]);
printf("Kc[1] = %g\n", kc[1]);
delete(iKin_ptr);
iKin_ptr = 0;
delete(gasTP);
delete(xc);
appdelete();
}
catch (CanteraError) {