Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt > Class Template Reference

Two-way solver class for the steam tables. More...

#include <solver2.h>

Inheritance diagram for Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >:

Inheritance graph
[legend]
Collaboration diagram for Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Solver2 (const bool debug=false)
 ~Solver2 ()
int whichRegion (const FirstProp &fp, const SecondProp &sp)
SteamCalculator solve (const FirstProp &fp, const SecondProp &sp)
 Solve with no first guess provided.
SteamCalculator solve (const FirstProp &fp, const SecondProp &sp, const SteamCalculator &firstguess)
 Solve with a first guess provided.
template<>
int whichRegion (const Pressure &p, const Temperature &T)
template<>
SteamCalculator makeRegion1Guess (const Pressure &p, const Temperature &T)
template<>
SteamCalculator makeRegion2Guess (const Pressure &p, const Temperature &T)
template<>
SteamCalculator solveRegion3 (const Pressure &p, const Temperature &T, const SteamCalculator &firstguess)
template<>
int whichRegion (const Temperature &T, const SpecificEnergy &h)
template<>
int whichRegion (const Temperature &T, const SpecificEntropy &s)
template<>
int whichRegion (const Pressure &p, const SpecificEntropy &s)
template<>
int whichRegion (const Pressure &p, const SpecificEnergy &u)
template<>
int whichRegion (const Pressure &p, const SpecificEnergy &h)
template<>
int whichRegion (const SpecificEnergy &u, const SpecificVolume &v)
template<>
SteamCalculator solveRegion3 (const Pressure &p, const Temperature &T, const SteamCalculator &firstguess)
template<>
SteamCalculator makeRegion1Guess (const Pressure &p, const Temperature &T)
template<>
SteamCalculator makeRegion2Guess (const Pressure &p, const Temperature &T)
template<>
SteamCalculator solveRegion3 (const Pressure &p, const Temperature &T, const SteamCalculator &firstguess)
template<>
int whichRegion (const Pressure &p, const Temperature &T)
template<>
int whichRegion (const Temperature &T, const SpecificEnergy &h)
template<>
int whichRegion (const Temperature &T, const SpecificEntropy &s)
template<>
int whichRegion (const Pressure &p, const SpecificEntropy &s)
template<>
int whichRegion (const Pressure &p, const SpecificEnergy &u)
template<>
int whichRegion (const Pressure &p, const SpecificEnergy &h)
template<>
int whichRegion (const SpecificEnergy &u, const SpecificVolume &v)


Detailed Description

template<class FirstProp, class SecondProp, int FirstPropAlt = 0, int SecondPropAlt = 0>
class Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >

Two-way solver class for the steam tables.

This is intended to be a general purpose way of defining steam state in terms of any combination of properties, eg to find the pressure at which rho = 1.1 kg/m3 and u = 2500 kJ/kg, use:

                        Solver2<Density,SpecificEnergy> SS;
                        SteamCalculator S = SS.solve(1.1 * kg_m3, 2500.0 * kJ_kg);
                        cerr << S->pres() << endl;

Likewise, even with one of the properties being a correlation property, just use

                        Solver2<Temperature,SpecificEnergy> SS;
                        SteamCalculator S = SS.solve(450.0 * Kelvin, 2500.0 * kJ_kg);
                        cerr << S->pres() << endl;

Or even,

                        Solver2<Temperature,Pressure> SS;
                        SteamCalculator S = SS.solve(450.0 * Kelvin, 10.0 * bar);
                        cerr << S->dens() << endl;

See also:
Solver (solving for one un-correlated property)
Examples:

/home/john/freesteam/solver2.h.


Constructor & Destructor Documentation

template<class FirstProp, class SecondProp, int FirstPropAlt = 0, int SecondPropAlt = 0>
Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::Solver2 ( const bool  debug = false  )  [inline]

template<class FirstProp, class SecondProp, int FirstPropAlt = 0, int SecondPropAlt = 0>
Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::~Solver2 (  )  [inline]


Member Function Documentation

template<class FirstProp, class SecondProp, int FirstPropAlt = 0, int SecondPropAlt = 0>
int Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::whichRegion ( const FirstProp &  fp,
const SecondProp &  sp 
) [virtual]

template<class FirstProp, class SecondProp, int FirstPropAlt = 0, int SecondPropAlt = 0>
SteamCalculator Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::solve ( const FirstProp &  fp,
const SecondProp &  sp 
) [inline, virtual]

Solve with no first guess provided.

This will called the appropriate 'make guess' method, based on the results of the whichRegion call, and then perform iteration in that region (using the appropriate 'solve region x' method) to home in on the solution using a two-way solver method.

Parameters:
fp Value of FirstProp property
sp Value of SecondProp property

Implements Solver2Base< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >.

References SteamProperty< Property, PropertyAlternative >::name(), and Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::whichRegion().

Referenced by Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::solve().

template<class FirstProp, class SecondProp, int FirstPropAlt = 0, int SecondPropAlt = 0>
SteamCalculator Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::solve ( const FirstProp &  fp,
const SecondProp &  sp,
const SteamCalculator firstguess 
) [inline]

Solve with a first guess provided.

If you already have steam properties very close to your expected point, you can use this method. Note that it will not use the 'make guess' (eg Solver2::makeRegion1Guess etc) methods, so if you have faster methods like that, it may be better not to provide a first guess for Solver2 iterations.

Parameters:
fp Value of FirstProp property
sp Value of SecondProp property
firstguess SteamCalculator initialised with state to be used for first guess

References SteamProperty< Property, PropertyAlternative >::get(), SteamCalculator::isSet(), SteamProperty< Property, PropertyAlternative >::name(), Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::solve(), SteamCalculator::whichRegion(), and Solver2< FirstProp, SecondProp, FirstPropAlt, SecondPropAlt >::whichRegion().

template<>
int Solver2< Pressure, Temperature, 0, 0 >::whichRegion ( const Pressure p,
const Temperature T 
) [inline]

whichRegion given p, T

References SteamCalculator::set_pT(), and SteamCalculator::whichRegion().

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::makeRegion1Guess ( const Pressure p,
const Temperature T 
) [inline]

Use the straight-up region 1 correlation if attempting to use Solver2<p,T> for region 1

References SteamCalculator::setRegion1_pT().

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::makeRegion2Guess ( const Pressure p,
const Temperature T 
) [inline]

Use the straight-up region 2 correlation if attempting to use Solver2<p,T> for region 2

References SteamCalculator::setRegion2_pT().

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::solveRegion3 ( const Pressure p,
const Temperature T,
const SteamCalculator firstguess 
) [inline]

That's easy - just use the correlation directly.

References SteamCalculator::set_pT().

template<>
int Solver2< Temperature, SpecificEnergy, 0, SOLVE_ENTHALPY >::whichRegion ( const Temperature T,
const SpecificEnergy h 
) [inline]

template<>
int Solver2< Temperature, SpecificEntropy, 0, SOLVE_ENTROPY >::whichRegion ( const Temperature T,
const SpecificEntropy s 
) [inline]

template<>
int Solver2< Pressure, SpecificEntropy, 0, SOLVE_ENTROPY >::whichRegion ( const Pressure p,
const SpecificEntropy s 
) [inline]

template<>
int Solver2< Pressure, SpecificEnergy, 0, SOLVE_IENERGY >::whichRegion ( const Pressure p,
const SpecificEnergy u 
) [inline]

template<>
int Solver2< Pressure, SpecificEnergy, 0, SOLVE_ENTHALPY >::whichRegion ( const Pressure p,
const SpecificEnergy h 
) [inline]

template<>
int Solver2< SpecificEnergy, SpecificVolume, SOLVE_IENERGY, 0 >::whichRegion ( const SpecificEnergy u,
const SpecificVolume v 
) [inline]

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::solveRegion3 ( const Pressure p,
const Temperature T,
const SteamCalculator firstguess 
) [inline]

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::makeRegion1Guess ( const Pressure p,
const Temperature T 
) [inline]

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::makeRegion2Guess ( const Pressure p,
const Temperature T 
) [inline]

template<>
SteamCalculator Solver2< Pressure, Temperature, 0, 0 >::solveRegion3 ( const Pressure p,
const Temperature T,
const SteamCalculator firstguess 
) [inline]

template<>
int Solver2< Pressure, Temperature, 0, 0 >::whichRegion ( const Pressure p,
const Temperature T 
) [inline]

template<>
int Solver2< Temperature, SpecificEnergy, 0, SOLVE_ENTHALPY >::whichRegion ( const Temperature T,
const SpecificEnergy h 
) [inline]

template<>
int Solver2< Temperature, SpecificEntropy, 0, SOLVE_ENTROPY >::whichRegion ( const Temperature T,
const SpecificEntropy s 
) [inline]

template<>
int Solver2< Pressure, SpecificEntropy, 0, SOLVE_ENTROPY >::whichRegion ( const Pressure p,
const SpecificEntropy s 
) [inline]

template<>
int Solver2< Pressure, SpecificEnergy, 0, SOLVE_IENERGY >::whichRegion ( const Pressure p,
const SpecificEnergy u 
) [inline]

template<>
int Solver2< Pressure, SpecificEnergy, 0, SOLVE_ENTHALPY >::whichRegion ( const Pressure p,
const SpecificEnergy h 
) [inline]

template<>
int Solver2< SpecificEnergy, SpecificVolume, SOLVE_IENERGY, 0 >::whichRegion ( const SpecificEnergy u,
const SpecificVolume v 
) [inline]


The documentation for this class was generated from the following file:

Generated on Tue Feb 10 18:37:37 2009 for freesteam by  doxygen 1.5.6