Fail appropriately when two-phase inputs are given for pseudo-pure; Closes #459

Fix is_pure() function

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2015-02-10 18:55:24 -07:00
parent 102e2a8cb4
commit f2b31faffc
2 changed files with 5 additions and 3 deletions

View File

@@ -1365,6 +1365,9 @@ void HelmholtzEOSMixtureBackend::T_phase_determination_pure_or_pseudopure(int ot
else if (value > p_liq){
this->_phase = iphase_liquid; _Q = 1000; return;
}
else if (!is_pure() && value < static_cast<long double>(_pLanc) && value > static_cast<long double>(_pVanc)){
throw ValueError("Two-phase inputs not supported for pseudo-pure for now");
}
break;
}
default:
@@ -1432,8 +1435,7 @@ void HelmholtzEOSMixtureBackend::T_phase_determination_pure_or_pseudopure(int ot
}
}
// Determine Q based on the input provided
if (!is_pure_or_pseudopure){throw ValueError("possibly two-phase inputs not supported for pseudo-pure for now");}
// Actually have to use saturation information sadly
// For the given temperature, find the saturation state

View File

@@ -54,7 +54,7 @@ public:
bool using_mole_fractions(){return true;}
bool using_mass_fractions(){return false;}
bool using_volu_fractions(){return false;}
bool is_pure(){ return is_pure_or_pseudopure; }
bool is_pure(){ return components.size() == 1 && !components[0]->EOSVector[0].pseudo_pure; }
bool has_melting_line(){ return is_pure_or_pseudopure && components[0]->ancillaries.melting_line.enabled();};
long double calc_melting_line(int param, int given, long double value);
phases calc_phase(void){return _phase;};