Cantera  2.1.2
L_matrix.h
Go to the documentation of this file.
1 /**
2  * @file L_matrix.h
3  * Functions to evaluate portions of the L matrix needed for
4  * multicomponent transport properties.
5  */
6
7 #ifndef CT_LMATRIX_H
8 #define CT_LMATRIX_H
9
11
12 namespace Cantera
13 {
14
15 //! Constant to compare dimensionless heat capacities against zero
16 const doublereal Min_C_Internal = 0.001;
17
18 bool MultiTransport::hasInternalModes(size_t j)
19 {
20  return (m_cinternal[j] > Min_C_Internal);
21 }
22
23 void MultiTransport::eval_L0000(const doublereal* const x)
24 {
25  doublereal prefactor = 16.0*m_temp/25.0;
26  doublereal sum;
27  for (size_t i = 0; i < m_nsp; i++) {
28  // subtract-off the k=i term to account for the first delta
29  // function in Eq. (12.121)
30
31  sum = -x[i]/m_bdiff(i,i);
32  for (size_t k = 0; k < m_nsp; k++) {
33  sum += x[k]/m_bdiff(i,k);
34  }
35
36  sum /= m_mw[i];
37  for (size_t j = 0; j != m_nsp; ++j) {
38  m_Lmatrix(i,j) = prefactor * x[j]
39  * (m_mw[j] * sum + x[i]/m_bdiff(i,j));
40  }
41  // diagonal term is zero
42  m_Lmatrix(i,i) = 0.0;
43  }
44 }
45
46 void MultiTransport::eval_L0010(const doublereal* const x)
47 {
48  doublereal prefactor = 1.6*m_temp;
49
50  doublereal sum, wj, xj;
51  for (size_t j = 0; j < m_nsp; j++) {
52  //constant = prefactor * x[j];
53  xj = x[j];
54  wj = m_mw[j];
55  sum = 0.0;
56  for (size_t i = 0; i < m_nsp; i++) {
57  m_Lmatrix(i,j + m_nsp) = - prefactor * x[i] * xj * m_mw[i] *
58  (1.2 * m_cstar(j,i) - 1.0) /
59  ((wj + m_mw[i]) * m_bdiff(j,i));
60
61  // the next term is independent of "j";
62  // need to do it for the "j,j" term
63  sum -= m_Lmatrix(i,j+m_nsp);
64  }
65  m_Lmatrix(j,j+m_nsp) += sum;
66  }
67 }
68
70 {
71  for (size_t j = 0; j < m_nsp; j++) {
72  for (size_t i = 0; i < m_nsp; i++) {
73  m_Lmatrix(i+m_nsp,j) = m_Lmatrix(j,i+m_nsp);
74  }
75  }
76 }
77
78 void MultiTransport::eval_L1010(const doublereal* x)
79 {
80  const doublereal fiveover3pi = 5.0/(3.0*Pi);
81  doublereal prefactor = (16.0*m_temp)/25.0;
82
83  doublereal constant1, wjsq, constant2, constant3, constant4,
84  fourmj, threemjsq, sum, sumwij;;
85  doublereal term1, term2;
86
87  for (size_t j = 0; j < m_nsp; j++) {
88
89  // get constant terms that depend on just species "j"
90
91  constant1 = prefactor*x[j];
92  wjsq = m_mw[j]*m_mw[j];
93  constant2 = 13.75*wjsq;
94  constant3 = m_crot[j]/m_rotrelax[j];
95  constant4 = 7.5*wjsq;
96  fourmj = 4.0*m_mw[j];
97  threemjsq = 3.0*m_mw[j]*m_mw[j];
98  sum = 0.0;
99  for (size_t i = 0; i < m_nsp; i++) {
100
101  sumwij = m_mw[i] + m_mw[j];
102  term1 = m_bdiff(i,j) * sumwij*sumwij;
103  term2 = fourmj*m_astar(i,j)*(1.0 + fiveover3pi*
104  (constant3 +
105  (m_crot[i]/m_rotrelax[i]))); // see Eq. (12.125)
106
107  m_Lmatrix(i+m_nsp,j+m_nsp) = constant1*x[i]*m_mw[i] /(m_mw[j]*term1) *
108  (constant2 - threemjsq*m_bstar(i,j)
109  - term2*m_mw[j]);
110
111  sum += x[i] /(term1) *
112  (constant4 + m_mw[i]*m_mw[i]*
113  (6.25 - 3.0*m_bstar(i,j)) + term2*m_mw[i]);
114  }
115
116  m_Lmatrix(j+m_nsp,j+m_nsp) -= sum*constant1;
117  }
118 }
119
120 void MultiTransport::eval_L1001(const doublereal* x)
121 {
122  doublereal prefactor = 32.00*m_temp/(5.00*Pi);
123  doublereal constant, sum;
124  size_t n2 = 2*m_nsp;
125  int npoly = 0;
126  for (size_t j = 0; j < m_nsp; j++) {
127  // collect terms that depend only on "j"
128  if (hasInternalModes(j)) {
129  constant = prefactor*m_mw[j]*x[j]*m_crot[j]/(m_cinternal[j]*m_rotrelax[j]);
130  sum = 0.0;
131  for (size_t i = 0; i < m_nsp; i++) {
132  // see Eq. (12.127)
133  m_Lmatrix(i+m_nsp,j+n2) = constant * m_astar(j,i) * x[i] /
134  ((m_mw[j] + m_mw[i]) * m_bdiff(j,i));
135  sum += m_Lmatrix(i+m_nsp,j+n2);
136  }
137  npoly++;
138  m_Lmatrix(j+m_nsp,j+n2) += sum;
139  } else {
140  for (size_t i = 0; i < m_nsp; i++) {
141  m_Lmatrix(i+m_nsp,j+n2) = 0.0;
142  }
143  }
144  }
145 }
146
147 void MultiTransport::eval_L0001()
148 {
149  size_t n2 = 2*m_nsp;
150  for (size_t j = 0; j < m_nsp; j++) {
151  for (size_t i = 0; i < m_nsp; i++) {
152  m_Lmatrix(i,j+n2) = 0.0;
153  }
154  }
155 }
156
157 void MultiTransport::eval_L0100()
158 {
159  size_t n2 = 2*m_nsp;
160  for (size_t j = 0; j < m_nsp; j++)
161  for (size_t i = 0; i < m_nsp; i++) {
162  m_Lmatrix(i+n2,j) = 0.0; // see Eq. (12.123)
163  }
164 }
165
166 void MultiTransport::eval_L0110()
167 {
168  size_t n2 = 2*m_nsp;
169  for (size_t j = 0; j < m_nsp; j++)
170  for (size_t i = 0; i < m_nsp; i++) {
171  m_Lmatrix(i+n2,j+m_nsp) = m_Lmatrix(j+m_nsp,i+n2); // see Eq. (12.123)
172  }
173 }
174
175 void MultiTransport::eval_L0101(const doublereal* x)
176 {
177  const doublereal fivepi = 5.00*Pi;
178  const doublereal eightoverpi = 8.0 / Pi;
179
180  doublereal prefactor = 4.00*m_temp;
181  size_t n2 = 2*m_nsp;
182  doublereal constant1, constant2, diff_int, sum;
183  for (size_t i = 0; i < m_nsp; i++) {
184  if (hasInternalModes(i)) {
185  // collect terms that depend only on "i"
186  constant1 = prefactor*x[i]/m_cinternal[i];
187  constant2 = 12.00*m_mw[i]*m_crot[i] /
188  (fivepi*m_cinternal[i]*m_rotrelax[i]);
189  sum = 0.0;
190  for (size_t k = 0; k < m_nsp; k++) {
191  // see Eq. (12.131)
192  diff_int = m_bdiff(i,k);
193  m_Lmatrix(k+n2,i+n2) = 0.0;
194  sum += x[k]/diff_int;
195  if (k != i) sum += x[k]*m_astar(i,k)*constant2 /
196  (m_mw[k]*diff_int);
197  }
198  // see Eq. (12.130)
199  m_Lmatrix(i+n2,i+n2) =
200  - eightoverpi*m_mw[i]*x[i]*x[i]*m_crot[i] /
201  (m_cinternal[i]*m_cinternal[i]*GasConstant*m_visc[i]*m_rotrelax[i])
202  - constant1*sum;
203  } else {
204  for (size_t k = 0; k < m_nsp; k++) {
205  m_Lmatrix(i+n2,i+n2) = 1.0;
206  }
207  }
208  }
209 }
210 }
211
212 #endif
void eval_L1000()
Evaluate the L1000 matrices.
Definition: L_matrix.h:69
DenseMatrix m_bstar
Dense matrix for bstar.
Interface for class MultiTransport.
DenseMatrix m_astar
Dense matrix for astar.
DenseMatrix m_cstar
Dense matrix for cstar.
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
Definition: GasTransport.h:243
const doublereal Pi
Pi.
Definition: ct_defs.h:51
doublereal m_temp
Current value of the temperature at which the properties in this object are calculated (Kelvin)...
Definition: GasTransport.h:205
const doublereal Min_C_Internal
Constant to compare dimensionless heat capacities against zero.
Definition: L_matrix.h:16
vector_fp m_visc
vector of species viscosities (kg /m /s).
Definition: GasTransport.h:170
void eval_L0000(const doublereal *const x)
Evaluate the L0000 matrices.
Definition: L_matrix.h:23
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:66
size_t m_nsp
Number of species.
void eval_L0010(const doublereal *const x)
Evaluate the L0010 matrices.
Definition: L_matrix.h:46
vector_fp m_mw
Local copy of the species molecular weights.
Definition: GasTransport.h:178