40 PureFluidPhase& PureFluidPhase::operator=(
const PureFluidPhase& right)
62 "could not create new substance object.");
68 double cp0_R, h0_RT, s0_R, p;
70 if (T0 < m_sub->Tcrit()) {
71 m_sub->Set(tpx::PropertyPair::TX, T0, 1.0);
74 p = 0.001*
m_sub->Pcrit();
77 m_sub->Set(tpx::PropertyPair::TP, T0, p);
83 debuglog(
"PureFluidPhase::initThermo: initialized phase " 89 eosdata.
_require(
"model",
"PureFluid");
90 m_subflag = atoi(eosdata[
"fluid_type"].c_str());
92 throw CanteraError(
"PureFluidPhase::setParametersFromXML",
93 "missing or negative substance flag");
157 return m_sub->isothermalCompressibility();
162 return m_sub->thermalExpansionCoeff();
234 double plow = 1.0E-8;
235 Set(tpx::PropertyPair::TP, t, plow);
237 Set(tpx::PropertyPair::TP, t, psave);
246 double plow = 1.0E-8;
247 Set(tpx::PropertyPair::TP, t, plow);
249 grt[0] += log(pref/plow);
250 Set(tpx::PropertyPair::TP, t, psave);
264 double plow = 1.0E-8;
265 Set(tpx::PropertyPair::TP, t, plow);
267 er[0] -= log(pref/plow);
268 Set(tpx::PropertyPair::TP, t, psave);
273 return m_sub->Tcrit();
278 return m_sub->Pcrit();
283 return 1.0/
m_sub->Vcrit();
288 return m_sub->Tsat(p);
298 Set(tpx::PropertyPair::HP, h, p);
304 Set(tpx::PropertyPair::UV, u, v);
310 Set(tpx::PropertyPair::SV, s, v);
316 Set(tpx::PropertyPair::SP, s, p);
322 Set(tpx::PropertyPair::ST, s, t);
328 Set(tpx::PropertyPair::TV, t, v);
334 Set(tpx::PropertyPair::PV, p, v);
340 Set(tpx::PropertyPair::UP, u, p);
346 Set(tpx::PropertyPair::VH, v, h);
352 Set(tpx::PropertyPair::TH, t, h);
358 Set(tpx::PropertyPair::SH, s, h);
364 Set(tpx::PropertyPair::TV, t,
m_sub->v());
378 Set(tpx::PropertyPair::TX, t, x);
385 Set(tpx::PropertyPair::PX, p, x);
394 b.write(
"\n {}:\n",
name());
397 b.write(
" temperature {:12.6g} K\n",
temperature());
398 b.write(
" pressure {:12.6g} Pa\n",
pressure());
399 b.write(
" density {:12.6g} kg/m^3\n",
density());
405 b.write(
" potential {:12.6g} V\n", phi);
409 b.write(
" 1 kg 1 kmol\n");
410 b.write(
" ----------- ------------\n");
411 b.write(
" enthalpy {:12.6g} {:12.4g} J\n",
413 b.write(
" internal energy {:12.6g} {:12.4g} J\n",
415 b.write(
" entropy {:12.6g} {:12.4g} J/K\n",
417 b.write(
" Gibbs function {:12.6g} {:12.4g} J\n",
419 b.write(
" heat capacity c_p {:12.6g} {:12.4g} J/K\n",
422 b.write(
" heat capacity c_v {:12.6g} {:12.4g} J/K\n",
425 b.write(
" heat capacity c_v <not implemented>\n");
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
PureFluidPhase()
Empty Base Constructor.
virtual void setPressure(doublereal p)
sets the thermodynamic pressure (Pa).
virtual void setState_SP(double s, double p, double tol=1e-9)
Set the specific entropy (J/kg/K) and pressure (Pa).
virtual doublereal critPressure() const
Critical pressure (Pa).
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 setState_ST(double s, double t, double tol=1e-9)
Set the specific entropy (J/kg/K) and temperature (K).
doublereal temperature() const
Temperature (K).
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
An error indicating that an unimplemented function has been called.
virtual doublereal satTemperature(doublereal p) const
Return the saturation temperature given the pressure.
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
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
tpx::Substance & TPX_Substance()
Returns a reference to the substance object.
ThermoPhase & operator=(const ThermoPhase &right)
virtual doublereal critDensity() const
Critical density (kg/m3).
virtual void setState_VH(double v, double h, double tol=1e-9)
Set the specific volume (m^3/kg) and the specific enthalpy (J/kg)
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
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 doublereal density() const
Density (kg/m^3).
doublereal m_mw
Molecular weight of the substance (kg kmol-1)
virtual doublereal refPressure(size_t k=npos) const
The reference-state pressure for species k.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
virtual void setState_PV(double p, double v, double tol=1e-9)
Set the pressure (Pa) and specific volume (m^3/kg).
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 setState_Tsat(doublereal t, doublereal x)
Set the state to a saturated system at a particular temperature.
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Base class for a phase with thermodynamic properties.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
virtual void setState_Psat(doublereal p, doublereal x)
Set the state to a saturated system at a particular pressure.
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 doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
doublereal molarDensity() const
Molar density (kmol/m^3).
Header for a ThermoPhase class for a pure fluid phase consisting of gas, liquid, mixed-gas-liquid and...
virtual void setState_TH(double t, double h, double tol=1e-9)
Set the temperature (K) and the specific enthalpy (J/kg)
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Classes providing support for XML data files.
doublereal electricPotential() const
Returns the electric potential of this phase (V).
doublereal entropy_mass() const
Specific entropy. Units: J/kg/K.
std::unique_ptr< tpx::Substance > m_sub
Pointer to the underlying tpx object Substance that does the work.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Base class for exceptions thrown by Cantera classes.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual doublereal vaporFraction() const
Return the fraction of vapor at the current conditions.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
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 gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
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...
virtual void setState_HP(double h, double p, double tol=1e-9)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
void debuglog(const std::string &msg, int loglevel)
Write a message to the log only if loglevel > 0.
MultiSpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual void setState_UP(double u, double p, double tol=1e-9)
Set the specific internal energy (J/kg) and pressure (Pa).
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
void setMolecularWeight(const int k, const double mw)
Set the molecular weight of a single species to a given value.
virtual void setState_TV(double t, double v, double tol=1e-9)
Set the temperature (K) and specific volume (m^3/kg).
virtual doublereal critTemperature() const
Critical temperature (K).
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
virtual void getStandardChemPotentials(doublereal *mu) const
doublereal gibbs_mass() const
Specific Gibbs function. Units: J/kg.
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
std::string name() const
Return the name of the phase.
Contains declarations for string manipulation functions within Cantera.
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 ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual void setState_SH(double s, double h, double tol=1e-9)
Set the specific entropy (J/kg/K) and the specific enthalpy (J/kg)
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 void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
virtual void setState_SV(double s, double v, double tol=1e-9)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
Namespace for the Cantera kernel.
doublereal intEnergy_mass() const
Specific internal energy. Units: J/kg.
virtual doublereal satPressure(doublereal t)
Return the saturation pressure given the temperature.
virtual void setState_UV(double u, double v, double tol=1e-9)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
void setState_TR(doublereal t, doublereal rho)
Set the internally stored temperature (K) and density (kg/m^3)
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.
void setTPXState() const
Sets the state using a TPX::TV call.