Merge branch 'master' into refprop_derivative_support

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-12-10 00:39:00 -05:00
28 changed files with 251 additions and 151 deletions

View File

@@ -571,6 +571,15 @@ std::string HelmholtzEOSMixtureBackend::calc_name(void)
return components[0]->name;
}
}
std::vector<std::string> HelmholtzEOSMixtureBackend::calc_fluid_names(void)
{
std::vector<std::string> out;
for (std::size_t i = 0; i < components.size(); ++i)
{
out.push_back(components[i]->name);
}
return out;
}
long double HelmholtzEOSMixtureBackend::calc_ODP(void)
{
if (components.size() != 1){
@@ -803,9 +812,9 @@ void HelmholtzEOSMixtureBackend::mass_to_molar_inputs(CoolProp::input_pairs &inp
switch(input_pair)
{
case DmassT_INPUTS: ///< Mass density in kg/m^3, Temperature in K
case HmassT_INPUTS: ///< Enthalpy in J/kg, Temperature in K
//case HmassT_INPUTS: ///< Enthalpy in J/kg, Temperature in K (NOT CURRENTLY IMPLEMENTED)
case SmassT_INPUTS: ///< Entropy in J/kg/K, Temperature in K
case TUmass_INPUTS: ///< Temperature in K, Internal energy in J/kg
//case TUmass_INPUTS: ///< Temperature in K, Internal energy in J/kg (NOT CURRENTLY IMPLEMENTED)
case DmassP_INPUTS: ///< Mass density in kg/m^3, Pressure in Pa
case HmassP_INPUTS: ///< Enthalpy in J/kg, Pressure in Pa
case PSmass_INPUTS: ///< Pressure in Pa, Entropy in J/kg/K
@@ -825,9 +834,9 @@ void HelmholtzEOSMixtureBackend::mass_to_molar_inputs(CoolProp::input_pairs &inp
switch(input_pair)
{
case DmassT_INPUTS: input_pair = DmolarT_INPUTS; value1 /= mm; break;
case HmassT_INPUTS: input_pair = HmolarT_INPUTS; value1 *= mm; break;
//case HmassT_INPUTS: input_pair = HmolarT_INPUTS; value1 *= mm; break; (NOT CURRENTLY IMPLEMENTED)
case SmassT_INPUTS: input_pair = SmolarT_INPUTS; value1 *= mm; break;
case TUmass_INPUTS: input_pair = TUmolar_INPUTS; value2 *= mm; break;
//case TUmass_INPUTS: input_pair = TUmolar_INPUTS; value2 *= mm; break; (NOT CURRENTLY IMPLEMENTED)
case DmassP_INPUTS: input_pair = DmolarP_INPUTS; value1 /= mm; break;
case HmassP_INPUTS: input_pair = HmolarP_INPUTS; value1 *= mm; break;
case PSmass_INPUTS: input_pair = PSmolar_INPUTS; value2 *= mm; break;
@@ -882,10 +891,10 @@ void HelmholtzEOSMixtureBackend::update(CoolProp::input_pairs input_pair, double
_rhomolar = value1; _T = value2; FlashRoutines::DHSU_T_flash(*this, iDmolar); break;
case SmolarT_INPUTS:
_smolar = value1; _T = value2; FlashRoutines::DHSU_T_flash(*this, iSmolar); break;
case HmolarT_INPUTS:
_hmolar = value1; _T = value2; FlashRoutines::DHSU_T_flash(*this, iHmolar); break;
case TUmolar_INPUTS:
_T = value1; _umolar = value2; FlashRoutines::DHSU_T_flash(*this, iUmolar); break;
//case HmolarT_INPUTS:
// _hmolar = value1; _T = value2; FlashRoutines::DHSU_T_flash(*this, iHmolar); break;
//case TUmolar_INPUTS:
// _T = value1; _umolar = value2; FlashRoutines::DHSU_T_flash(*this, iUmolar); break;
case DmolarP_INPUTS:
_rhomolar = value1; _p = value2; FlashRoutines::PHSU_D_flash(*this, iP); break;
case DmolarHmolar_INPUTS:

View File

@@ -235,6 +235,7 @@ public:
long double calc_rhomolar_reducing(void){return get_reducing_state().rhomolar;};
std::string calc_name(void);
std::vector<std::string> calc_fluid_names(void);
void calc_all_alphar_deriv_cache(const std::vector<long double> &mole_fractions, const long double &tau, const long double &delta);
long double calc_alphar_deriv_nocache(const int nTau, const int nDelta, const std::vector<long double> & mole_fractions, const long double &tau, const long double &delta);

View File

@@ -554,6 +554,7 @@ bool REFPROPMixtureBackend::REFPROP_supported () {
void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &fluid_names)
{
long ierr=0;
this->fluid_names = fluid_names;
char component_string[10000], herr[errormessagelength];
std::string components_joined = strjoin(fluid_names,"|");
std::string components_joined_raw = strjoin(fluid_names,"|");

View File

@@ -22,6 +22,8 @@ protected:
static bool _REFPROP_supported;
std::vector<double> mole_fractions, mass_fractions;
std::vector<double> mole_fractions_liq, mole_fractions_vap;
std::vector<std::string> fluid_names;
/// Call the PHIXdll function in the dll
long double call_phixdll(long itau, long idelta);
@@ -35,6 +37,8 @@ public:
/// @param fluid_names The vector of strings of the fluid components, without file ending
REFPROPMixtureBackend(const std::vector<std::string>& fluid_names);
virtual ~REFPROPMixtureBackend();
std::vector<std::string> calc_fluid_names(){return fluid_names;};
// REFPROP backend uses mole fractions
bool using_mole_fractions(){return true;}