Throw the correct error when inputs are not two-phase to two_phase_deriv; closes #639

This commit is contained in:
Ian Bell
2015-04-30 18:14:39 -06:00
parent ebc9b777e1
commit 3f0a495a99

View File

@@ -2823,11 +2823,13 @@ CoolPropDbl HelmholtzEOSMixtureBackend::calc_first_two_phase_deriv(parameters Of
CoolPropDbl HelmholtzEOSMixtureBackend::calc_first_two_phase_deriv_splined(parameters Of, parameters Wrt, parameters Constant, CoolPropDbl x_end)
{
if (_Q > x_end){throw ValueError(format("Q [%g] is greater than x_end [%Lg]", _Q, x_end).c_str());}
if (_phase != iphase_twophase){throw ValueError(format("state is not two-phase")); }
shared_ptr<HelmholtzEOSMixtureBackend> Liq(new HelmholtzEOSMixtureBackend(this->get_components())),
End(new HelmholtzEOSMixtureBackend(this->get_components()));
Liq->specify_phase(iphase_liquid);
Liq->update(DmolarT_INPUTS, SatL->rhomolar(), SatL->T());
Liq->_Q = -1;
Liq->update_DmolarT_direct(SatL->rhomolar(), SatL->T());
End->update(QT_INPUTS, x_end, SatL->T());
bool mass_based_inputs = ((Of == iDmass) && ((Wrt == iHmass && Constant == iP) || (Wrt == iP && Constant == iHmass) || (Wrt == iDmass && Constant == iDmass)));