Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longdouble remap #499

Merged
merged 2 commits into from Feb 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Web/coolprop/snippets/mixture_derivative_table.cxx
Expand Up @@ -6,7 +6,7 @@ int main()
{
// Ethane/Propane mixture, 25/75 molar
std::vector<std::string> components(2,"Ethane"); components[1] = "Propane";
std::vector<long double> z(2,0.25); z[1] = 0.75;
std::vector<CoolPropDbl> z(2,0.25); z[1] = 0.75;

shared_ptr<HelmholtzEOSMixtureBackend> HEOS(new HelmholtzEOSMixtureBackend(components));
HelmholtzEOSMixtureBackend &rHEOS = *(HEOS.get());
Expand Down
238 changes: 119 additions & 119 deletions include/AbstractState.h

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions include/Ancillaries.h
Expand Up @@ -24,8 +24,8 @@ surface tension is in N/m
class SurfaceTensionCorrelation
{
public:
std::vector<long double> a, n, s;
long double Tc;
std::vector<CoolPropDbl> a, n, s;
CoolPropDbl Tc;

std::size_t N;

Expand All @@ -42,10 +42,10 @@ class SurfaceTensionCorrelation
this->N = n.size();
s = n;
};
long double evaluate(long double T)
CoolPropDbl evaluate(CoolPropDbl T)
{
if (a.empty()){ throw NotImplementedError(format("surface tension curve not provided"));}
long double THETA = 1-T/Tc;
CoolPropDbl THETA = 1-T/Tc;
for (std::size_t i = 0; i < N; ++i)
{
s[i] = a[i]*pow(THETA, n[i]);
Expand Down Expand Up @@ -84,7 +84,7 @@ class SaturationAncillaryFunction
den_coeffs; ///< Coefficients for denominator in rational polynomial
std::vector<double> n, t, s;
bool using_tau_r;
long double Tmax, Tmin, reducing_value, T_r, max_abs_error;
CoolPropDbl Tmax, Tmin, reducing_value, T_r, max_abs_error;
enum ancillaryfunctiontypes{TYPE_NOT_SET = 0,
TYPE_NOT_EXPONENTIAL,
TYPE_EXPONENTIAL,
Expand All @@ -101,7 +101,7 @@ class SaturationAncillaryFunction

/// Get the maximum absolute error for this fit
/// @returns max_abs_error the maximum absolute error for ancillaries that are characterized by maximum absolute error
long double get_max_abs_error(){return max_abs_error;};
CoolPropDbl get_max_abs_error(){return max_abs_error;};

/// Evaluate this ancillary function, yielding for instance the saturated liquid density
/// @param T The temperature in K
Expand All @@ -127,7 +127,7 @@ class SaturationAncillaryFunction

struct MeltingLinePiecewiseSimonSegment
{
long double T_0, a, c, p_0, T_max, T_min, p_min, p_max;
CoolPropDbl T_0, a, c, p_0, T_max, T_min, p_min, p_max;
};
struct MeltingLinePiecewiseSimonData
{
Expand All @@ -136,11 +136,11 @@ struct MeltingLinePiecewiseSimonData
class MeltingLinePiecewisePolynomialInTrSegment
{
public:
std::vector<long double> a, t;
long double T_0, p_0, T_max, T_min, p_min, p_max;
long double evaluate(long double T)
std::vector<CoolPropDbl> a, t;
CoolPropDbl T_0, p_0, T_max, T_min, p_min, p_max;
CoolPropDbl evaluate(CoolPropDbl T)
{
long double summer = 0;
CoolPropDbl summer = 0;
for (std::size_t i =0; i < a.size(); ++i){
summer += a[i]*(pow(T/T_0,t[i])-1);
}
Expand All @@ -154,12 +154,12 @@ struct MeltingLinePiecewisePolynomialInTrData
class MeltingLinePiecewisePolynomialInThetaSegment
{
public:
std::vector<long double> a, t;
long double T_0, p_0, T_max, T_min, p_min, p_max;
std::vector<CoolPropDbl> a, t;
CoolPropDbl T_0, p_0, T_max, T_min, p_min, p_max;

long double evaluate(long double T)
CoolPropDbl evaluate(CoolPropDbl T)
{
long double summer = 0;
CoolPropDbl summer = 0;
for (std::size_t i =0; i < a.size(); ++i){
summer += a[i]*pow(T/T_0-1,t[i]);
}
Expand All @@ -179,16 +179,16 @@ class MeltingLineVariables
MELTING_LINE_POLYNOMIAL_IN_THETA_TYPE,
MELTING_LINE_NOT_SET
};
long double Tmin, Tmax, pmin, pmax;
CoolPropDbl Tmin, Tmax, pmin, pmax;

long double evaluate(int OF, int GIVEN, long double value);
CoolPropDbl evaluate(int OF, int GIVEN, CoolPropDbl value);

/// Evaluate the melting line to calculate the limits of the curve (Tmin/Tmax and pmin/pmax)
void set_limits();

bool enabled(){return type != MELTING_LINE_NOT_SET;};
std::string BibTeX;
long double T_m; ///< Melting temperature at 1 atmosphere
CoolPropDbl T_m; ///< Melting temperature at 1 atmosphere
MeltingLinePiecewiseSimonData simon;
MeltingLinePiecewisePolynomialInTrData polynomial_in_Tr;
MeltingLinePiecewisePolynomialInThetaData polynomial_in_Theta;
Expand Down
6 changes: 3 additions & 3 deletions include/CachedElement.h
Expand Up @@ -33,7 +33,7 @@ class CachedElement {

private:
bool is_cached;
long double value;
CoolPropDbl value;
public:
/// Default constructor
CachedElement() {
Expand Down Expand Up @@ -62,7 +62,7 @@ class CachedElement {
throw std::exception();
}
}
operator long double() {
operator CoolPropDbl() {
if (is_cached) {return value; }
else {
throw std::exception();
Expand All @@ -73,7 +73,7 @@ class CachedElement {
is_cached = false;
this->value = _HUGE;
};
long double &pt(){
CoolPropDbl &pt(){
return this->value;
}
};
Expand Down
90 changes: 45 additions & 45 deletions include/CoolPropFluid.h
Expand Up @@ -91,17 +91,17 @@ struct EOSLimits

struct ConductivityECSVariables{
std::string reference_fluid;
long double psi_rhomolar_reducing, f_int_T_reducing;
std::vector<long double> psi_a, psi_t, f_int_a, f_int_t;
CoolPropDbl psi_rhomolar_reducing, f_int_T_reducing;
std::vector<CoolPropDbl> psi_a, psi_t, f_int_a, f_int_t;
};

struct ConductivityDiluteEta0AndPolyData{
std::vector<long double> A, t;
std::vector<CoolPropDbl> A, t;
};

struct ConductivityDiluteRatioPolynomialsData{
long double T_reducing, p_reducing;
std::vector<long double> A, B, n, m;
CoolPropDbl T_reducing, p_reducing;
std::vector<CoolPropDbl> A, B, n, m;
};
struct ConductivityDiluteVariables
{
Expand All @@ -120,13 +120,13 @@ struct ConductivityDiluteVariables
};

struct ConductivityResidualPolynomialAndExponentialData{
long double T_reducing, rhomass_reducing;
std::vector<long double> A, t, d, gamma, l;
CoolPropDbl T_reducing, rhomass_reducing;
std::vector<CoolPropDbl> A, t, d, gamma, l;
};

struct ConductivityResidualPolynomialData{
long double T_reducing, rhomass_reducing;
std::vector<long double> B, t, d;
CoolPropDbl T_reducing, rhomass_reducing;
std::vector<CoolPropDbl> B, t, d;
};
struct ConductivityResidualVariables
{
Expand All @@ -144,7 +144,7 @@ struct ConductivityResidualVariables
};

struct ConductivityCriticalSimplifiedOlchowySengersData{
long double T_reducing, p_reducing, k, R0, gamma, nu, qD, zeta0, GAMMA, T_ref;
CoolPropDbl T_reducing, p_reducing, k, R0, gamma, nu, qD, zeta0, GAMMA, T_ref;
ConductivityCriticalSimplifiedOlchowySengersData(){
// Universal constants - can still be adjusted if need be
k = 1.3806488e-23; //[J/K]
Expand Down Expand Up @@ -179,18 +179,18 @@ struct ConductivityCriticalVariables
/// Variables for the dilute gas part
struct ViscosityDiluteGasCollisionIntegralData
{
long double molar_mass, C;
std::vector<long double> a, t;
CoolPropDbl molar_mass, C;
std::vector<CoolPropDbl> a, t;
};
struct ViscosityDiluteCollisionIntegralPowersOfTstarData
{
long double T_reducing, ///< Reducing temperature [K[
CoolPropDbl T_reducing, ///< Reducing temperature [K[
C; ///< Leading constant
std::vector<long double> a, t;
std::vector<CoolPropDbl> a, t;
};
struct ViscosityDiluteGasPowersOfT
{
std::vector<long double> a, t;
std::vector<CoolPropDbl> a, t;
};
struct ViscosityDiluteVariables
{
Expand All @@ -211,12 +211,12 @@ struct ViscosityDiluteVariables

struct ViscosityRainWaterFriendData
{
std::vector<long double> b, t;
std::vector<CoolPropDbl> b, t;
};
struct ViscosityInitialDensityEmpiricalData
{
std::vector<long double> n, d, t;
long double T_reducing, rhomolar_reducing;
std::vector<CoolPropDbl> n, d, t;
CoolPropDbl T_reducing, rhomolar_reducing;
};

struct ViscosityInitialDensityVariables
Expand All @@ -233,14 +233,14 @@ struct ViscosityInitialDensityVariables

struct ViscosityModifiedBatschinskiHildebrandData
{
std::vector<long double> a,d1,d2,t1,t2,f,g,h,p,q,gamma, l;
long double T_reduce, rhomolar_reduce;
std::vector<CoolPropDbl> a,d1,d2,t1,t2,f,g,h,p,q,gamma, l;
CoolPropDbl T_reduce, rhomolar_reduce;
};
struct ViscosityFrictionTheoryData
{
std::vector<long double> Aa, Aaa, Aaaa, Ar, Arr, Adrdr, Arrr, Ai, Aii, AdrAdr;
std::vector<CoolPropDbl> Aa, Aaa, Aaaa, Ar, Arr, Adrdr, Arrr, Ai, Aii, AdrAdr;
int Na, Naa, Naaa, Nr, Nrr, Nrrr, Nii;
long double c1, c2, T_reduce, rhomolar_reduce;
CoolPropDbl c1, c2, T_reduce, rhomolar_reduce;
};
struct ViscosityHigherOrderVariables
{
Expand All @@ -261,8 +261,8 @@ struct ViscosityHigherOrderVariables

struct ViscosityECSVariables{
std::string reference_fluid;
long double psi_rhomolar_reducing;
std::vector<long double> psi_a, psi_t;
CoolPropDbl psi_rhomolar_reducing;
std::vector<CoolPropDbl> psi_a, psi_t;
};

class TransportPropertyData
Expand Down Expand Up @@ -295,7 +295,7 @@ class TransportPropertyData
bool conductivity_using_ECS; ///< A flag for whether to use extended corresponding states for conductivity. False for no
bool conductivity_model_provided; ///< A flag for whether thermal conductivity model is provided. False for no
bool viscosity_model_provided; ///< A flag for whether viscosity model is provided. False for no
long double sigma_eta, ///< The Lennard-Jones 12-6 \f$ \sigma \f$ parameter
CoolPropDbl sigma_eta, ///< The Lennard-Jones 12-6 \f$ \sigma \f$ parameter
epsilon_over_k; ///< The Lennard-Jones 12-6 \f$ \varepsilon/k \f$ parameter
ViscosityHardcodedEnum hardcoded_viscosity; ///< Hardcoded flags for the viscosity
ConductivityHardcodedEnum hardcoded_conductivity; ///< Hardcoded flags for the conductivity
Expand Down Expand Up @@ -352,90 +352,90 @@ class EquationOfState{
assert(R_u < 9 && R_u > 8);
assert(molar_mass > 0.001 && molar_mass < 1);
};
long double baser(const long double &tau, const long double &delta) throw()
CoolPropDbl baser(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.base(tau, delta);
};
// First partials
long double dalphar_dDelta(const long double &tau, const long double &delta) throw()
CoolPropDbl dalphar_dDelta(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dDelta(tau, delta);
};
long double dalphar_dTau(const long double &tau, const long double &delta) throw()
CoolPropDbl dalphar_dTau(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dTau(tau, delta);
};
// Second partials
long double d2alphar_dDelta2(const long double &tau, const long double &delta) throw()
CoolPropDbl d2alphar_dDelta2(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dDelta2(tau, delta);
};
long double d2alphar_dDelta_dTau(const long double &tau, const long double &delta) throw()
CoolPropDbl d2alphar_dDelta_dTau(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dDelta_dTau(tau, delta);
};
long double d2alphar_dTau2(const long double &tau, const long double &delta) throw()
CoolPropDbl d2alphar_dTau2(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dTau2(tau, delta);
};
// Third partials
long double d3alphar_dDelta3(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alphar_dDelta3(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dDelta3(tau, delta);
};
long double d3alphar_dDelta2_dTau(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alphar_dDelta2_dTau(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dDelta2_dTau(tau, delta);
};
long double d3alphar_dDelta_dTau2(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alphar_dDelta_dTau2(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dDelta_dTau2(tau, delta);
};
long double d3alphar_dTau3(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alphar_dTau3(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alphar.dTau3(tau, delta);
};

long double base0(const long double &tau, const long double &delta) throw()
CoolPropDbl base0(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.base(tau, delta);
};
// First partials
long double dalpha0_dDelta(const long double &tau, const long double &delta) throw()
CoolPropDbl dalpha0_dDelta(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dDelta(tau, delta);
};
long double dalpha0_dTau(const long double &tau, const long double &delta) throw()
CoolPropDbl dalpha0_dTau(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dTau(tau, delta);
};
// Second partials
long double d2alpha0_dDelta2(const long double &tau, const long double &delta) throw()
CoolPropDbl d2alpha0_dDelta2(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dDelta2(tau, delta);
};
long double d2alpha0_dDelta_dTau(const long double &tau, const long double &delta) throw()
CoolPropDbl d2alpha0_dDelta_dTau(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dDelta_dTau(tau, delta);
};
long double d2alpha0_dTau2(const long double &tau, const long double &delta) throw()
CoolPropDbl d2alpha0_dTau2(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dTau2(tau, delta);
};
// Third partials
long double d3alpha0_dDelta3(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alpha0_dDelta3(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dDelta3(tau, delta);
};
long double d3alpha0_dDelta2_dTau(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alpha0_dDelta2_dTau(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dDelta2_dTau(tau, delta);
};
long double d3alpha0_dDelta_dTau2(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alpha0_dDelta_dTau2(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dDelta_dTau2(tau, delta);
};
long double d3alpha0_dTau3(const long double &tau, const long double &delta) throw()
CoolPropDbl d3alpha0_dTau3(const CoolPropDbl &tau, const CoolPropDbl &delta) throw()
{
return alpha0.dTau3(tau, delta);
};
Expand Down
2 changes: 2 additions & 0 deletions include/CoolPropTools.h
Expand Up @@ -11,6 +11,8 @@
#include <cmath>
#include "float.h"

typedef long double CoolPropDbl;

#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/DataStructures.h
Expand Up @@ -175,7 +175,7 @@ std::string get_csv_parameter_list();
/// These are constants for the compositions
enum composition_types{IFRAC_MASS, IFRAC_MOLE, IFRAC_VOLUME, IFRAC_UNDEFINED, IFRAC_PURE};

const long double R_u_CODATA = 8.3144621; ///< The value for the ideal gas constant in J/mol/K according to CODATA 2010. This value is used to harmonize all the ideal gas constants. This is especially important in the critical region.
const CoolPropDbl R_u_CODATA = 8.3144621; ///< The value for the ideal gas constant in J/mol/K according to CODATA 2010. This value is used to harmonize all the ideal gas constants. This is especially important in the critical region.

/// These are unit types for the fluid
enum fluid_types{FLUID_TYPE_PURE, FLUID_TYPE_PSEUDOPURE, FLUID_TYPE_REFPROP, FLUID_TYPE_INCOMPRESSIBLE_LIQUID, FLUID_TYPE_INCOMPRESSIBLE_SOLUTION, FLUID_TYPE_UNDEFINED};
Expand Down