Make the gas constant an adjustable parameter and update to CODATA 2014 value

This commit is contained in:
Ian Bell
2016-04-07 20:14:39 -06:00
parent 616d775aa9
commit cd996fb1ff
4 changed files with 4 additions and 5 deletions

View File

@@ -32,6 +32,7 @@
X(DONT_CHECK_PROPERTY_LIMITS, "DONT_CHECK_PROPERTY_LIMITS", false, "If true, when possible, CoolProp will skip checking whether values are inside the property limits") \
X(HENRYS_LAW_TO_GENERATE_VLE_GUESSES, "HENRYS_LAW_TO_GENERATE_VLE_GUESSES", false, "If true, when doing water-based mixture dewpoint calculations, use Henry's Law to generate guesses for liquid-phase composition") \
X(PHASE_ENVELOPE_STARTING_PRESSURE_PA, "PHASE_ENVELOPE_STARTING_PRESSURE_PA", 100.0, "Starting pressure [Pa] for phase envelope construction") \
X(R_U_CODATA, "R_U_CODATA", 8.3144598, "The value for the ideal gas constant in J/mol/K according to CODATA 2014. This value is used to harmonize all the ideal gas constants. This is especially important in the critical region.") \
// Use preprocessor to create the Enum
enum configuration_keys{

View File

@@ -197,8 +197,6 @@ std::string get_csv_parameter_list();
/// These are constants for the compositions
enum composition_types{IFRAC_MASS, IFRAC_MOLE, IFRAC_VOLUME, IFRAC_UNDEFINED, IFRAC_PURE};
const CoolPropDbl R_u_CODATA = 8.3144621; ///< The value for the ideal gas constant in J/mol/K according to CODATA 2010. This value is used to harmonize all the ideal gas constants. This is especially important in the critical region.
/// These are unit types for the fluid
enum fluid_types{FLUID_TYPE_PURE, FLUID_TYPE_PSEUDOPURE, FLUID_TYPE_REFPROP, FLUID_TYPE_INCOMPRESSIBLE_LIQUID, FLUID_TYPE_INCOMPRESSIBLE_SOLUTION, FLUID_TYPE_UNDEFINED};

View File

@@ -76,10 +76,10 @@ AbstractState * AbstractState::factory(const std::string &backend, const std::ve
throw ValueError("TREND backend not yet implemented");
}
else if (backend == "SRK"){
return new SRKBackend(fluid_names, R_u_CODATA);
return new SRKBackend(fluid_names, get_config_double(R_U_CODATA));
}
else if (backend == "PR" || backend == "Peng-Robinson"){
return new PengRobinsonBackend(fluid_names, R_u_CODATA);
return new PengRobinsonBackend(fluid_names, get_config_double(R_u_CODATA));
}
else if (!backend.compare("?") || backend.empty())
{

View File

@@ -348,7 +348,7 @@ CoolPropDbl HelmholtzEOSMixtureBackend::calc_gas_constant(void)
}
else{
if (get_config_bool(NORMALIZE_GAS_CONSTANTS)){
return R_u_CODATA;
return get_config_double(R_U_CODATA);
}
else{
// mass fraction weighted average of the components