71 "could not create new substance object.");
77 double cp0_R, h0_RT, s0_R, T0, p;
79 if (T0 < m_sub->Tcrit()) {
80 m_sub->
Set(tpx::PropertyPair::TX, T0, 1.0);
86 m_sub->
Set(tpx::PropertyPair::TP, T0, p);
92 writelog(
"PureFluidPhase::initThermo: initialized phase "
99 eosdata.
_require(
"model",
"PureFluid");
100 m_subflag = atoi(eosdata[
"fluid_type"].c_str());
102 throw CanteraError(
"PureFluidPhase::setParametersFromXML",
103 "missing or negative substance flag");
173 return m_sub->isothermalCompressibility();
178 return m_sub->thermalExpansionCoeff();
238 doublereal rt =
_RT();
251 doublereal rt =
_RT();
261 double plow = 1.0E-8;
262 Set(tpx::PropertyPair::TP, t, plow);
264 Set(tpx::PropertyPair::TP, t, psave);
273 double plow = 1.0E-8;
274 Set(tpx::PropertyPair::TP, t, plow);
276 grt[0] += log(pref/plow);
277 Set(tpx::PropertyPair::TP, t, psave);
291 double plow = 1.0E-8;
292 Set(tpx::PropertyPair::TP, t, plow);
294 er[0] -= log(pref/plow);
295 Set(tpx::PropertyPair::TP, t, psave);
321 Set(tpx::PropertyPair::HP, h, p);
328 Set(tpx::PropertyPair::UV, u, v);
335 Set(tpx::PropertyPair::SV, s, v);
342 Set(tpx::PropertyPair::SP, s, p);
348 doublereal vsv =
m_sub->
v();
349 Set(tpx::PropertyPair::TV,t,vsv);
363 Set(tpx::PropertyPair::TX, t, x);
370 Set(tpx::PropertyPair::PX, p, x);
380 sprintf(p,
" \n %s:\n",
name().c_str());
383 sprintf(p,
" \n temperature %12.6g K\n",
temperature());
385 sprintf(p,
" pressure %12.6g Pa\n",
pressure());
387 sprintf(p,
" density %12.6g kg/m^3\n",
density());
396 sprintf(p,
" potential %12.6g V\n", phi);
402 sprintf(p,
" 1 kg 1 kmol\n");
404 sprintf(p,
" ----------- ------------\n");
406 sprintf(p,
" enthalpy %12.6g %12.4g J\n",
409 sprintf(p,
" internal energy %12.6g %12.4g J\n",
412 sprintf(p,
" entropy %12.6g %12.4g J/K\n",
415 sprintf(p,
" Gibbs function %12.6g %12.4g J\n",
418 sprintf(p,
" heat capacity c_p %12.6g %12.4g J/K\n",
422 sprintf(p,
" heat capacity c_v %12.6g %12.4g J/K\n",
427 sprintf(p,
" heat capacity c_v <not implemented> \n");
virtual double MolWt()=0
Molecular weight [kg/kmol].
void _require(const std::string &a, const std::string &v) const
Require that the current xml node have an attribute named by the first argument, a, and that this attribute have the the string value listed in the second argument, v.
virtual double Vcrit()=0
Critical specific volume [m^3/kg].
PureFluidPhase()
Empty Base Constructor.
virtual doublereal density() const
Density (kg/m^3).
virtual ~PureFluidPhase()
Destructor.
doublereal electricPotential() const
Returns the electric potential of this phase (V).
virtual void setPressure(doublereal p)
sets the thermodynamic pressure (Pa).
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
double x()
Vapor mass fraction.
bool m_verbose
flag to turn on some printing.
This phase object consists of a single component that can be a gas, a liquid, a mixed gas-liquid flui...
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
double Tsat(double p)
Saturation temperature at pressure p.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
doublereal _RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void setState_UV(doublereal u, doublereal v, doublereal tol=1.e-8)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
tpx::Substance & TPX_Substance()
Returns a reference to the substance object.
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
virtual void update_one(size_t k, doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Like update(), but only updates the single species k.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
Class XML_Node is a tree-based representation of the contents of an XML file.
int m_subflag
Int indicating the type of the fluid.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
doublereal m_mw
Molecular weight of the substance (kg kmol-1)
double s()
Entropy [J/kg/K].
doublereal molarDensity() const
Molar density (kmol/m^3).
double v()
Specific volume [m^3/kg].
virtual std::string report(bool show_thermo=true) const
returns a summary of the state of the phase as a string
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual void setState_Tsat(doublereal t, doublereal x)
Set the state to a saturated system at a particular temperature.
std::string name() const
Return the name of the phase.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual double cv()
Specific heat at constant volume [J/kg/K].
virtual void setState_SV(doublereal s, doublereal v, doublereal tol=1.e-8)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
virtual doublereal critPressure() const
critical pressure
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
doublereal intEnergy_mass() const
Specific internal energy.
Base class for a phase with thermodynamic properties.
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
tpx::Substance * m_sub
Pointer to the underlying tpx object Substance that does the work.
virtual void setState_Psat(doublereal p, doublereal x)
Set the state to a saturated system at a particular pressure.
virtual doublereal satTemperature(doublereal p) const
saturation temperature
doublereal gibbs_mass() const
Specific Gibbs function.
virtual doublereal critTemperature() const
critical temperature
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
doublereal entropy_mass() const
Specific entropy.
Header for a ThermoPhase class for a pure fluid phase consisting of gas, liquid, mixed-gas-liquid and...
double Temp()
Temperature [K].
ThermoPhase * duplMyselfAsThermoPhase() const
Duplication function.
doublereal cp_mass() const
Specific heat at constant pressure.
Classes providing support for XML data files.
void setTPXState() const
Sets the state using a TPX::TV call.
virtual doublereal refPressure(size_t k=npos) const =0
The reference-state pressure for species k.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Base class for exceptions thrown by Cantera classes.
doublereal cv_mass() const
Specific heat at constant volume.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values There is no restriction on the sum of the mole fractio...
double g()
Gibbs function [J/kg].
virtual doublereal critDensity() const
critical density
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
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 setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
void setMolecularWeight(const int k, const double mw)
Set the molecular weight of a single species to a given value.
virtual void setState_HP(doublereal h, doublereal p, doublereal tol=1.e-8)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
doublereal temperature() const
Temperature (K).
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
virtual double Tcrit()=0
Critical temperature [K].
virtual double cp()
Specific heat at constant pressure [J/kg/K].
PureFluidPhase & operator=(const PureFluidPhase &right)
Assignment operator.
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
doublereal enthalpy_mass() const
Specific enthalpy.
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the gibbs function of the reference state at the current temperature of the sol...
double h()
Enthalpy [J/kg].
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
double u()
Internal energy [J/kg].
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
void writelog(const std::string &msg)
Write a message to the screen.
void Set(PropertyPair::type XY, double x0, double y0)
Function to set or change the state for a property pair XY where x0 is the value of first property an...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual double Pcrit()=0
Critical pressure [Pa].
void Set(tpx::PropertyPair::type n, double x, double y) const
Main call to the tpx level to set the state of the system.
virtual doublereal satPressure(doublereal t)
Return the saturation pressure given the temperature.
void setState_TR(doublereal t, doublereal rho)
Set the internally stored temperature (K) and density (kg/m^3)
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual void setState_SP(doublereal s, doublereal p, doublereal tol=1.e-8)
Set the specific entropy (J/kg/K) and pressure (Pa).
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual doublereal vaporFraction() const
Return the fraction of vapor at the current conditions.
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
void save()
Function to put this error onto Cantera's error stack.