|
CoolProp 8.0.0
An open-source fluid property and humid air property database
|
A superancillary object is formed of a number of one dimensional Chebyshev approximations, one for each phase, property pair.
Loaded from the file are density and pressure as functions of temperature, and a thermodynamic model can be used to build the
Definition at line 817 of file superancillary.h.
#include <superancillary.h>
Classes | |
| struct | CheckPoint |
| struct | LoadedData |
Public Member Functions | |
| SuperAncillary (const std::string &s) | |
| const auto & | get_approx1d (char k, short Q) const |
| void | clear_caloric_variables () |
| void | ensure_HSU_under_lock (double caller_a1, double caller_a2, const std::function< double(double, double)> &h_callable, const std::function< double(double, double)> &s_callable, const std::function< double(double, double)> &u_callable) |
| std::optional< std::pair< double, double > > | get_caloric_alpha0_stamp () const |
| unsigned int | get_caloric_build_count () const |
| bool | has_variable (char k) const |
| const auto & | get_invlnp () |
| const double | get_pmin () const |
| Get the minimum pressure in Pa. More... | |
| const double | get_pmax () const |
| Get the maximum pressure in Pa. More... | |
| const double | get_Tmin () const |
| Get the minimum temperature in K. More... | |
| const double | get_Tcrit_num () const |
| Get the numerical critical temperature in K. More... | |
| const double | get_rhocrit_num () const |
| Get the numerical critical density in mol/m^3. More... | |
| const std::vector< CheckPoint > & | get_check_points () const |
| Get the extended-precision verification states (empty if none are present in the JSON) More... | |
| void | add_variable (char var, const std::function< double(double, double)> &caller) |
| double | eval_sat (double T, char k, short Q) const |
| template<typename Container > | |
| void | eval_sat_many (const Container &T, char k, short Q, Container &y) const |
| template<typename Container > | |
| void | eval_sat_manyC (const Container T[], std::size_t N, char k, short Q, Container y[]) const |
| auto | solve_for_T (double propval, char k, bool Q, unsigned int bits=64, unsigned int max_iter=100, double boundsftol=1e-13) const |
| auto | get_vaporquality (double T, double propval, char k) const |
| auto | get_T_from_p (double p) |
| Use the inverted pressure superancillary to calculate temperature given pressure. More... | |
| auto | get_yval (double T, double q, char k) const |
| Return the evaluated value of the thermodynamic variable, given the temperature and vapor quality. More... | |
| template<typename Container > | |
| void | get_yval_many (const Container &T, char k, const Container &q, Container &y) const |
| A vectorized version of get_yval for profiling in Python. More... | |
| auto | get_all_intersections (const char k, const double val, unsigned int bits, std::size_t max_iter, double boundsftol) const |
| std::optional< SuperAncillaryTwoPhaseSolution > | iterate_for_Tq_XY (double Tmin, double Tmax, char ch1, double val1, char ch2, double val2, unsigned int bits, std::size_t max_iter, double boundsftol) const |
| Iterate to find a value of temperature and vapor quality corresponding to the two given thermodynamic variables, if such a solution exists. This is the lower-level function used by the solve_XX methods. More... | |
| std::optional< SuperAncillaryTwoPhaseSolution > | solve_for_Tq_DX (const double rho, const double propval, const char k, unsigned int bits, std::size_t max_iter, double boundsftol) const |
| template<typename Container > | |
| void | solve_for_Tq_DX_many (const Container &rho, const Container &propval, const char k, unsigned int bits, std::size_t max_iter, double boundsftol, Container &T, Container &q, Container &count) |
| A vectorize version of solve_for_Tq_DX for use in the Python interface for profiling. More... | |
|
explicit |
Load the superancillary with the data passed in as a string blob of JSON. The JSON parsing is defined out-of-line in the non-installed src/superancillary.cpp and explicitly instantiated for std::vector<double>, so this installed header carries no JSON-library type. (Construction is therefore available only for the instantiated ArrayType(s).)
| s | The string-encoded JSON data for the superancillaries |
Definition at line 73 of file superancillary.cpp.
|
inline |
Using the provided function that gives y(T, rho), build the ancillaries for this variable based on the ancillaries for rhoL and rhoV
| var | The key for the property (H,S,U) |
| caller | A function that takes temperature and molar density and returns the property of interest, molar enthalpy in the case of H, etc. |
This entry point acquires the lazy-build mutex. Callers that already hold the mutex (e.g. ensure_HS_under_lock) must use add_variable_locked.
Definition at line 1120 of file superancillary.h.
|
inline |
Discard the cached caloric saturation Chebyshev approximations. Not invoked by any normal control path — the cache is reference-state- agnostic via the shift trick recorded by m_caloric_alpha0_stamp. This method is kept as a diagnostic / forced-rebuild hatch for future use (e.g. if the prefactor or Core offset ever becomes runtime-mutable), but no current code calls it. See #2773.
Definition at line 1000 of file superancillary.h.
|
inline |
Thread-safe lazy build of H and S caloric superancillaries. Records the caller's IdealHelmholtzEnthalpyEntropyOffset (a1, a2) as the "stamp" — the reference state the cached coefficients are expressed in. Subsequent callers with different offsets do NOT rebuild; instead, the FlashRoutines code shifts the user's target h or s by the stamp- caller offset difference at query time (the shift is a constant in T per IdealHelmholtzEnthalpyEntropyOffset::all). This keeps the cache shared and rebuild-free across all HEOS instances of the same fluid, regardless of how many distinct reference states are in play. See #2773.
Definition at line 1021 of file superancillary.h.
|
inline |
Given the value of Q in {0,1}, evaluate one of the the ChebyshevApproximation1D
| T | Temperature, in K |
| k | Property key, in {D,P,H,S,U} |
| Q | Vapor quality, in {0,1} |
Definition at line 1201 of file superancillary.h.
|
inline |
A vectorized version of eval_sat for wrapping in Python interface and profiling
Definition at line 1213 of file superancillary.h.
|
inline |
A vectorized version of eval_sat for wrapping in Python interface and profiling
Definition at line 1227 of file superancillary.h.
|
inline |
Determine all the values of temperature that correspond to intersections with the superancillary function, for both the vapor and liquid phases
| k | Property key, in {D,P,H,S,U} |
| val | Value of the thermodynamic variable |
| bits | passed to toms748 algorithm |
| max_iter | Maximum allowed number of function calls |
| boundsftol | A functional value stopping condition to test on the endpoints |
Definition at line 1329 of file superancillary.h.
|
inline |
Get a const reference to a ChebyshevApproximation1D
| k | The key for the property (D,S,H,P,U) |
| Q | The vapor quality, either 0 or 1 |
Definition at line 971 of file superancillary.h.
|
inline |
Get the (a1, a2) stamp recorded when the caloric superancillaries were first built. Returns nullopt if not yet built.
Definition at line 1043 of file superancillary.h.
|
inline |
Number of times the caloric superancillaries were (re)built. Used by tests to verify the multi-instance / multi-ref-state code path does not cause thrashing rebuilds.
Definition at line 1051 of file superancillary.h.
|
inline |
Get the extended-precision verification states (empty if none are present in the JSON)
Definition at line 1108 of file superancillary.h.
|
inline |
Get a const reference to the inverse approximation for T(ln(p)). Lazily constructed on first access; serialized by the same mutex that guards H/S/U construction so concurrent first-call accesses from threads on different HEOS instances of the same fluid don't race.
Definition at line 1078 of file superancillary.h.
|
inline |
Get the maximum pressure in Pa.
Definition at line 1092 of file superancillary.h.
|
inline |
Get the minimum pressure in Pa.
Definition at line 1088 of file superancillary.h.
|
inline |
Get the numerical critical density in mol/m^3.
Definition at line 1104 of file superancillary.h.
|
inline |
Use the inverted pressure superancillary to calculate temperature given pressure.
| p | The pressure (not its logarithm!), in Pa |
Definition at line 1272 of file superancillary.h.
|
inline |
Get the numerical critical temperature in K.
Definition at line 1100 of file superancillary.h.
|
inline |
Get the minimum temperature in K.
Definition at line 1096 of file superancillary.h.
|
inline |
Get the non-iterative vapor quality q given the temperature T and the value of the thermodynamic variable
| T | Temperature, in K |
| propval | The value of the given thermodynamic variable |
| k | Property key, in {D,P,H,S,U} |
Definition at line 1254 of file superancillary.h.
|
inline |
Return the evaluated value of the thermodynamic variable, given the temperature and vapor quality.
| T | Temperature, in K |
| q | Vapor quality, in [0,1] |
| k | Property key, in {D,P,H,S,U} |
Definition at line 1283 of file superancillary.h.
|
inline |
A vectorized version of get_yval for profiling in Python.
Definition at line 1300 of file superancillary.h.
|
inline |
Whether a property's saturation Chebyshev approximation has been populated. P and D are always present; H/S/U are only present after add_variable() has been called (or, in some JSON layouts, loaded from disk).
| k | Property key in {D,P,H,S,U} |
Definition at line 1059 of file superancillary.h.
|
inline |
Iterate to find a value of temperature and vapor quality corresponding to the two given thermodynamic variables, if such a solution exists. This is the lower-level function used by the solve_XX methods.
| Tmin | Minimum temperature, in K |
| Tmax | Maximum temperature, in K |
| ch1 | The key for the first variable, in {T,D,P,H,S,U} |
| val1 | The value for the first variable |
| ch2 | The key for the second variable, in {T,D,P,H,S,U} |
| val2 | The value for the second variable |
| bits | passed to toms748 algorithm |
| max_iter | Maximum allowed number of function calls |
| boundsftol | A functional value stopping condition to test on the endpoints |
Definition at line 1357 of file superancillary.h.
|
inline |
A convenience function to pass off to the ChebyshevApproximation1D and do an inversion calculation for a value of the variable for a saturated state
| propval | The value of the property |
| k | Property key, in {D,P,H,S,U} |
| Q | Vapor quality, in {0,1} |
| bits | passed to toms748 algorithm |
| max_iter | Maximum allowed number of function calls |
| boundsftol | A functional value stopping condition to test on the endpoints |
Definition at line 1244 of file superancillary.h.
|
inline |
Given a saturated density and another property other than T, solve for the temperature and vapor quality
| rho | The molar density |
| propval | The value of the other property |
| k | Property key, in {D,P,H,S,U} |
| bits | passed to toms748 algorithm |
| max_iter | Maximum allowed number of function calls |
| boundsftol | A functional value stopping condition to test on the endpoints |
Definition at line 1414 of file superancillary.h.
|
inline |
A vectorize version of solve_for_Tq_DX for use in the Python interface for profiling.
Definition at line 1442 of file superancillary.h.