Add a better error message if fluid does not have thermal conductivity or viscosity model

See https://github.com/CoolProp/CoolProp/issues/285

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2014-12-05 14:22:00 -05:00
parent 8ed02eefef
commit e84274367d
3 changed files with 14 additions and 0 deletions

View File

@@ -856,11 +856,13 @@ protected:
// Parse viscosity
if (transport.HasMember("viscosity")){
parse_viscosity(transport["viscosity"],fluid);
fluid.transport.viscosity_model_provided = true;
}
// Parse thermal conductivity
if (transport.HasMember("conductivity")){
parse_thermal_conductivity(transport["conductivity"],fluid);
fluid.transport.conductivity_model_provided = true;
}
};

View File

@@ -399,6 +399,10 @@ long double HelmholtzEOSMixtureBackend::calc_viscosity(void)
{
// Get a reference for code cleanness
CoolPropFluid &component = *(components[0]);
if (!component.transport.viscosity_model_provided){
throw ValueError(format("Viscosity model is not available for this fluid"));
}
// Check if using ECS
if (component.transport.viscosity_using_ECS)
@@ -465,6 +469,10 @@ long double HelmholtzEOSMixtureBackend::calc_conductivity(void)
{
// Get a reference for code cleanness
CoolPropFluid &component = *(components[0]);
if (!component.transport.conductivity_model_provided){
throw ValueError(format("Thermal conductivity model is not available for this fluid"));
}
// Check if using ECS
if (component.transport.conductivity_using_ECS)