@@ -26,7 +26,7 @@ struct SRK
26
26
am = 0.0 ;
27
27
bm = 0.0 ;
28
28
AMREX_ASSERT (T > 0.0 );
29
- amrex::Real sqrtT = std::sqrt (T);
29
+ const amrex::Real sqrtT = std::sqrt (T);
30
30
amrex::Real amloc[NUM_SPECIES];
31
31
32
32
// Combine as follows: add diagonal to am in first loop, loop upper triang
@@ -50,7 +50,7 @@ struct SRK
50
50
{
51
51
am = 0.0 ;
52
52
AMREX_ASSERT (T > 0.0 );
53
- amrex::Real sqrtT = std::sqrt (T);
53
+ const amrex::Real sqrtT = std::sqrt (T);
54
54
amrex::Real amloc[NUM_SPECIES];
55
55
56
56
// Combine as follows: add diagonal to am in first loop, loop upper triang
@@ -83,8 +83,8 @@ struct SRK
83
83
{
84
84
dAmdT = 0.0 ;
85
85
AMREX_ASSERT (T > 0.0 );
86
- amrex::Real oneOverT = 1.0 / T;
87
- amrex::Real sqrtT = std::sqrt (T);
86
+ const amrex::Real oneOverT = 1.0 / T;
87
+ const amrex::Real sqrtT = std::sqrt (T);
88
88
amrex::Real amloc[NUM_SPECIES];
89
89
amrex::Real amlocder[NUM_SPECIES];
90
90
@@ -108,7 +108,7 @@ struct SRK
108
108
void Calc_dAmdY (amrex::Real T, amrex::Real Y[], amrex::Real dAmdY[])
109
109
{
110
110
AMREX_ASSERT (T > 0.0 );
111
- amrex::Real sqrtT = std::sqrt (T);
111
+ const amrex::Real sqrtT = std::sqrt (T);
112
112
amrex::Real amloc[NUM_SPECIES];
113
113
114
114
for (int ii = 0 ; ii < NUM_SPECIES; ii++) {
@@ -130,7 +130,7 @@ struct SRK
130
130
amrex::Real T, amrex::Real* /* Y[]*/ , amrex::Real d2AmdY2[][NUM_SPECIES])
131
131
{
132
132
AMREX_ASSERT (T > 0.0 );
133
- amrex::Real sqrtT = std::sqrt (T);
133
+ const amrex::Real sqrtT = std::sqrt (T);
134
134
amrex::Real amloc[NUM_SPECIES];
135
135
136
136
for (int ii = 0 ; ii < NUM_SPECIES; ii++) {
@@ -150,8 +150,8 @@ struct SRK
150
150
void Calc_d2AmdTY (amrex::Real T, amrex::Real Y[], amrex::Real d2AmdTY[])
151
151
{
152
152
AMREX_ASSERT (T > 0.0 );
153
- amrex::Real oneOverT = 1.0 / T;
154
- amrex::Real sqrtT = std::sqrt (T);
153
+ const amrex::Real oneOverT = 1.0 / T;
154
+ const amrex::Real sqrtT = std::sqrt (T);
155
155
amrex::Real amloc[NUM_SPECIES];
156
156
amrex::Real amlocder[NUM_SPECIES];
157
157
@@ -181,7 +181,6 @@ struct SRK
181
181
amrex::Real T,
182
182
amrex::Real Wbar)
183
183
{
184
- amrex::Real theta, Z1, Z2, Z3, sqrtQ, third;
185
184
amrex::Real RmT = Constants::RU / Wbar * T;
186
185
amrex::Real B1 = bm * P / RmT;
187
186
amrex::Real R1 = RmT;
@@ -193,18 +192,18 @@ struct SRK
193
192
amrex::Real Q = (alpha * alpha - 3.0 * beta) / 9.0 ;
194
193
amrex::Real R =
195
194
(2.0 * alpha * alpha * alpha - 9.0 * alpha * beta + 27.0 * gamma ) / 54.0 ;
196
- amrex::Real PIval = 3.1415926535897932 ;
197
195
198
196
// Multiple roots of cubic
199
- third = 1.0 / 3.0 ;
197
+ const amrex::Real third = 1.0 / 3.0 ;
200
198
if ((Q * Q * Q - R * R) > 0 ) {
201
- sqrtQ = std::sqrt (Q);
202
- theta = std::acos (R / (Q * sqrtQ));
203
- Z1 = -2.0 * sqrtQ * std::cos (theta * third) - alpha * third;
204
- Z2 =
205
- -2.0 * sqrtQ * std::cos ((theta + 2.0 * PIval) * third) - alpha * third;
206
- Z3 =
207
- -2.0 * sqrtQ * std::cos ((theta + 4.0 * PIval) * third) - alpha * third;
199
+ const amrex::Real sqrtQ = std::sqrt (Q);
200
+ const amrex::Real theta = std::acos (R / (Q * sqrtQ));
201
+ const amrex::Real Z1 =
202
+ -2.0 * sqrtQ * std::cos (theta * third) - alpha * third;
203
+ const amrex::Real Z2 =
204
+ -2.0 * sqrtQ * std::cos ((theta + 2.0 * M_PI) * third) - alpha * third;
205
+ const amrex::Real Z3 =
206
+ -2.0 * sqrtQ * std::cos ((theta + 4.0 * M_PI) * third) - alpha * third;
208
207
Z = std::max (Z1, Z2);
209
208
Z = std::max (Z, Z3);
210
209
} else {
@@ -220,9 +219,9 @@ struct SRK
220
219
void Calc_d2AmdT2 (amrex::Real T, amrex::Real Y[], amrex::Real& d2AmdT2)
221
220
{
222
221
AMREX_ASSERT (T > 0.0 );
223
- amrex::Real oneOverT = 1.0 / T;
224
- amrex::Real tmp1 = -0.5 * oneOverT;
225
- amrex::Real sqrtT = std::sqrt (T);
222
+ const amrex::Real oneOverT = 1.0 / T;
223
+ const amrex::Real tmp1 = -0.5 * oneOverT;
224
+ const amrex::Real sqrtT = std::sqrt (T);
226
225
amrex::Real amloc[NUM_SPECIES];
227
226
amrex::Real amlocder[NUM_SPECIES];
228
227
@@ -254,16 +253,12 @@ struct SRK
254
253
amrex::Real& d2AmdT2)
255
254
{
256
255
AMREX_ASSERT (T > 0.0 );
257
- amrex::Real oneOverT = 1.0 / T;
258
- amrex::Real tmp1 = -0.5 * oneOverT;
259
- amrex::Real sqrtT = std::sqrt (T);
256
+ const amrex::Real oneOverT = 1.0 / T;
257
+ const amrex::Real tmp1 = -0.5 * oneOverT;
258
+ const amrex::Real sqrtT = std::sqrt (T);
260
259
amrex::Real amloc[NUM_SPECIES];
261
260
amrex::Real amlocder[NUM_SPECIES];
262
261
263
- am = 0.0 ;
264
- dAmdT = 0.0 ;
265
- d2AmdT2 = 0.0 ;
266
-
267
262
// Compute species-dependent intermediates
268
263
for (int ii = 0 ; ii < NUM_SPECIES; ii++) {
269
264
amloc[ii] =
0 commit comments