mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-02-19 01:54:29 -05:00
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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user