Transfering bugfixes from liquidTransport to the main branch.

This mainly involved fixing the copy and assignment operators
for the IonsFromNeutralVPSSTP operator.

Added docs for PDSS_SSVol

Turned on keyword substitution
This commit is contained in:
Harry Moffat 2009-12-05 19:08:43 +00:00
parent b6c6d090f6
commit 7b3b9b186a
124 changed files with 1960 additions and 434 deletions

View file

@ -8,9 +8,9 @@
*
*/
/* $Author: dggoodwin $
* $Revision: 1.2 $
* $Date: 2007/12/24 15:32:30 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2007 California Institute of Technology

View file

@ -5,9 +5,9 @@
* \link Cantera::ConstCpPoly ConstCpPoly \endlink).
*/
/*
* $Author: hkmoffa $
* $Revision: 1.3 $
* $Date: 2008/12/17 17:04:46 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -5,9 +5,9 @@
* \link Cantera::ConstCpPoly ConstCpPoly\endlink).
*/
/*
* $Author: hkmoffa $
* $Revision: 1.3 $
* $Date: 2008/12/13 01:59:49 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -5,7 +5,7 @@
\endlink).
*/
/*
* $Id: ConstDensityThermo.cpp,v 1.5 2008/12/17 17:04:47 hkmoffa Exp $
* $Id$
*
* Copyright 2002 California Institute of Technology
*/

View file

@ -4,9 +4,9 @@
* (see \ref thermoprops and \link Cantera::ConstDensityThermo ConstDensityThermo\endlink).
*/
/*
* $Author: hkmoffa $
* $Date: 2008/12/10 16:42:48 $
* $Revision: 1.5 $
* $Author$
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*

View file

@ -5,8 +5,8 @@
*/
/*
* $Date: 2009/01/04 21:28:02 $
* $Revision: 1.7 $
* $Date$
* $Revision$
*/
// Copyright 2001 California Institute of Technology

View file

@ -5,8 +5,8 @@
*/
/*
* $Date: 2009/02/23 20:41:03 $
* $Revision: 1.7 $
* $Date$
* $Revision$
*/
// Copyright 2001 California Institute of Technology

View file

@ -1,9 +1,9 @@
/**
* @file Crystal.h
*
* $Author: dggoodwin $
* $Date: 2007/05/04 14:02:40 $
* $Revision: 1.1 $
* $Author$
* $Date$
* $Revision$
*/
#ifndef CT_CRYSTAL_H
#define CT_CRYSTAL_H

View file

@ -13,7 +13,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: DebyeHuckel.cpp,v 1.33 2009/03/27 00:38:56 hkmoffa Exp $
* $Id$
*/
//! Max function
#ifndef MAX

View file

@ -15,7 +15,7 @@
*/
/*
* $Id: DebyeHuckel.h,v 1.31 2009/03/27 00:38:57 hkmoffa Exp $
* $Id$
*/
#ifndef CT_DEBYEHUCKEL_H

View file

@ -4,9 +4,9 @@
* between two surfaces (see \ref thermoprops and \link Cantera::EdgePhase EdgePhase\endlink).
*/
/* $Author: hkmoffa $
* $Date: 2008/10/08 22:11:08 $
* $Revision: 1.3 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*

View file

@ -9,9 +9,9 @@
/****************************************************************************
* $RCSfile: Elements.cpp,v $
* $Author: hkmoffa $
* $Date: 2009/03/13 03:21:34 $
* $Revision: 1.7 $
* $Author$
* $Date$
* $Revision$
*
*
****************************************************************************/

View file

@ -7,9 +7,9 @@
*/
/***********************************************************************
* $RCSfile: Elements.h,v $
* $Author: hkmoffa $
* $Date: 2008/12/04 02:02:45 $
* $Revision: 1.5 $
* $Author$
* $Date$
* $Revision$
***********************************************************************/
// Copyright 2001 California Institute of Technology

View file

@ -5,7 +5,7 @@
* \link Cantera::GeneralSpeciesThermo GeneralSpeciesThermo\endlink).
*/
/*
* $Id: GeneralSpeciesThermo.cpp,v 1.10 2008/12/13 01:59:49 hkmoffa Exp $
* $Id$
*/
// Copyright 2001-2004 California Institute of Technology

View file

@ -8,9 +8,9 @@
*/
/*
* $Author: hkmoffa $
* $Revision: 1.7 $
* $Date: 2008/12/13 01:59:49 $
* $Author$
* $Revision$
* $Date$
*/
#ifndef CT_GENERALSPECIESTHERMO_H

View file

@ -17,8 +17,8 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Date: 2009/03/03 21:08:31 $
* $Revision: 1.3 $
* $Date$
* $Revision$
*/
@ -45,7 +45,7 @@ namespace Cantera {
GibbsExcessVPSSTP::GibbsExcessVPSSTP(const GibbsExcessVPSSTP &b) :
VPStandardStateTP()
{
*this = operator=(b);
GibbsExcessVPSSTP::operator=(b);
}
/*
@ -56,13 +56,16 @@ namespace Cantera {
*/
GibbsExcessVPSSTP& GibbsExcessVPSSTP::
operator=(const GibbsExcessVPSSTP &b) {
if (&b != this) {
VPStandardStateTP::operator=(b);
if (&b == this) {
return *this;
}
VPStandardStateTP::operator=(b);
moleFractions_ = b.moleFractions_;
lnActCoeff_Scaled_ = b.lnActCoeff_Scaled_;
dlnActCoeffdT_Scaled_ = b.dlnActCoeffdT_Scaled_;
dlnActCoeffdlnC_Scaled_ = b.dlnActCoeffdlnC_Scaled_;
m_pp = b.m_pp;
return *this;
@ -93,33 +96,21 @@ namespace Cantera {
*/
void GibbsExcessVPSSTP::setMassFractions(const doublereal* const y) {
#if DEBUG_MODE
checkMFSum(y);
#endif
State::setMassFractions(y);
getMoleFractions(DATA_PTR(moleFractions_));
}
void GibbsExcessVPSSTP::setMassFractions_NoNorm(const doublereal* const y) {
#if DEBUG_MODE
checkMFSum(y);
#endif
State::setMassFractions_NoNorm(y);
getMoleFractions(DATA_PTR(moleFractions_));
}
void GibbsExcessVPSSTP::setMoleFractions(const doublereal* const x) {
#if DEBUG_MODE
checkMFSum(x);
#endif
State::setMoleFractions(x);
getMoleFractions(DATA_PTR(moleFractions_));
}
void GibbsExcessVPSSTP::setMoleFractions_NoNorm(const doublereal* const x) {
#if DEBUG_MODE
checkMFSum(x);
#endif
State::setMoleFractions_NoNorm(x);
getMoleFractions(DATA_PTR(moleFractions_));
}
@ -257,21 +248,13 @@ namespace Cantera {
return 0;
}
//@}
/// @name Properties of the Standard State of the Species in the Solution
//@{
//@}
/// @name Thermodynamic Values for the Species Reference States
//@{
double GibbsExcessVPSSTP::checkMFSum(const doublereal * const x) const {
doublereal norm = accumulate(x, x + m_kk, 0.0);
if (fabs(norm - 1.0) > 1.0E-9) {
throw CanteraError("GibbsExcessVPSSTP::checkMFSun",
"MF sum exceeded tolerance of 1.0E-9:" + fp2str(norm));
throw CanteraError("GibbsExcessVPSSTP::checkMFSum",
"(MF sum - 1) exceeded tolerance of 1.0E-9:" + fp2str(norm));
}
return norm;
}
@ -337,6 +320,7 @@ namespace Cantera {
moleFractions_.resize(m_kk);
lnActCoeff_Scaled_.resize(m_kk);
dlnActCoeffdT_Scaled_.resize(m_kk);
dlnActCoeffdlnC_Scaled_.resize(m_kk);
m_pp.resize(m_kk);
}

View file

@ -1,9 +1,9 @@
/**
* @file gibbsExcessVPSSTP.h
* @file GibbsExcessVPSSTP.h
* Header for intermediate ThermoPhase object for phases which
* employ gibbs excess free energy based formulations
* (see \ref thermoprops
* and class \link Cantera::gibbsExcessVPSSTP gibbsExcessVPSSTP\endlink).
* and class \link Cantera::GibbsExcessVPSSTP GibbsExcessVPSSTP\endlink).
*
* Header file for a derived class of ThermoPhase that handles
* variable pressure standard state methods for calculating
@ -17,7 +17,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: GibbsExcessVPSSTP.h,v 1.3 2009/03/03 21:08:31 hkmoffa Exp $
* $Id$
*/
#ifndef CT_GIBBSEXCESSVPSSTP_H
@ -302,6 +302,28 @@ namespace Cantera {
err("getdlnActCoeffdT");
}
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
/*!
* This function is a virtual method. For ideal mixtures
* (unity activity coefficients), this can return zero.
* Implementations should take the derivative of the
* logarithm of the activity coefficient with respect to the
* logarithm of the concentration-like variable (i.e. mole fraction,
* molality, etc.) that represents the standard state.
* This quantity is to be used in conjunction with derivatives of
* that concentration-like variable when the derivative of the chemical
* potential is taken.
*
* units = dimensionless
*
* @param dlnActCoeffdlnC Output vector of derivatives of the
* log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const {
err("getdlnActCoeffdlnC");
}
//@}
/// @name Partial Molar Properties of the Solution
//@{
@ -517,6 +539,10 @@ namespace Cantera {
protected:
//! utility routine to check mole fraction sum
/*!
* @param x vector of mole fractions.
*/
double checkMFSum(const doublereal * const x) const;
protected:
@ -528,10 +554,16 @@ namespace Cantera {
//! species, divided by RT
mutable std::vector<doublereal> lnActCoeff_Scaled_;
//! Storage for the current derivative values of the log of the
// activity coefficients of the species
//! Storage for the current derivative values of the
//! gradients with respect to temperature of the
//! log of theactivity coefficients of the species
mutable std::vector<doublereal> dlnActCoeffdT_Scaled_;
//! Storage for the current derivative values of the
//! gradients with respect to logarithm of the mole fraction of the
//! log of theactivity coefficients of the species
mutable std::vector<doublereal> dlnActCoeffdlnC_Scaled_;
//! Temporary storage space that is fair game
mutable std::vector<doublereal> m_pp;

View file

@ -18,7 +18,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: HMWSoln.cpp,v 1.53 2009/03/27 00:38:57 hkmoffa Exp $
* $Id$
*/
//@{
#ifndef MAX

View file

@ -14,7 +14,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: HMWSoln.h,v 1.62 2009/03/27 00:38:57 hkmoffa Exp $
* $Id$
*/
#ifndef CT_HMWSOLN_H
@ -104,7 +104,7 @@ namespace Cantera {
* water (IAPWS 1995 formulation) is used as its standard state.
* All standard state properties for the solvent are based on
* this real model for water, and involve function calls
* to the object that handles the real water model, #WaterPropsIAPWS.
* to the object that handles the real water model, #Cantera::WaterPropsIAPWS.
*
* The standard states for solutes are on the unit molality basis.
* Therefore, in the documentation below, the normal \f$ o \f$
@ -507,7 +507,7 @@ namespace Cantera {
* \f]
*
*
* <H3> Activity of the Water Solvent </H3>
* <H3> Activity of the Water Solvent </H3>
*
* The activity for the solvent water,\f$ a_o \f$, is not independent and must be
* determined either from the Gibbs-Duhem relation or from taking the appropriate derivative

View file

@ -13,7 +13,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: HMWSoln_input.cpp,v 1.33 2009/01/29 02:07:05 hkmoffa Exp $
* $Id$
*/
#include "HMWSoln.h"

View file

@ -7,7 +7,7 @@
*
*/
/*
* $Id: IdealGasPhase.cpp,v 1.3 2008/08/23 00:53:54 hkmoffa Exp $
* $Id$
*/
#ifdef WIN32

View file

@ -6,9 +6,9 @@
*
*/
/* $Author: hkmoffa $
* $Date: 2009/07/05 18:07:18 $
* $Revision: 1.5 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2001 California Institute of Technology
*

View file

@ -19,8 +19,8 @@
*/
/*
*
* $Date: 2009/03/27 00:51:38 $
* $Revision: 1.27 $
* $Date$
* $Revision$
*/
#include "IdealMolalSoln.h"

View file

@ -19,9 +19,9 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Author: hkmoffa $
* $Date: 2009/03/27 00:51:38 $
* $Revision: 1.24 $
* $Author$
* $Date$
* $Revision$
*/
#ifndef CT_IDEALMOLALSOLN_H

View file

@ -5,7 +5,7 @@
* \link Cantera::IdealSolidSolnPhase IdealSolidSolnPhase\endlink).
*/
/*
* $Id: IdealSolidSolnPhase.cpp,v 1.11 2009/03/27 00:51:39 hkmoffa Exp $
* $Id$
*/
/*
* Copywrite 2006 Sandia Corporation. Under the terms of Contract

View file

@ -10,9 +10,9 @@
*/
/*
* $Author: hkmoffa $
* $Date: 2009/03/27 00:51:39 $
* $Revision: 1.18 $
* $Author$
* $Date$
* $Revision$
*/
/*
* Copywrite 2006 Sandia Corporation. Under the terms of Contract

View file

@ -12,9 +12,9 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Author: hkmoffa $
* $Date: 2008/09/16 14:38:13 $
* $Revision: 1.2 $
* $Author$
* $Date$
* $Revision$
*/
// turn off warnings under Windows

View file

@ -12,9 +12,9 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Author: hkmoffa $
* $Date: 2008/08/23 00:53:54 $
* $Revision: 1.1 $
* $Author$
* $Date$
* $Revision$
*/
#ifndef CT_IDEALSOLNGASVPSS_H

View file

@ -1,9 +1,9 @@
/**
* @file PseudoBinaryVPSSTP.cpp
* Definitions for intermediate ThermoPhase object for phases which
* employ excess gibbs free energy formulations
* @file IonsFromNeutralVPSSTP.cpp
* Definitions for the object which treats ionic liquids as made of ions as species
* even though the thermodynamics is obtained from the neutral molecule representation.
* (see \ref thermoprops
* and class \link Cantera::PseudoBinaryVPSSTP PseudoBinaryVPSSTP\endlink).
* and class \link Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink).
*
* Header file for a derived class of ThermoPhase that handles
* variable pressure standard state methods for calculating
@ -17,11 +17,10 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Date: 2009/03/27 01:08:55 $
* $Revision: 1.2 $
* $Date$
* $Revision$
*/
#include "IonsFromNeutralVPSSTP.h"
#include "ThermoFactory.h"
@ -142,7 +141,7 @@ namespace Cantera {
neutralMoleculePhase_(0),
IOwnNThermoPhase_(true)
{
*this = operator=(b);
IonsFromNeutralVPSSTP::operator=(b);
}
/*
@ -153,14 +152,38 @@ namespace Cantera {
*/
IonsFromNeutralVPSSTP& IonsFromNeutralVPSSTP::
operator=(const IonsFromNeutralVPSSTP &b) {
if (&b != this) {
GibbsExcessVPSSTP::operator=(b);
}
if (&b == this) {
return *this;
}
/*
* If we own the underlying neutral molecule phase, then we do a deep
* copy. If not, we do a shallow copy. We get a valid pointer for
* neutralMoleculePhase_ first, because we need it to assign the pointers
* within the PDSS_IonsFromNeutral object. which is done in the
* GibbsExcessVPSSTP::operator=(b) step.
*/
if (IOwnNThermoPhase_) {
if (b.neutralMoleculePhase_) {
if (neutralMoleculePhase_) {
delete neutralMoleculePhase_;
}
neutralMoleculePhase_ = (b.neutralMoleculePhase_)->duplMyselfAsThermoPhase();
} else {
neutralMoleculePhase_ = 0;
}
} else {
neutralMoleculePhase_ = b.neutralMoleculePhase_;
}
GibbsExcessVPSSTP::operator=(b);
ionSolnType_ = b.ionSolnType_;
numNeutralMoleculeSpecies_ = b.numNeutralMoleculeSpecies_;
indexSpecialSpecies_ = b.indexSpecialSpecies_;
indexSecondSpecialSpecies_ = b.indexSecondSpecialSpecies_;
fm_neutralMolec_ions_ = b.fm_neutralMolec_ions_;
fm_invert_ionForNeutral = b.fm_invert_ionForNeutral;
NeutralMolecMoleFractions_ = b.NeutralMolecMoleFractions_;
cationList_ = b.cationList_;
numCationSpecies_ = b.numCationSpecies_;
@ -168,21 +191,18 @@ namespace Cantera {
numAnionSpecies_ = b.numAnionSpecies_;
passThroughList_ = b.passThroughList_;
numPassThroughSpecies_ = b.numPassThroughSpecies_;
/*
* This is a shallow copy. We need to figure this out
*/
neutralMoleculePhase_ = b.neutralMoleculePhase_;
if (neutralMoleculePhase_) {
exit(-1);
}
IOwnNThermoPhase_ = b.IOwnNThermoPhase_;
IOwnNThermoPhase_ = b.IOwnNThermoPhase_;
moleFractionsTmp_ = b.moleFractionsTmp_;
muNeutralMolecule_ = b.muNeutralMolecule_;
gammaNeutralMolecule_ = b.gammaNeutralMolecule_;
dlnActCoeffdT_NeutralMolecule_ = b.dlnActCoeffdT_NeutralMolecule_;
dlnActCoeffdlnC_NeutralMolecule_ = b.dlnActCoeffdlnC_NeutralMolecule_;
return *this;
}
/**
/*
*
* ~IonsFromNeutralVPSSTP(): (virtual)
*
@ -192,7 +212,7 @@ namespace Cantera {
IonsFromNeutralVPSSTP::~IonsFromNeutralVPSSTP() {
if (IOwnNThermoPhase_) {
delete neutralMoleculePhase_;
neutralMoleculePhase_=0;
neutralMoleculePhase_ = 0;
}
}
@ -563,6 +583,37 @@ namespace Cantera {
}
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
/*!
* This function is a virtual method. For ideal mixtures
* (unity activity coefficients), this can return zero.
* Implementations should take the derivative of the
* logarithm of the activity coefficient with respect to the
* logarithm of the concentration-like variable (i.e. mole fraction,
* molality, etc.) that represents the standard state.
* This quantity is to be used in conjunction with derivatives of
* that concentration-like variable when the derivative of the chemical
* potential is taken.
*
* units = dimensionless
*
* @param dlnActCoeffdlnC Output vector of log(mole fraction)
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const {
s_update_lnActCoeff();
s_update_dlnActCoeff_dlnC();
for (int k = 0; k < m_kk; k++) {
dlnActCoeffdlnC[k] = dlnActCoeffdlnC_Scaled_[k];
}
}
// This is temporary. We will get rid of this
void IonsFromNeutralVPSSTP::setTemperature(doublereal t) {
double p = pressure();
@ -776,21 +827,21 @@ namespace Cantera {
neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_));
}
void IonsFromNeutralVPSSTP::setMoleFractions(const doublereal* const y) {
GibbsExcessVPSSTP::setMoleFractions(y);
void IonsFromNeutralVPSSTP::setMoleFractions(const doublereal* const x) {
GibbsExcessVPSSTP::setMoleFractions(x);
calcNeutralMoleculeMoleFractions();
neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_));
}
void IonsFromNeutralVPSSTP::setMoleFractions_NoNorm(const doublereal* const y) {
GibbsExcessVPSSTP::setMoleFractions_NoNorm(y);
void IonsFromNeutralVPSSTP::setMoleFractions_NoNorm(const doublereal* const x) {
GibbsExcessVPSSTP::setMoleFractions_NoNorm(x);
calcNeutralMoleculeMoleFractions();
neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_));
}
void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const y) {
GibbsExcessVPSSTP::setConcentrations(y);
void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c) {
GibbsExcessVPSSTP::setConcentrations(c);
calcNeutralMoleculeMoleFractions();
neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_));
}
@ -979,6 +1030,7 @@ namespace Cantera {
muNeutralMolecule_.resize(numNeutralMoleculeSpecies_);
gammaNeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdT_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdlnC_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
}
static double factorOverlap(const std::vector<std::string>& elnamesVN ,
@ -1280,6 +1332,64 @@ namespace Cantera {
}
/*
* This function will be called to update the internally storred
* temperature derivative of the natural logarithm of the activity coefficients
*/
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnC() const {
int k, icat, jNeut;
doublereal fmij;
/*
* Get the activity coefficients of the neutral molecules
*/
GibbsExcessVPSSTP *geThermo = dynamic_cast<GibbsExcessVPSSTP *>(neutralMoleculePhase_);
if (!geThermo) {
fvo_zero_dbl_1(dlnActCoeffdlnC_Scaled_, m_kk);
return;
}
geThermo->getdlnActCoeffdlnC(DATA_PTR(dlnActCoeffdlnC_NeutralMolecule_));
switch (ionSolnType_) {
case cIonSolnType_PASSTHROUGH:
break;
case cIonSolnType_SINGLEANION:
// Do the cation list
for (k = 0; k < (int) cationList_.size(); k++) {
//! Get the id for the next cation
icat = cationList_[k];
jNeut = fm_invert_ionForNeutral[icat];
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
dlnActCoeffdlnC_Scaled_[icat] = fmij * dlnActCoeffdlnC_NeutralMolecule_[jNeut];
}
// Do the anion list
icat = anionList_[0];
jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdT_Scaled_[icat]= 0.0;
// Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdlnC_Scaled_[icat] = dlnActCoeffdlnC_NeutralMolecule_[jNeut];
}
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff", "Unimplemented type");
break;
case cIonSolnType_MULTICATIONANION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff", "Unimplemented type");
break;
default:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff", "Unimplemented type");
break;
}
}
/**
* Format a summary of the mixture state for output.
*/

View file

@ -17,7 +17,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: $
* $Id$
*/
#ifndef CT_IONSFROMNEUTRALVPSSTP_H
@ -152,9 +152,9 @@ namespace Cantera {
/// Destructor.
virtual ~IonsFromNeutralVPSSTP();
//! Duplication routine for objects which inherit from ThermoPhase.
//! Duplication routine for objects which inherit from ThermoPhase.
/*!
* This virtual routine can be used to duplicate thermophase objects
* This virtual routine can be used to duplicate ThermoPhase objects
* inherited from ThermoPhase even if the application only has
* a pointer to ThermoPhase to work with.
*/
@ -404,6 +404,27 @@ namespace Cantera {
*/
virtual void getPartialMolarEntropies(doublereal* sbar) const;
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
/*!
* This function is a virtual method. For ideal mixtures
* (unity activity coefficients), this can return zero.
* Implementations should take the derivative of the
* logarithm of the activity coefficient with respect to the
* logarithm of the concentration-like variable (i.e. mole fraction,
* molality, etc.) that represents the standard state.
* This quantity is to be used in conjunction with derivatives of
* that concentration-like variable when the derivative of the chemical
* potential is taken.
*
* units = dimensionless
*
* @param dlnActCoeffdlnC Output vector of log(mole fraction)
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const;
//@}
/// @name Properties of the Standard State of the Species in the Solution
@ -652,13 +673,23 @@ namespace Cantera {
*/
void s_update_lnActCoeff() const;
//! Update the temperatture derivative of the ln activity coefficients
//! Update the temperature derivative of the ln activity coefficients
/*!
* This function will be called to update the internally storred
* temperature derivative of the natural logarithm of the activity coefficients
*/
void s_update_dlnActCoeffdT() const;
//! Update the derivative of the log of the activity coefficients
//! wrt log(mole fraction)
/*!
* This function will be called to update the internally storred
* derivative of the natural logarithm of the activity coefficients
* wrt logarithm of the mole fractions.
*/
void s_update_dlnActCoeff_dlnC() const;
private:
//! Error function
/*!
@ -689,7 +720,7 @@ namespace Cantera {
//! Index of special species
int indexSpecialSpecies_;
//! Index of special species
//! Index of special species
int indexSecondSpecialSpecies_;
//! Formula Matrix for composition of neutral molecules
@ -737,7 +768,7 @@ namespace Cantera {
int numCationSpecies_;
//! List of the species in this ThermoPhase which are anion species
std::vector<int>anionList_;
std::vector<int> anionList_;
//! Number of anion species
int numAnionSpecies_;
@ -754,9 +785,22 @@ namespace Cantera {
int numPassThroughSpecies_;
public:
//! This is a pointer to the neutral Molecule Phase
/*!
* If the variable, IOwnNThermoPhase_ is true, then we own
* the pointer. If not, then this is considered a shallow pointer.
*/
ThermoPhase *neutralMoleculePhase_;
protected:
private:
//! If true then we own the underlying neutral Molecule Phase
/*!
* If this is false, then the neutral molecule phase is considered
* as a shallow pointer.
*/
bool IOwnNThermoPhase_;
//! ThermoPhase for the cation lattice
/*!
* Currently this is unimplemented and may be deleted
@ -775,10 +819,8 @@ namespace Cantera {
mutable std::vector<doublereal> muNeutralMolecule_;
mutable std::vector<doublereal> gammaNeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdT_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdlnC_NeutralMolecule_;
private:
};

View file

@ -8,7 +8,7 @@
*
*/
/*
* $Id: LatticePhase.cpp,v 1.8 2009/01/02 22:34:41 hkmoffa Exp $
* $Id$
*/
#include "config.h"

View file

@ -6,9 +6,9 @@
* (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink).
*
*/
/* $Author: hkmoffa $
* $Date: 2008/12/13 01:59:49 $
* $Revision: 1.7 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2005 California Institute of Technology
*

View file

@ -2,7 +2,7 @@
*
* @file LatticeSolidPhase.cpp
*
* $Id: LatticeSolidPhase.cpp,v 1.4 2008/10/08 22:11:08 hkmoffa Exp $
* $Id$
*/
#ifdef WIN32

View file

@ -7,9 +7,9 @@
*/
/* $Author: hkmoffa $
* $Date: 2008/12/13 01:59:49 $
* $Revision: 1.5 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2005 California Institute of Technology
*

View file

@ -1,8 +1,8 @@
#/bin/sh
###############################################################
# $Author: hkmoffa $
# $Date: 2009/03/03 21:08:31 $
# $Revision: 1.30 $
# $Author$
# $Date$
# $Revision$
#
# Copyright 2002 California Institute of Technology
#
@ -40,7 +40,7 @@ THERMO_OBJ = State.o Elements.o Constituents.o Phase.o \
ThermoFactory.o phasereport.o SpeciesThermoInterpType.o \
VPSSMgr.o VPSSMgrFactory.o VPSSMgr_General.o IdealSolnGasVPSS.o \
VPSSMgr_IdealGas.o VPSSMgr_ConstVol.o PDSS_ConstVol.o PDSS_IdealGas.o \
@phase_object_files@
PDSS_SSVol.o @phase_object_files@
THERMO_H = State.h Elements.h Constituents.h Phase.h mix_defs.h \
ThermoPhase.h IdealGasPhase.h ConstDensityThermo.h \
@ -54,7 +54,7 @@ THERMO_H = State.h Elements.h Constituents.h Phase.h mix_defs.h \
EdgePhase.h \
VPSSMgr.h VPSSMgrFactory.h VPSSMgr_General.h IdealSolnGasVPSS.h \
VPSSMgr_IdealGas.h VPSSMgr_ConstVol.h PDSS_ConstVol.h PDSS_IdealGas.h \
@phase_header_files@
PDSS_SSVol.h @phase_header_files@
# Extended Cantera Thermodynamics Object Files

View file

@ -12,8 +12,8 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Date: 2009/03/03 21:08:31 $
* $Revision: 1.1 $
* $Date$
* $Revision$
*/
@ -75,7 +75,7 @@ namespace Cantera {
MargulesVPSSTP::MargulesVPSSTP(const MargulesVPSSTP &b) :
GibbsExcessVPSSTP()
{
*this = operator=(b);
MargulesVPSSTP::operator=(b);
}
/*
@ -86,9 +86,11 @@ namespace Cantera {
*/
MargulesVPSSTP& MargulesVPSSTP::
operator=(const MargulesVPSSTP &b) {
if (&b != this) {
GibbsExcessVPSSTP::operator=(b);
if (&b == this) {
return *this;
}
GibbsExcessVPSSTP::operator=(b);
numBinaryInteractions_ = b.numBinaryInteractions_ ;
m_HE_b_ij = b.m_HE_b_ij;
@ -648,6 +650,46 @@ namespace Cantera {
}
}
// Update the derivative of the log of the activity coefficients wrt ln(X)
/*
* This function will be called to update the internally stored gradients of the
* logarithm of the activity coefficients. These are used in the determination
* of the diffusion coefficients.
*
* he = X_A X_B(B + C(X_A - X_B))
*/
void MargulesVPSSTP::s_update_dlnActCoeff_dlnC() const {
int iA, iB;
doublereal XA, XB, g0 , g1;
doublereal T = temperature();
fvo_zero_dbl_1(dlnActCoeffdlnC_Scaled_, m_kk);
doublereal RT = GasConstant * T;
for (int i = 0; i < numBinaryInteractions_; i++) {
iA = m_pSpecies_A_ij[i];
iB = m_pSpecies_B_ij[i];
XA = moleFractions_[iA];
XB = moleFractions_[iB];
g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT ;
g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT;
dlnActCoeffdlnC_Scaled_[iA] += XA * ( ( - 2.0 + 2.0 * XA ) * g0
+ ( - 4.0 + 10.0 * XA - 6.0 * XA*XA ) * g1 ) ;
dlnActCoeffdlnC_Scaled_[iB] += XB * ( ( - 2.0 + 2.0 * XB ) * g0
+ ( 2.0 - 8.0 * XB + 6.0 * XB*XB ) * g1 ) ;
}
}
void MargulesVPSSTP::getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const {
s_update_dlnActCoeff_dlnC();
for (int k = 0; k < m_kk; k++) {
dlnActCoeffdlnC[k] = dlnActCoeffdlnC_Scaled_[k];
}
}
void MargulesVPSSTP::resizeNumInteractions(const int num) {
numBinaryInteractions_ = num;

View file

@ -1,5 +1,5 @@
/**
* @file Margules.h
* @file MargulesVPSSTP.h
* Header for intermediate ThermoPhase object for phases which
* employ gibbs excess free energy based formulations
* (see \ref thermoprops
@ -17,7 +17,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: MargulesVPSSTP.h,v 1.1 2009/03/03 21:08:31 hkmoffa Exp $
* $Id$
*/
#ifndef CT_MARGULESVPSSTP_H
@ -336,10 +336,11 @@ namespace Cantera {
//! Special constructor for a hard-coded problem
/*!
*
* LiKCl treating the PseudoBinary layer as passthrough.
* -> test to predict the eutectic and liquidus correctly.
*
*
* @param testProb Hard-coded value. Only the value of 1 is
* used. It's for
* a LiKCl system
* -> test to predict the eutectic and liquidus correctly.
*/
MargulesVPSSTP(int testProb);
@ -350,7 +351,7 @@ namespace Cantera {
*
* @param b class to be copied
*/
MargulesVPSSTP(const MargulesVPSSTP&b);
MargulesVPSSTP(const MargulesVPSSTP& b);
//! Assignment operator
/*!
@ -537,6 +538,9 @@ namespace Cantera {
* \f[
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
* \f]
*
* @param hbar Vector of returned partial molar enthalpies
* (length m_kk, units = J/kmol)
*/
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
@ -554,6 +558,9 @@ namespace Cantera {
* - R \ln( \gamma_k X_k)
* - R T \frac{d \ln(\gamma_k) }{dT}
* \f]
*
* @param sbar Vector of returned partial molar entropies
* (length m_kk, units = J/kmol/K)
*/
virtual void getPartialMolarEntropies(doublereal* sbar) const;
@ -567,7 +574,7 @@ namespace Cantera {
* Units: J/kmol
*
* @param mu output vector containing the species electrochemical potentials.
* Length: m_kk.
* Length: m_kk., units = J/kmol
*/
void getElectrochemPotentials(doublereal* mu) const;
@ -581,10 +588,33 @@ namespace Cantera {
*
* @param dlnActCoeffdT Output vector of temperature derivatives of the
* log Activity Coefficients. length = m_kk
*
*/
virtual void getdlnActCoeffdT(doublereal *dlnActCoeffdT) const;
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
/*!
* This function is a virtual method. For ideal mixtures
* (unity activity coefficients), this can return zero.
* Implementations should take the derivative of the
* logarithm of the activity coefficient with respect to the
* logarithm of the concentration-like variable (i.e. mole fraction,
* molality, etc.) that represents the standard state.
* This quantity is to be used in conjunction with derivatives of
* that concentration-like variable when the derivative of the chemical
* potential is taken.
*
* units = dimensionless
*
* @param dlnActCoeffdlnC Output vector of log(mole fraction)
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const;
//@}
/// @name Properties of the Standard State of the Species in the Solution
//@{
@ -692,11 +722,16 @@ namespace Cantera {
* This function reads the XML file and writes the coefficients
* it finds to an internal data structures.
*
* @param BinSalt reference to the XML_Node named "binaryNeutralSpeciesParameters"
* containing the binary interaction
* @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
* containing the binary interaction
*/
void readXMLBinarySpecies(XML_Node &xmLBinarySpecies);
void readXMLBinarySpecies(XML_Node &xmlBinarySpecies);
//! Resize internal arrays within the object that depend upon the number
//! of binary Margules interaction terms
/*!
* @param num Number of binary Margules interaction terms
*/
void resizeNumInteractions(const int num);
@ -711,14 +746,23 @@ namespace Cantera {
*/
void s_update_lnActCoeff() const;
// Update the derivative of the log of the activity coefficients wrt T
/*
//! Update the derivative of the log of the activity coefficients wrt T
/*!
* This function will be called to update the internally storred
* natural logarithm of the activity coefficients
*
* derivative of the natural logarithm of the activity coefficients
* wrt temperature.
*/
void s_update_dlnActCoeff_dT() const;
//! Update the derivative of the log of the activity coefficients
//! wrt log(mole fraction)
/*!
* This function will be called to update the internally storred
* derivative of the natural logarithm of the activity coefficients
* wrt logarithm of the mole fractions.
*/
void s_update_dlnActCoeff_dlnC() const;
private:
//! Error function
@ -733,30 +777,57 @@ namespace Cantera {
//! number of binary interaction expressions
int numBinaryInteractions_;
//! Enthalpy term for the binary mole fraction interaction of the
//! excess gibbs free energy expression
mutable vector_fp m_HE_b_ij;
//! Enthalpy term for the ternary mole fraction interaction of the
//! excess gibbs free energy expression
mutable vector_fp m_HE_c_ij;
//! Enthalpy term for the quaternary mole fraction interaction of the
//! excess gibbs free energy expression
mutable vector_fp m_HE_d_ij;
//! Entropy term for the binary mole fraction interaction of the
//! excess gibbs free energy expression
mutable vector_fp m_SE_b_ij;
//! Entropy term for the ternary mole fraction interaction of the
//! excess gibbs free energy expression
mutable vector_fp m_SE_c_ij;
//! Entropy term for the quaternary mole fraction interaction of the
//! excess gibbs free energy expression
mutable vector_fp m_SE_d_ij;
//! vector of species indices representing species A in the interaction
/*!
* Each Margules excess Gibbs free energy term involves two species, A and B.
* This vector identifies species A.
*/
vector_int m_pSpecies_A_ij;
//! vector of species indices representing species B in the interaction
/*!
* Each Margules excess Gibbs free energy term involves two species, A and B.
* This vector identifies species B.
*/
vector_int m_pSpecies_B_ij;
//! form of the Margules interaction expression
/*!
* Currently there is only one form.
*/
int formMargules_;
int formTempModel_;
private:
//! form of the temperatuer dependence of the Margules interaction expression
/*!
* Currently there is only one form -> constant wrt temperature.
*/
int formTempModel_;
};

View file

@ -4,9 +4,9 @@
*
*/
/* $Author: hkmoffa $
* $Date: 2009/03/24 20:36:05 $
* $Revision: 1.4 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2003 California Institute of Technology
*

View file

@ -14,7 +14,7 @@
*/
/*
* $Id: MineralEQ3.cpp,v 1.2 2008/12/27 00:27:55 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"

View file

@ -14,8 +14,8 @@
*/
/*
* $Date: 2009/01/04 19:21:28 $
* $Revision: 1.4 $
* $Date$
* $Revision$
*/
#ifndef CT_MINERALEQ3_H

View file

@ -17,9 +17,9 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Author: hkmoffa $
* $Date: 2009/01/16 16:24:35 $
* $Revision: 1.23 $
* $Author$
* $Date$
* $Revision$
*/

View file

@ -17,7 +17,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: MolalityVPSSTP.h,v 1.20 2009/01/20 21:48:54 hkmoffa Exp $
* $Id$
*/
#ifndef CT_MOLALITYVPSSTP_H

View file

@ -6,9 +6,9 @@
* (see \ref spthermo and class \link Cantera::Mu0Poly Mu0Poly\endlink).
*/
/*
* $Author: dggoodwin $
* $Revision: 1.1 $
* $Date: 2007/05/04 14:02:42 $
* $Author$
* $Revision$
* $Date$
*/

View file

@ -6,9 +6,9 @@
* (see \ref spthermo and class \link Cantera::Mu0Poly Mu0Poly\endlink).
*/
/* $Author: hkmoffa $
* $Revision: 1.2 $
* $Date: 2007/09/13 15:05:39 $
/* $Author$
* $Revision$
* $Date$
*/

View file

@ -10,9 +10,9 @@
* This parameterization has one NASA temperature region.
*/
/* $Author: hkmoffa $
* $Revision: 1.4 $
* $Date: 2007/12/27 19:09:38 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2007 Sandia National Laboratories

View file

@ -19,8 +19,8 @@
#define CT_NASA9POLY1_H
/*
* $Revision: 1.4 $
* $Date: 2009/01/04 19:21:28 $
* $Revision$
* $Date$
*/

View file

@ -11,9 +11,9 @@
* This parameterization has one NASA temperature region.
*/
/* $Author: hkmoffa $
* $Revision: 1.5 $
* $Date: 2008/03/04 23:40:18 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2007 Sandia National Laboratories

View file

@ -14,9 +14,9 @@
#ifndef CT_NASA9POLYMULTITEMPREGION_H
#define CT_NASA9POLYMULTITEMPREGION_H
/* $Author: hkmoffa $
* $Revision: 1.3 $
* $Date: 2007/12/27 19:09:38 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2007 Sandia National Laboratories

View file

@ -14,9 +14,9 @@
#define CT_NASAPOLY1_H
/* $Author: hkmoffa $
* $Revision: 1.3 $
* $Date: 2008/12/13 01:59:49 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -8,9 +8,9 @@
* Two zoned Nasa polynomial parameterization
*/
/* $Author: hkmoffa $
* $Revision: 1.3 $
* $Date: 2008/12/13 01:59:49 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -7,8 +7,8 @@
*/
/*
* $Revision: 1.7 $
* $Date: 2009/01/04 19:21:28 $
* $Revision$
* $Date$
*/
// Copyright 2003 California Institute of Technology

View file

@ -10,7 +10,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS.cpp,v 1.17 2009/01/04 06:34:19 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"

View file

@ -10,7 +10,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS.h,v 1.16 2009/01/04 19:21:28 hkmoffa Exp $
* $Id$
*/
#ifndef CT_PDSS_H
@ -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
@ -100,7 +100,22 @@ namespace Cantera {
* pressure dependencies to these thermo functions.
* .
*
* - PDSS_Water_
* - PDSS_SSVol
* - standardState model = "constant_incompressible" || model == "constant"
* - standardState model = "temperature_polynomial"
* - standardState model = "density_temperature_polynomial"
* - This model assumes that the species in the phase obey a
* fairly general equation of state, but one that separates out
* the calculation of the standard state density and/or volume.
* 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.
* .
*
* - PDSS_Water
* - standardState model = "Water"
* - This model assumes that
* Species 0 is assumed to be water, and a real equation
@ -653,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

@ -5,7 +5,7 @@
* (see \ref pdssthermo and class \link Cantera::SpeciesThermoFactory SpeciesThermoFactory\endlink);
*/
/*
* $Id: PDSSFactory.cpp,v 1.2 2008/10/13 21:01:48 hkmoffa Exp $
* $Id$
*/
// Copyright 2001 California Institute of Technology

View file

@ -9,7 +9,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_ConstVol.cpp,v 1.10 2009/01/04 06:34:20 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"

View file

@ -10,7 +10,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_ConstVol.h,v 1.6 2008/10/13 21:01:48 hkmoffa Exp $
* $Id$
*/
#ifndef CT_PDSS_CONSTVOL_H
@ -99,7 +99,6 @@ namespace Cantera {
* @name Utilities
* @{
*/
virtual int pdssType() const { return -1; }
/**
* @}

View file

@ -7,7 +7,7 @@
*/
/*
* $Id: PDSS_HKFT.cpp,v 1.22 2009/03/13 03:21:34 hkmoffa Exp $
* $Id$
*/
/*

View file

@ -7,8 +7,8 @@
*/
/*
* $Date: 2009/01/04 19:21:28 $
* $Revision: 1.14 $
* $Date$
* $Revision$
*/
/*
@ -126,7 +126,6 @@ namespace Cantera {
* @name Utilities
* @{
*/
virtual int pdssType() const { return -1; }
/**
* @}

View file

@ -9,7 +9,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_IdealGas.cpp,v 1.8 2009/01/04 06:34:20 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"

View file

@ -10,7 +10,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_IdealGas.h,v 1.4 2008/10/13 21:01:48 hkmoffa Exp $
* $Id$
*/
#ifndef CT_PDSS_IDEALGAS_H
@ -101,8 +101,6 @@ namespace Cantera {
* @name Utilities
* @{
*/
virtual int pdssType() const { return -1; }
/**
* @}

View file

@ -9,7 +9,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_IonsFromNeutral.cpp,v 1.8 2009/01/04 06:34:20 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"
@ -37,8 +37,7 @@ namespace Cantera {
{
m_pdssType = cPDSS_IONSFROMNEUTRAL;
}
//====================================================================================================================
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex,
std::string inputFile, std::string id) :
PDSS(tp, spindex),
@ -50,8 +49,7 @@ namespace Cantera {
m_pdssType = cPDSS_IONSFROMNEUTRAL;
constructPDSSFile(tp, spindex, inputFile, id);
}
//====================================================================================================================
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex, const XML_Node& speciesNode,
const XML_Node& phaseRoot, bool spInstalled) :
@ -68,8 +66,7 @@ namespace Cantera {
std::string id = "";
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, id);
}
//====================================================================================================================
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(const PDSS_IonsFromNeutral &b) :
PDSS(b)
@ -80,35 +77,57 @@ namespace Cantera {
*/
*this = b;
}
/**
//====================================================================================================================
/*
* Assignment operator
*/
PDSS_IonsFromNeutral& PDSS_IonsFromNeutral::operator=(const PDSS_IonsFromNeutral&b) {
if (&b == this) return *this;
if (&b == this) {
return *this;
}
PDSS::operator=(b);
m_tmin = b.m_tmin;
m_tmax = b.m_tmax;
/*
* The shallow pointer copy in the next step will be insufficient in most cases. However, its
* functionally the best we can do for this assignment operator. We fix up the pointer in the
* initAllPtrs() function.
*/
neutralMoleculePhase_ = b.neutralMoleculePhase_;
numMult_ = b.numMult_;
idNeutralMoleculeVec = b.idNeutralMoleculeVec;
factorVec = b.factorVec;
add2RTln2_ = b.add2RTln2_;
tmpNM = b.tmpNM;
specialSpecies_ = b.specialSpecies_;
return *this;
}
//====================================================================================================================
PDSS_IonsFromNeutral::~PDSS_IonsFromNeutral() {
}
//====================================================================================================================
//! Duplicator
PDSS* PDSS_IonsFromNeutral::duplMyselfAsPDSS() const {
PDSS_IonsFromNeutral * idg = new PDSS_IonsFromNeutral(*this);
return (PDSS *) idg;
}
//====================================================================================================================
void PDSS_IonsFromNeutral::initAllPtrs(VPStandardStateTP *tp, VPSSMgr *vpssmgr_ptr,
SpeciesThermo* spthermo) {
PDSS::initAllPtrs(tp, vpssmgr_ptr, spthermo);
IonsFromNeutralVPSSTP *ionPhase = dynamic_cast<IonsFromNeutralVPSSTP *>(tp);
if (!ionPhase) {
throw CanteraError("PDSS_IonsFromNeutral::initAllPts", "Dynamic cast failed");
}
neutralMoleculePhase_ = ionPhase->neutralMoleculePhase_;
}
//====================================================================================================================
/**
* constructPDSSXML:
*
@ -140,6 +159,9 @@ namespace Cantera {
}
IonsFromNeutralVPSSTP *ionPhase = dynamic_cast<IonsFromNeutralVPSSTP *>(tp);
if (!ionPhase) {
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML", "Dynamic cast failed");
}
neutralMoleculePhase_ = ionPhase->neutralMoleculePhase_;
std::vector<std::string> key;
@ -172,7 +194,7 @@ namespace Cantera {
}
}
//====================================================================================================================
void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP *tp, int spindex,
std::string inputFile, std::string id) {

View file

@ -11,7 +11,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_IdealGas.h,v 1.4 2008/10/13 21:01:48 hkmoffa Exp $
* $Id$
*/
#ifndef CT_PDSS_IONSFROMNEUTRAL_H
@ -48,18 +48,6 @@ namespace Cantera {
*/
PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex);
//! Copy Constructur
/*!
* @param b Object to be copied
*/
PDSS_IonsFromNeutral(const PDSS_IonsFromNeutral& b);
//! Assignment operator
/*!
* @param b Object to be copeid
*/
PDSS_IonsFromNeutral& operator=(const PDSS_IonsFromNeutral& b);
//! Constructor that initializes the object by examining the input file
//! of the ThermoPhase object
/*!
@ -91,20 +79,48 @@ namespace Cantera {
PDSS_IonsFromNeutral(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode,
const XML_Node& phaseRef, bool spInstalled);
//! Copy Constructor
/*!
* @param b Object to be copied
*/
PDSS_IonsFromNeutral(const PDSS_IonsFromNeutral& b);
//! Assignment operator
/*!
* @param b Object to be copeid
*/
PDSS_IonsFromNeutral& operator=(const PDSS_IonsFromNeutral& b);
//! Destructor
virtual ~PDSS_IonsFromNeutral();
//! Duplicator
virtual PDSS *duplMyselfAsPDSS() const;
//! Initialize or Reinitialize all shallow pointers in the object
/*!
* This command is called to reinitialize all shallow pointers in the
* object. It's needed for the duplicator capability.
* We need to have an inherited function here to set neutralMoleculePhase_ properly.
*
* @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
* This object must have already been malloced.
*
* @param vpssmgr_ptr Pointer to the variable pressure standard state
* calculator for this phase
*
* @param spthermo_ptr Pointer to the optional SpeciesThermo object
* that will handle the calculation of the reference
* state thermodynamic coefficients.
*/
virtual void initAllPtrs(VPStandardStateTP *vptp_ptr, VPSSMgr *vpssmgr_ptr,
SpeciesThermo* spthermo_ptr);
/**
* @}
* @name Utilities
* @{
*/
virtual int pdssType() const { return -1; }
/**
* @}
@ -438,7 +454,10 @@ namespace Cantera {
doublereal m_tmax;
//! Pointer to the Neutral Molecule thermophase object
//! Pointer to the Neutral Molecule ThermoPhase object
/*!
* This is a shallow pointer.
*/
ThermoPhase *neutralMoleculePhase_;
public:

View file

@ -0,0 +1,435 @@
/**
* @file PDSS_SSVol.cpp
* Implementation of a pressure dependent standard state
* virtual function.
*/
/*
* Copywrite (2006) Sandia Corporation. Under the terms of
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
* U.S. Government retains certain rights in this software.
*/
/*
* $Id$
*/
#include "ct_defs.h"
#include "xml.h"
#include "ctml.h"
#include "PDSS_SSVol.h"
#include "ThermoFactory.h"
#include "VPStandardStateTP.h"
using namespace std;
namespace Cantera {
/**
* Basic list of constructors and duplicators
*/
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex) :
PDSS(tp, spindex),
volumeModel_(cSSVOLUME_CONSTANT),
m_constMolarVolume(-1.0)
{
m_pdssType = cPDSS_SSVOL;
TCoeff_[0] = 0.0;
TCoeff_[1] = 0.0;
TCoeff_[2] = 0.0;
}
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp,
int spindex, std::string inputFile, std::string id) :
PDSS(tp, spindex),
volumeModel_(cSSVOLUME_CONSTANT),
m_constMolarVolume(-1.0)
{
m_pdssType = cPDSS_SSVOL;
constructPDSSFile(tp, spindex, inputFile, id);
}
PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex,
const XML_Node& speciesNode,
const XML_Node& phaseRoot,
bool spInstalled) :
PDSS(tp, spindex),
volumeModel_(cSSVOLUME_CONSTANT),
m_constMolarVolume(-1.0)
{
m_pdssType = cPDSS_SSVOL;
constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled) ;
}
PDSS_SSVol::PDSS_SSVol(const PDSS_SSVol &b) :
PDSS(b),
volumeModel_(cSSVOLUME_CONSTANT),
m_constMolarVolume(-1.0)
{
/*
* Use the assignment operator to do the brunt
* of the work for the copy construtor.
*/
*this = b;
}
/*
* Assignment operator
*/
PDSS_SSVol& PDSS_SSVol::operator=(const PDSS_SSVol&b) {
if (&b == this) return *this;
PDSS::operator=(b);
volumeModel_ = b.volumeModel_;
m_constMolarVolume = b.m_constMolarVolume;
TCoeff_ = b.TCoeff_;
return *this;
}
PDSS_SSVol::~PDSS_SSVol() {
}
//! Duplicator
PDSS* PDSS_SSVol::duplMyselfAsPDSS() const {
PDSS_SSVol * idg = new PDSS_SSVol(*this);
return (PDSS *) idg;
}
/*
* constructPDSSXML:
*
* Initialization of a PDSS_SSVol object using an
* xml file.
*
* This routine is a precursor to initThermo(XML_Node*)
* routine, which does most of the work.
*
* @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.
*/
void PDSS_SSVol::constructPDSSXML(VPStandardStateTP *tp, int spindex,
const XML_Node& speciesNode,
const XML_Node& phaseNode, bool spInstalled) {
PDSS::initThermo();
SpeciesThermo &sp = m_tp->speciesThermo();
m_p0 = sp.refPressure(m_spindex);
if (!spInstalled) {
throw CanteraError("PDSS_SSVol::constructPDSSXML", "spInstalled false not handled");
}
const XML_Node *ss = speciesNode.findByName("standardState");
if (!ss) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
"no standardState Node for species " + speciesNode.name());
}
std::string model = (*ss)["model"];
if (model == "constant_incompressible" || model == "constant") {
volumeModel_ = cSSVOLUME_CONSTANT;
m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI");
} else if (model == "temperature_polynomial") {
volumeModel_ = cSSVOLUME_TPOLY;
int num = getFloatArray(*ss, TCoeff_, true, "", "volumeTemperaturePolynomial");
if (num != 4) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
" 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 4 density polynomial numbers for species " + speciesNode.name());
}
} else {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
"standardState model for species isn't constant_incompressible: " + speciesNode.name());
}
std::string id = "";
}
/*
* constructPDSSFile():
*
* Initialization of a PDSS_SSVol object using an
* xml file.
*
* This routine is a precursor to initThermo(XML_Node*)
* routine, which does most of the work.
*
* @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.
*/
void PDSS_SSVol::constructPDSSFile(VPStandardStateTP *tp, int spindex,
std::string inputFile, std::string id) {
if (inputFile.size() == 0) {
throw CanteraError("PDSS_SSVol::initThermo",
"input file is null");
}
std::string path = findInputFile(inputFile);
ifstream fin(path.c_str());
if (!fin) {
throw CanteraError("PDSS_SSVol::initThermo","could not open "
+path+" for reading.");
}
/*
* The phase object automatically constructs an XML object.
* Use this object to store information.
*/
XML_Node *fxml = new XML_Node();
fxml->build(fin);
XML_Node *fxml_phase = findXMLPhase(fxml, id);
if (!fxml_phase) {
throw CanteraError("PDSS_SSVol::initThermo",
"ERROR: Can not find phase named " +
id + " in file named " + inputFile);
}
XML_Node& speciesList = fxml_phase->child("speciesArray");
XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"],
&(fxml_phase->root()));
const vector<string>&sss = tp->speciesNames();
const XML_Node* s = speciesDB->findByAttr("name", sss[spindex]);
constructPDSSXML(tp, spindex, *s, *fxml_phase, true);
delete fxml;
}
void PDSS_SSVol::initThermoXML(const XML_Node& phaseNode, std::string& id) {
PDSS::initThermoXML(phaseNode, id);
m_minTemp = m_spthermo->minTemp(m_spindex);
m_maxTemp = m_spthermo->maxTemp(m_spindex);
m_p0 = m_spthermo->refPressure(m_spindex);
m_mw = m_tp->molecularWeight(m_spindex);
}
void PDSS_SSVol::initThermo() {
PDSS::initThermo();
SpeciesThermo &sp = m_tp->speciesThermo();
m_p0 = sp.refPressure(m_spindex);
m_V0_ptr[m_spindex] = m_constMolarVolume;
m_Vss_ptr[m_spindex] = m_constMolarVolume;
}
doublereal
PDSS_SSVol::enthalpy_mole() const {
doublereal val = enthalpy_RT();
doublereal RT = GasConstant * m_temp;
return (val * RT);
}
doublereal
PDSS_SSVol::enthalpy_RT() const {
doublereal val = m_hss_RT_ptr[m_spindex];
return (val);
}
doublereal
PDSS_SSVol::intEnergy_mole() const {
doublereal pVRT = (m_pres * m_Vss_ptr[m_spindex]) / (GasConstant * m_temp);
doublereal val = m_h0_RT_ptr[m_spindex] - pVRT;
doublereal RT = GasConstant * m_temp;
return (val * RT);
}
doublereal
PDSS_SSVol::entropy_mole() const {
doublereal val = entropy_R();
return (val * GasConstant);
}
doublereal
PDSS_SSVol::entropy_R() const {
doublereal val = m_sss_R_ptr[m_spindex];
return (val);
}
/**
* Calculate the Gibbs free energy in mks units of
* J kmol-1 K-1.
*/
doublereal
PDSS_SSVol::gibbs_mole() const {
doublereal val = gibbs_RT();
doublereal RT = GasConstant * m_temp;
return (val * RT);
}
doublereal
PDSS_SSVol::gibbs_RT() const {
doublereal val = m_gss_RT_ptr[m_spindex];
return (val);
}
doublereal
PDSS_SSVol::cp_mole() const {
doublereal val = m_cpss_R_ptr[m_spindex];
return (val * GasConstant);
}
doublereal
PDSS_SSVol::cp_R() const {
doublereal val = m_cpss_R_ptr[m_spindex];
return (val);
}
doublereal
PDSS_SSVol::cv_mole() const {
doublereal val = (cp_mole() - m_V0_ptr[m_spindex]);
return (val);
}
doublereal
PDSS_SSVol::molarVolume() const {
doublereal val = m_Vss_ptr[m_spindex];
return (val);
}
doublereal
PDSS_SSVol::density() const {
doublereal val = m_Vss_ptr[m_spindex];
return (m_mw/val);
}
doublereal
PDSS_SSVol::gibbs_RT_ref() const {
doublereal val = m_g0_RT_ptr[m_spindex];
return (val);
}
doublereal PDSS_SSVol::enthalpy_RT_ref() const {
doublereal val = m_h0_RT_ptr[m_spindex];
return (val);
}
doublereal PDSS_SSVol::entropy_R_ref() const {
doublereal val = m_s0_R_ptr[m_spindex];
return (val);
}
doublereal PDSS_SSVol::cp_R_ref() const {
doublereal val = m_cp0_R_ptr[m_spindex];
return (val);
}
doublereal PDSS_SSVol::molarVolume_ref() const {
doublereal val = m_V0_ptr[m_spindex];
return (val);
}
void PDSS_SSVol::calcMolarVolume() const {
if (volumeModel_ == cSSVOLUME_CONSTANT ) {
m_Vss_ptr[m_spindex] = m_constMolarVolume;
} else if (volumeModel_ == cSSVOLUME_TPOLY) {
m_Vss_ptr[m_spindex] = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3]));
dVdT_ = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3];
d2VdT2_ = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3];
} else if (volumeModel_ == cSSVOLUME_DENSITY_TPOLY) {
doublereal dens = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3]));
m_Vss_ptr[m_spindex] = m_mw / dens;
doublereal dens2 = dens * dens;
doublereal ddensdT = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3];
doublereal d2densdT2 = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3];
dVdT_ = - m_mw / (dens2) * (ddensdT);
d2VdT2_ = 2.0 * m_mw / (dens2 * dens) * ddensdT * ddensdT - m_mw / dens2 * d2densdT2;
} else {
throw CanteraError("PDSS_SSVol::calcMolarVolume", "unimplemented");
}
}
/// critical temperature
doublereal PDSS_SSVol::critTemperature() const {
throw CanteraError("PDSS_SSVol::critTemperature()", "unimplemented");
return (0.0);
}
/// critical pressure
doublereal PDSS_SSVol::critPressure() const {
throw CanteraError("PDSS_SSVol::critPressure()", "unimplemented");
return (0.0);
}
/// critical density
doublereal PDSS_SSVol::critDensity() const {
throw CanteraError("PDSS_SSVol::critDensity()", "unimplemented");
return (0.0);
}
void PDSS_SSVol::setPressure(doublereal p) {
m_pres = p;
doublereal deltaP = m_pres - m_p0;
if (fabs(deltaP) < 1.0E-10) {
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex];
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex];
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex];
} else {
doublereal del_pRT = deltaP / (GasConstant * m_temp);
doublereal sV_term = - deltaP / (GasConstant) * dVdT_;
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]);
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term;
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_;
}
}
void PDSS_SSVol::setTemperature(doublereal temp) {
m_temp = temp;
m_spthermo->update_one(m_spindex, temp, m_cp0_R_ptr, m_h0_RT_ptr, m_s0_R_ptr);
calcMolarVolume();
m_g0_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] - m_s0_R_ptr[m_spindex];
doublereal deltaP = m_pres - m_p0;
if (fabs(deltaP) < 1.0E-10) {
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex];
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex];
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex];
} else {
doublereal del_pRT = deltaP / (GasConstant * m_temp);
doublereal sV_term = - deltaP / (GasConstant) * dVdT_;
m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]);
m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term;
m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex];
m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_;
}
}
void PDSS_SSVol::setState_TP(doublereal temp, doublereal pres) {
m_pres = pres;
setTemperature(temp);
}
void PDSS_SSVol::setState_TR(doublereal temp, doublereal rho) {
doublereal rhoStored = m_mw / m_constMolarVolume;
if (fabs(rhoStored - rho) / (rhoStored + rho) > 1.0E-4) {
throw CanteraError("PDSS_SSVol::setState_TR",
"Inconsistent supplied rho");
}
setTemperature(temp);
}
/// saturation pressure
doublereal PDSS_SSVol::satPressure(doublereal t){
return (1.0E-200);
}
}

View file

@ -0,0 +1,586 @@
/**
* @file PDSS_SSVol.h
* Declarations for the class PDSS_SSVol (pressure dependent standard state)
* which handles calculations for a single species with an expression for the standard state molar volume in a phase
* given by an enumerated data type
* (see class \ref pdssthermo and \link Cantera::PDSS_SSVol PDSS_SSVol\endlink).
*/
/*
* Copywrite (2009) Sandia Corporation. Under the terms of
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
* U.S. Government retains certain rights in this software.
*/
/*
* $Id$
*/
#ifndef CT_PDSS_SSVOL_H
#define CT_PDSS_SSVOL_H
#include "PDSS.h"
namespace Cantera {
class XML_Node;
class VPStandardStateTP;
//! 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
*/
class PDSS_SSVol : public PDSS {
public:
/**
* @name Constructors
* @{
*/
//! Constructor
/*!
* @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
*/
PDSS_SSVol(VPStandardStateTP *tp, int spindex);
//! Constructor that initializes the object by examining the input file
//! of the ThermoPhase object
/*!
* This function calls the constructPDSSFile member function.
*
* @param tp Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
* @param inputFile String name of the input file
* @param id String name of the phase in the input file. The default
* is the empty string, in which case the first phase in the
* file is used.
*/
PDSS_SSVol(VPStandardStateTP *tp, int spindex,
std::string inputFile, std::string id = "");
//! Constructor that initializes the object by examining the input file
//! of the ThermoPhase object
/*!
* This function calls the constructPDSSXML member function.
*
* @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase
* @param spindex Species index of the species in the phase
* @param speciesNode Reference to the species XML tree.
* @param phaseRef Reference to the XML tree containing the phase information.
* @param spInstalled Boolean indicating whether the species is installed yet
* or not.
*/
PDSS_SSVol(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode,
const XML_Node& phaseRef, bool spInstalled);
//! Copy Constructur
/*!
* @param b Object to be copied
*/
PDSS_SSVol(const PDSS_SSVol &b);
//! Assignment operator
/*!
* @param b Object to be copeid
*/
PDSS_SSVol& operator=(const PDSS_SSVol&b);
//! Destructor
virtual ~PDSS_SSVol();
//! Duplicator
virtual PDSS *duplMyselfAsPDSS() const;
/**
* @}
* @name Utilities
* @{
*/
/**
* @}
* @name Molar Thermodynamic Properties of the Species Standard State
* in the Solution
* @{
*/
//! Return the molar enthalpy in units of J kmol-1
/*!
* Returns the species standard state enthalpy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state enthalpy in J kmol-1
*/
virtual doublereal enthalpy_mole() const;
//! Return the standard state molar enthalpy divided by RT
/*!
* Returns the species standard state enthalpy divided by RT at the
* current temperature and pressure.
*
* @return returns the species standard state enthalpy in unitless form
*/
virtual doublereal enthalpy_RT() const;
//! Return the molar internal Energy in units of J kmol-1
/*!
* Returns the species standard state internal Energy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state internal Energy in J kmol-1
*/
virtual doublereal intEnergy_mole() const;
//! Return the molar entropy in units of J kmol-1 K-1
/*!
* Returns the species standard state entropy in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state entropy in J kmol-1 K-1
*/
virtual doublereal entropy_mole() const;
//! Return the standard state entropy divided by RT
/*!
* Returns the species standard state entropy divided by RT at the
* current temperature and pressure.
*
* @return returns the species standard state entropy divided by RT
*/
virtual doublereal entropy_R() const;
//! Return the molar gibbs free energy in units of J kmol-1
/*!
* Returns the species standard state gibbs free energy in J kmol-1 at the
* current temperature and pressure.
*
* @return returns the species standard state gibbs free energy in J kmol-1
*/
virtual doublereal gibbs_mole() const;
//! Return the molar gibbs free energy divided by RT
/*!
* Returns the species standard state gibbs free energy divided by RT at the
* current temperature and pressure.
*
* @return returns the species standard state gibbs free energy divided by RT
*/
virtual doublereal gibbs_RT() const;
//! Return the molar const pressure heat capacity in units of J kmol-1 K-1
/*!
* Returns the species standard state Cp in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cp in J kmol-1 K-1
*/
virtual doublereal cp_mole() const;
//! Return the molar const pressure heat capacity divided by RT
/*!
* Returns the species standard state Cp divided by RT at the
* current temperature and pressure.
*
* @return returns the species standard state Cp divided by RT
*/
virtual doublereal cp_R() const;
//! Return the molar const volume heat capacity in units of J kmol-1 K-1
/*!
* Returns the species standard state Cv in J kmol-1 K-1 at the
* current temperature and pressure.
*
* @return returns the species standard state Cv in J kmol-1 K-1
*/
virtual doublereal cv_mole() const;
//! Return the molar volume at standard state
/*!
* Returns the species standard state molar volume at the
* current temperature and pressure
*
* @return returns the standard state molar volume divided by R
* units are m**3 kmol-1.
*/
virtual doublereal molarVolume() const;
//! Return the standard state density at standard state
/*!
* Returns the species standard state density at the
* current temperature and pressure
*
* @return returns the standard state density
* units are kg m-3
*/
virtual doublereal density() const;
/**
* @}
* @name Properties of the Reference State of the Species
* in the Solution
* @{
*/
//! Return the molar gibbs free energy divided by RT at reference pressure
/*!
* Returns the species reference state gibbs free energy divided by RT at the
* current temperature.
*
* @return returns the reference state gibbs free energy divided by RT
*/
virtual doublereal gibbs_RT_ref() const;
//! Return the molar enthalpy divided by RT at reference pressure
/*!
* Returns the species reference state enthalpy divided by RT at the
* current temperature.
*
* @return returns the reference state enthalpy divided by RT
*/
virtual doublereal enthalpy_RT_ref() const;
//! Return the molar entropy divided by R at reference pressure
/*!
* Returns the species reference state entropy divided by R at the
* current temperature.
*
* @return returns the reference state entropy divided by R
*/
virtual doublereal entropy_R_ref() const;
//! Return the molar heat capacity divided by R at reference pressure
/*!
* Returns the species reference state heat capacity divided by R at the
* current temperature.
*
* @return returns the reference state heat capacity divided by R
*/
virtual doublereal cp_R_ref() const;
//! Return the molar volume at reference pressure
/*!
* Returns the species reference state molar volume at the
* current temperature.
*
* @return returns the reference state molar volume divided by R
* units are m**3 kmol-1.
*/
virtual doublereal molarVolume_ref() const;
private:
//! Does the internal calculation of the volume
/*!
*
*/
void calcMolarVolume() const;
/**
* @}
* @name Mechanical Equation of State Properties
* @{
*/
//! Sets the pressure in the object
/*!
* Currently, this sets the pressure in the PDSS object.
* It is indeterminant what happens to the owning VPStandardStateTP
* object and to the VPSSMgr object.
*
* @param pres Pressure to be set (Pascal)
*/
virtual void setPressure(doublereal pres);
//! Set the internal temperature
/*!
* @param temp Temperature (Kelvin)
*/
virtual void setTemperature(doublereal temp);
//! Set the internal temperature and pressure
/*!
* @param temp Temperature (Kelvin)
* @param pres pressure (Pascals)
*/
virtual void setState_TP(doublereal temp, doublereal pres);
//! Set the internal temperature and density
/*!
* @param temp Temperature (Kelvin)
* @param rho Density (kg m-3)
*/
virtual void setState_TR(doublereal temp, doublereal rho);
/**
* @}
* @name Miscellaneous properties of the standard state
* @{
*/
/// critical temperature
virtual doublereal critTemperature() const;
/// critical pressure
virtual doublereal critPressure() const;
/// critical density
virtual doublereal critDensity() const;
/// saturation pressure
/*!
* @param t Temperature (kelvin)
*/
virtual doublereal satPressure(doublereal t);
/**
* @}
* @name Initialization of the Object
* @{
*/
//! Initialization routine for all of the shallow pointers
/*!
* This is a cascading call, where each level should call the
* the parent level.
*
* The initThermo() routines get called before the initThermoXML() routines
* from the constructPDSSXML() routine.
*
*
* Calls initPtrs();
*/
virtual void initThermo();
//! Initialization of a PDSS object using an
//! input XML file.
/*!
*
* This routine is a precursor to constructPDSSXML(XML_Node*)
* routine, which does most of the work.
*
* @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
* This object must have already been malloced.
*
* @param spindex Species index within the phase
*
* @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 constructPDSSFile(VPStandardStateTP *vptp_ptr, int spindex,
std::string inputFile, std::string id);
//! Initialization of a PDSS object using an xml tree
/*!
* This routine is a driver for the initialization of the
* object.
*
* basic logic:
* initThermo() (cascade)
* getStuff from species Part of XML file
* initThermoXML(phaseNode) (cascade)
*
* @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object
* This object must have already been malloced.
*
* @param spindex Species index within the phase
*
* @param speciesNode XML Node containing the species information
*
* @param phaseNode Reference to the phase Information for the phase
* that owns this species.
*
* @param spInstalled Boolean indicating whether the species is
* already installed.
*/
void constructPDSSXML(VPStandardStateTP *vptp_ptr, int spindex,
const XML_Node& speciesNode,
const XML_Node& phaseNode, bool spInstalled);
//! Initialization routine for the PDSS object based on the phaseNode
/*!
* This is a cascading call, where each level should call the
* the parent level.
*
* @param phaseNode Reference to the phase Information for the phase
* that owns this species.
*
* @param id Optional parameter identifying the name of the
* phase. If none is given, the first XML
* phase element will be used.
*/
virtual void initThermoXML(const XML_Node& phaseNode, std::string& id);
//@}
private:
//! Enumerated data type describing the type of volume model
//! used to calculate the standard state volume of the species
SSVolume_Model_enumType volumeModel_;
//! Value of the constant molar volume for the species
/*!
* m3 / kmol
*/
doublereal m_constMolarVolume;
//! coefficients for the temperature representation
vector_fp TCoeff_;
//! Derivative of the volume wrt temperature
mutable doublereal dVdT_;
//! 2nd derivative of the volume wrt temperature
mutable doublereal d2VdT2_;
};
}
#endif

View file

@ -8,7 +8,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PDSS_Water.cpp,v 1.15 2008/12/22 22:40:44 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"

View file

@ -9,9 +9,9 @@
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
* U.S. Government retains certain rights in this software.
*/
/* $Author: hkmoffa $
* $Date: 2009/01/03 03:59:39 $
* $Revision: 1.11 $
/* $Author$
* $Date$
* $Revision$
*/
#ifndef CT_PDSS_WATER_H

View file

@ -8,9 +8,9 @@
*/
/*
* $Author: hkmoffa $
* $Revision: 1.5 $
* $Date: 2008/02/03 20:59:18 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology
@ -502,6 +502,7 @@ namespace Cantera {
* base classes become hidden.
*/
int m_kk;
/**
* m_ndim is the dimensionality of the phase. Volumetric
* phases have dimensionality 3 and surface phases have

View file

@ -17,8 +17,8 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Date: 2009/03/27 01:08:55 $
* $Revision: 1.2 $
* $Date$
* $Revision$
*/

View file

@ -17,7 +17,7 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Id: PseudoBinaryVPSSTP.h,v 1.1 2009/03/03 21:08:31 hkmoffa Exp $
* $Id$
*/
#ifndef CT_PSEUDOBINARYVPSSTP_H

View file

@ -6,7 +6,7 @@
* and class \link Cantera::PureFluidPhase PureFluidPhase\endlink).
*/
/*
* $Id: PureFluidPhase.cpp,v 1.5 2009/03/13 03:21:34 hkmoffa Exp $
* $Id$
*/
#include "xml.h"
#include "PureFluidPhase.h"

View file

@ -10,9 +10,9 @@
* It inherits from ThermoPhase, but is built on top of the tpx package.
*/
/* $Author: dggoodwin $
* $Date: 2007/12/24 15:32:30 $
* $Revision: 1.7 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2003 California Institute of Technology
*/

View file

@ -4,9 +4,9 @@
*
*/
/* $Author: dggoodwin $
* $Date: 2007/11/27 13:26:08 $
* $Revision: 1.2 $
/* $Author$
* $Date$
* $Revision$
*
* Copyright 2003 California Institute of Technology
*

View file

@ -8,9 +8,9 @@
* Shomate polynomial expressions.
*/
/*
* $Author: hkmoffa $
* $Revision: 1.3 $
* $Date: 2008/12/13 01:59:49 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -6,7 +6,7 @@
* \link Cantera::ShomateThermo ShomateThermo\endlink).
*/
/*
* $Id: ShomateThermo.h,v 1.6 2008/12/13 01:59:49 hkmoffa Exp $
* $Id$
*/
// Copyright 2001 California Institute of Technology

View file

@ -6,7 +6,7 @@
* \link Cantera::SimpleThermo SimpleThermo\endlink).
*/
/*
* $Id: SimpleThermo.h,v 1.9 2008/12/13 01:59:49 hkmoffa Exp $
* $Id$
*/
#ifndef CT_SIMPLETHERMO_H
@ -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

@ -12,9 +12,9 @@
*/
/*
* $Author: hkmoffa $
* $Date: 2007/06/05 15:17:15 $
* $Revision: 1.10 $
* $Author$
* $Date$
* $Revision$
*/
#include "SingleSpeciesTP.h"

View file

@ -13,9 +13,9 @@
/*
* $Author: hkmoffa $
* $Date: 2008/12/13 01:59:49 $
* $Revision: 1.13 $
* $Author$
* $Date$
* $Revision$
*
*/

View file

@ -6,9 +6,9 @@
*/
/*
* $Author: hkmoffa $
* $Revision: 1.10 $
* $Date: 2008/12/13 01:59:49 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -5,8 +5,8 @@
* (see \ref spthermo and class \link Cantera::SpeciesThermoFactory SpeciesThermoFactory\endlink);
*/
/*
* $Revision: 1.20 $
* $Date: 2008/12/29 21:35:15 $
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -7,8 +7,8 @@
*/
/*
* $Revision: 1.11 $
* $Date: 2009/02/11 20:03:08 $
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -3,9 +3,9 @@
* Definitions for a
*/
/* $Author: hkmoffa $
* $Revision: 1.5 $
* $Date: 2009/01/04 06:34:20 $
/* $Author$
* $Revision$
* $Date$
*/
// Copyright 2007 Sandia National Laboratories

View file

@ -5,9 +5,9 @@
* (see \ref spthermo and class \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType \endlink).
*/
/*
* $Author: hkmoffa $
* $Revision: 1.8 $
* $Date: 2008/12/13 01:59:49 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -7,9 +7,9 @@
* \link Cantera::SpeciesThermoDuo SpeciesThermoDuo\endlink and
* \link Cantera::SpeciesThermo1 SpeciesThermo1\endlink)
*
* $Author: hkmoffa $
* $Revision: 1.12 $
* $Date: 2009/02/11 20:03:08 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -7,8 +7,8 @@
/*
*
* $Date: 2009/03/03 19:53:34 $
* $Revision: 1.8 $
* $Date$
* $Revision$
*
* Copyright 2003-2004 California Institute of Technology
* See file License.txt for licensing information
@ -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();
}

58
Cantera/src/thermo/State.h Executable file → Normal file
View file

@ -6,8 +6,8 @@
*/
/*
* $Date: 2009/02/15 17:33:06 $
* $Revision: 1.6 $
* $Date$
* $Revision$
*
* Copyright 2001-2003 California Institute of Technology
* See file License.txt for licensing information
@ -123,14 +123,18 @@ namespace Cantera {
*/
doublereal moleFraction(const int k) const;
/**
* Set the mole fractions to the specified values, and then
* normalize them so that they sum to 1.0.
//! Set the mole fractions to the specified values, and then
//! normalize them so that they sum to 1.0.
/*!
* @param x Array of unnormalized mole fraction values (input).
* Must have a length greater than or equal to the number of
* species.
* Must have a length greater than or equal to the number of
* species.
*
* @param x Input vector of mole fractions.
* @param x Input vector of mole fractions. There is no restriction
* on the sum of the mole fraction vector. Internally,
* the State object will normalize this vector before
* storring its contents.
* Length is m_kk.
*/
virtual void setMoleFractions(const doublereal* const x);
@ -176,7 +180,10 @@ namespace Cantera {
* Must have a length greater than or equal to the number of
* species.
*
* @param y Input vector of mass fractions.
* @param y Input vector of mass fractions. There is no restriction
* on the sum of the mass fraction vector. Internally,
* the State object will normalize this vector before
* storring its contents.
* Length is m_kk.
*/
virtual void setMassFractions(const doublereal* const y);
@ -209,22 +216,29 @@ namespace Cantera {
*/
doublereal concentration(const int k) const;
/**
* Set the concentrations to the specified values within the
* phase.
//! 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

@ -5,8 +5,8 @@
* ThermoPhase class.
*/
/*
* $Date: 2009/01/04 21:28:02 $
* $Revision: 1.8 $
* $Date$
* $Revision$
*
* Copyright 2001 California Institute of Technology
*

View file

@ -5,8 +5,8 @@
*/
/*
* $Date: 2009/01/04 21:28:02 $
* $Revision: 1.8 $
* $Date$
* $Revision$
*
* Copyright 2001 California Institute of Technology
*

View file

@ -14,7 +14,7 @@
*/
/*
* $Id: StoichSubstanceSSTP.cpp,v 1.13 2009/01/02 20:04:17 hkmoffa Exp $
* $Id$
*/
#include "ct_defs.h"

View file

@ -12,8 +12,8 @@
*/
/*
* $Date: 2009/01/02 20:04:17 $
* $Revision: 1.12 $
* $Date$
* $Revision$
*/
#ifndef CT_STOICHSUBSTANCESSTP_H

View file

@ -7,8 +7,8 @@
*/
/*
* $Revision: 1.13 $
* $Date: 2009/01/24 00:15:00 $
* $Revision$
* $Date$
*/
// Copyright 2002 California Institute of Technology

View file

@ -7,8 +7,8 @@
*/
/*
* $Date: 2009/01/04 21:28:02 $
* $Revision: 1.11 $
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*

View file

@ -6,8 +6,8 @@
*/
/*
* $Revision: 1.20 $
* $Date: 2009/03/13 03:21:34 $
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -6,9 +6,9 @@
*/
/*
* $Author: hkmoffa $
* $Revision: 1.10 $
* $Date: 2009/02/11 20:03:08 $
* $Author$
* $Revision$
* $Date$
*/
// Copyright 2001 California Institute of Technology

View file

@ -6,9 +6,9 @@
*/
/*
* $Author: hkmoffa $
* $Date: 2009/03/03 19:53:34 $
* $Revision: 1.18 $
* $Author$
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*

27
Cantera/src/thermo/ThermoPhase.h Executable file → Normal file
View file

@ -7,8 +7,8 @@
*/
/*
* $Date: 2009/02/18 22:31:32 $
* $Revision: 1.26 $
* $Date$
* $Revision$
*
* Copyright 2002 California Institute of Technology
*
@ -848,6 +848,29 @@ namespace Cantera {
}
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
/*!
* This function is a virtual method. For ideal mixtures
* (unity activity coefficients), this can return zero.
* Implementations should take the derivative of the
* logarithm of the activity coefficient with respect to the
* logarithm of the concentration-like variable (i.e. mole fraction,
* molality, etc.) that represents the standard state.
* This quantity is to be used in conjunction with derivatives of
* that concentration-like variable when the derivative of the chemical
* potential is taken.
*
* units = dimensionless
*
* @param dlnActCoeffdlnC Output vector of derivatives of the
* log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const {
err("getdlnActCoeffdlnC");
}
/**
* @}
* @name Mechanical Properties

View file

@ -12,9 +12,9 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Author: hkmoffa $
* $Date: 2009/05/28 23:08:06 $
* $Revision: 1.8 $
* $Author$
* $Date$
* $Revision$
*/
// turn off warnings under Windows
@ -74,12 +74,30 @@ namespace Cantera {
*this = right;
}
//====================================================================================================================
/*
* Assigment operator
* We use a shallow copy strategy here. Note, this will have to be fixed up later.
*/
VPSSMgr&
VPSSMgr::operator=(const VPSSMgr &right) {
if (&right == this) {
return *this;
}
m_kk = right.m_kk;
/*
* What we are doing here is to make a shallow copy of the VPStandardStateTP
* pointer in the "new" VPSSMgr object using the value from the "old"
* VPSSMgr object. This is not appropriate if we are making a copy of a ThermoPhase
* object and the VPSSMgr objects are owned by the ThermoPhase object.
*
* The new object will want to have a different value of m_vptp_ptr than the
* value this is being copied here. It will want to refer to the copy of the
* VPStandardStateTP object being made that will own the new VPSSMgr object.
* However, the assignment object is not the place to carry out this fixup.
*
* We will have to "fix" up the shallow copies later.
*/
m_vptp_ptr = right.m_vptp_ptr;
m_spthermo = right.m_spthermo;
m_tlast = -1.0;
@ -113,13 +131,12 @@ namespace Cantera {
return *this;
}
//====================================================================================================================
VPSSMgr *VPSSMgr::duplMyselfAsVPSSMgr() const {
VPSSMgr *vp = new VPSSMgr(*this);
return vp;
}
//====================================================================================================================
void VPSSMgr::initAllPtrs(VPStandardStateTP *vp_ptr,
SpeciesThermo *sp_ptr) {
m_vptp_ptr = vp_ptr;
@ -141,8 +158,7 @@ namespace Cantera {
}
}
/*****************************************************************/
//====================================================================================================================
// Standard States
void

View file

@ -8,9 +8,9 @@
*/
/*
* $Author: hkmoffa $
* $Revision: 1.5 $
* $Date: 2009/05/28 23:08:06 $
* $Author$
* $Revision$
* $Date$
*/
/*
* Copywrite (2005) Sandia Corporation. Under the terms of
@ -772,11 +772,11 @@ namespace Cantera {
const XML_Node * const phaseNode_ptr);
//! Initialize the internal pointers in this object
//! Initialize the internal shallow pointers in this object
/*!
* There are a bunch of internal shallow pointers that point to the owning
* VPStandardStateTP and SpeciesThermo objects. This function reinitializes
* them.
* them. This function is called like an onion.
*
* @param vp_ptr Pointer to the VPStandardStateTP standard state
* @param sp_ptr Poitner to the SpeciesThermo standard state

View file

@ -6,7 +6,7 @@
* \link Cantera::VPSSMgrFactory VPSSMgrFactory\endlink);
*/
/*
* $Id: VPSSMgrFactory.cpp,v 1.8 2009/03/04 01:01:57 hkmoffa Exp $
* $Id$
*/
/*
@ -114,6 +114,10 @@ namespace Cantera {
} else if (ssModel == "constant_incompressible" ||
ssModel == "constantVolume") {
has_nasa_constVol++;
} else if (ssModel == "temperature_polynomial" ||
ssModel == "density_temperature_polynomial" ||
ssModel == "constant") {
has_other++;
} else {
throw UnknownVPSSMgrModel("getVPSSMgrTypes:",
spNode->attrib("name"));
@ -126,6 +130,10 @@ namespace Cantera {
} else if (ssModel == "constant_incompressible" ||
ssModel == "constantVolume") {
has_shomate_constVol++;
} else if (ssModel == "temperature_polynomial" ||
ssModel == "density_temperature_polynomial" ||
ssModel == "constant") {
has_other++;
} else {
throw UnknownVPSSMgrModel("getVPSSMgrTypes:",
spNode->attrib("name"));
@ -138,6 +146,10 @@ namespace Cantera {
} else if (ssModel == "constant_incompressible" ||
ssModel == "constantVolume") {
has_simple_constVol++;
} else if (ssModel == "temperature_polynomial" ||
ssModel == "density_temperature_polynomial" ||
ssModel == "constant") {
has_other++;
} else {
throw UnknownVPSSMgrModel("getVPSSMgrTypes:",
spNode->attrib("name"));

View file

@ -6,8 +6,8 @@
*/
/*
* $Revision: 1.5 $
* $Date: 2009/02/11 20:03:08 $
* $Revision$
* $Date$
*/
/*

View file

@ -12,9 +12,9 @@
* U.S. Government retains certain rights in this software.
*/
/*
* $Author: hkmoffa $
* $Date: 2009/05/28 23:08:06 $
* $Revision: 1.4 $
* $Author$
* $Date$
* $Revision$
*/
// turn off warnings under Windows

Some files were not shown because too many files have changed in this diff Show more