mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-02-02 01:45:18 -05:00
Updated some reference state functions, does not work properly at the moment.
This commit is contained in:
@@ -67,7 +67,7 @@ void IncompressibleBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
this->_phase = iphase_liquid;
|
||||
if (get_debug_level()>=50) std::cout << format("Incompressible backend: Phase type is %d ",this->_phase) << std::endl;
|
||||
|
||||
switch (input_pair)
|
||||
switch (input_pair)
|
||||
{
|
||||
case PT_INPUTS: {
|
||||
_p = value1;
|
||||
@@ -94,6 +94,12 @@ void IncompressibleBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
_T = this->HmassP_flash(value1, value2);
|
||||
break;
|
||||
}
|
||||
case QT_INPUTS: {
|
||||
if (value1!=0) {throw ValueError("Incompressible fluids can only handle saturated liquid, Q=0.");}
|
||||
_T = value2;
|
||||
_p = fluid->psat(value2, _fractions[0]);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw ValueError(
|
||||
format("This pair of inputs [%s] is not yet supported",
|
||||
@@ -139,7 +145,11 @@ void IncompressibleBackend::set_mass_fractions(const std::vector<long double> &m
|
||||
this->_fractions = std::vector<long double>(1,0);
|
||||
if (get_debug_level()>=20) std::cout << format("Incompressible backend: Overwriting fractions for pure fluid with %s -> %s",vec_to_string(mass_fractions).c_str(),vec_to_string(this->_fractions).c_str()) << std::endl;
|
||||
} else if (fluid->getxid()==IFRAC_MASS) {
|
||||
this->_fractions = mass_fractions;
|
||||
if (this->_fractions[0]!=mass_fractions[0]) {
|
||||
if (get_debug_level()>=20) std::cout << format("Incompressible backend: Updating the mass fractions triggered a change in reference state %s -> %s",vec_to_string(mass_fractions).c_str(),vec_to_string(this->_fractions).c_str()) << std::endl;
|
||||
this->_fractions = mass_fractions;
|
||||
fluid->set_reference_state(fluid->getTref(), fluid->getpref(), this->_fractions[0], fluid->gethref(), fluid->getsref());
|
||||
}
|
||||
} else {
|
||||
this->_fractions.clear();
|
||||
for (std::size_t i = 0; i < mass_fractions.size(); i++) {
|
||||
|
||||
@@ -491,7 +491,7 @@ bool IncompressibleFluid::checkP(double T, double p, double x) {
|
||||
double ps = 0.0;
|
||||
if (p_sat.type!=IncompressibleData::INCOMPRESSIBLE_NOT_SET) ps = psat(T, x);
|
||||
if (p < 0.0) throw ValueError(format("You cannot use negative pressures: %f < %f. ", p, 0.0));
|
||||
if (ps>0.0 && p < ps) throw ValueError(format("Equations are valid for liquid phase only: %f < %f (psat). ", p, ps));
|
||||
if (ps> 0.0 && p < ps) throw ValueError(format("Equations are valid for liquid phase only: %f < %f (psat). ", p, ps));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user