Format macros, they keep getting picked incrementally by clang format + Strip trailing whitespaces

```
find . -regextype posix-extended -regex '.*\.(cpp|hpp|c|h|cxx|hxx|py)$' | xargs -I@ sed -i 's/[ \t]*$//' "@"
```
This commit is contained in:
Julien Marrec
2022-03-31 18:04:57 +02:00
committed by Ian Bell
parent a7a3c844e2
commit 6913fc41dc
53 changed files with 486 additions and 415 deletions

View File

@@ -23,15 +23,15 @@ Fluid Information
:widths: 40, 60
:delim: ;
:file: {fluid:s}-info.csv
REFPROP Validation Data
=======================
.. note::
This figure compares the results generated from CoolProp and those generated from REFPROP. They are all results obtained in the form :math:`Y(T,\\rho)`, where :math:`Y` is the parameter of interest and which for all EOS is a direct evaluation of the EOS
You can download the script that generated the following figure here: :download:`(link to script)<REFPROPplots/{fluid:s}.py>`, right-click the link and then save as... or the equivalent in your browser. You can also download this figure :download:`as a PDF<REFPROPplots/{fluid:s}.pdf>`.
You can download the script that generated the following figure here: :download:`(link to script)<REFPROPplots/{fluid:s}.py>`, right-click the link and then save as... or the equivalent in your browser. You can also download this figure :download:`as a PDF<REFPROPplots/{fluid:s}.pdf>`.
.. image:: REFPROPplots/{fluid:s}.png
@@ -44,7 +44,7 @@ In this figure, we start off with a state point given by T,P and then we calcula
.. note::
You can download the script that generated the following figure here: :download:`(link to script)<Consistencyplots/{fluid:s}.py>`, right-click the link and then save as... or the equivalent in your browser. You can also download this figure :download:`as a PDF<Consistencyplots/{fluid:s}.pdf>`.
You can download the script that generated the following figure here: :download:`(link to script)<Consistencyplots/{fluid:s}.py>`, right-click the link and then save as... or the equivalent in your browser. You can also download this figure :download:`as a PDF<Consistencyplots/{fluid:s}.pdf>`.
.. image:: Consistencyplots/{fluid:s}.png
@@ -218,7 +218,7 @@ class FluidGenerator(object):
ITG.write(path)
del_old = CP.get_config_string(CP.LIST_STRING_DELIMITER)
CP.set_config_string(CP.LIST_STRING_DELIMITER, '|')
try:
aliases = ', '.join(['``' + a.strip() + '``' for a in CoolProp.CoolProp.get_fluid_param_string(self.fluid, 'aliases').strip().split('|') if a])

View File

@@ -5,7 +5,7 @@ h = HAPropsSI('H','T',298.15,'P',101325,'R',0.5); print(h)
T = HAPropsSI('T','P',101325,'H',h,'R',1.0); print(T)
T = HAPropsSI('T','H',h,'R',1.0,'P',101325); print(T)
# Verification script
# Verification script
import CoolProp.CoolProp as CP
import numpy as np
import itertools

View File

@@ -58,7 +58,7 @@ HELIUM helium Helium 5.1953 R-704 - - - - - - N/A - - - - - - - - - - - -
HEPTANE heptane n-Heptane 540.13 * * * - - - 2.58 0.5 0.5 0.592 - - - - - - - - -
HEXANE hexane n-Hexane 507.82 * 3.1 * - - - 2.57 0.5 0.4 0.495 4.94E-01 - - - - - - - - -
HYDROGEN Hydrogen 33.145 R-702 - - - - - - N/A - - - 4.94E-01 - - - - - - - - -
IBUTENE 2-methyl-1-propene/methylpropene/isobutene/isobutylene Isobutene 418.09 * * * - - - N/A 0.6 0.6 6.27E-01 - - - - - - 6.67E+04
IBUTENE 2-methyl-1-propene/methylpropene/isobutene/isobutylene Isobutene 418.09 * * * - - - N/A 0.6 0.6 6.27E-01 - - - - - - 6.67E+04
IHEXANE 2-methylpentane (methylpentane) Isohexane 497.7 * * * - - - N/A - - - - - - - - - - - -
IPENTANE 2-methylbutane Isopentane 460.35 * * * - - - 1.8 0.3 0.3 4.05E-01 - - - - - - - - -
ISOBUTAN 2-methylpropane IsoButane 407.817 * * * - - - 1.74 0.4 0.3 3.07E-01 - - - - - - - - -
@@ -246,7 +246,7 @@ HH = """:'0','2','0','3','0',
:'1','1','1','NA','2',
:'1','NA','1','NA','2',
:'NA','1','1','1','1',
:'3','0','2','0','0',
:'3','0','2','0','0',
:'1','1','NA','NA','NA','1',
:'1','1','1','2','1','1',
:'1','1','1','1'"""
@@ -269,7 +269,7 @@ FH = """:'4','3','0','1','0',
:'1','1','1','NA','1',
:'0','NA','0','NA','0',
:'NA','1','2','2','0',
:'0','4','3','0','0',
:'0','4','3','0','0',
:'1','1','NA','NA','NA','1',
:'1','0','0','1','1','4',
:'1','1','1','0' """
@@ -292,7 +292,7 @@ PH = """:'0','0','0','0','0',
:'0','0','0','NA','1',
:'0','NA','1','NA','1',
:'NA','0','0','0','0',
:'0','1','0','0','3',
:'0','1','0','0','3',
:'0','0','NA','NA','NA','0',
:'0','0','0','0','0','1',
:'0','0','0','2'"""

View File

@@ -393,7 +393,7 @@ class SolutionDataWriter(object):
# Let the base class default method raise the TypeError
return json.JSONEncoder.default(self, obj)
dump = json.dumps(jobj, indent=2, sort_keys=True, cls=RoundingEncoder)
# print dump
hashes = self.load_hashes()

View File

@@ -62,26 +62,26 @@ def arrayize(*args):
def HFO():
# Data from Zhao et al. dx.doi.org/10.1021/je5001457 | J. Chem. Eng. Data 2014, 59, 1366-1371
data_R1234yf = """293.15 1109.9 32.8 12.04 0.1442 6.82
303.09 1073.5 43.6 12.53 0.1319 5.71
313.20 1033.6 57.8 13.16 0.1223 4.60
323.19 990.2 76.0 13.88 0.1126 3.55
333.14 941.4 99.7 14.82 0.1016 2.55
343.11 883.5 132.2 16.12 0.0899 1.64
353.08 809.6 179.9 18.17 0.0820 0.81
358.05 761.5 214.8 19.78 0.0770 0.46
363.05 695.7 267.7 22.44 0.0700 0.15
data_R1234yf = """293.15 1109.9 32.8 12.04 0.1442 6.82
303.09 1073.5 43.6 12.53 0.1319 5.71
313.20 1033.6 57.8 13.16 0.1223 4.60
323.19 990.2 76.0 13.88 0.1126 3.55
333.14 941.4 99.7 14.82 0.1016 2.55
343.11 883.5 132.2 16.12 0.0899 1.64
353.08 809.6 179.9 18.17 0.0820 0.81
358.05 761.5 214.8 19.78 0.0770 0.46
363.05 695.7 267.7 22.44 0.0700 0.15
365.05 657.4 301.0 24.26 0.0624 0.05"""
# Data from Zhao et al. dx.doi.org/10.1021/je5001457 | J. Chem. Eng. Data 2014, 59, 1366-1371
data_R1234zeE = """295.23 1172.5 24.1 12.11 0.1776 8.88
303.19 1146.1 30.6 12.46 0.1607 7.91
313.21 1111.1 40.8 12.93 0.1429 6.66
323.19 1073.6 53.6 13.46 0.1319 5.48
333.00 1033.3 69.8 14.06 0.1193 4.36
343.05 986.7 91.3 14.82 0.1132 3.30
353.00 924.0 119.7 15.80 0.1051 2.26
363.12 866.8 160.4 17.28 0.0924 1.35
data_R1234zeE = """295.23 1172.5 24.1 12.11 0.1776 8.88
303.19 1146.1 30.6 12.46 0.1607 7.91
313.21 1111.1 40.8 12.93 0.1429 6.66
323.19 1073.6 53.6 13.46 0.1319 5.48
333.00 1033.3 69.8 14.06 0.1193 4.36
343.05 986.7 91.3 14.82 0.1132 3.30
353.00 924.0 119.7 15.80 0.1051 2.26
363.12 866.8 160.4 17.28 0.0924 1.35
373.14 776.9 225.2 19.89 0.0817 0.54"""
for fluid, data, e_k, sigma_nm in zip(['R1234yf', 'R1234ze(E)'], [data_R1234yf, data_R1234zeE], [281.14, 292.11], [0.5328, 0.5017]):
@@ -126,14 +126,14 @@ def HFO():
def pentanes():
# from doi 10.1021/je0202174 | J. Chem. Eng. Data 2003, 48, 1418-1421
# T (K), rhoL (kg/m^3), rhoV (kg/m^3), eta (mPa-s)
data_cyclopentane = """253.15 258.15 263.15 268.15 273.15 278.15 283.15 288.15 293.15 298.15 303.15 308.15 313.15 318.15 323.15 328.15 333.15 338.15 343.15 348.15 353.15
data_cyclopentane = """253.15 258.15 263.15 268.15 273.15 278.15 283.15 288.15 293.15 298.15 303.15 308.15 313.15 318.15 323.15 328.15 333.15 338.15 343.15 348.15 353.15
784.64 779.53 774.59 769.77 765.12 760.20 755.32 750.27 745.02 738.63 731.97 725.15 718.32 711.59 705.11 699.08 693.40 688.44 684.25 680.96 678.71
0.0881 0.1127 0.1443 0.1848 0.2368 0.3036 0.3894 0.4999 0.6421 0.8255 1.062 1.368 1.764 2.279 2.950 3.827 4.980 6.509 8.554 11.33 15.20
0.7268 0.6786 0.6347 0.5930 0.5567 0.5224 0.4922 0.4646 0.4382 0.4148 0.3923 0.3714 0.3521 0.3350 0.3190 0.3048 0.2912 0.2793 0.2690 0.2590 0.2502"""
# from doi 10.1021/je0202174 | J. Chem. Eng. Data 2003, 48, 1418-1421
# T (K), rhoL (kg/m^3), rhoV (kg/m^3), eta (mPa-s)
data_isopentane = """253.15 258.15 263.15 268.15 273.15 278.15 283.15 288.15 293.15 298.15 303.15 308.15 313.15 318.15 323.15 328.15 333.15 338.15 343.15 348.15 353.15
data_isopentane = """253.15 258.15 263.15 268.15 273.15 278.15 283.15 288.15 293.15 298.15 303.15 308.15 313.15 318.15 323.15 328.15 333.15 338.15 343.15 348.15 353.15
658.32 653.55 648.73 643.87 639.01 634.15 629.35 624.63 620.05 615.69 610.87 605.63 600.05 594.23 588.24 582.18 576.13 570.18 564.41 558.92 553.79
0.4655 0.5889 0.7372 0.9137 1.122 1.366 1.650 1.979 2.356 2.788 3.278 3.833 4.459 5.162 5.949 6.827 7.803 8.886 10.09 11.41 12.87
0.3893 0.3661 0.3439 0.3201 0.3023 0.2859 0.2703 0.2547 0.2399 0.2289 0.2144 0.2023 0.1910 0.1813 0.1724 0.1611 0.1543 0.1480 0.1411 0.1332 0.1287"""

View File

@@ -161,35 +161,35 @@ def write_output(c, d, theta_MAE, phi_MAE):
template = textwrap.dedent(
"""
double {name:s}Class::viscosity_Trho(double T, double rho)
{{
{{
/*
Fitting of shape factor curves to R134a data. This method is employed because solving
for the shape factors is computationally very expensive and not very nice
convergence behavior is experienced. Thus we can use the ECS method,
but with about the execution time of a conventional viscosity correlation.
This function code was automatically generated by the fit_shape_factor.py
This function code was automatically generated by the fit_shape_factor.py
script in the dev/ folder on {timestamp:s}
Mean absolute errors of shape factor prediction:
theta = {theta_MAE:g} %
phi = {phi_MAE:g} %
*/
double e_k, sigma, tau, delta, A1, A2, A3, A4, theta, Tc, Tc0, T0, rho0;
double e_k, sigma, tau, delta, A1, A2, A3, A4, theta, Tc, Tc0, T0, rho0;
double DELTA, PSI_theta, psi, f, h, F_eta, M, M0, delta_omega, rho0bar;
double B1, B2, B3, B4, PSI_phi, Zc, Zc0, rhoc0, rhoc, log_tau, phi, rhobar;
double c[] = {{{cdata:s}}};
double d[] = {{{ddata:s}}};
tau = reduce.T/T;
delta = rho/reduce.rho;
R134aClass R134a = R134aClass();
R134a.post_load();
delta_omega = params.accentricfactor-R134a.params.accentricfactor;
Zc = reduce.p/(reduce.rho*R()*reduce.T);
Zc0 = R134a.reduce.p/(R134a.reduce.rho*R134a.R()*R134a.reduce.T);
Tc = reduce.T;
@@ -198,21 +198,21 @@ def write_output(c, d, theta_MAE, phi_MAE):
rhoc0 = R134a.reduce.rho;
M = params.molemass;
M0 = R134a.params.molemass;
rhobar = rho/M;
if (rho > {rhomin:g})
{{
DELTA = pow(delta-1,2)+pow(tau-1,2);
log_tau = log(tau);
A1 = c[0]-c[1]*log_tau;
A2 = c[2]-c[3]*log_tau;
A3 = c[4]-c[5]*log_tau;
A4 = c[6]-c[7]*pow(log_tau,2);
PSI_theta = c[8]*delta*exp(-c[9]*pow(DELTA,2));
theta = 1+(delta_omega)*(A1+A2*exp(-pow(delta,2))+A3*exp(-pow(delta,c[10]))+A4*exp(-pow(delta,c[11]))+PSI_theta);
B1 = d[0]-d[1]*log_tau;
B2 = d[2]-d[3]*log_tau;
B3 = d[4]-d[5]*log_tau;
@@ -229,13 +229,13 @@ def write_output(c, d, theta_MAE, phi_MAE):
h = M/M0*rhoc0/rhoc*phi;
rho0bar = rhobar*h;
rho0 = M0*rho0bar;
psi = ECS_psi_viscosity(delta);
f = T/T0;
F_eta = sqrt(f)*pow(h,-2.0/3.0)*sqrt(M/M0);
ECSParams(&e_k,&sigma);
return viscosity_dilute(T,e_k,sigma) + R134a.viscosity_background(T0,rho0*psi)*F_eta;
}}
}}
"""
)

View File

@@ -117,7 +117,7 @@ def inject_acentric(fluid, i, json_data):
def inject_states(fluid):
fluid_path = '../fluids/' + fluid + '.json'
# AS =
# AS =
# Open the fluid JSON file
with open(fluid_path, 'r') as fp:
@@ -137,7 +137,7 @@ def inject_states(fluid):
fp.write(json.dumps(json_data, **json_options))
if __name__ == '__main__':
for fld in ['MD2M','MD3M','MD4M','R1243zf','R1234ze(Z)','Neon','HydrogenChloride','HeavyWater']:
inject_states(fld)

View File

@@ -20,7 +20,7 @@ if __name__ == '__main__':
import json
a1, a2 = get_offset_NBP(name)
print(json.dumps({
"a1": a1,
"a2": a2,
"a1": a1,
"a2": a2,
"type": "IdealGasHelmholtzLead"
}, indent=2))

View File

@@ -58,25 +58,25 @@ class SurfaceTensionCorrelation
}
};
/**
*
* This is generalized class that can be used to manage an ancillary curve,
*
* This is generalized class that can be used to manage an ancillary curve,
* here they are ancillary curves for saturation pressure, density, enthalpy, entropy.
*
*
* The form of the ancillary equation can take one of a number of forms:
*
*
* a) So-called "exponential" form (type = TYPE_EXPONENTIAL) that has a form like
*
* \f[ y = y_c\exp\left(\frac{T_c}{T}\sum(n_i \theta^{t_i})\right) \f]
* or
*
* \f[ y = y_c\exp\left(\frac{T_c}{T}\sum(n_i \theta^{t_i})\right) \f]
* or
* \f[ y = y_c\exp\left(\sum(n_i \theta^{t_i})\right) \f]
*
*
* b) A non-exponential form (type = TYPE_NOT_EXPONENTIAL) that has a form of
*
* \f[ y = y_c\left(1+\sum_i(n_i\theta^t_i)\right) \f]
* with
* \f[ \theta = \left(1-\frac{T}{T_c}\right) \f]
* which is conveniently equal to zero at the critical point
*
*
* c) Rational polynomial form (type = TYPE_RATIONAL_POLYNOMIAL) that has a form of
* \f[ y = \frac{\sum_iA_iT^i}{\sum_iB_iT^i}\f]
* where i is an integer, and the coefficients are in increasing order in both numerator and denominator
@@ -190,7 +190,7 @@ struct MeltingLinePiecewisePolynomialInTrData
std::vector<MeltingLinePiecewisePolynomialInTrSegment> parts;
};
/**
/**
\brief The evaluator class for a melting curve formed of segments in the form
\f[
@@ -242,7 +242,7 @@ class MeltingLineVariables
MeltingLineVariables() : Tmin(_HUGE), Tmax(_HUGE), pmin(_HUGE), pmax(_HUGE), T_m(_HUGE), type(MELTING_LINE_NOT_SET){};
/**
/**
* \brief Evaluate the melting line
* @param OF The output variable
* @param GIVEN The given variable

View File

@@ -212,7 +212,7 @@ std::vector<T> logspace(T xmin, T xmax, std::size_t n) {
/**
* @brief Use bisection to find the inputs that bisect the value you want, the trick
* here is that this function is allowed to have "holes" where parts of the the array are
* here is that this function is allowed to have "holes" where parts of the the array are
* also filled with invalid numbers for which ValidNumber(x) is false
* @param vec The vector to be bisected
* @param val The value to be found
@@ -291,7 +291,7 @@ void bisect_vector(const std::vector<T>& vec, T val, std::size_t& i) {
/**
* @brief Use bisection to find the inputs that bisect the value you want, the trick
* here is that this function is allowed to have "holes" where parts of the the array are
* here is that this function is allowed to have "holes" where parts of the the array are
* also filled with invalid numbers for which ValidNumber(x) is false
* @param matrix The vector to be bisected
* @param j The index of the matric in the off-grain dimension
@@ -553,9 +553,9 @@ T is_in_closed_range(T x1, T x2, T x) {
};
/** \brief Solve a cubic with coefficients in decreasing order
*
*
* 0 = ax^3 + b*x^2 + c*x + d
*
*
* @param a The x^3 coefficient
* @param b The x^2 coefficient
* @param c The x^1 coefficient
@@ -649,10 +649,10 @@ void sort3(T& a, T& b, T& c) {
* Due to the periodicity of angles, you need to handle the case where the
* angles wrap around - suppose theta_d is 6.28 and you are at an angles of 0.1 rad,
* the difference should be around 0.1, not -6.27
*
*
* This brilliant method is from http://blog.lexique-du-net.com/index.php?post/Calculate-the-real-difference-between-two-angles-keeping-the-sign
* and the comment of user tk
*
*
* Originally implemented in PDSim
*/
template <class T>

View File

@@ -12,10 +12,10 @@
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
* This will be used to generate an enum like:
* enum configuration_keys {NORMALIZE_GAS_CONSTANTS, CRITICAL_SPLINES_ENABLED};
*
*
* The values in this list are given by:
* enum, string representation of enum, default value, description
*
*
* The type of the default value specifies the only type that will be accepted for this parameter
*/
#define CONFIGURATION_KEYS_ENUM \

View File

@@ -66,7 +66,7 @@ void set_error_string(const std::string& error);
void set_warning_string(const std::string& warning);
/* \brief Extract a value from the saturation ancillary
*
*
* @param fluid_name The name of the fluid to be used - HelmholtzEOS backend only
* @param output The desired output variable ("P" for instance for pressure)
* @param Q The quality, 0 or 1
@@ -85,12 +85,12 @@ std::string get_global_param_string(const std::string& ParamName);
/// @returns long element from global type enumeration
long getFluidType(std::string FluidName);*/
/**
/**
\brief Get a string for a value from a fluid (numerical values for the fluid can be obtained from Props1SI function)
@param FluidName The name of the fluid that is part of CoolProp, for instance "n-Propane"
@param ParamName A string, can be in one of the terms described in the following table
ParamName | Description
-------------------------- | ----------------------------------------
"aliases" | A comma separated list of aliases for the fluid
@@ -100,15 +100,15 @@ std::string get_global_param_string(const std::string& ParamName);
"Bibtex-XXX" | A BibTeX key, where XXX is one of the bibtex keys used in get_BibTeXKey
"pure" | "true" if the fluid is pure, "false" otherwise
"formula" | The chemical formula of the fluid in LaTeX form if available, "" otherwise
@returns The string, or an error message if not valid input
*/
std::string get_fluid_param_string(const std::string& FluidName, const std::string& ParamName);
/** \brief Check if the fluid name is valid
*
*
* @returns output Returns true if the fluid string is valid
*
*
* \note "gfreilgregre" -> false; "HEOS::Water" -> true; "Water" -> true
*
*/
@@ -122,12 +122,12 @@ bool is_valid_fluid_string(const std::string& fluidstring);
*/
bool add_fluids_as_JSON(const std::string& backend, const std::string& fluidstring);
/**
/**
\brief Set the reference state based on a string representation
@param FluidName The name of the fluid (Backend can be provided like "REFPROP::Water", or if no backend is provided, "HEOS" is the assumed backend)
@param reference_state The reference state to use, one of
@param reference_state The reference state to use, one of
Reference State | Description
------------- | -------------------
"IIR" | h = 200 kJ/kg, s=1 kJ/kg/K at 0C saturated liquid
@@ -135,10 +135,10 @@ bool add_fluids_as_JSON(const std::string& backend, const std::string& fluidstri
"NBP" | h = 0, s = 0 @ 1.0 bar saturated liquid
"DEF" | Reset to the default reference state for the fluid
"RESET" | Remove the offset
The offset in the ideal gas Helmholtz energy can be obtained from
\f[
\displaystyle\frac{\Delta s}{R_u/M}+\frac{\Delta h}{(R_u/M)T}\tau
\f[
\displaystyle\frac{\Delta s}{R_u/M}+\frac{\Delta h}{(R_u/M)T}\tau
\f]
where \f$ \Delta s = s-s_{spec} \f$ and \f$ \Delta h = h-h_{spec} \f$
*/

View File

@@ -1,19 +1,19 @@
/** \brief This file defines an interface for shared library (DLL) wrapping
*
* In general the functions defined here take strings which are 0-terminated (C-style),
*
* In general the functions defined here take strings which are 0-terminated (C-style),
* vectors of doubles are passed as double* and length
* These functions pass directly to equivalently named functions in CoolProp.h in the CoolProp namespace
* that take std::string, vector<double> etc.
*
*
* Functions with the call type like
* EXPORT_CODE void CONVENTION AFunction(double, double);
* will be exported to the DLL
*
*
* The exact symbol that will be exported depends on the values of the preprocessor macros COOLPROP_LIB, EXPORT_CODE, CONVENTION, etc.
*
*
* In order to have 100% control over the export macros, you can specify EXPORT_CODE and CONVENTION directly. Check out
* CMakeLists.txt in the repo root to see some examples.
*
*
*/
#ifndef COOLPROPDLL_H
@@ -78,14 +78,14 @@ inline void __assert(const char* error) {
/**
* \overload
* \sa \ref CoolProp::Props1SI(std::string, std::string)
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE double CONVENTION Props1SI(const char* FluidName, const char* Output);
/**
*\overload
*\sa \ref CoolProp::PropsSI(const std::string &, const std::string &, double, const std::string &, double, const std::string&)
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE double CONVENTION PropsSI(const char* Output, const char* Name1, double Prop1, const char* Name2, double Prop2, const char* Ref);
@@ -93,7 +93,7 @@ EXPORT_CODE double CONVENTION PropsSI(const char* Output, const char* Name1, dou
/**
*\overload
*\sa \ref CoolProp::PhaseSI(const std::string &, double, const std::string &, double, const std::string&)
*
*
* \note This function returns the phase string in pre-allocated phase variable. If buffer is not large enough, no copy is made
*/
EXPORT_CODE long CONVENTION PhaseSI(const char* Name1, double Prop1, const char* Name2, double Prop2, const char* Ref, char* phase, int n);
@@ -101,9 +101,9 @@ EXPORT_CODE long CONVENTION PhaseSI(const char* Name1, double Prop1, const char*
/**
*\overload
*\sa \ref CoolProp::get_global_param_string
*
*
* @returns error_code 1 = Ok 0 = error
*
*
* \note This function returns the output string in pre-allocated char buffer. If buffer is not large enough, no copy is made
*/
EXPORT_CODE long CONVENTION get_global_param_string(const char* param, char* Output, int n);
@@ -111,14 +111,14 @@ EXPORT_CODE long CONVENTION get_global_param_string(const char* param, char* Out
* \overload
* \sa \ref CoolProp::get_parameter_information_string
* \note This function returns the output string in pre-allocated char buffer. If buffer is not large enough, no copy is made
*
*
* @returns error_code 1 = Ok 0 = error
*/
EXPORT_CODE long CONVENTION get_parameter_information_string(const char* key, char* Output, int n);
/**
/**
* \overload
* \sa \ref CoolProp::get_fluid_param_string
*
*
* @returns error_code 1 = Ok 0 = error
*/
EXPORT_CODE long CONVENTION get_fluid_param_string(const char* fluid, const char* param, char* Output, int n);
@@ -167,7 +167,7 @@ EXPORT_CODE int CONVENTION set_reference_stateD(const char* Ref, double T, doubl
/** \brief FORTRAN 77 style wrapper of the PropsSI function
* \overload
* \sa \ref CoolProp::PropsSI(const std::string &, const std::string &, double, const std::string &, double, const std::string&)
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE void CONVENTION propssi_(const char* Output, const char* Name1, const double* Prop1, const char* Name2, const double* Prop2,
@@ -178,12 +178,12 @@ EXPORT_CODE double CONVENTION F2K(double T_F);
/// Convert from Kelvin to degrees Fahrenheit (useful primarily for testing)
EXPORT_CODE double CONVENTION K2F(double T_K);
/** \brief Get the index for a parameter "T", "P", etc.
*
*
* @returns index The index as a long. If input is invalid, returns -1
*/
EXPORT_CODE long CONVENTION get_param_index(const char* param);
/** \brief Get the index for an input pair for AbstractState.update function
*
*
* @returns index The index as a long. If input is invalid, returns -1
*/
EXPORT_CODE long CONVENTION get_input_pair_index(const char* param);
@@ -203,7 +203,7 @@ EXPORT_CODE int CONVENTION get_debug_level();
EXPORT_CODE void CONVENTION set_debug_level(int level);
/* \brief Extract a value from the saturation ancillary
*
*
* @param fluid_name The name of the fluid to be used - HelmholtzEOS backend only
* @param output The desired output variable ("P" for instance for pressure)
* @param Q The quality, 0 or 1
@@ -218,7 +218,7 @@ EXPORT_CODE double CONVENTION saturation_ancillary(const char* fluid_name, const
/** \brief DLL wrapper of the HAPropsSI function
* \sa \ref HumidAir::HAPropsSI(const char *OutputName, const char *Input1Name, double Input1, const char *Input2Name, double Input2, const char *Input3Name, double Input3);
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE double CONVENTION HAPropsSI(const char* Output, const char* Name1, double Prop1, const char* Name2, double Prop2, const char* Name3,
@@ -235,17 +235,17 @@ EXPORT_CODE double CONVENTION cair_sat(double T);
/** \brief FORTRAN 77 style wrapper of the HAPropsSI function
* \sa \ref HumidAir::HAPropsSI(const char *OutputName, const char *Input1Name, double Input1, const char *Input2Name, double Input2, const char *Input3Name, double Input3);
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE void CONVENTION hapropssi_(const char* Output, const char* Name1, const double* Prop1, const char* Name2, const double* Prop2,
const char* Name3, const double* Prop3, double* output);
/** \brief DLL wrapper of the HAProps function
*
*
* \warning DEPRECATED!!
* \sa \ref HumidAir::HAProps(const char *OutputName, const char *Input1Name, double Input1, const char *Input2Name, double Input2, const char *Input3Name, double Input3);
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE double CONVENTION HAProps(const char* Output, const char* Name1, double Prop1, const char* Name2, double Prop2, const char* Name3,
@@ -255,7 +255,7 @@ EXPORT_CODE double CONVENTION HAProps(const char* Output, const char* Name1, dou
*
* \warning DEPRECATED!!
* \sa \ref HumidAir::HAProps(const char *OutputName, const char *Input1Name, double Input1, const char *Input2Name, double Input2, const char *Input3Name, double Input3);
*
*
* \note If there is an error, a huge value will be returned, you can get the error message by doing something like get_global_param_string("errstring",output)
*/
EXPORT_CODE void CONVENTION haprops_(const char* Output, const char* Name1, const double* Prop1, const char* Name2, const double* Prop2,
@@ -283,7 +283,7 @@ EXPORT_CODE long CONVENTION AbstractState_factory(const char* backend, const cha
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
* @param message_buffer A buffer for the error code
* @param buffer_length The length of the buffer for the error code
* @return
* @return
*/
EXPORT_CODE void CONVENTION AbstractState_fluid_names(const long handle, char* fluids, long* errcode, char* message_buffer, const long buffer_length);
/**
@@ -292,7 +292,7 @@ EXPORT_CODE void CONVENTION AbstractState_fluid_names(const long handle, char* f
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
* @param message_buffer A buffer for the error code
* @param buffer_length The length of the buffer for the error code
* @return
* @return
*/
EXPORT_CODE void CONVENTION AbstractState_free(const long handle, long* errcode, char* message_buffer, const long buffer_length);
/**
@@ -303,7 +303,7 @@ EXPORT_CODE void CONVENTION AbstractState_free(const long handle, long* errcode,
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
* @param message_buffer A buffer for the error code
* @param buffer_length The length of the buffer for the error code
* @return
* @return
*/
EXPORT_CODE void CONVENTION AbstractState_set_fractions(const long handle, const double* fractions, const long N, long* errcode, char* message_buffer,
const long buffer_length);
@@ -316,7 +316,7 @@ EXPORT_CODE void CONVENTION AbstractState_set_fractions(const long handle, const
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
* @param message_buffer A buffer for the error code
* @param buffer_length The length of the buffer for the error code
* @return
* @return
*/
EXPORT_CODE void CONVENTION AbstractState_get_mole_fractions(const long handle, double* fractions, const long maxN, long* N, long* errcode,
char* message_buffer, const long buffer_length);
@@ -329,7 +329,7 @@ EXPORT_CODE void CONVENTION AbstractState_get_mole_fractions(const long handle,
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
* @param message_buffer A buffer for the error code
* @param buffer_length The length of the buffer for the error code
* @return
* @return
*/
EXPORT_CODE void CONVENTION AbstractState_update(const long handle, const long input_pair, const double value1, const double value2, long* errcode,
char* message_buffer, const long buffer_length);
@@ -360,7 +360,7 @@ EXPORT_CODE void CONVENTION AbstractState_unspecify_phase(const long handle, lon
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
* @param message_buffer A buffer for the error code
* @param buffer_length The length of the buffer for the error code
* @return
* @return
*/
EXPORT_CODE double CONVENTION AbstractState_keyed_output(const long handle, const long param, long* errcode, char* message_buffer,
const long buffer_length);

View File

@@ -134,9 +134,9 @@ struct HelmholtzDerivatives
/// The base class class for the Helmholtz energy terms
/**
Residual Helmholtz Energy Terms:
Term | Helmholtz Energy Contribution
---------- | ------------------------------
ResidualHelmholtzPower | \f$ \alpha^r=\left\lbrace\begin{array}{cc}\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} & l_i=0\\ \displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-\delta^{l_i}) & l_i\neq 0\end{array}\right.\f$
@@ -146,10 +146,10 @@ struct HelmholtzDerivatives
ResidualHelmholtzGERG2008Gaussian | \f$ \alpha^r=\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-\eta_i(\delta-\epsilon_i)^2-\beta_i(\delta-\gamma_i))\f$
ResidualHelmholtzNonAnalytic | \f$ \begin{array}{c}\alpha^r&=&\displaystyle\sum_i n_i \Delta^{b_i}\delta\psi \\ \Delta & = & \theta^2+B_i[(\delta-1)^2]^{a_i}\\ \theta & = & (1-\tau)+A_i[(\delta-1)^2]^{1/(2\beta_i)}\\ \psi & = & \exp(-C_i(\delta-1)^2-D_i(\tau-1)^2) \end{array}\f$
ResidualHelmholtzSAFTAssociating | \f$ \alpha^r = am\left(\ln X-\frac{X}{2}+\frac{1}{2}\right); \f$
Ideal-Gas Helmholtz Energy Terms:
Term | Helmholtz Energy Contribution
---------- | ------------------------------
IdealHelmholtzLead | \f$ \alpha^0 = n_1 + n_2\tau + \ln\delta \f$
@@ -322,11 +322,11 @@ struct ResidualHelmholtzGeneralizedExponentialElement
};
};
/** \brief A generalized residual helmholtz energy container that can deal with a wide range of terms which can be converted to this general form
*
*
* \f$ \alpha^r=\sum_i n_i \delta^{d_i} \tau^{t_i}\exp(u_i) \f$
*
*
* where \f$ u_i \f$ is given by
*
*
* \f$ u_i = -c_i\delta^{l_i}-\omega_i\tau^{m_i}-\eta_{1,i}(\delta-\epsilon_{1,i})-\eta_{2,i}(\delta-\epsilon_{2,i})^2-\beta_{1,i}(\tau-\gamma_{1,i})-\beta_{2,i}(\tau-\gamma_{2,i})^2 \f$
*/
class ResidualHelmholtzGeneralizedExponential : public BaseHelmholtzTerm
@@ -350,7 +350,7 @@ class ResidualHelmholtzGeneralizedExponential : public BaseHelmholtzTerm
ResidualHelmholtzGeneralizedExponential()
: delta_li_in_u(false), tau_mi_in_u(false), eta1_in_u(false), eta2_in_u(false), beta1_in_u(false), beta2_in_u(false), finished(false), N(0){};
/** \brief Add and convert an old-style power (polynomial) term to generalized form
*
*
* Term of the format
* \f$ \alpha^r=\left\lbrace\begin{array}{cc}\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} & l_i=0\\ \displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-\delta^{l_i}) & l_i\neq 0\end{array}\right.\f$
*/
@@ -372,8 +372,8 @@ class ResidualHelmholtzGeneralizedExponential : public BaseHelmholtzTerm
delta_li_in_u = true;
};
/** \brief Add and convert an old-style exponential term to generalized form
*
* Term of the format
*
* Term of the format
* \f$ \alpha^r=\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-g_i\delta^{l_i}) \f$
*/
void add_Exponential(const std::vector<CoolPropDbl>& n, const std::vector<CoolPropDbl>& d, const std::vector<CoolPropDbl>& t,
@@ -391,7 +391,7 @@ class ResidualHelmholtzGeneralizedExponential : public BaseHelmholtzTerm
delta_li_in_u = true;
}
/** \brief Add and convert an old-style Gaussian term to generalized form
*
*
* Term of the format
* \f$ \alpha^r=\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-\eta_i(\delta-\epsilon_i)^2-\beta_i(\tau-\gamma_i)^2)\f$
*/
@@ -413,7 +413,7 @@ class ResidualHelmholtzGeneralizedExponential : public BaseHelmholtzTerm
beta2_in_u = true;
};
/** \brief Add and convert an old-style Gaussian term from GERG 2008 natural gas model to generalized form
*
*
* Term of the format
* \f$ \alpha^r=\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-\eta_i(\delta-\epsilon_i)^2-\beta_i(\delta-\gamma_i))\f$
*/
@@ -435,7 +435,7 @@ class ResidualHelmholtzGeneralizedExponential : public BaseHelmholtzTerm
eta1_in_u = true;
};
/** \brief Add and convert a term from Lemmon and Jacobsen (2005) used for R125
*
*
* Term of the format
* \f$ \alpha^r=\displaystyle\sum_i n_i \delta^{d_i} \tau^{t_i} \exp(-\delta^{l_i}-\tau^{m_i})\f$
*/
@@ -989,10 +989,10 @@ class IdealHelmholtzPower : public BaseHelmholtzTerm
/**
\f[
\alpha^0 = \displaystyle\sum_i n_i\log[c_i+d_i\exp(\theta_i\tau)]
\alpha^0 = \displaystyle\sum_i n_i\log[c_i+d_i\exp(\theta_i\tau)]
\f]
To convert conventional Plank-Einstein forms, given by
To convert conventional Plank-Einstein forms, given by
\f$
\frac{c_p^0}{R} = a_k\displaystyle\frac{\left( b_k/T \right)^2\exp \left( b_k/T \right)}{\left(\exp \left(b_k/T\right) - 1 \right)^2}
\f$
@@ -1002,7 +1002,7 @@ and
\f$
use \f$c = 1\f$, \f$d = -1\f$, \f$n = a\f$, \f$\theta = -\displaystyle\frac{b_k}{T_c}\f$
To convert the second form of Plank-Einstein terms, given by
To convert the second form of Plank-Einstein terms, given by
\f$
\frac{c_p^0}{R} = a_k\displaystyle\frac{\left( -b_k/T \right)^2\exp \left( b_k/T \right)}{c\left(\exp \left(-b_k/T\right) + 1 \right)^2}
\f$

View File

@@ -7,13 +7,13 @@
namespace HumidAir {
/* \brief Standard I/O function using base SI units exclusively
*
*
*/
double HAPropsSI(const std::string& OutputName, const std::string& Input1Name, double Input1, const std::string& Input2Name, double Input2,
const std::string& Input3Name, double Input3);
/* \brief Standard I/O function using mixed kSI units
*
*
* \warning DEPRECATED!! Use \ref HAPropsSI
*/
double HAProps(const std::string& OutputName, const std::string& Input1Name, double Input1, const std::string& Input2Name, double Input2,

View File

@@ -143,7 +143,7 @@ Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> vec_to_eigen(const std::vector<
}
return result;
}
/**
/**
* @param coefficients matrix containing the ordered coefficients
* @param axis axis along which to extract data
*/

View File

@@ -31,7 +31,7 @@ class AbstractODEIntegrator
@param hmax Maximum step size
@param eps_allowed Maximum absolute error of any CV per step allowed. Don't make this parameter too big or you may not be able to get a stable solution. Also don't make it too small because then you are going to run into truncation error.
@param step_relax The relaxation factor that is used in the step resizing algorithm. Should be less than 1.0; you can play with this parameter to improve the adaptive resizing, but should not be necessary.
*/
bool AdaptiveRK54(AbstractODEIntegrator& ode, double tmin, double tmax, double hmin, double hmax, double eps_allowed, double step_relax);

View File

@@ -4,16 +4,34 @@
#include "Exceptions.h"
#define PHASE_ENVELOPE_MATRICES X(K) X(lnK) X(x) X(y)
#define PHASE_ENVELOPE_VECTORS \
X(T) \
X(p) X(lnT) X(lnp) X(rhomolar_liq) X(rhomolar_vap) X(lnrhomolar_liq) X(lnrhomolar_vap) X(hmolar_liq) X(hmolar_vap) X(smolar_liq) X(smolar_vap) \
X(Q) X(cpmolar_liq) X(cpmolar_vap) X(cvmolar_liq) X(cvmolar_vap) X(viscosity_liq) X(viscosity_vap) X(conductivity_liq) X(conductivity_vap) \
X(speed_sound_vap)
#define PHASE_ENVELOPE_VECTORS \
X(T) \
X(p) \
X(lnT) \
X(lnp) \
X(rhomolar_liq) \
X(rhomolar_vap) \
X(lnrhomolar_liq) \
X(lnrhomolar_vap) \
X(hmolar_liq) \
X(hmolar_vap) \
X(smolar_liq) \
X(smolar_vap) \
X(Q) \
X(cpmolar_liq) \
X(cpmolar_vap) \
X(cvmolar_liq) \
X(cvmolar_vap) \
X(viscosity_liq) \
X(viscosity_vap) \
X(conductivity_liq) \
X(conductivity_vap) \
X(speed_sound_vap)
namespace CoolProp {
/** \brief A data structure to hold the data for a phase envelope
*
*
*/
class PhaseEnvelopeData
{
@@ -119,4 +137,4 @@ class PhaseEnvelopeData
} /* namespace CoolProp */
#endif
#endif

View File

@@ -1,11 +1,11 @@
/*
The goal of this backend is to allow the Helmholtz-based structure for cubics and to replace the entire
multi-fluid model with a one-fluid model. The other changes are relatively trivial. The primary
multi-fluid model with a one-fluid model. The other changes are relatively trivial. The primary
change is to replace the core residual Helmholtz energy derivatives from HelmholtzEOSMixtureBackend
with the derivatives from this class.
with the derivatives from this class.
The core code for the Helmholtz translations is from the publication
The core code for the Helmholtz translations is from the publication
"Helmholtz energy translations for common cubic equations of state for use in one-fluid and multi-fluid mixture models"
by Ian H. Bell and Andreas Jaeger, J. Res. NIST, 2016
@@ -200,7 +200,7 @@ class AbstractCubicBackend : public HelmholtzEOSMixtureBackend
};
/**
* /brief Solve for rho = f(T,p)
*
*
* You can often get three solutions, to overcome this problem you must either specify the phase, or provide a reasonable guess value for rho_guess, but not both
*/
CoolPropDbl solver_rho_Tp(CoolPropDbl T, CoolPropDbl p, CoolPropDbl rho_guess = -1);

View File

@@ -2,10 +2,10 @@
This C++ code is the implementation of the analyses presented in the paper
I.Bell and A. Jäger, "Helmholtz energy translations for common cubic equations of state
for use in one-fluid and multi-fluid mixture models", J. Res. NIST, 2016
This code is in the public domain, though if used in academic work, we would appreciate
a reference back to the paper given above.
*/
#ifndef CUBIC_H
@@ -90,12 +90,12 @@ class AbstractCubic
public:
/**
\brief The abstract base clase for the concrete implementations of the cubic equations of state
This abstract base class describes the structure that must be implemented by concrete implementations
of the cubic equations of state (SRK, PR, etc.). The virtual functions must be implemented by the
derived classes, the remaining functions are generic and are not dependent on the equation of state,
so long as it has the formulation given in this work.
*/
AbstractCubic(std::vector<double> Tc, std::vector<double> pc, std::vector<double> acentric, double R_u, double Delta_1, double Delta_2,
std::vector<double> C1 = std::vector<double>(), std::vector<double> C2 = std::vector<double>(),

View File

@@ -53,10 +53,10 @@ class UNIFACMixture
public:
UNIFACMixture(const UNIFACLibrary::UNIFACParameterLibrary& library, const double T_r) : library(library), T_r(T_r){};
/**
/**
* \brief Set all the interaction parameters between groups
*
* \param subgroups A vector of the set of the unique Group forming the mixture - these
* \param subgroups A vector of the set of the unique Group forming the mixture - these
* permutations represent the set of posisble binary interactions
*/
void set_interaction_parameters();

View File

@@ -76,7 +76,7 @@ struct Component
*
* This container is intended to be sufficiently generic to allow the user to populate it with UNIFAC parameters from
* any of the standard UNIFAC models
*
*
* Input of parameters (population) is done using JSON-formatted strings, and the class can be interrogated to return
* the desired group information and/or interaction parameters
*/

View File

@@ -13,8 +13,8 @@ namespace CoolProp {
typedef std::vector<std::vector<CoolPropDbl>> STLMatrix;
/** \brief The abstract base class for departure functions used in the excess part of the Helmholtz energy
*
* The only code included in the ABC is the structure for the derivatives of the Helmholtz energy with
*
* The only code included in the ABC is the structure for the derivatives of the Helmholtz energy with
* the reduced density and reciprocal reduced temperature
*/
class DepartureFunction
@@ -94,7 +94,7 @@ class DepartureFunction
};
/** \brief The departure function used by the GERG-2008 formulation
*
*
* This departure function has a form like
* \f[
* \alphar^r_{ij} = \sum_k n_{ij,k}\delta^{d_{ij,k}}\tau^{t_{ij,k}} + \sum_k n_{ij,k}\delta^{d_{ij,k}}\tau^{t_{ij,k}}\exp[-\eta_{ij,k}(\delta-\varepsilon_{ij,k})^2-\beta_{ij,k}(\delta-\gamma_{ij,k})]
@@ -171,7 +171,7 @@ class GaussianExponentialDepartureFunction : public DepartureFunction
};
/** \brief A polynomial/exponential departure function
*
*
* This departure function has a form like
* \f[
* \alpha^r_{ij} = \sum_k n_{ij,k}\delta^{d_{ij,k}}\tau^{t_{ij,k}}\exp(-\delta^{l_{ij,k}})

View File

@@ -1,7 +1,7 @@
/**
This file contains flash routines in which the state is unknown,
and a solver of some kind must be used to obtain temperature and
density, the two state variables upon which the equation of
density, the two state variables upon which the equation of
state is based.
*/
@@ -18,7 +18,7 @@ state is based.
namespace CoolProp {
/**
This class is a friend class of HelmholtzEOSMixtureBackend, therefore the
This class is a friend class of HelmholtzEOSMixtureBackend, therefore the
static methods contained in it have access to the private and
protected variables in the HelmholtzEOSMixtureBackend instance.

View File

@@ -1,5 +1,5 @@
/**
* This file contains derivatives needed in the mixture model. The derivatives are quite nasty, and there
* This file contains derivatives needed in the mixture model. The derivatives are quite nasty, and there
* are a lot of them, so they are put in this file for cleanness. The MixtureDerivatives class is a friend class
* of the HelmholtzEOSMixtureBackend, so it can access all the private members of the HelmholtzEOSMixtureBackend
* class
@@ -23,7 +23,7 @@ namespace CoolProp {
class HelmholtzEOSMixtureBackend;
/**
This class is a friend class of HelmholtzEOSMixtureBackend, therefore the
This class is a friend class of HelmholtzEOSMixtureBackend, therefore the
static methods contained in it have access to the private and
protected variables in the HelmholtzEOSMixtureBackend instance.
@@ -34,7 +34,7 @@ class MixtureDerivatives
{
public:
/** \brief GERG 2004 Monograph equation 7.62
*
*
* The derivative term
* \f[
* n\left(\frac{\partial p}{\partial V} \right)_{T,\bar n} = -\rho^2 RT(1+2\delta \alpha_{\delta}^r+\delta^2\alpha^r_{\delta\delta})
@@ -44,7 +44,7 @@ class MixtureDerivatives
static CoolPropDbl ndpdV__constT_n(HelmholtzEOSMixtureBackend& HEOS);
/** \brief GERG 2004 Monograph equation 7.61
*
*
* The derivative term
* \f[
* \left(\frac{\partial p}{\partial T} \right)_{V,\bar n} = \rho R(1+\delta \alpha_{\delta}^r-\delta \tau \alpha^r_{\delta\tau})
@@ -56,7 +56,7 @@ class MixtureDerivatives
static CoolPropDbl dpdrho__constT_n(HelmholtzEOSMixtureBackend& HEOS);
/** \brief GERG 2004 Monograph equation 7.63
*
*
* The derivative term
* \f[
* n\left(\frac{\partial p}{\partial n_i} \right)_{T,V,n_j} = \rho RT\left[1+\delta\alpha_{\delta}^r\left[2- \frac{1}{\rho_r}\cdot n\left( \frac{\partial \rho_r}{\partial n_i}\right)_{n_j}\right] +\delta\cdot n\left(\frac{\partial\alpha_{\delta}^r}{\partial n_i}\right)_{T,V,n_j}\right]
@@ -68,7 +68,7 @@ class MixtureDerivatives
static CoolPropDbl ndpdni__constT_V_nj(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 monograph Eqn. 7.32
*
*
* The partial molar volume
* \f[
* \hat v_i = \left( \frac{\partial V}{\partial n_i}\right)_{T,p,n_j} = \frac{-\left(\dfrac{\partial p}{\partial n_i}\right)_{T,V,n_j}}{\left(\dfrac{\partial p}{\partial V}\right)_{T,\bar n}}
@@ -80,7 +80,7 @@ class MixtureDerivatives
static CoolPropDbl partial_molar_volume(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief Fugacity of the i-th component
*
*
* Given by the equation
* \f[
* f_i(\delta, \tau, \bar x) = x_i\rho R T \exp\left(\frac{\partial n\alpha^r}{\partial n_i}\right)_{T,V,n_{j \neq i}}
@@ -89,7 +89,7 @@ class MixtureDerivatives
static CoolPropDbl fugacity_i(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief Natural logarithm of the fugacity coefficient
*
*
* @param HEOS The HelmholtzEOSMixtureBackend to be used
* @param i The index of interest
* @param xN_flag A flag specifying whether the all mole fractions are independent or only the first N-1
@@ -97,7 +97,7 @@ class MixtureDerivatives
static CoolPropDbl ln_fugacity_coefficient(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief Derivative of the natural logarithm of the fugacity with respect to T
*
*
* From Witzke, Eqn. 3.14
* \f[
* \left(\frac{\partial \ln(f_i)}{\partial T} \right)_{\rho,x} = -\frac{1}{T}\left(1-\tau\alpha^r_{\tau}-\tau n\left(\frac{\partial\left(\frac{\partial \alpha^r}{\partial n_i}\right)_{T,V,n_j}}{\partial \tau}\right)_{\delta,\bar x} \right)
@@ -109,7 +109,7 @@ class MixtureDerivatives
static CoolPropDbl dln_fugacity_i_dT__constrho_n(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief Derivative of the natural logarithm of the fugacity with respect to T
*
*
* From Witzke, Eqn. 3.15
* \f[
* \left(\frac{\partial \ln(f_i)}{\partial \rho} \right)_{T, x} = \frac{1}{\rho}\left(1+\delta\alpha^r_{\delta}+\delta n\left(\frac{\partial\left(\frac{\partial \alpha^r}{\partial n_i}\right)_{T,V,n_j}}{\partial \delta}\right)_{\tau,\bar x} \right)
@@ -121,9 +121,9 @@ class MixtureDerivatives
static CoolPropDbl dln_fugacity_i_drho__constT_n(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph Eqn. 7.29
*
*
* The derivative term
*
*
* \f[
* \left(\frac{\partial \ln \phi_i}{\partial T} \right)_{p,\bar n} = \left(\frac{\partial^2n\alpha^r}{\partial T\partial n_i} \right)_{V,n_j} + \frac{1}{T}-\frac{\hat v}{RT}\left(\frac{\partial p}{\partial T}\right)_{V,\bar n}
* \f]
@@ -319,7 +319,7 @@ class MixtureDerivatives
}
/** \brief Table B4, Kunz, JCED, 2012 for the original term and the subsequent substitutions
*
*
* The derivative term
* \f[
* n\left(\frac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j}
@@ -340,7 +340,7 @@ class MixtureDerivatives
static CoolPropDbl dnalphar_dni__constT_V_nj(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph Eqn. 7.30
*
*
* The derivative term
* \f[
* \left(\frac{\partial \ln \phi_i}{\partial p} \right)_{T,\bar n} = \frac{\hat v_i}{RT}-\frac{1}{p}
@@ -352,7 +352,7 @@ class MixtureDerivatives
static CoolPropDbl dln_fugacity_coefficient_dp__constT_n(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph Equation 7.31
*
*
* The derivative term
* \f[
* n\left(\frac{\partial \ln \phi_i}{\partial n_j}\right)_{T,p} = n\left(\frac{\partial^2n\alpha^r}{\partial n_j \partial n_i} \right)_{T,V}+1+\frac{n}{RT}\frac{\left(\frac{\partial p}{\partial n_j}\right)_{T,V,n_i}\left(\frac{\partial p}{\partial n_i}\right)_{T,V,n_j}}{\left(\frac{\partial p}{\partial V}\right)_{T,\bar n}}
@@ -370,7 +370,7 @@ class MixtureDerivatives
x_N_dependency_flag xN_flag);
/** \brief Gernert Equation 3.115
*
*
* The derivative term
* \f[
* \left(\frac{\partial \ln \phi_i}{\partial x_j}\right)_{T,p,x_{k\neq j}} = \left(\frac{\partial^2n\alpha^r}{\partial x_j \partial n_i} \right)_{T,V}+\frac{1}{RT}\frac{\left(\frac{\partial p}{\partial n_i}\right)_{T,V,n_{k\neq i}}\left(\frac{\partial p}{\partial x_j}\right)_{T,V,x_{k\neq j}}}{\left(\frac{\partial p}{\partial V}\right)_{T,\bar n}}
@@ -379,13 +379,13 @@ class MixtureDerivatives
* @param i The first index of interest
* @param j The second index of interest
* @param xN_flag A flag specifying whether the all mole fractions are independent or only the first N-1
*
*
*/
static CoolPropDbl dln_fugacity_coefficient_dxj__constT_p_xi(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, std::size_t j,
x_N_dependency_flag xN_flag);
/** \brief Gernert Equation 3.130
*
*
* The derivative term
* \f[
* \left(\frac{\partial p}{\partial x_j} \right)_{T,V,x_{k\neq j}} = \rho RT\left(-\frac{1}{\rho_r}\left(\frac{\partial \rho_r}{\partial x_j}\right)_{x_{k\neq j}} \delta\alpha_{\delta}^r + \delta\left(\frac{\partial}{\partial x_j}\left(\left( \frac{\partial \alpha^r}{\partial \delta}\right)_{\tau,\bar x}\right)\right)_{T,V,x_{k\neq j}}\right)
@@ -397,7 +397,7 @@ class MixtureDerivatives
static CoolPropDbl dpdxj__constT_V_xi(HelmholtzEOSMixtureBackend& HEOS, std::size_t j, x_N_dependency_flag xN_flag);
/** \brief Gernert Equation 3.117
*
*
* The derivative term
* \f[
* \left(\frac{\partial^2n\alpha^r}{\partial x_j\partial n_i} \right)_{T,V} = \left(\frac{\partial}{\partial x_j}\left(n\left(\frac{\partial \alpha^r}{\partial n_i}\right)_{T,V,n_{j\neq i}}\right)\right)_{T,V,x_{k\neq j}} +\left(\frac{\partial \alpha^r}{\partial x_j}\right)_{T,V,x_{k\neq j}}
@@ -433,7 +433,7 @@ class MixtureDerivatives
static CoolPropDbl dtau_dxj__constT_V_xi(HelmholtzEOSMixtureBackend& HEOS, std::size_t j, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph, equations 7.44 and 7.51
*
*
* The derivative term
* \f[
* \left(\frac{\partial^2n\alpha^r}{\partial T\partial n_i} \right)_{V,n_j} = \left( \frac{\partial}{\partial T}\left(\frac{\partial n \alpha^r}{\partial n_i}\right)_{T,V,n_j} \right)_{V,\bar n}
@@ -448,7 +448,7 @@ class MixtureDerivatives
static CoolPropDbl d2nalphar_dni_dT(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph Equation 7.51 and Table B4, Kunz, JCED, 2012
*
*
* The derivative term
* \f{eqnarray*}{
* \frac{\partial }{\partial \tau} \left( n\left(\frac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j} \right) &=& \delta \alpha^r_{\delta\tau}\left[ 1-\frac{1}{\rho_r}\left[\left(\frac{\partial \rho_r}{\partial x_i}\right)_{x_j} - \sum_{k=1}^N x_k\left(\frac{\partial \rho_r}{\partial x_k}\right)_{x_j} \right]\right]\\
@@ -476,7 +476,7 @@ class MixtureDerivatives
static CoolPropDbl d3_ndalphardni_dTau3(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph Equation 7.50 and Table B4, Kunz, JCED, 2012
*
*
* The derivative term
* \f{eqnarray*}{
* \left(\frac{\partial }{\partial \delta} \left( n\left(\frac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j} \right)\right)_{\tau,\bar x} &=& (\alpha_{\delta}^r+\delta\alpha_{\delta\delta}^r)\left[1-\frac{1}{\rho_r}\cdot n\left(\frac{\partial \rho_r}{\partial n_i}\right)_{n_j} \right] \\
@@ -493,8 +493,8 @@ class MixtureDerivatives
*
* The derivative term
* \f[
* \begin{array}{ccl}
* \left(\dfrac{\partial^2 }{\partial \delta^2} \left( n\left(\dfrac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j} \right)\right)_{\tau,\bar x} &=& (2\alpha_{\delta\delta}^r+\delta\alpha_{\delta\delta\delta}^r)\Psi_{\rho} +\tau\alpha^r_{\delta\delta\tau}\Psi_T+\alpha^r_{\delta\delta x_i}-\sum_{k=1}^{N}x_k\alpha^r_{\delta\delta x_k}
* \begin{array}{ccl}
* \left(\dfrac{\partial^2 }{\partial \delta^2} \left( n\left(\dfrac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j} \right)\right)_{\tau,\bar x} &=& (2\alpha_{\delta\delta}^r+\delta\alpha_{\delta\delta\delta}^r)\Psi_{\rho} +\tau\alpha^r_{\delta\delta\tau}\Psi_T+\alpha^r_{\delta\delta x_i}-\sum_{k=1}^{N}x_k\alpha^r_{\delta\delta x_k}
* \end{array}
* \f]
* @param HEOS The HelmholtzEOSMixtureBackend to be used
@@ -510,8 +510,8 @@ class MixtureDerivatives
* The derivative term
* \f[
* \begin{array}{ccl}
* \left(\dfrac{\partial^2 }{\partial \delta\partial \tau} \left( n\left(\dfrac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j} \right)\right)_{\bar x} &=& (\alpha_{\delta\tau}^r+\delta\alpha_{\delta\delta\tau}^r)\Psi_{\rho} +(\tau\alpha^r_{\delta\tau\tau} + \alpha^r_{\delta\tau})\Psi_T
+\alpha^r_{\delta\tau x_i}-\sum_{k=1}^{N}x_k\alpha^r_{\delta\tau x_k}
* \left(\dfrac{\partial^2 }{\partial \delta\partial \tau} \left( n\left(\dfrac{\partial \alpha^r}{\partial n_i} \right)_{T,V,n_j} \right)\right)_{\bar x} &=& (\alpha_{\delta\tau}^r+\delta\alpha_{\delta\delta\tau}^r)\Psi_{\rho} +(\tau\alpha^r_{\delta\tau\tau} + \alpha^r_{\delta\tau})\Psi_T
+\alpha^r_{\delta\tau x_i}-\sum_{k=1}^{N}x_k\alpha^r_{\delta\tau x_k}
* \end{array}
* \f]
* @param HEOS The HelmholtzEOSMixtureBackend to be used
@@ -564,7 +564,7 @@ class MixtureDerivatives
x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph equation 7.41
*
*
* The derivative term
* \f[
* n\left(\frac{\partial^2n\alpha^r}{\partial n_i \partial n_j} \right)_{T,V} = n\left( \frac{\partial}{\partial n_j}\left(\frac{\partial n\alpha^r}{\partial n_i}\right)_{T,V,n_j}\right)_{T,V,n_i}
@@ -601,7 +601,7 @@ class MixtureDerivatives
static CoolPropDbl nd_ndalphardni_dnj__constT_V(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, std::size_t j, x_N_dependency_flag xN_flag);
/* \brief \f$\tau\f$ derivative of GERG 2004 7.47
*
*
*/
static CoolPropDbl d_nd_ndalphardni_dnj_dTau__constdelta_x(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, std::size_t j,
x_N_dependency_flag xN_flag);
@@ -630,7 +630,7 @@ class MixtureDerivatives
x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph equation 7.48
*
*
* The derivative term
* \f[
* n\left(\frac{\partial \delta}{\partial n_i} \right)_{T,V,n_j} = \delta - \frac{\delta}{\rho_r}\cdot n\left(\frac{\partial \rho_r}{\partial n_i} \right)_{n_j}
@@ -649,7 +649,7 @@ class MixtureDerivatives
x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph equation 7.49
*
*
* The derivative term
* \f[
* n\left(\frac{\partial \tau}{\partial n_i} \right)_{T,V,n_j} = \frac{\tau}{T_r}\cdot n\left(\frac{\partial T_r}{\partial n_i} \right)_{n_j}
@@ -667,7 +667,7 @@ class MixtureDerivatives
static CoolPropDbl d2_ndtaudni_dxj_dTau__constdelta(HelmholtzEOSMixtureBackend& HEOS, std::size_t i, std::size_t j, x_N_dependency_flag xN_flag);
/** \brief GERG 2004 Monograph equation 7.52
*
*
* The derivative term
* \f{eqnarray*}{
* \left( \frac{\partial}{\partial x_j}\left(n\left(\frac{\partial\alpha^r}{\partial n_i}\right)_{T,V,n_j}\right)\right)_{\delta,\tau,x_i} &=& \delta\alpha_{\delta x_j}^{r}\left[ 1-\frac{1}{\rho_r}\cdot n\left(\frac{\partial \rho_r}{\partial n_i}\right)_{n_j}\right] \\

View File

@@ -604,7 +604,7 @@ void MixtureParameters::set_mixture_parameters(HelmholtzEOSMixtureBackend& HEOS)
}
/*
if (i == 0){
std::cout << format("betaT %10.9Lg gammaT %10.9Lg betaV %10.9Lg gammaV %10.9Lg %s",
std::cout << format("betaT %10.9Lg gammaT %10.9Lg betaV %10.9Lg gammaV %10.9Lg %s",
beta_T[i][j], gamma_T[i][j], beta_v[i][j], gamma_v[i][j], get_mixture_binary_pair_data(CAS[0],CAS[1],"gammaT").c_str()) << std::endl;
}
*/

View File

@@ -6,24 +6,24 @@
namespace CoolProp {
/** \brief Get a comma-separated list of CAS code pairs
*
*
* Each of the pairs will be CAS1&CAS2 ("&" delimited)
*/
std::string get_csv_mixture_binary_pairs();
/** \brief Get the parameters for a predefined mixture - R410A, R404A, etc. if the mixture is predefined
*
*
*/
bool is_predefined_mixture(const std::string& name, Dictionary& dict);
/** \brief Get a comma-separated list of predefined mixtures in CoolProp
*
*
*/
std::string get_csv_predefined_mixtures();
/** \brief Get a string for the given binary pair
*
*
*
*
*/
std::string get_mixture_binary_pair_data(const std::string& CAS1, const std::string& CAS2, const std::string& param);
@@ -51,7 +51,7 @@ class MixtureParameters
static void set_mixture_parameters(HelmholtzEOSMixtureBackend& HEOS);
};
/**
/**
* @brief Get the allocated Departure function for a given departure function name
* @param Name The name of the function to be used, or its alias
* @warning The pointer points to an instance created with new, you should manage the pointer with shared_ptr or similar
@@ -74,7 +74,7 @@ struct REFPROP_departure_function
std::vector<std::string> comments;
};
/**
/**
* @brief Set the departure functions in the departure function library from a string format
* @param string_data The departure functions to be set, either provided as a JSON-formatted string
* or as a string of the contents of a HMX.BNC file from REFPROP
@@ -84,7 +84,7 @@ struct REFPROP_departure_function
*/
void set_departure_functions(const std::string& string_data);
/**
/**
* @brief Set the interaction parameters from a string format
* @param string_data The model parameters, as a JSON-formatted string
*

View File

@@ -21,18 +21,18 @@ class PhaseEnvelopeRoutines
static void refine(HelmholtzEOSMixtureBackend& HEOS, const std::string& level = "");
/** \brief Finalize the phase envelope and calculate maxima values, critical point, etc.
*
*
* @param HEOS The HelmholtzEOSMixtureBackend instance to be used
*/
static void finalize(HelmholtzEOSMixtureBackend& HEOS);
/** \brief Determine which indices bound a given value
*
* If you provide pressure for instance, it will return each of the indices
*
* If you provide pressure for instance, it will return each of the indices
* that bound crossings in the pressure versus rhov curve. Thus this information
* can be used to determine whether another input is "inside" or "outside" the phase
* boundary.
*
*
* @param env The PhaseEnvelopeData instance to be used
* @param iInput The key for the variable type that is to be checked
* @param value The value associated with iInput
@@ -40,7 +40,7 @@ class PhaseEnvelopeRoutines
static std::vector<std::pair<std::size_t, std::size_t>> find_intersections(const PhaseEnvelopeData& env, parameters iInput, double value);
/** \brief Determine whether a pair of inputs is inside or outside the phase envelope
*
*
* @param env The PhaseEnvelopeData instance to be used
* @param iInput1 The key for the first input
* @param value1 The value of the first input

View File

@@ -1,6 +1,6 @@
/** \brief Code for all the binary pairs in the mixture
*
* This includes both binary pair information for the reducing functions as well as the departure
*
* This includes both binary pair information for the reducing functions as well as the departure
* functions for the given binary pair.
*/
@@ -25,7 +25,7 @@ std::string get_reducing_function_name(const std::string& CAS1, const std::strin
/** \brief Abstract base class for reducing function
* An abstract base class for the reducing function to allow for
* Lemmon-Jacobsen, GERG, or other reducing function to yield the
* Lemmon-Jacobsen, GERG, or other reducing function to yield the
* reducing parameters \f$\rho_r\f$ and \f$T_r\f$
*/
class ReducingFunction
@@ -89,7 +89,7 @@ class ReducingFunction
x_N_dependency_flag xN_flag) const = 0;
/** \brief GERG 2004 Monograph equation 7.56:
*
*
* If the \f$x_i\f$ are all independent
* \f[
* \left(\frac{\partial}{\partial x_j}\left(n\left(\frac{\partial T_r}{\partial n_i} \right)_{n_j}\right)\right)_{x_i} = \left(\frac{\partial^2T_r}{\partial x_j \partial x_i}\right)-\left(\frac{\partial T_r}{\partial x_j}\right)_{x_i}-\sum_{k=0}^{N-1}x_k\left(\frac{\partial^2T_r}{\partial x_j \partial x_k}\right)
@@ -104,8 +104,8 @@ class ReducingFunction
virtual CoolPropDbl d2_ndTrdni_dxj_dxk__constxi(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, std::size_t k,
x_N_dependency_flag xN_flag) const;
/** \brief
*
/** \brief
*
* GERG 2004 Monograph equation 7.55:
* If the \f$x_i\f$ are all independent
* \f[
@@ -115,7 +115,7 @@ class ReducingFunction
* If \f$x_N = 1-\sum x_i\f$:
* \f[
* \left(\frac{\partial}{\partial x_j}\left(n\left(\frac{\partial \rho_r}{\partial n_i} \right)_{n_j}\right)\right)_{x_i} = \left(\frac{\partial^2\rho_r}{\partial x_j \partial x_i}\right)-\left(\frac{\partial \rho_r}{\partial x_j}\right)_{x_i}-\sum_{k=0}^{N-2}x_k\left(\frac{\partial^2\rho_r}{\partial x_j \partial x_k}\right)
* \f]
* \f]
*/
virtual CoolPropDbl d_ndrhorbardni_dxj__constxi(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j,
x_N_dependency_flag xN_flag) const;
@@ -136,7 +136,7 @@ class ReducingFunction
};
/** \brief The reducing function model of GERG-2008
*
*
* Used by the GERG-2008 formulation to yield the
* reducing parameters \f$ \rho_r \f$ and \f$ T_r \f$ and derivatives thereof
*/
@@ -254,17 +254,17 @@ class GERG2008ReducingFunction : public ReducingFunction
CoolPropDbl d2Tr_dxidbetaT(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief The derivative of reducing temperature with respect to component i mole fraction
*
*
* Calculated from \ref dYrdxi__constxj with \f$T = Y\f$
*/
CoolPropDbl dTrdxi__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief The second derivative of reducing temperature with respect to component i mole fraction
*
*
* Calculated from \ref d2Yrdxi2__constxj with \f$T = Y\f$
*/
CoolPropDbl d2Trdxi2__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief The second derivative of reducing temperature with respect to component i and j mole fractions
*
*
* Calculated from \ref d2Yrdxidxj with \f$T = Y\f$
*/
CoolPropDbl d2Trdxidxj(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, x_N_dependency_flag xN_flag) const;
@@ -275,17 +275,17 @@ class GERG2008ReducingFunction : public ReducingFunction
CoolPropDbl d3Trdxidxjdxk(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, std::size_t k, x_N_dependency_flag xN_flag) const;
/** \brief The derivative of reducing molar volume with respect to component i mole fraction
*
*
* Calculated from \ref dYrdxi__constxj with \f$v = Y\f$
*/
CoolPropDbl dvrmolardxi__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief The second derivative of reducing molar volume with respect to component i mole fraction
*
*
* Calculated from \ref d2Yrdxi2__constxj with \f$v = Y\f$
*/
CoolPropDbl d2vrmolardxi2__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief The second derivative of reducing molar volume with respect to component i and j mole fractions
*
*
* Calculated from \ref d2Yrdxidxj with \f$v = Y\f$
*/
CoolPropDbl d2vrmolardxidxj(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, x_N_dependency_flag xN_flag) const;
@@ -295,7 +295,7 @@ class GERG2008ReducingFunction : public ReducingFunction
*/
CoolPropDbl d3vrmolardxidxjdxk(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, std::size_t k, x_N_dependency_flag xN_flag) const;
/** \brief The molar reducing density
*
*
* Given by \f$ \rho_r = 1/v_r \f$
*/
CoolPropDbl rhormolar(const std::vector<CoolPropDbl>& x) const;
@@ -327,7 +327,7 @@ class GERG2008ReducingFunction : public ReducingFunction
CoolPropDbl d2rhormolar_dxidgammaV(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief Derivative of the molar reducing density with respect to component i mole fraction
*
*
* See also GERG 2004, Eqn. 7.57
* \f[
* \left(\frac{\partial \rho_r}{\partial x_i}\right)_{x_{i\neq j}} = -\rho_r^2\left(\frac{\partial v_r}{\partial x_i}\right)_{x_{i\neq j}}
@@ -335,7 +335,7 @@ class GERG2008ReducingFunction : public ReducingFunction
*/
CoolPropDbl drhormolardxi__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief Derivative of the molar reducing density with respect to component i mole fraction
*
*
* See also GERG 2004, Eqn. 7.58
* \f[
* \left(\frac{\partial^2 \rho_r}{\partial x_i^2}\right)_{x_{i\neq j}} = 2\rho_r^3\left(\left(\frac{\partial v_r}{\partial x_i}\right)_{x_{i\neq j}}\right)^2-\rho_r\left(\left(\frac{\partial^2 v_r}{\partial x_i^2}\right)_{x_{i\neq j}}\right)
@@ -343,7 +343,7 @@ class GERG2008ReducingFunction : public ReducingFunction
*/
CoolPropDbl d2rhormolardxi2__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, x_N_dependency_flag xN_flag) const;
/** \brief Derivative of the molar reducing density with respect to component i and j mole fractions
*
*
* See also GERG 2004, Eqn. 7.59
* \f[
* \left(\frac{\partial^2 \rho_r}{\partial x_i\partial x_j}\right) = 2\rho_r^3\left(\left(\frac{\partial v_r}{\partial x_i}\right)_{x_{i\neq j}}\right)\left(\left(\frac{\partial v_r}{\partial x_j}\right)_{x_{i\neq j}}\right)-\rho_r^2\left(\left(\frac{\partial v_r}{\partial x_i\partial x_j}\right)\right)
@@ -357,7 +357,7 @@ class GERG2008ReducingFunction : public ReducingFunction
x_N_dependency_flag xN_flag) const;
/** \brief Generalized reducing term \f$Y_r\f$
*
*
* \f[
* Y_r = \sum_{i=1}^{N}x_iY_{c,i}^2+\sum_{i=1}^{N-1}\sum_{j=i+1}^{N} c_{Y,ij}f_{Y,ij}(x_i,x_j)
* \f]
@@ -380,7 +380,7 @@ class GERG2008ReducingFunction : public ReducingFunction
const std::vector<CoolPropDbl>& Yc) const;
/** \brief First composition derivative of \f$Y_r\f$ with \f$x_i\f$
*
*
* If \f$x_N\f$ is given by \f$ x_N = 1-\sum_{i=1}^{N-1}x_i\f$ (Gernert, FPE, 2014, Table S1):
* \f{eqnarray*}{
* \left(\frac{\partial Y_r}{\partial x_i}\right)_{\substack{x_{j\neq i} \\ i<N}} &=& 2x_iY_{c,j}-2x_NY_{c,N} + \sum_{k=1}^{i-1}c_{Y,ki}\frac{\partial f_{Y,ki}(x_k, x_i)}{\partial x_i}+\sum_{k=i+1}^{N-1}c_{Y,ik}\frac{\partial f_{Y,ik}(x_i, x_k)}{\partial x_i} \\
@@ -392,7 +392,7 @@ class GERG2008ReducingFunction : public ReducingFunction
* \f[
* \left(\frac{\partial Y_r}{\partial x_i}\right)_{\substack{x_{j\neq i}}} = 2x_iY_{c,i} + \sum_{k=1}^{i-1}c_{Y,ki}\frac{\partial f_{Y,ki}(x_k,x_i)}{\partial x_i} + \sum_{k=i+1}^{N}c_{Y,ik}\frac{\partial f_{Y,ik}(x_i,x_k)}{\partial x_i}
* \f]
*
*
*/
CoolPropDbl dYrdxi__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, const STLMatrix& beta, const STLMatrix& gamma,
const STLMatrix& Y_c_ij, const std::vector<CoolPropDbl>& Yc, x_N_dependency_flag xN_flag) const;
@@ -407,7 +407,7 @@ class GERG2008ReducingFunction : public ReducingFunction
const std::vector<CoolPropDbl>& Yc, x_N_dependency_flag xN_flag) const;
/** \brief Second composition derivative of \f$Y_r\f$ with \f$x_i\f$
*
*
* If \f$x_N\f$ is given by \f$ x_N = 1-\sum_{i=1}^{N-1}x_i\f$ (Gernert, FPE, 2014, Table S1):
* \f{eqnarray*}{
* \left(\frac{\partial^2 Y_r}{\partial x_i^2}\right)_{\substack{x_{j\neq i} \\ i<N}} &=& 2(Y_{c,i}+Y_{c,N}) + \sum_{k=1}^{i-1}c_{Y,ki}\frac{\partial^2 f_{Y,ki}(x_k, x_i)}{\partial x_i^2}+\sum_{k=i+1}^{N-1}c_{Y,ik}\frac{\partial^2 f_{Y,ik}(x_i, x_k)}{\partial x_i^2} \\
@@ -423,7 +423,7 @@ class GERG2008ReducingFunction : public ReducingFunction
CoolPropDbl d2Yrdxi2__constxj(const std::vector<CoolPropDbl>& x, std::size_t i, const STLMatrix& beta, const STLMatrix& gamma,
const STLMatrix& Y_c_ij, const std::vector<CoolPropDbl>& Yc, x_N_dependency_flag xN_flag) const;
/** \brief Second mixed composition derivative of \f$Y_r\f$ with \f$x_i\f$ and \f$x_j\f$
*
*
* If \f$x_N\f$ is given by \f$ x_N = 1-\sum_{i=1}^{N-1}x_i\f$ (Gernert, FPE, 2014, Table S1):
* \f{eqnarray*}{
* \left(\frac{\partial^2 Y_r}{\partial x_i\partial x_j}\right)_{\substack{x_{k\neq j\neq i} \\ i<N \\ j < N}} &=& 2Y_{c,N} + c_{Y,ij}\frac{\partial^2 f_{Y,ij}(x_i, x_j)}{\partial x_i\partial x_j}+\sum_{k=1}^{N-1}2c_{Y,kN}x_k^2 \frac{1-\beta_{Y,kN}^2}{(\beta_{Y,kN}^2x_k+x_N)^2} \left(\frac{x_N}{\beta_{Y,kN}^2 x_k+x_N}-1\right) \\
@@ -446,7 +446,7 @@ class GERG2008ReducingFunction : public ReducingFunction
const STLMatrix& gamma, const STLMatrix& Y_c_ij, const std::vector<CoolPropDbl>& Yc, x_N_dependency_flag xN_flag) const;
/** \brief The coefficient \f$ c_{Y,ij} \f$
*
*
* \f[
* c_{Y,ij} = 2\beta_{Y,ij}\gamma_{Y,ij}Y_{c,ij}
* \f]
@@ -454,19 +454,19 @@ class GERG2008ReducingFunction : public ReducingFunction
const CoolPropDbl c_Y_ij(const std::size_t i, const std::size_t j, const STLMatrix& beta, const STLMatrix& gamma, const STLMatrix& Y_c) const;
/** \brief The function \f$ f_{Y,ij}(x_i,x_j) \f$
*
*
* \f[ f_{Y,ij}(x_i,x_j) = x_ix_j\frac{x_i+x_j}{\beta_{Y,ij}^2x_i+x_j} \f]
*/
CoolPropDbl f_Y_ij(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t j, const STLMatrix& beta) const;
/**
*
*
* \f[
* \left(\frac{\partial f_{Y,ki}(x_k, x_i)}{\partial x_i}\right)_{x_{k\neq i}} = x_k\frac{x_k+x_i}{\beta_{Y,ki}^2x_k+x_i} + \frac{x_kx_i}{\beta_{Y,ki}^2x_k+x_i}\left(1-\frac{x_k+x_i}{\beta_{Y,ki}^2x_k+x_i}\right)
* \f]
*/
CoolPropDbl dfYkidxi__constxk(const std::vector<CoolPropDbl>& x, std::size_t k, std::size_t i, const STLMatrix& beta) const;
/**
*
*
* \f[
* \left(\frac{\partial f_{Y,ik}(x_i, x_k)}{\partial x_i}\right)_{x_k} = x_k\frac{x_i+x_k}{\beta_{Y,ik}^2x_i+x_k} + \frac{x_ix_k}{\beta_{Y,ik}^2x_i+x_k}\left(1-\beta_{Y,ik}^2\frac{x_i+x_k}{\beta_{Y,ik}^2x_i+x_k}\right)
* \f]
@@ -518,9 +518,9 @@ class GERG2008ReducingFunction : public ReducingFunction
CoolPropDbl d3fYikdxi3__constxk(const std::vector<CoolPropDbl>& x, std::size_t i, std::size_t k, const STLMatrix& beta) const;
};
/** \brief A constant reducing function that does not vary with composition. Think for instance the
/** \brief A constant reducing function that does not vary with composition. Think for instance the
* reducing function for the cubic EOS
*
*
* Yields the reducing parameters \f$ \rho_r \f$ and \f$ T_r \f$
*/
class ConstantReducingFunction : public ReducingFunction
@@ -643,7 +643,7 @@ class ConstantReducingFunction : public ReducingFunction
};
/** \brief Reducing function converter for dry air and HFC blends
*
*
* From Lemmon, JPCRD, 2000 for the properties of Dry Air, and also from Lemmon, JPCRD, 2004 for the properties of R404A, R410A, etc.
* \f[
* \rho_r(\bar x) = \left[ \sum_{i=1}^m\frac{x_i}{\rho_{c_i}}+\sum_{i=1}^{m-1}\sum_{j=i+1}^{m}x_ix_j\zeta_{ij}\right]^{-1}
@@ -651,11 +651,11 @@ class ConstantReducingFunction : public ReducingFunction
* \f[
* T_r(\bar x) = \sum_{i=1}^mx_iT_{c_i}+\sum_{i=1}^{m-1}\sum_{j=i+1}^mx_ix_j\xi_{ij}
* \f]
*
*
* These can be converted to the form of GERG by the following equations:
* \f[
* \beta_T = 1\ \ \ \ \beta_v = 1
* \f]
* \beta_T = 1\ \ \ \ \beta_v = 1
* \f]
* and
* \f[
* \boxed{\gamma_T = \dfrac{T_{c0}+T_{c1}+\xi_{01}}{2\sqrt{T_{c0}T_{c1}}}}

View File

@@ -79,8 +79,8 @@ class TransportRoutines
static CoolPropDbl viscosity_initial_density_dependence_Rainwater_Friend(HelmholtzEOSMixtureBackend& HEOS);
/**
* \brief An empirical form for the initial density dependence
*
* \brief An empirical form for the initial density dependence
*
* Given by the polynomial-like form
* \f[
* \eta^1 = \sum_i n_i\delta^{d_i}\tau^{t_i}
@@ -107,7 +107,7 @@ class TransportRoutines
static CoolPropDbl viscosity_dilute_cyclohexane(HelmholtzEOSMixtureBackend& HEOS);
/** \brief Viscosity hardcoded for Methanol
*
*
* From Xiang et al., A New Reference Correlation for the Viscosity of Methanol, J. Phys. Chem. Ref. Data, Vol. 35, No. 4, 2006
*/
static CoolPropDbl viscosity_methanol_hardcoded(HelmholtzEOSMixtureBackend& HEOS);
@@ -129,15 +129,15 @@ class TransportRoutines
/**
* @brief Higher-order viscosity term from friction theory of Sergio Quinones-Cisneros
*
*
* Several functional forms have been proposed and this function attempts to handle all of them
* \f$ \eta_{HO} = \kappa_ap_a + \kappa_r\Delta p_r + \kappa_i p_{id}+\kappa_{aa}p_a^2 + \kappa_{drdr}\Delta p_r^2 + \kappa_{rr}p_{r}^2 + \kappa_{ii}p_{id}^2 +\kappa_{rrr}p_r^3 + \kappa_{aaa}p_a^3
*
*
* Watch out that sometimes it is \f$\Delta p_r\f$ and other times it is \f$p_r\f$!
*
*
* 1e5 for conversion from Pa -> bar
*
* \f[ p_r = T \frac{\partial p}{\partial T}\right|_{\rho}/1e5 \f]
*
* \f[ p_r = T \frac{\partial p}{\partial T}\right|_{\rho}/1e5 \f]
* \f[ p_a = p - p_r \f]
* \f[ p_{id} = \rho R T \f] / 1e5 \f]
* \f[ \Delta p_r = p_r - p_{id} \f]
@@ -152,16 +152,16 @@ class TransportRoutines
* \f[ \kappa_{aa} = (A_{aa,0} + F_{Aaa,1}\psi_1 + F.Aaa[2]\psi_2)\tau^{N_{aa}} \f]
* \f[ \kappa_{rrr} = (A_{rrr,0} + A_{rrr,1}\psi_1 + A_{rrr,2}\psi_2)\tau^{N_{rrr}} \f]
* \f[ \kappa_{aaa} = (A_{aaa,0} + A_{aaa,1}\psi_1 + A_{aaa,2}\psi_2)\tau^{N_{aaa}} \f]
*
*
* @param HEOS The instance to use
* @return
* @return
*/
static CoolPropDbl viscosity_higher_order_friction_theory(HelmholtzEOSMixtureBackend& HEOS);
/**
* Implement the method of:
*
* Chung, Ting Horng, et al. "Generalized multiparameter correlation for nonpolar and polar fluid transport properties."
* Chung, Ting Horng, et al. "Generalized multiparameter correlation for nonpolar and polar fluid transport properties."
* Industrial & engineering chemistry research 27(4) (1988): 671-679.
*/
static CoolPropDbl viscosity_Chung(HelmholtzEOSMixtureBackend& HEOS);
@@ -274,7 +274,7 @@ class TransportRoutines
static CoolPropDbl conductivity_ECS(HelmholtzEOSMixtureBackend& HEOS, HelmholtzEOSMixtureBackend& HEOS_Reference);
/* \brief Solver for the conformal state for ECS model
*
*
*/
static void conformal_state_solver(HelmholtzEOSMixtureBackend& HEOS, HelmholtzEOSMixtureBackend& HEOS_Reference, CoolPropDbl& T0,
CoolPropDbl& rhomolar0);

View File

@@ -105,7 +105,7 @@ void saturation_PHSU_pure(HelmholtzEOSMixtureBackend& HEOS, CoolPropDbl specifie
/* \brief This is a backup saturation_p solver for the case where the Newton solver cannot approach closely enough the solution
*
* This is especially a problem at low pressures where catastrophic truncation error occurs, especially in the saturated vapor side
*
*
* @param HEOS The Helmholtz EOS backend instance to be used
* @param p Imposed pressure in kPa
* @param options Options to be passed to the function (at least T, rhoL and rhoV must be provided)
@@ -115,7 +115,7 @@ void saturation_P_pure_1D_T(HelmholtzEOSMixtureBackend& HEOS, CoolPropDbl p, sat
/* \brief This is a backup saturation_T solver for the case where the Newton solver cannot approach closely enough the solution
*
* This is especially a problem at low pressures where catastrophic truncation error occurs, especially in the saturated vapor side
*
*
* @param HEOS The Helmholtz EOS backend instance to be used
* @param T Imposed temperature in K
* @param options Options to be passed to the function (at least p, rhoL and rhoV must be provided)
@@ -123,14 +123,14 @@ void saturation_P_pure_1D_T(HelmholtzEOSMixtureBackend& HEOS, CoolPropDbl p, sat
void saturation_T_pure_1D_P(HelmholtzEOSMixtureBackend& HEOS, CoolPropDbl T, saturation_T_pure_options& options);
/* \brief A robust but slow solver in the very-near-critical region
*
*
* This solver operates in the following fashion:
* 1. Using a bounded interval for rho'':[rhoc, rhoc-??], guess a value for rho''
* 2. For guessed value of rho'' and given value of T, calculate p
* 3. Using a Brent solver on the other co-existing phase (rho'), calculate the (bounded) value of rho' that yields the same pressure
* 4. Use another outer Brent solver on rho'' to enforce the same Gibbs function between liquid and vapor
* 5. Fin.
*
*
* @param HEOS The Helmholtz EOS backend instance to be used
* @param ykey The CoolProp::parameters key to be imposed - one of iT or iP
* @param y The value for the imposed variable
@@ -223,11 +223,11 @@ inline double saturation_preconditioner(HelmholtzEOSMixtureBackend& HEOS, double
* \f[
* \sum_i \frac{x_i(K_i-1)}{1 - \beta + \beta K_i} = 0
* \f]
* When \f$T\f$ is known for \f$\beta=0$, \f$p\f$can be obtained from
* When \f$T\f$ is known for \f$\beta=0$, \f$p\f$can be obtained from
* \f[
* -1+\sum_i K_ix_i=0,
* \f]
* or
* or
* \f[
* p = \sum_i x_ip_{c,i}\exp(5.373(1+\omega_i)(1-T_{c,i}/T).
* \f]
@@ -235,7 +235,7 @@ inline double saturation_preconditioner(HelmholtzEOSMixtureBackend& HEOS, double
* \f[
* -1+\sum_ix_i=0,
* \f]
* or
* or
* \f[
* p = \left[ \sum_i \frac{y_i}{p_{c,i}\exp(5.373(1+\omega_i)(1-T_{c,i}/T)} \right]^{-1}
* \f]
@@ -319,33 +319,33 @@ struct newton_raphson_twophase_options
};
/** \brief A class to do newton raphson solver for mixture VLE for p,Q or T,Q
*
*
* A class is used rather than a function so that it is easier to store iteration histories, additional output values, etc.
*
*
* As in Gernert, FPE, 2014, except that only one of T and P are known
*
*
* The independent variables are \f$N-1\f$ mole fractions in liquid, \f$N-1\f$ mole fractions in vapor, and the non-specified variable in p or T, for a total of \f$2N-1\f$ independent variables
*
*
* First N residuals are from
*
*
* \f$F_k = \ln f_i(T,p,\mathbf{x}) - \ln f_i(T,p,\mathbf{y})\f$ for \f$i = 1, ... N\f$ and \f$k=i\f$
*
*
* Derivatives are the same as for the saturation solver \ref newton_raphson_saturation
*
*
* Second N-1 residuals are from
*
*
* \f$F_k = \dfrac{z_i-x_i}{y_i-x_i} - \beta_{spec}\f$ for \f$ i = 1, ... N-2\f$ and \f$k = i+N\f$
*
*
* Gernert eq. 35
*
*
* \f$\dfrac{\partial F_k}{\partial x_i} = \dfrac{z_i-y_i}{(y_i-x_i)^2}\f$
*
*
* Gernert eq. 36
*
*
* \f$\dfrac{\partial F_k}{\partial y_i} = -\dfrac{z_i-x_i}{(y_i-x_i)^2}\f$
*
*
* \f$\dfrac{\partial F_k}{\partial T} = 0\f$ Because x, y and T are independent by definition of the formulation
*
*
* \f$\dfrac{\partial F_k}{\partial p} = 0\f$ Because x, y and p are independent by definition of the formulation
*/
class newton_raphson_twophase
@@ -394,17 +394,17 @@ class newton_raphson_twophase
/** \brief Call the Newton-Raphson VLE Solver
*
* This solver must be passed reasonable guess values for the mole fractions,
* This solver must be passed reasonable guess values for the mole fractions,
* densities, etc. You may want to take a few steps of successive substitution
* before you start with Newton Raphson.
*
*
* @param HEOS HelmholtzEOSMixtureBackend instance
* @param IO The input/output data structure
*/
void call(HelmholtzEOSMixtureBackend& HEOS, newton_raphson_twophase_options& IO);
/* \brief Build the arrays for the Newton-Raphson solve
*
*
*/
void build_arrays();
};
@@ -444,30 +444,30 @@ struct newton_raphson_saturation_options
};
/** \brief A class to do newton raphson solver mixture bubble point and dew point calculations
*
* A class is used rather than a function so that it is easier to store iteration histories, additional output
*
* A class is used rather than a function so that it is easier to store iteration histories, additional output
* values, etc. This class is used in \ref PhaseEnvelopeRoutines for the construction of the phase envelope
*
* This class only handles bubble and dew lines. The independent variables are the first N-1 mole fractions
*
* This class only handles bubble and dew lines. The independent variables are the first N-1 mole fractions
* in the incipient phase along with one of T, p, or \f$\rho''\f$.
*
* These methods are based on the work of Gernert, FPE, 2014, the thesis of Gernert, as well as much
*
* These methods are based on the work of Gernert, FPE, 2014, the thesis of Gernert, as well as much
* help from Andreas Jaeger of Uni. Bochum.
*
*
* There are N residuals from
*
*
* \f$F_i = \ln f_i(T, p, \mathbf{x}) - \ln f_i(T, p, \mathbf{y})\f$ for \f$i = 1, ... N\f$
*
* if either T or p are imposed. In this case a solver is used to find \f$\rho\f$ given \f$T\f$ and \f$p\f$.
*
*
* if either T or p are imposed. In this case a solver is used to find \f$\rho\f$ given \f$T\f$ and \f$p\f$.
*
* In the case that \f$\rho''\f$ is imposed, the case is much nicer and the first \f$N\f$ residuals are
*
* \f$F_i = \ln f_i(T, \rho', \mathbf{x}) - \ln f_i(T, \rho'', \mathbf{y})\f$ for \f$i = 1, ... N\f$
*
*
* \f$F_i = \ln f_i(T, \rho', \mathbf{x}) - \ln f_i(T, \rho'', \mathbf{y})\f$ for \f$i = 1, ... N\f$
*
* which requires no iteration. A final residual is set up to ensure the same pressures in the phases:
*
*
* \f$p(T,\rho',\mathbf{x})-p(T,\rho'',\mathbf{y}) = 0\f$
*
*
* Documentation of the derivatives needed can be found in the work of Gernert, FPE, 2014
*/
class newton_raphson_saturation
@@ -503,10 +503,10 @@ class newton_raphson_saturation
/** \brief Call the Newton-Raphson VLE Solver
*
* This solver must be passed reasonable guess values for the mole fractions,
* This solver must be passed reasonable guess values for the mole fractions,
* densities, etc. You may want to take a few steps of successive substitution
* before you start with Newton Raphson.
*
*
* @param HEOS HelmholtzEOSMixtureBackend instance
* @param z Bulk mole fractions [-]
* @param z_incipient Initial guesses for the mole fractions of the incipient phase [-]
@@ -516,9 +516,9 @@ class newton_raphson_saturation
newton_raphson_saturation_options& IO);
/** \brief Build the arrays for the Newton-Raphson solve
*
*
* This method builds the Jacobian matrix, the sensitivity matrix, etc.
*
*
*/
void build_arrays();

View File

@@ -14,7 +14,7 @@
namespace CoolProp {
/**
This backend is used for pure and pseudo-pure fluids powered by
This backend is used for pure and pseudo-pure fluids powered by
REFPROP. It hides all the implementation of mixture properties
and exposes just the pure fluid interface.
*/

View File

@@ -41,10 +41,10 @@ void CoolProp::BicubicBackend::find_nearest_neighbor(SinglePhaseGriddedTableData
}
/** Use the single_phase table to evaluate an output for a transport property
*
* Here we use linear interpolation because we don't have any information about the derivatives with respect to the
*
* Here we use linear interpolation because we don't have any information about the derivatives with respect to the
* independent variables and it is too computationally expensive to build the derivatives numerically
*
*
* See also http://en.wikipedia.org/wiki/Bilinear_interpolation#Nonlinear
*/
double CoolProp::BicubicBackend::evaluate_single_phase_transport(SinglePhaseGriddedTableData& table, parameters output, double x, double y,

View File

@@ -10,8 +10,8 @@ namespace CoolProp {
/** \brief This class implements bicubic interpolation, as very clearly laid out by
* the page on wikipedia: http://en.wikipedia.org/wiki/Bicubic_interpolation
*
* Essentially you have an already-inverted matrix that you need to multiply
*
* Essentially you have an already-inverted matrix that you need to multiply
\f[
A^{-1} = \left[ \begin{array}{*{16}c} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
@@ -95,13 +95,13 @@ class BicubicBackend : public TabularBackend
* @param table A reference to the table to be used
* @param coeffs A reference to the matrix of the coefficients
* @param output The output variable
* @param x The
* @param x The
* @param y
* @param i
* @param j
* @param Nx The number of derivatives with respect to x with y held constant
* @param Ny The number of derivatives with respect to y with x held constant
* @return
* @return
*/
double evaluate_single_phase_derivative(SinglePhaseGriddedTableData& table, std::vector<std::vector<CellCoeffs>>& coeffs, parameters output,
double x, double y, std::size_t i, std::size_t j, std::size_t Nx, std::size_t Ny);
@@ -113,7 +113,7 @@ class BicubicBackend : public TabularBackend
};
/**
* @brief
* @brief
* @param table A reference to the table that is to be used
* @param coeffs A reference to the matrix of bicubic coefficients
* @param output What output is desired
@@ -121,7 +121,7 @@ class BicubicBackend : public TabularBackend
* @param y
* @param i
* @param j
* @return
* @return
*/
double evaluate_single_phase(const SinglePhaseGriddedTableData& table, const std::vector<std::vector<CellCoeffs>>& coeffs,
const parameters output, const double x, const double y, const std::size_t i, const std::size_t j);
@@ -144,9 +144,9 @@ class BicubicBackend : public TabularBackend
* @brief Evaluate the single-phase transport properties using linear interpolation. Works well except for near the critical point
* @param table A reference to the table to be used
* @param output The output parameter, viscosity or conductivity
* @param x The
* @param x The
* @param y
* @return
* @return
*/
double evaluate_single_phase_transport(SinglePhaseGriddedTableData& table, parameters output, double x, double y, std::size_t i, std::size_t j);
@@ -161,7 +161,7 @@ class BicubicBackend : public TabularBackend
* @brief Use the table to solve for the x variable of the table given the y coordinate of the table and a variable that can yield a unique solution for x
* @param table The table to be used
* @param coeffs The matrix of coefficients to be used
* @param other_key The x variable
* @param other_key The x variable
* @param other The value of the x-ish variable to be used to find d
* @param i The x-coordinate of the cell
* @param j The y-coordinate of the cell

View File

@@ -4,10 +4,10 @@
# include "CoolProp.h"
/** Use the single_phase table to evaluate an output for a transport property
*
* Here we use bilinear interpolation because we don't have any information about the derivatives with respect to the
*
* Here we use bilinear interpolation because we don't have any information about the derivatives with respect to the
* independent variables and it is too computationally expensive to build the derivatives numerically
*
*
* See also http://en.wikipedia.org/wiki/Bilinear_interpolation#Nonlinear
*/
double CoolProp::TTSEBackend::evaluate_single_phase_transport(SinglePhaseGriddedTableData& table, parameters output, double x, double y,

View File

@@ -64,13 +64,13 @@ class TTSEBackend : public TabularBackend
* @brief Evaluate a derivative in terms of the native inputs of the table
* @param table A reference to the table to be used
* @param output The output variable
* @param x The
* @param x The
* @param y
* @param i
* @param j
* @param Nx The number of derivatives with respect to x with y held constant
* @param Ny The number of derivatives with respect to y with x held constant
* @return
* @return
*/
double evaluate_single_phase_derivative(SinglePhaseGriddedTableData& table, parameters output, double x, double y, std::size_t i, std::size_t j,
std::size_t Nx, std::size_t Ny);

View File

@@ -15,26 +15,79 @@
* See http://stackoverflow.com/a/148610
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
*/
#define LIST_OF_MATRICES \
X(T) \
X(p) \
X(rhomolar) \
X(hmolar) X(smolar) X(umolar) X(dTdx) X(dTdy) X(dpdx) X(dpdy) X(drhomolardx) X(drhomolardy) X(dhmolardx) X(dhmolardy) X(dsmolardx) X(dsmolardy) \
X(dumolardx) X(dumolardy) X(d2Tdx2) X(d2Tdxdy) X(d2Tdy2) X(d2pdx2) X(d2pdxdy) X(d2pdy2) X(d2rhomolardx2) X(d2rhomolardxdy) X(d2rhomolardy2) \
X(d2hmolardx2) X(d2hmolardxdy) X(d2hmolardy2) X(d2smolardx2) X(d2smolardxdy) X(d2smolardy2) X(d2umolardx2) X(d2umolardxdy) X(d2umolardy2) \
X(visc) X(cond)
#define LIST_OF_MATRICES \
X(T) \
X(p) \
X(rhomolar) \
X(hmolar) \
X(smolar) \
X(umolar) \
X(dTdx) \
X(dTdy) \
X(dpdx) \
X(dpdy) \
X(drhomolardx) \
X(drhomolardy) \
X(dhmolardx) \
X(dhmolardy) \
X(dsmolardx) \
X(dsmolardy) \
X(dumolardx) \
X(dumolardy) \
X(d2Tdx2) \
X(d2Tdxdy) \
X(d2Tdy2) \
X(d2pdx2) \
X(d2pdxdy) \
X(d2pdy2) \
X(d2rhomolardx2) \
X(d2rhomolardxdy) \
X(d2rhomolardy2) \
X(d2hmolardx2) \
X(d2hmolardxdy) \
X(d2hmolardy2) \
X(d2smolardx2) \
X(d2smolardxdy) \
X(d2smolardy2) \
X(d2umolardx2) \
X(d2umolardxdy) \
X(d2umolardy2) \
X(visc) \
X(cond)
/** ***MAGIC WARNING***!! X Macros in use
* See http://stackoverflow.com/a/148610
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
*/
#define LIST_OF_SATURATION_VECTORS \
X(TL) \
X(pL) \
X(logpL) \
X(hmolarL) X(smolarL) X(umolarL) X(rhomolarL) X(logrhomolarL) X(viscL) X(condL) X(logviscL) X(TV) X(pV) X(logpV) X(hmolarV) X(smolarV) \
X(umolarV) X(rhomolarV) X(logrhomolarV) X(viscV) X(condV) X(logviscV) X(cpmolarV) X(cpmolarL) X(cvmolarV) X(cvmolarL) X(speed_soundL) \
X(speed_soundV)
#define LIST_OF_SATURATION_VECTORS \
X(TL) \
X(pL) \
X(logpL) \
X(hmolarL) \
X(smolarL) \
X(umolarL) \
X(rhomolarL) \
X(logrhomolarL) \
X(viscL) \
X(condL) \
X(logviscL) \
X(TV) \
X(pV) \
X(logpV) \
X(hmolarV) \
X(smolarV) \
X(umolarV) \
X(rhomolarV) \
X(logrhomolarV) \
X(viscV) \
X(condV) \
X(logviscV) \
X(cpmolarV) \
X(cpmolarL) \
X(cvmolarV) \
X(cvmolarL) \
X(speed_soundL) \
X(speed_soundV)
namespace CoolProp {

View File

@@ -36,9 +36,9 @@ double ramp(double x) {
/*
void ResidualHelmholtzGeneralizedExponential::allEigen(const CoolPropDbl &tau, const CoolPropDbl &delta, HelmholtzDerivatives &derivs) throw()
{
double log_tau = log(tau), log_delta = log(delta),
double log_tau = log(tau), log_delta = log(delta),
one_over_delta = 1/delta, one_over_tau = 1/tau; // division is much slower than multiplication, so do one division here
Eigen::Map<Eigen::ArrayXd> nE(&(n[0]), elements.size());
Eigen::Map<Eigen::ArrayXd> dE(&(d[0]), elements.size());
Eigen::Map<Eigen::ArrayXd> tE(&(t[0]), elements.size());
@@ -53,11 +53,11 @@ void ResidualHelmholtzGeneralizedExponential::allEigen(const CoolPropDbl &tau, c
Eigen::Map<Eigen::ArrayXd> beta2E(&(beta2[0]), elements.size());
Eigen::Map<Eigen::ArrayXd> gamma1E(&(gamma1[0]), elements.size());
Eigen::Map<Eigen::ArrayXd> gamma2E(&(gamma2[0]), elements.size());
// ****************************************
// The u part in exp(u) and its derivatives
// ****************************************
#if defined(EIGEN_VECTORIZE_SSE2)
//std::cout << "EIGEN_VECTORIZE_SSE2" << std::endl;
#endif
@@ -70,7 +70,7 @@ void ResidualHelmholtzGeneralizedExponential::allEigen(const CoolPropDbl &tau, c
d2u_dtau2E.fill(0);
d3u_ddelta3E.fill(0);
d3u_dtau3E.fill(0);
if (delta_li_in_u){
Eigen::ArrayXd u_increment = -cE*(log_delta*l_doubleE).exp(); //pow(delta,L) -> exp(L*log(delta))
uE += u_increment;
@@ -78,7 +78,7 @@ void ResidualHelmholtzGeneralizedExponential::allEigen(const CoolPropDbl &tau, c
d2u_ddelta2E += (l_doubleE-1)*l_doubleE*u_increment*one_over_delta*one_over_delta;
d3u_ddelta3E += (l_doubleE-2)*(l_doubleE-1)*l_doubleE*u_increment*one_over_delta*one_over_delta*one_over_delta;
}
// if (tau_mi_in_u){
// CoolPropDbl omegai = el.omega, m_double = el.m_double;
// if (std::abs(m_double) > 0){
@@ -110,7 +110,7 @@ void ResidualHelmholtzGeneralizedExponential::allEigen(const CoolPropDbl &tau, c
du_dtauE += -2*beta2E*(tau-gamma2E);
d2u_dtau2E += -2*beta2E;
}
Eigen::ArrayXd ndteuE = nE*exp(tE*log_tau + dE*log_delta + uE);
Eigen::ArrayXd B_deltaE = delta*du_ddeltaE + dE;
Eigen::ArrayXd B_tauE = tau*du_dtauE + tE;
@@ -118,19 +118,19 @@ void ResidualHelmholtzGeneralizedExponential::allEigen(const CoolPropDbl &tau, c
Eigen::ArrayXd B_tau2E = POW2(tau)*(d2u_dtau2E + du_dtauE.square()) + 2*tE*tau*du_dtauE + tE*(tE-1);
Eigen::ArrayXd B_delta3E = POW3(delta)*d3u_ddelta3E + 3*dE*POW2(delta)*d2u_ddelta2E+3*POW3(delta)*d2u_ddelta2E*du_ddeltaE+3*dE*POW2(delta*du_ddeltaE)+3*dE*(dE-1)*delta*du_ddeltaE+dE*(dE-1)*(dE-2)+POW3(delta*du_ddeltaE);
Eigen::ArrayXd B_tau3E = POW3(tau)*d3u_dtau3E + 3*tE*POW2(tau)*d2u_dtau2E+3*POW3(tau)*d2u_dtau2E*du_dtauE+3*tE*POW2(tau*du_dtauE)+3*tE*(tE-1)*tau*du_dtauE+tE*(tE-1)*(tE-2)+POW3(tau*du_dtauE);
derivs.alphar += ndteuE.sum();
derivs.dalphar_ddelta += (ndteuE*B_deltaE).sum()*one_over_delta;
derivs.dalphar_dtau += (ndteuE*B_tauE).sum()*one_over_tau;
derivs.d2alphar_ddelta2 += (ndteuE*B_delta2E).sum()*POW2(one_over_delta);
derivs.d2alphar_dtau2 += (ndteuE*B_tau2E).sum()*POW2(one_over_tau);
derivs.d2alphar_ddelta_dtau += (ndteuE*B_deltaE*B_tauE).sum()*one_over_delta*one_over_tau;
derivs.d3alphar_ddelta3 += (ndteuE*B_delta3E).sum()*POW3(one_over_delta);
derivs.d3alphar_dtau3 += (ndteuE*B_tau3E).sum()*POW3(one_over_tau);
derivs.d3alphar_ddelta2_dtau += (ndteuE*B_delta2E*B_tauE).sum()*POW2(one_over_delta)*one_over_tau;
derivs.d3alphar_ddelta_dtau2 += (ndteuE*B_deltaE*B_tau2E).sum()*one_over_delta*POW2(one_over_tau);
return;
};
*/

View File

@@ -195,13 +195,13 @@ double Halley(FuncWrapper1DWithTwoDerivs* f, double x0, double ftol, int maxiter
/**
In the 4-th order Householder method, three derivatives of the input variable are needed, it yields the following method:
\f[
x_{n+1} = x_n - f(x_n)\left( \frac {[f'(x_n)]^2 - f(x_n)f''(x_n)/2 } {[f'(x_n)]^3-f(x_n)f'(x_n)f''(x_n)+f'''(x_n)*[f(x_n)]^2/6 } \right)
\f]
http://numbers.computation.free.fr/Constants/Algorithms/newton.ps
@param f A pointer to an instance of the FuncWrapper1DWithThreeDerivs class that implements the call() and three derivatives
@param x0 The initial guess for the solution
@param ftol The absolute value of the tolerance accepted for the objective function

View File

@@ -1,5 +1,5 @@
/*
* UDF TO CALCULATE FLUID PROPERTIES BASED ON THE OPEN-SOURCE
/*
* UDF TO CALCULATE FLUID PROPERTIES BASED ON THE OPEN-SOURCE
* THERMODYNAMIC LIBRARY COOLPROP
*/

View File

@@ -8,17 +8,17 @@
*/
extern void ModelicaMessage(const char* string);
/*
/*
Output the message string (no format control).
*/
extern void ModelicaFormatMessage(const char* string, ...);
/*
/*
Output the message under the same format control as the C-function printf.
*/
extern void ModelicaError(const char* string);
/*
/*
Output the error message string (no format control). This function
never returns to the calling function, but handles the error
similarly to an assert in the Modelica code.
@@ -32,7 +32,7 @@ but handles the error similarly to an assert in the Modelica code.
*/
extern char* ModelicaAllocateString(size_t len);
/*
/*
Allocate memory for a Modelica string which is used as return
argument of an external Modelica function. Note, that the storage
for string arrays (= pointer to string array) is still provided by the

View File

@@ -59,7 +59,7 @@ double BaseSolver::criticalEntropy() const {
This function sets the fluid constants which are defined in the
FluidConstants record in Modelica. It should be called when a new
solver is created.
Must be re-implemented in the specific solver
*/
void BaseSolver::setFluidConstants() {}
@@ -414,11 +414,11 @@ void BaseSolver::setSat_T(double& T, ExternalSaturationProperties* const propert
//! Set bubble state
/*!
This function sets the bubble state record bubbleProperties corresponding to the
This function sets the bubble state record bubbleProperties corresponding to the
saturation data contained in the properties record.
The default implementation of the setBubbleState function is relying on the correct
behaviour of setState_ph with respect to the state input. Can be overridden
The default implementation of the setBubbleState function is relying on the correct
behaviour of setState_ph with respect to the state input. Can be overridden
in the specific solver code to get more efficient or correct handling of this situation.
@param properties ExternalSaturationProperties record with saturation properties data
@param phase Phase (1: one-phase, 2: two-phase)
@@ -431,11 +431,11 @@ void BaseSolver::setBubbleState(ExternalSaturationProperties* const properties,
//! Set dew state
/*!
This function sets the dew state record dewProperties corresponding to the
This function sets the dew state record dewProperties corresponding to the
saturation data contained in the properties record.
The default implementation of the setDewState function is relying on the correct
behaviour of setState_ph with respect to the state input. Can be overridden
The default implementation of the setDewState function is relying on the correct
behaviour of setState_ph with respect to the state input. Can be overridden
in the specific solver code to get more efficient or correct handling of this situation.
@param properties ExternalSaturationProperties record with saturation properties data
@param phase Phase (1: one-phase, 2: two-phase)
@@ -618,7 +618,7 @@ double BaseSolver::sv(ExternalSaturationProperties* const properties) {
/*!
This function computes the derivatives according to the Bridgman's table.
The computed values are written to the two phase medium property struct.
This function can be called from within the setState_XX routines
This function can be called from within the setState_XX routines
when implementing a new solver. Please be aware that cp, beta and
kappa have to be provided to allow the computation of the derivatives. It
returns false if the computation failed.

View File

@@ -1,21 +1,21 @@
/*!
/*!
\mainpage External Media HowTo
\section intro_sec Introduction
The ExternalMedia project was started in 2006 by Francesco Casella and
The ExternalMedia project was started in 2006 by Francesco Casella and
Christoph Richter, with the aim of providing a framework for interfacing
external codes computing fluid properties to Modelica.Media-compatible
component models. The two main requirements are: maximizing the efficiency
of the code and minimizing the amount of extra code required to use your
own external code within the framework.
The first implementation featured a hidden cache in the C++ layer and used
integer unique IDs to reference that cache. This architecture worked well
if the models did not contain implicit algebraic equations involving medium
properties, but had serious issues when such equations were involved, which
is often the case when solving steady-state initialization problems.
The library has been restructured in 2012 by Francesco Casella and Roberto
Bonifetto. The main idea has been to get rid of the hidden cache and of the
unique ID references and use the Modelica state records for caching. In this
@@ -27,7 +27,7 @@
that the paths of the medium packages have been changed from the previous
versions, so you might need some small changes if you want to upgrade your
models from previous versions of the ExternalMedia library.
There are two ways to use this library. The easiest way is to use the
releases available on the Modelica website, which include a pre-compiled
interface to the FluidProp tool (http://www.fluidprop.com). FluidProp features
@@ -36,28 +36,28 @@
with state-of-the-art accuracy. If you want to use your own fluid property
computation code instead, then you need to check out the source code and
add the interface to it, as described in this manual.
Please contact the main developer, Francesco Casella
Please contact the main developer, Francesco Casella
(<a href="mailto://casella@elet.polimi.it">casella@elet.polimi.it</a>)
if you have questions or suggestions for improvement.
Licensed by the Modelica Association under the Modelica License 2
Copyright (c) 2006-2012, Politecnico di Milano, TU Braunschweig, Politecnico
di Torino.
\section releases_sec Using the pre-packaged releases with FluidProp
Download and install the latest version of FluidProp from
<a href="http://www.fluidprop.com">http://www.fluidprop.com</a>.
Download and install the latest version of FluidProp from
<a href="http://www.fluidprop.com">http://www.fluidprop.com</a>.
If you want to use the RefProp fluid models,
you need to get the full version of FluidProp, which has an extra license fee.
Download and unzip the library corresponding to the version of Microsoft Visual Studio
that you use to compile your Modelica models, in order to avoid linker errors.
Make sure that you load the ExternalMedia library in your Modelica tool
workspace, e.g. by opening the main package.mo file.
You can now define medium models for the different libraries supported by FluidProp,
by extending the ExternalMedia.Media.FluidPropMedium package. Please note that
only single-component fluids are supported. Set libraryName
@@ -66,19 +66,19 @@
Set substanceNames to a single-element string array containing the name
of the specific medium, as specified by the FluidProp documentation. Set
mediumName to a string that describes the medium (this only used for
documentation purposes but has no effect in selecting the medium model).
documentation purposes but has no effect in selecting the medium model).
See ExternalMedia.Examples for examples.
Please note that the medium model IF97 is already available
natively in Modelica.Media as Water.StandardWater, which is much faster than
the FluidProp version. If you need ideal gas models (single-component or
mixtures), use the medium packages contained in Modelica.Media.IdealGases.
\section architecture_sec Architecture of the package
This section gives an overview of the package structure, in order to help
you understand how to interface your own code to Modelica using it.
At the top level there is a Modelica package (ExternalMedia), which
contains all the basic infrastructure needed to use external fluid
properties computation software through a Modelica.Media compliant
@@ -102,14 +102,14 @@
the SolverMap C++ class. The key to each solver in the map is given by those
strings. It is then possible to use multiple instances of many solvers in the
same Modelica model at the same time.
All the external C functions pass the libraryName, mediumName and substanceNames
strings to the corresponding functions of the interface layer. These in turn
use the SolverMap object to look for an active solver in the solver map,
corresponding to those strings. If one is found, the corresponding function
of the solver is called, otherwise a new solver object is instantiated and
added to the map, before calling the corresponding function of the solver.
The default implementation of an external medium model is implemented by the
ExternalTwoPhaseMedium Modelica package. The setState_xx() and setSat_x()
function calls are rerouted to the corresponding functions of the solver
@@ -119,11 +119,11 @@
records defined in ExternalTwoPhaseMedium. All the functions returning
properties as a function of the state records are implemented in Modelica and
simply return the corresponding element in the state record, which acts as
a cache. This is an efficient implementation for many complex fluid models,
a cache. This is an efficient implementation for many complex fluid models,
where most of the CPU time is spent solving the basic equation of state, while
the computation of all derived properties adds a minor overhead, so it makes
sense to compute them once and for all when the setState_XX() or setSat_xx()
functions are called.
functions are called.
In case some of the thermodynamic properties require a significant amount of
CPU time on their own, it is possible to override this default implementation.
@@ -148,7 +148,7 @@
The following instructions apply if you want to develop an external
medium model which include a (sub)set of the functions defined in
Modelica.Media.Interfaces.PartialTwoPhaseMedium.
The most straightforward implementation is the one in which all fluid
properties are computed at once by the setState_XX() and setSat_X() functions
and all the other functions return the values cached in the state records.
@@ -156,7 +156,7 @@
Get the source code from the SVN repository of the Modelica Association:
<a href="https://svn.modelica.org/projects/ExternalMediaLibrary/trunk">
https://svn.modelica.org/projects/ExternalMediaLibrary/trunk</a>.
First of all, you have to write you own solver object code: you can
look at the code of the TestMedium and FluidPropMedium code as
examples. Inherit from the BaseSolver object, which provides default
@@ -186,13 +186,13 @@
static library (or to a DLL). The compiled libraries and the externalmedialib.h
files must then be copied into the Include subdirectory of the Modelica package
so that the Modelica tool can link them when compiling the models.
As already mentioned in the previous section, you might provide customized
implementations where some of the properties are not computed by the setState
and setSat functions and stored in the cache records, but rather computed
on demand, based on a smaller set of thermodynamic properties computed by the
setState and setSat functions and stored in the state C struct.
Please note that compiling ExternalMedia from source code might require
the professional version of Microsoft Visual Studio, which includes the
COM libraries used by the FluidProp interface. However, if you remove

View File

@@ -3,7 +3,7 @@
*
* The actual implementation depends on the selected preprocessor
* variable defined in include.h
*
*
* Francesco Casella, Christoph Richter, Nov 2006
********************************************************************/

View File

@@ -219,7 +219,7 @@ void FluidPropSolver::setSat_T(double& T, ExternalSaturationProperties* const pr
}
//! Computes the properties of the state vector from p and h
/*! Note: the phase input is currently not supported according to the standard,
/*! Note: the phase input is currently not supported according to the standard,
the phase input is returned in the state record
*/
void FluidPropSolver::setState_ph(double& p, double& h, int& phase, ExternalThermodynamicState* const properties) {
@@ -292,7 +292,7 @@ void FluidPropSolver::setState_pT(double& p, double& T, ExternalThermodynamicSta
}
// Computes the properties of the state vector from d and T
/*! Note: the phase input is currently not supported according to the standard,
/*! Note: the phase input is currently not supported according to the standard,
the phase input is returned in the state record
*/
void FluidPropSolver::setState_dT(double& d, double& T, int& phase, ExternalThermodynamicState* const properties) {
@@ -330,7 +330,7 @@ void FluidPropSolver::setState_dT(double& d, double& T, int& phase, ExternalTher
}
//! Computes the properties of the state vector from p and s
/*! Note: the phase input is currently not supported according to the standard,
/*! Note: the phase input is currently not supported according to the standard,
the phase input is returned in the state record
*/
void FluidPropSolver::setState_ps(double& p, double& s, int& phase, ExternalThermodynamicState* const properties) {
@@ -370,7 +370,7 @@ void FluidPropSolver::setState_ps(double& p, double& s, int& phase, ExternalTher
//! Set bubble state
/*!
This function sets the bubble state record bubbleProperties corresponding to the
This function sets the bubble state record bubbleProperties corresponding to the
saturation data contained in the properties record.
Due to current lack of direct control over the phase in FluidProp, a small delta is added to
@@ -395,11 +395,11 @@ void FluidPropSolver::setBubbleState(ExternalSaturationProperties* const propert
//! Set dew state
/*!
This function sets the dew state record dewProperties corresponding to the
This function sets the dew state record dewProperties corresponding to the
saturation data contained in the properties record.
The default implementation of the setDewState function is relying on the correct
behaviour of setState_ph with respect to the state input. Can be overridden
The default implementation of the setDewState function is relying on the correct
behaviour of setState_ph with respect to the state input. Can be overridden
in the specific solver code to get more efficient or correct handling of this situation.
@param properties ExternalSaturationProperties record with saturation properties data
@param phase Phase (1: one-phase, 2: two-phase)

View File

@@ -3,7 +3,7 @@
* This class defines a solver object encapsulating a FluidProp object
*
* The class will work if FluidProp is correctly installed, and if
* the following files, defining the CFluidProp object, are included
* the following files, defining the CFluidProp object, are included
* in the C project:
* - FluidProp_IF.h
* - FluidProp_IF.cpp
@@ -14,7 +14,7 @@
* Compilation requires support of the COM libraries:
* http://en.wikipedia.org/wiki/Component_Object_Model
*
* To instantiate a specific FluidProp fluid, it is necessary to set
* To instantiate a specific FluidProp fluid, it is necessary to set
* the libraryName and substanceNames package constants as in the
* following example:
*
@@ -28,7 +28,7 @@
*
* Francesco Casella, Christoph Richter, Roberto Bonifetto
* 2006 - 2012
* Copyright Politecnico di Milano, TU Braunschweig,
* Copyright Politecnico di Milano, TU Braunschweig,
* Politecnico di Torino
********************************************************************/

View File

@@ -11,7 +11,7 @@
Ian Bell (ian.bell@ulg.ac.be)
2012-2013
University of Liege, Liege, Belgium
Francesco Casella, Christoph Richter, Roberto Bonifetto
2006-2012
Copyright Politecnico di Milano, TU Braunschweig, Politecnico di Torino
@@ -63,7 +63,7 @@
// Selection of build type for this project
//! Build project into a DLL
/*!
Set this preprocessor variable to 1 if the project is built into a
Set this preprocessor variable to 1 if the project is built into a
dynamic link library. This setting influences the error reporting
mechanism as well as the export statement.
*/
@@ -79,7 +79,7 @@
/********************************************************************
* End of user option selection
* Do not change anything below this line
* Do not change anything below this line
********************************************************************/
// General purpose includes

View File

@@ -53,7 +53,7 @@ BaseSolver* SolverMap::getSolver(const string& mediumName, const string& library
//! Generate a unique solver key
/*!
This function generates a unique solver key based on the library name and
This function generates a unique solver key based on the library name and
substance name.
*/
string SolverMap::solverKey(const string& libraryName, const string& substanceName) {

View File

@@ -15,7 +15,7 @@ class BaseSolver;
Ian Bell
2012-2013
University of Liege, Liege, Belgium
Francesco Casella, Christoph Richter, Roberto Bonifetto
2006-2012
Copyright Politecnico di Milano, TU Braunschweig, Politecnico di Torino

View File

@@ -10,16 +10,16 @@
the need of any further external code. The class is useful for debugging
purposes, to test whether the C compiler and the Modelica tools are set
up correctly before tackling problems with the actual - usually way more
complex - external code. It is *not* meant to be used as an actual
complex - external code. It is *not* meant to be used as an actual
fluid model for any real application.
To keep complexity down to the absolute medium, the current version of the
To keep complexity down to the absolute medium, the current version of the
solver can only compute the fluid properties in the liquid phase region:
1e5 Pa < p < 2e5 Pa
300 K < T < 350 K ;
results returned with inputs outside that range (possibly corresponding
results returned with inputs outside that range (possibly corresponding
to two-phase or vapour points) are not reliable.
Saturation properties are computed in the range
Saturation properties are computed in the range
1e5 Pa < psat < 2e5 Pa ;
results obtained outside that range might be unrealistic.

View File

@@ -137,16 +137,16 @@ def _get_index(prop):
class BaseQuantity(object):
"""A very basic property that can convert an input to and from a
given unit system, note that the conversion from SI units starts
with a multiplication. If you need to remove an offset, use the
off_SI property.
"""A very basic property that can convert an input to and from a
given unit system, note that the conversion from SI units starts
with a multiplication. If you need to remove an offset, use the
off_SI property.
Examples with temperature:
celsius = BaseQuantity(add_SI=-273.15)
fahrenheit = BaseQuantity(add_SI=32.0, mul_SI=1.8, off_SI=-273.15)
Examples with pressure:
bar = BaseQuantity(mul_SI=1e-5)
psi = BaseQuantity(mul_SI=0.000145037738)
psi = BaseQuantity(mul_SI=0.000145037738)
"""
def __init__(self, add_SI=0.0, mul_SI=1.0, off_SI=0.0):
@@ -330,7 +330,7 @@ class EURunits(KSIunits):
class Base2DObject(with_metaclass(ABCMeta), object):
"""A container for shared settings and constants for the
"""A container for shared settings and constants for the
isolines and the property plots."""
# A list of supported plot
@@ -458,8 +458,8 @@ class Base2DObject(with_metaclass(ABCMeta), object):
class IsoLine(Base2DObject):
"""An object that holds the functions to calculate a line of
a constant property in the dimensions of a property plot. This
"""An object that holds the functions to calculate a line of
a constant property in the dimensions of a property plot. This
class only uses SI units."""
# Normally we calculate a sweep in x-dimensions, but
@@ -510,7 +510,7 @@ class IsoLine(Base2DObject):
"""Processes the values for the isoproperty and the graph dimensions
to figure which should be used as inputs to the state update. Returns
a tuple with the indices for the update call and the property constant.
For an isobar in a Ts-diagram it returns the default order and the
For an isobar in a Ts-diagram it returns the default order and the
correct constant for the update pair:
get_update_pair(CoolProp.iP,CoolProp.iSmass,CoolProp.iT) -> (0,1,2,CoolProp.PSmass_INPUTS)
other values require switching and swapping.
@@ -694,7 +694,7 @@ class IsoLine(Base2DObject):
class BasePlot(Base2DObject):
"""The base class for all plots. It can be instantiated itself, but provides many
"""The base class for all plots. It can be instantiated itself, but provides many
general facilities to be used in the different plots. """
# Define the iteration keys
@@ -881,7 +881,7 @@ consider replacing it with \"_get_sat_bounds\".",
self.axis.grid(kwargs)
def set_Tp_limits(self, limits):
"""Set the limits for the graphs in temperature and pressure, based on
"""Set the limits for the graphs in temperature and pressure, based on
the active units: [Tmin, Tmax, pmin, pmax]"""
dim = self._system[CoolProp.iT]
limits[0] = dim.to_SI(limits[0])
@@ -892,7 +892,7 @@ consider replacing it with \"_get_sat_bounds\".",
self.limits = limits
def get_Tp_limits(self):
"""Get the limits for the graphs in temperature and pressure, based on
"""Get the limits for the graphs in temperature and pressure, based on
the active units: [Tmin, Tmax, pmin, pmax]"""
limits = self._get_Tp_limits()
dim = self._system[CoolProp.iT]
@@ -904,7 +904,7 @@ consider replacing it with \"_get_sat_bounds\".",
return limits
def _get_Tp_limits(self):
"""Get the limits for the graphs in temperature and pressure, based on
"""Get the limits for the graphs in temperature and pressure, based on
SI units: [Tmin, Tmax, pmin, pmax]"""
T_lo, T_hi, P_lo, P_hi = self.limits
Ts_lo, Ts_hi = self._get_sat_bounds(CoolProp.iT)
@@ -945,7 +945,7 @@ consider replacing it with \"_get_sat_bounds\".",
self.axis.set_ylim([dim.from_SI(limits[2]), dim.from_SI(limits[3])])
def get_axis_limits(self, x_index=None, y_index=None):
"""Returns the previously set limits or generates them and
"""Returns the previously set limits or generates them and
converts the default values to the selected unit system.
Returns a list containing [xmin, xmax, ymin, ymax]"""
if x_index is None: x_index = self._x_index

View File

@@ -31,7 +31,7 @@ class PropertyPlot(BasePlot):
tp_limits : string, ['NONE','DEF','ACHP','ORC']
Select the limits in T and p.
reciprocal_density : bool
NOT IMPLEMENTED: If True, 1/rho will be plotted instead of rho
NOT IMPLEMENTED: If True, 1/rho will be plotted instead of rho
Examples
--------
@@ -116,7 +116,7 @@ class PropertyPlot(BasePlot):
def calc_isolines(self, iso_type=None, iso_range=None, num=15, rounding=False, points=250):
"""Calculate lines with constant values of type 'iso_type' in terms of x and y as
defined by the plot object. 'iso_range' either is a collection of values or
defined by the plot object. 'iso_range' either is a collection of values or
simply the minimum and maximum value between which 'num' lines get calculated.
The 'rounding' parameter can be used to generate prettier labels if needed.
"""

View File

@@ -59,7 +59,7 @@ def copy_BibTeX_library(file=None, folder=None):
"""
Copy the CoolProp BibTeX library file to the file given by ``file``, or the folder given by ``folder``
If no inputs are provided, the file will be copied to the current working
If no inputs are provided, the file will be copied to the current working
directory
Parameters