67 "could not create new substance object.");
73 double cp0_R, h0_RT, s0_R, p;
75 if (T0 < m_sub->Tcrit()) {
76 m_sub->
Set(tpx::PropertyPair::TX, T0, 1.0);
82 m_sub->
Set(tpx::PropertyPair::TP, T0, p);
88 writelog(
"PureFluidPhase::initThermo: initialized phase "
94 eosdata.
_require(
"model",
"PureFluid");
95 m_subflag = atoi(eosdata[
"fluid_type"].c_str());
97 throw CanteraError(
"PureFluidPhase::setParametersFromXML",
98 "missing or negative substance flag");
161 return m_sub->isothermalCompressibility();
166 return m_sub->thermalExpansionCoeff();
238 double plow = 1.0E-8;
239 Set(tpx::PropertyPair::TP, t, plow);
241 Set(tpx::PropertyPair::TP, t, psave);
250 double plow = 1.0E-8;
251 Set(tpx::PropertyPair::TP, t, plow);
253 grt[0] += log(pref/plow);
254 Set(tpx::PropertyPair::TP, t, psave);
268 double plow = 1.0E-8;
269 Set(tpx::PropertyPair::TP, t, plow);
271 er[0] -= log(pref/plow);
272 Set(tpx::PropertyPair::TP, t, psave);
298 Set(tpx::PropertyPair::HP, h, p);
305 Set(tpx::PropertyPair::UV, u, v);
312 Set(tpx::PropertyPair::SV, s, v);
319 Set(tpx::PropertyPair::SP, s, p);
325 Set(tpx::PropertyPair::TV, t,
m_sub->
v());
339 Set(tpx::PropertyPair::TX, t, x);
346 Set(tpx::PropertyPair::PX, p, x);
356 sprintf(p,
" \n %s:\n",
name().c_str());
359 sprintf(p,
" \n temperature %12.6g K\n",
temperature());
361 sprintf(p,
" pressure %12.6g Pa\n",
pressure());
363 sprintf(p,
" density %12.6g kg/m^3\n",
density());
372 sprintf(p,
" potential %12.6g V\n", phi);
378 sprintf(p,
" 1 kg 1 kmol\n");
380 sprintf(p,
" ----------- ------------\n");
382 sprintf(p,
" enthalpy %12.6g %12.4g J\n",
385 sprintf(p,
" internal energy %12.6g %12.4g J\n",
388 sprintf(p,
" entropy %12.6g %12.4g J/K\n",
391 sprintf(p,
" Gibbs function %12.6g %12.4g J\n",
394 sprintf(p,
" heat capacity c_p %12.6g %12.4g J/K\n",
398 sprintf(p,
" heat capacity c_v %12.6g %12.4g J/K\n",
403 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...
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 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.
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...
virtual std::string report(bool show_thermo=true, doublereal threshold=1e-14) const
returns a summary of the state of the phase as a string
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.