mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-02-09 05:15:45 -05:00
Really this time un-specify the phase
More logical debug output for invalid phases Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
@@ -563,10 +563,17 @@ void FlashRoutines::HSU_P_flash_singlephase_Brent(HelmholtzEOSMixtureBackend &HE
|
||||
solver_resid resid(&HEOS, HEOS._p, value, other);
|
||||
|
||||
std::string errstr;
|
||||
double T = Brent(resid, Tmin, Tmax, DBL_EPSILON, 1e-12, 100, errstr);
|
||||
|
||||
// Un-impose the phase of the fluid
|
||||
HEOS.specify_phase(iphase_not_imposed);
|
||||
try{
|
||||
double T = Brent(resid, Tmin, Tmax, DBL_EPSILON, 1e-12, 100, errstr);
|
||||
// Un-specify the phase of the fluid
|
||||
HEOS.unspecify_phase();
|
||||
}
|
||||
catch(std::exception &e){
|
||||
// Un-specify the phase of the fluid
|
||||
HEOS.unspecify_phase();
|
||||
throw;
|
||||
}
|
||||
|
||||
int rr = 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -590,7 +590,7 @@ void HelmholtzEOSMixtureBackend::mass_to_molar_inputs(long &input_pair, double &
|
||||
}
|
||||
void HelmholtzEOSMixtureBackend::update(long input_pair, double value1, double value2 )
|
||||
{
|
||||
if (get_debug_level() > 0){std::cout << format("%s (%d): update called with (%d: (%s), %g, %g)",__FILE__,__LINE__, input_pair, get_input_pair_short_desc(input_pair).c_str(), value1, value2) << std::endl;}
|
||||
if (get_debug_level() > 10){std::cout << format("%s (%d): update called with (%d: (%s), %g, %g)",__FILE__,__LINE__, input_pair, get_input_pair_short_desc(input_pair).c_str(), value1, value2) << std::endl;}
|
||||
|
||||
clear();
|
||||
|
||||
@@ -1688,7 +1688,7 @@ long double HelmholtzEOSMixtureBackend::calc_hmolar(void)
|
||||
return static_cast<long double>(_hmolar);
|
||||
}
|
||||
else{
|
||||
throw ValueError(format("phase is invalid"));
|
||||
throw ValueError(format("phase is invalid in calc_hmolar"));
|
||||
}
|
||||
}
|
||||
long double HelmholtzEOSMixtureBackend::calc_smolar_nocache(long double T, long double rhomolar)
|
||||
@@ -1734,7 +1734,7 @@ long double HelmholtzEOSMixtureBackend::calc_smolar(void)
|
||||
return static_cast<long double>(_smolar);
|
||||
}
|
||||
else{
|
||||
throw ValueError(format("phase is invalid"));
|
||||
throw ValueError(format("phase is invalid in calc_smolar"));
|
||||
}
|
||||
}
|
||||
long double HelmholtzEOSMixtureBackend::calc_umolar_nocache(long double T, long double rhomolar)
|
||||
@@ -1775,7 +1775,7 @@ long double HelmholtzEOSMixtureBackend::calc_umolar(void)
|
||||
return static_cast<long double>(_umolar);
|
||||
}
|
||||
else{
|
||||
throw ValueError(format("phase is invalid"));
|
||||
throw ValueError(format("phase is invalid in calc_umolar"));
|
||||
}
|
||||
}
|
||||
long double HelmholtzEOSMixtureBackend::calc_cvmolar(void)
|
||||
@@ -1865,13 +1865,13 @@ long double HelmholtzEOSMixtureBackend::calc_gibbsmolar(void)
|
||||
long double dar_dDelta = dalphar_dDelta();
|
||||
long double R_u = gas_constant();
|
||||
|
||||
// Get molar entropy
|
||||
// Get molar gibbs function
|
||||
_gibbsmolar = R_u*_T*(1 + a0 + ar +_delta.pt()*dar_dDelta);
|
||||
|
||||
return static_cast<long double>(_gibbsmolar);
|
||||
}
|
||||
else{
|
||||
throw ValueError(format("phase is invalid"));
|
||||
throw ValueError(format("phase is invalid in calc_gibbsmolar"));
|
||||
}
|
||||
}
|
||||
long double HelmholtzEOSMixtureBackend::calc_fugacity_coefficient(int i)
|
||||
|
||||
@@ -74,6 +74,11 @@ public:
|
||||
@param phase_index The index from CoolProp::phases
|
||||
*/
|
||||
void specify_phase(phases phase_index){imposed_phase_index = phase_index; _phase = phase_index;};
|
||||
|
||||
/**
|
||||
\brief Unspecify the phase - the phase is no longer imposed, different solvers can do as they like
|
||||
*/
|
||||
void unspecify_phase(){imposed_phase_index = iphase_not_imposed;};
|
||||
|
||||
void set_reducing_function();
|
||||
void set_excess_term();
|
||||
|
||||
Reference in New Issue
Block a user