11 using namespace Cantera;
17 static const double Tmn = 182.56;
18 static const double Tmx = 1000.0;
19 static const double Tc=537.68;
20 static const double Roc=197.60;
21 static const double To=300;
22 static const double R=82.99504;
23 static const double Gamma=9.611604E-6;
24 static const double u0=3.4058439E5;
25 static const double s0=1.1080254E3;
26 static const double Tp=400;
27 static const double Pc=2.6199E6;
28 static const double M=100.20;
31 static const double Ahept[]= {
45 static const double F[]= {
57 static const double D[]= {
67 static const double G[]= {
76 double Heptane::C(
int j,
double Tinverse,
double T2inverse,
double T3inverse,
double T4inverse)
80 return Ahept[0] * R * T -
82 Ahept[2] * T2inverse +
83 Ahept[3] * T3inverse -
86 return Ahept[5] * R * T -
90 return Ahept[9] * (Ahept[6] + Ahept[7] * Tinverse);
92 return Ahept[8] * T2inverse;
98 inline double Heptane::Cprime(
int j,
double T2inverse,
double T3inverse,
double T4inverse)
102 return Ahept[0] * R -
103 -2 * Ahept[2] * T3inverse +
104 -3 * Ahept[3] * T4inverse -
105 -4 * Ahept[4] * pow(T, -5.0);
107 return Ahept[5] * R -
108 -1 * Ahept[7] * T2inverse;
110 return Ahept[9] * (-1 * Ahept[7] * T2inverse);
112 return -2 * Ahept[8] * T3inverse;
118 inline double Heptane::I(
int j,
double ergho,
double Gamma)
124 return Rho * Rho / 2;
126 return pow(Rho, 5.0)/ 5;
128 return 1 / Gamma - (Gamma * Rho * Rho + 2) * ergho / (2 * Gamma);
134 double Heptane::H(
int i,
double egrho)
141 return pow(Rho,3) * (1 + Gamma * Rho * Rho) * egrho;
149 double Tinverse = 1.0/T;
150 double T2inverse = pow(T, -2);
151 double T3inverse = pow(T, -3);
152 double T4inverse = pow(T, -4);
153 double egrho = exp(-Gamma*Rho*Rho);
157 for (i=1; i<=5; i++) {
158 sum += G[i]*(pow(T,i) - pow(To,i))/
double(i);
161 sum += G[0]*log(T/To);
163 for (i=0; i<=6; i++) {
164 sum += (C(i, Tinverse, T2inverse, T3inverse, T4inverse) - T*Cprime(i,T2inverse, T3inverse, T4inverse))*I(i,egrho, Gamma);
169 return sum + m_energy_offset;
174 double T2inverse = pow(T, -2);
175 double T3inverse = pow(T, -3);
176 double T4inverse = pow(T, -4);
177 double egrho = exp(-Gamma*Rho*Rho);
181 for (
int i=2; i<=5; i++) {
182 sum += G[i]*(pow(T,i-1) - pow(To,i-1))/
double(i-1);
185 sum += G[1]*log(T/To);
186 sum -= G[0]*(1.0/T - 1.0/To);
188 for (
int i=0; i<=6; i++) {
189 sum -= Cprime(i,T2inverse, T3inverse, T4inverse)*I(i,egrho, Gamma);
192 sum += s0 - R*log(Rho);
194 return sum + m_entropy_offset;
199 double Tinverse = pow(T,-1);
200 double T2inverse = pow(T, -2);
201 double T3inverse = pow(T, -3);
202 double T4inverse = pow(T, -4);
203 double egrho = exp(-Gamma*Rho*Rho);
207 for (
int i=0; i<=3; i++) {
208 P += C(i,Tinverse, T2inverse, T3inverse, T4inverse)*H(i,egrho);
214 double Heptane::Psat()
217 if ((T < Tmn) || (T > Tc)) {
218 throw TPX_Error(
"Heptane::Psat",
219 "Temperature out of range. T = " +
fp2str(T));
221 for (
int i=1; i<=8; i++) {
222 sum += F[i-1] * pow((T/Tp -1),
double(i-1));
225 log = ((Tc/T)-1)*sum;
229 double Heptane::ldens()
231 double xx=1-(T/Tc), sum=0;
232 if ((T < Tmn) || (T > Tc)) {
233 throw TPX_Error(
"Heptane::ldens",
234 "Temperature out of range. T = " +
fp2str(T));
236 for (
int i=1; i<=6; i++) {
237 sum+=D[i-1]*pow(xx,
double(i-1)/3.0);
246 double Heptane::Tcrit()
250 double Heptane::Pcrit()
254 double Heptane::Vcrit()
258 double Heptane::Tmin()
262 double Heptane::Tmax()
266 char* Heptane::name()
268 return (
char*) m_name.c_str();
270 char* Heptane::formula()
272 return (
char*) m_formula.c_str();
274 double Heptane::MolWt()
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
Contains declarations for string manipulation functions within Cantera.