[Thermo] Simplify setState specialization of SingleSpeciesTP

We don't need to override every function that sets the mass/mole fractions, just
the ones that would have actually done something.
This commit is contained in:
Ray Speth 2014-04-08 16:26:29 +00:00
parent 14ea7e64c6
commit 6449415933
2 changed files with 5 additions and 152 deletions

View file

@ -401,100 +401,11 @@ public:
* @{
*/
//! Set the temperature (K), pressure (Pa), and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param x Vector of mole fractions.
* Length is equal to m_kk.
*/
void setState_TPX(doublereal t, doublereal p, const doublereal* x);
//! Mass fractions are fixed, with Y[0] = 1.0.
void setMassFractions(const doublereal* y) {};
//! Set the temperature (K), pressure (Pa), and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param x String containing a composition map of the mole fractions. Species not in
* the composition map are assumed to have zero mole fraction
*/
void setState_TPX(doublereal t, doublereal p, const compositionMap& x);
//! Set the temperature (K), pressure (Pa), and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param x String containing a composition map of the mole fractions. Species not in
* the composition map are assumed to have zero mole fraction
*/
void setState_TPX(doublereal t, doublereal p, const std::string& x);
//! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase.
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param y Vector of mass fractions.
* Length is equal to m_kk.
*/
void setState_TPY(doublereal t, doublereal p, const doublereal* y);
//! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param y Composition map of mass fractions. Species not in
* the composition map are assumed to have zero mass fraction
*/
void setState_TPY(doublereal t, doublereal p, const compositionMap& y);
//! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param t Temperature (K)
* @param p Pressure (Pa)
* @param y String containing a composition map of the mass fractions. Species not in
* the composition map are assumed to have zero mass fraction
*/
void setState_TPY(doublereal t, doublereal p, const std::string& y);
//! Set the pressure (Pa) and mole fractions.
/*!
* Note, the mole fractions are set to X[0] = 1.0.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param p Pressure (Pa)
* @param x Vector of mole fractions.
* Length is equal to m_kk.
*/
void setState_PX(doublereal p, doublereal* x);
//! Set the internally stored pressure (Pa) and mass fractions.
/*!
* Note, the mass fractions are set to Y[0] = 1.0.
* Note, the temperature is held constant during this operation.
* Setting the pressure may involve the solution of a nonlinear equation.
*
* @param p Pressure (Pa)
* @param y Vector of mass fractions.
* Length is equal to m_kk.
*/
void setState_PY(doublereal p, doublereal* y);
//! Mole fractions are fixed, with x[0] = 1.0.
void setMoleFractions(const doublereal* x) {};
//! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
/*!

View file

@ -239,64 +239,6 @@ void SingleSpeciesTP::getCp_R_ref(doublereal* cpr) const
* ------------------ Setting the State ------------------------
*/
void SingleSpeciesTP::setState_TPX(doublereal t, doublereal p,
const doublereal* x)
{
setTemperature(t);
setPressure(p);
}
void SingleSpeciesTP::setState_TPX(doublereal t, doublereal p,
const compositionMap& x)
{
setTemperature(t);
setPressure(p);
}
void SingleSpeciesTP::setState_TPX(doublereal t, doublereal p,
const std::string& x)
{
setTemperature(t);
setPressure(p);
}
void SingleSpeciesTP::setState_TPY(doublereal t, doublereal p,
const doublereal* y)
{
setTemperature(t);
setPressure(p);
}
void SingleSpeciesTP::setState_TPY(doublereal t, doublereal p,
const compositionMap& y)
{
setTemperature(t);
setPressure(p);
}
void SingleSpeciesTP::setState_TPY(doublereal t, doublereal p,
const std::string& y)
{
setTemperature(t);
setPressure(p);
}
void SingleSpeciesTP::setState_PX(doublereal p, doublereal* x)
{
if (x[0] != 1.0) {
err("setStatePX -> x[0] not 1.0");
}
setPressure(p);
}
void SingleSpeciesTP::setState_PY(doublereal p, doublereal* y)
{
if (y[0] != 1.0) {
err("setStatePY -> x[0] not 1.0");
}
setPressure(p);
}
void SingleSpeciesTP::setState_HP(doublereal h, doublereal p,
doublereal tol)
{
@ -417,7 +359,7 @@ void SingleSpeciesTP::initThermo()
* Make sure the species mole fraction is equal to 1.0;
*/
double x = 1.0;
setMoleFractions(&x);
ThermoPhase::setMoleFractions(&x);
/*
* Call the base class initThermo object.
*/