Cantera  2.5.1
HFC134a.cpp
Go to the documentation of this file.
1 //! @file HFC134a.cpp
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at https://cantera.org/license.txt for license and copyright information.
5 
6 #include "HFC134a.h"
8 
9 using namespace Cantera;
10 
11 namespace tpx
12 {
13 
14 const double
15 M = 102.032,
16 Tmn = 170.0,
17 Tmx = 455.0,
18 Tc = 374.18,
19 Pc = 4056290.0,
20 Roc = 508.0,
21 R = 81.48885644;
22 
23 const double a134[] = {
24  0.5586817e-1,
25  0.4982230,
26  0.2458698e-1,
27  0.8570145e-3,
28  0.4788584e-3,
29  -0.1800808e1,
30  0.2671641,
31  -0.4781652e-1,
32  0.1423987e-1,
33  0.3324062,
34  -0.7485907e-2,
35  0.1017263e-3,
36  -0.5184567,
37  -0.8692288e-1,
38  0.2057144,
39  -0.5000457e-2,
40  0.4603262e-3,
41  -0.3497836e-2,
42  0.6995038e-2,
43  -0.1452184e-1,
44  -0.1285458e-3
45 };
46 
47 const double t134[] = {
48  -0.5, 0.0, 0.0, 0.0, 1.5, 1.5, 2.0, 2.0, 1.0, 3.0, 5.0,
49  1.0, 5.0, 5.0, 6.0, 10.0, 10.0, 10.0, 18.0, 22.0, 50.0
50 };
51 
52 const int d134[] = {
53  2, 1, 3, 6, 6, 1, 1, 2, 5, 2, 2,
54  4, 1, 4, 1, 2, 4, 1, 5, 3, 10
55 };
56 
57 const double b134[] = {
58  -1.019535,
59  9.047135,
60  -1.629789,
61  -9.723916,
62  -3.927170
63 };
64 
65 double HFC134a::fp()
66 {
67  double sum1 = 0.0, sum2 = 0.0, sum3 = 0.0,
68  sum4 = 0.0, sum5 = 0.0;
69  double tau = Tc/T;
70  double delta = Rho/Roc;
71 
72  double phi0 = b134[0] + b134[1]*tau + b134[2]*log(tau)
73  + log(delta) + b134[3]/sqrt(tau) + b134[4]*pow(tau,-0.75);
74  int i;
75  for (i = 0; i<8; i++) {
76  sum1 += a134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
77  }
78  for (i = 8; i<11; i++) {
79  sum2 += a134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
80  }
81  for (i = 11; i<17; i++) {
82  sum3 += a134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
83  }
84  for (i = 17; i<20; i++) {
85  sum4 += a134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
86  }
87  sum5 = a134[20]*pow(tau,t134[20])*pow(delta,d134[20]);
88  double phir = sum1 + exp(-delta)*sum2 + exp(-delta*delta)*sum3
89  + exp(-delta*delta*delta)*sum4
90  + exp(-delta*delta*delta*delta)*sum5;
91  return R*T*(phir + phi0);
92 }
93 
94 double HFC134a::up()
95 {
96  double sum1 = 0.0, sum2 = 0.0, sum3 = 0.0,
97  sum4 = 0.0, sum5 = 0.0;
98  double tau = Tc/T;
99  double delta = Rho/Roc;
100 
101  double phi0t = b134[1]*tau + b134[2]
102  - 0.5*b134[3]*pow(tau,-0.5) - 0.75*b134[4]*pow(tau,-0.75);
103  int i;
104  for (i = 0; i<8; i++) {
105  sum1 += a134[i]*t134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
106  }
107  for (i = 8; i<11; i++) {
108  sum2 += a134[i]*t134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
109  }
110  for (i = 11; i<17; i++) {
111  sum3 += a134[i]*t134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
112  }
113  for (i = 17; i<20; i++) {
114  sum4 += a134[i]*t134[i]*pow(tau,t134[i])*pow(delta,d134[i]);
115  }
116  sum5 = a134[20]*t134[20]*pow(tau,t134[20])*pow(delta,d134[20]);
117  double phirt = sum1 + exp(-delta)*sum2 + exp(-delta*delta)*sum3
118  + exp(-delta*delta*delta)*sum4
119  + exp(-delta*delta*delta*delta)*sum5;
120  return R*T*(phirt + phi0t) + m_energy_offset;
121 }
122 
123 double HFC134a::Pp()
124 {
125  double sum1 = 0.0, sum2 = 0.0, sum3 = 0.0,
126  sum4 = 0.0, sum5 = 0.0;
127  double tau = Tc/T;
128  double delta = Rho/Roc;
129  double phi0d = 1.0/delta;
130 
131  int i;
132  for (i = 0; i<8; i++) {
133  sum1 += a134[i]*pow(tau,t134[i])*d134[i]*pow(delta,d134[i]-1);
134  }
135  for (i = 8; i<11; i++) {
136  sum2 += a134[i]*pow(tau,t134[i])*(d134[i] - delta)*pow(delta,d134[i]-1);
137  }
138  sum2 *= exp(-delta);
139  double dk = delta*delta;
140  for (i = 11; i<17; i++) {
141  sum3 += a134[i]*pow(tau,t134[i])*(d134[i] - 2.0*dk)*pow(delta,d134[i]-1);
142  }
143  sum3 *= exp(-dk);
144  dk *= delta;
145  for (i = 17; i<20; i++) {
146  sum4 += a134[i]*pow(tau,t134[i])*(d134[i] - 3.0*dk)*pow(delta,d134[i]-1);
147  }
148  sum4 *= exp(-dk);
149  dk *= delta;
150  sum5 = a134[20]*pow(tau,t134[20])*(d134[20] - 4.0*dk)*pow(delta,d134[20]-1);
151  sum5 *= exp(-dk);
152  double phird = sum1 + sum2 + sum3 + sum4 + sum5;
153  return R*T*delta*delta*Roc*(phird + phi0d);
154 }
155 
156 double HFC134a::Psat()
157 {
158  if ((T < Tmn) || (T > Tc)) {
159  throw CanteraError("HFC134a::Psat",
160  "Temperature out of range. T = {}", T);
161  }
162  double x1 = T/Tc;
163  double x2 = 1.0 - x1;
164  double f = -7.686556*x2 + 2.311791*pow(x2,1.5)
165  - 2.039554*x2*x2 - 3.583758*pow(x2,4);
166  return Pc*exp(f/x1);
167 }
168 
169 double HFC134a::ldens()
170 {
171  if ((T < Tmn) || (T > Tc)) {
172  throw CanteraError("HFC134a::ldens",
173  "Temperature out of range. T = {}", T);
174  }
175  double x1 = T/Tc;
176  double x2 = 1.0 - x1;
177  return 518.2 + 884.13*pow(x2,1.0/3.0) + 485.84*pow(x2,2.0/3.0)
178  + 193.29*pow(x2,10.0/3.0);
179 }
180 
181 double HFC134a::Tcrit()
182 {
183  return 374.21;
184 }
185 double HFC134a::Pcrit()
186 {
187  return 4059280.0;
188 }
189 double HFC134a::Vcrit()
190 {
191  return 1.0/511.95;
192 }
193 double HFC134a::Tmin()
194 {
195  return Tmn;
196 }
197 double HFC134a::Tmax()
198 {
199  return Tmx;
200 }
201 double HFC134a::MolWt()
202 {
203  return M;
204 }
205 
206 }
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:61
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
Contains declarations for string manipulation functions within Cantera.