Skip to content

Commit

Permalink
Make the gas constant an adjustable parameter and update to CODATA 20…
Browse files Browse the repository at this point in the history
…14 value
  • Loading branch information
ibell committed Apr 8, 2016
1 parent 616d775 commit cd996fb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 0 additions & 2 deletions include/DataStructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
4 changes: 2 additions & 2 deletions src/AbstractState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
2 changes: 1 addition & 1 deletion src/Backends/Helmholtz/HelmholtzEOSMixtureBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd996fb

Please sign in to comment.