24 IdealSolnGasVPSS::IdealSolnGasVPSS() :
30 IdealSolnGasVPSS::IdealSolnGasVPSS(
const std::string& infile, std::string id_) :
41 "Couldn't find phase named '{} in file '{}'",
50 throw CanteraError(
"IdealSolnGasVPSS::setStandardConcentrationModel",
51 "Standard concentration model not applicable for ideal gas");
63 throw CanteraError(
"IdealSolnGasVPSS::setStandardConcentrationModel",
64 "Unknown standard concentration model '{}'", model);
109 double dens = 1.0 /
dot(vss.begin(), vss.end(), dtmp);
128 return Units(1.0, 0, -3, 0, 0, 0, 1);
142 for (
size_t k = 0; k <
m_kk; k++) {
147 for (
size_t k = 0; k <
m_kk; k++) {
152 for (
size_t k = 0; k <
m_kk; k++) {
180 for (
size_t k = 0; k <
m_kk; k++) {
190 for (
size_t k = 0; k <
m_kk; k++) {
192 mu[k] +=
RT() * log(xx);
206 for (
size_t k = 0; k <
m_kk; k++) {
238 doublereal pres = 0.0;
240 for (
size_t k = 0; k <
m_kk; k++) {
241 double tmp = -
m_g0_RT[k] + mu_RT[k];
244 }
else if (tmp > 500.0) {
245 double tmp2 = tmp / 500.;
247 m_pp[k] = m_p0 * exp(500.) * tmp2;
249 m_pp[k] = m_p0 * exp(tmp);
270 const string& model =
m_input[
"thermo"].asString();
271 if (model ==
"ideal-solution-VPSS") {
273 }
else if (model ==
"ideal-gas-VPSS") {
283 "solution / gas mode not set");
291 std::string model = thermoNode[
"model"];
292 if (model ==
"IdealGasVPSS") {
294 }
else if (model ==
"IdealSolnVPSS") {
298 "Unknown thermo model : " + model);
307 if (phaseNode.
hasChild(
"standardConc")) {
312 "Unspecified standardConc model");
321 std::string model = thermoNode[
"model"];
322 if (model ==
"IdealGasVPSS") {
324 }
else if (model ==
"IdealSolnVPSS") {
327 throw CanteraError(
"IdealSolnGasVPSS::setParametersFromXML",
328 "Unknown thermo model : " + model);
Definition file for a derived class of ThermoPhase that assumes either an ideal gas or ideal solution...
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Base class for exceptions thrown by Cantera classes.
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature,...
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
void setGasMode()
Set this phase to represent an ideal gas.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
vector_fp m_pp
Temporary storage - length = m_kk.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
virtual void initThermo()
void setSolnMode()
Set this phase to represent an ideal liquid or solid solution.
int m_formGC
form of the generalized concentrations
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
void setStandardConcentrationModel(const std::string &model)
Set the standard concentration model.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
virtual void setParametersFromXML(const XML_Node &thermoNode)
Set equation of state parameter values from XML entries.
virtual void calcDensity()
Calculate the density of the mixture using the partial molar volumes and mole fractions as input.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
int m_idealGas
boolean indicating what ideal solution this is
virtual doublereal standardConcentration(size_t k=0) const
Returns the standard concentration , which is used to normalize the generalized concentration.
An error indicating that an unimplemented function has been called.
void getConcentrations(double *const c) const
Get the species concentrations (kmol/m^3).
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
const double * moleFractdivMMW() const
Returns a const pointer to the start of the moleFraction/MW array.
size_t m_kk
Number of species in the phase.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
double moleFraction(size_t k) const
Return the mole fraction of a single species.
doublereal sum_xlogx() const
Evaluate .
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
AnyMap m_input
Data supplied via setParameters.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
A representation of the units associated with a dimensional quantity.
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast and P = p_ref.
virtual bool addSpecies(shared_ptr< Species > spec)
Add a Species to this Phase.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual void initThermo()
vector_fp m_sss_R
Vector containing the species Standard State entropies at T = m_tlast and P = m_plast.
vector_fp m_cpss_R
Vector containing the species Standard State constant pressure heat capacities at T = m_tlast and P =...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
doublereal m_Pcurrent
Current value of the pressure - state variable.
virtual doublereal pressure() const
Returns the current pressure of the phase.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void updateStandardStateThermo() const
Updates the standard state thermodynamic functions at the current T and P of the solution.
vector_fp m_hss_RT
Vector containing the species Standard State enthalpies at T = m_tlast and P = m_plast.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Class XML_Node is a tree-based representation of the contents of an XML file.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
const double SmallNumber
smallest number to compare to zero.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
const double GasConstant
Universal Gas Constant [J/kmol/K].
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
Namespace for the Cantera kernel.
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
bool caseInsensitiveEquals(const std::string &input, const std::string &test)
Case insensitive equality predicate.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Contains declarations for string manipulation functions within Cantera.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...