4 #include "Exceptions.h" 6 #include "rapidjson_include.h" 27 std::vector<CoolPropDbl>
a,
36 a = cpjson::get_long_double_array(json_code[
"a"]);
37 n = cpjson::get_long_double_array(json_code[
"n"]);
39 Tc = cpjson::get_double(json_code,
"Tc");
40 BibTeX = cpjson::get_string(json_code,
"BibTeX");
51 throw ValueError(format(
"Must be saturated state : T <= Tc"));
53 CoolPropDbl THETA = 1 - T /
Tc;
54 for (std::size_t i = 0; i <
N; ++i) {
55 s[i] = a[i] * pow(THETA, n[i]);
57 return std::accumulate(s.begin(), s.end(), 0.0);
87 Eigen::MatrixXd num_coeffs,
89 std::vector<double>
n, t,
s;
96 CoolPropDbl reducing_value,
103 enum ancillaryfunctiontypes
106 TYPE_NOT_EXPONENTIAL,
108 TYPE_RATIONAL_POLYNOMIAL
110 ancillaryfunctiontypes type;
121 return type != TYPE_NOT_SET;
127 return max_abs_error;
140 double invert(
double value,
double min_bound = -1,
double max_bound = -1);
161 CoolPropDbl T_0,
a, c, p_0, T_max, T_min, p_min, p_max;
165 std::vector<MeltingLinePiecewiseSimonSegment> parts;
178 std::vector<CoolPropDbl>
a, t;
179 CoolPropDbl T_0, p_0, T_max, T_min, p_min, p_max;
180 CoolPropDbl
evaluate(CoolPropDbl T) {
181 CoolPropDbl summer = 0;
182 for (std::size_t i = 0; i < a.size(); ++i) {
183 summer += a[i] * (pow(T / T_0, t[i]) - 1);
185 return p_0 * (1 + summer);
190 std::vector<MeltingLinePiecewisePolynomialInTrSegment> parts;
203 std::vector<CoolPropDbl>
a, t;
204 CoolPropDbl T_0, p_0, T_max, T_min, p_min, p_max;
206 CoolPropDbl
evaluate(CoolPropDbl T) {
207 CoolPropDbl summer = 0;
208 for (std::size_t i = 0; i < a.size(); ++i) {
209 summer += a[i] * pow(T / T_0 - 1, t[i]);
211 return p_0 * (1 + summer);
216 std::vector<MeltingLinePiecewisePolynomialInThetaSegment> parts;
224 MELTING_LINE_NOT_SET = 0,
243 MeltingLineVariables() : Tmin(_HUGE), Tmax(_HUGE), pmin(_HUGE), pmax(_HUGE), T_m(_HUGE), type(MELTING_LINE_NOT_SET){};
251 CoolPropDbl
evaluate(
int OF,
int GIVEN, CoolPropDbl value);
258 return type != MELTING_LINE_NOT_SET;
CoolPropDbl Tmin
Minimum temperature in K.
Definition: Ancillaries.h:229
Definition: Ancillaries.h:159
Definition: Ancillaries.h:214
CoolPropDbl T_r
The temperature in K used to reduce the temperature (usually the critical temperature) ...
Definition: Ancillaries.h:96
std::size_t N
number of a_i, n_i pairs
Definition: Ancillaries.h:31
a polynomial in is in use
Definition: Ancillaries.h:227
This is generalized class that can be used to manage an ancillary curve, here they are ancillary curv...
Definition: Ancillaries.h:84
CoolPropDbl max_abs_error
For TYPE_RATIONAL_POLYNOMIAL.
Definition: Ancillaries.h:92
The surface tension correlation class uses correlations for the surface tension that are all of the f...
Definition: Ancillaries.h:24
CoolPropDbl get_max_abs_error()
Get the maximum absolute error for this fit.
Definition: Ancillaries.h:126
int type
The data needed for a melting curve formed of segments that are polynomials in .
Definition: Ancillaries.h:241
Definition: Ancillaries.h:219
bool enabled(void)
Return true if the ancillary is enabled (type is not TYPE_NOT_SET)
Definition: Ancillaries.h:120
std::vector< CoolPropDbl > s
a summation buffer
Definition: Ancillaries.h:27
bool using_tau_r
Whether the term is included in the.
Definition: Ancillaries.h:95
std::vector< CoolPropDbl > a
the leading coefficients a_i
Definition: Ancillaries.h:27
MeltingLineVariablesEnum
Definition: Ancillaries.h:222
double get_Tmin(void)
Get the minimum temperature in K.
Definition: Ancillaries.h:143
Definition: Ancillaries.h:163
Definition: Exceptions.h:45
std::vector< CoolPropDbl > n
the powers n_i
Definition: Ancillaries.h:27
std::string BibTeX
BibTeX key for the melting curve in use.
Definition: Ancillaries.h:234
Definition: Ancillaries.h:188
The evaluator class for a melting curve formed of segments in the form.
Definition: Ancillaries.h:175
CoolPropDbl T_m
Melting temperature at 1 atmosphere.
Definition: Ancillaries.h:235
A simon-type curve is in use.
Definition: Ancillaries.h:225
double get_Tmax(void)
Get the maximum temperature in K.
Definition: Ancillaries.h:148
MeltingLinePiecewisePolynomialInTrData polynomial_in_Tr
The data used for a Simon-style curve.
Definition: Ancillaries.h:238
std::size_t N
The number of values in the arrays.
Definition: Ancillaries.h:98
The evaluator class for a melting curve formed of segments in the form.
Definition: Ancillaries.h:200
CoolPropDbl evaluate(CoolPropDbl T)
Actually evaluate the surface tension equation.
Definition: Ancillaries.h:46
std::string BibTeX
The BiBTeX key for the surface tension curve in use.
Definition: Ancillaries.h:32
MeltingLinePiecewisePolynomialInThetaData polynomial_in_Theta
The data needed for a melting curve formed of segments that are polynomials in .
Definition: Ancillaries.h:240
CoolPropDbl Tc
critical temperature in K
Definition: Ancillaries.h:30
This file contains flash routines in which the state is unknown, and a solver of some kind must be us...
Definition: AbstractState.h:19
bool enabled()
Return true if the ancillary is enabled (type is not the default value of MELTING_LINE_NOT_SET) ...
Definition: Ancillaries.h:257
a polynomial in is in use
Definition: Ancillaries.h:226