8
8
9
9
const std::string cond_name = " stellar" ;
10
10
11
- using namespace amrex ;
11
+ using namespace amrex ::literals ;
12
12
13
13
AMREX_FORCE_INLINE
14
14
void
@@ -50,86 +50,86 @@ actual_conductivity (T& state)
50
50
// iec = 4*e**4*me/(3*pi*hbar**3)
51
51
// xec = hbar/kerg*e*sqrt(4*pi/me)
52
52
53
- const Real third = 1 .0_rt/3 .0_rt;
54
- const Real twoth = 2 .0_rt * third;
53
+ const amrex:: Real third = 1 .0_rt/3 .0_rt;
54
+ const amrex:: Real twoth = 2 .0_rt * third;
55
55
56
- const Real zbound = 0 .1e0_rt;
57
- const Real t7peek = 1 .0e20_rt;
58
- const Real k2c = 4 .0_rt/3 .0_rt*C::a_rad*C::c_light;
59
- const Real meff = 1 .194648642401440e-10_rt;
60
- const Real weid = 6 .884326138694269e-5_rt;
61
- const Real iec = 1 .754582332329132e16_rt;
62
- const Real xec = 4 .309054377592449e-7_rt;
63
- const Real rt3 = 1 .7320508075688772e0_rt;
64
- const Real con2 = 1 .07726359439811217e-7_rt;
56
+ const amrex:: Real zbound = 0 .1e0_rt;
57
+ const amrex:: Real t7peek = 1 .0e20_rt;
58
+ const amrex:: Real k2c = 4 .0_rt/3 .0_rt*C::a_rad*C::c_light;
59
+ const amrex:: Real meff = 1 .194648642401440e-10_rt;
60
+ const amrex:: Real weid = 6 .884326138694269e-5_rt;
61
+ const amrex:: Real iec = 1 .754582332329132e16_rt;
62
+ const amrex:: Real xec = 4 .309054377592449e-7_rt;
63
+ const amrex:: Real rt3 = 1 .7320508075688772e0_rt;
64
+ const amrex:: Real con2 = 1 .07726359439811217e-7_rt;
65
65
66
66
// switches for the iben & christy regimes
67
- const Real t6_switch1 = 0 .5_rt;
68
- const Real t6_switch2 = 0 .9_rt;
67
+ const amrex:: Real t6_switch1 = 0 .5_rt;
68
+ const amrex:: Real t6_switch2 = 0 .9_rt;
69
69
70
70
// initialize
71
- Real opac = 0 .0e0_rt;
72
- Real orad = 0 .0e0_rt;
73
- Real ocond = 0 .0e0_rt;
74
- Real oiben1 = 0 .0e0_rt;
75
- Real oiben2 = 0 .0e0_rt;
76
- Real ochrs = 0 .0e0_rt;
77
- Real oh = 0 .0e0_rt;
78
- Real ov = 0 .0e0_rt;
79
- Real zbar = 0 .0e0_rt;
80
- Real ytot1 = 0 .0e0_rt;
71
+ amrex:: Real opac = 0 .0e0_rt;
72
+ amrex:: Real orad = 0 .0e0_rt;
73
+ amrex:: Real ocond = 0 .0e0_rt;
74
+ amrex:: Real oiben1 = 0 .0e0_rt;
75
+ amrex:: Real oiben2 = 0 .0e0_rt;
76
+ amrex:: Real ochrs = 0 .0e0_rt;
77
+ amrex:: Real oh = 0 .0e0_rt;
78
+ amrex:: Real ov = 0 .0e0_rt;
79
+ amrex:: Real zbar = 0 .0e0_rt;
80
+ amrex:: Real ytot1 = 0 .0e0_rt;
81
81
82
82
// set the composition variables
83
- Real w[6 ];
83
+ amrex:: Real w[6 ];
84
84
for (int i = 0 ; i < 6 ; i++) {
85
85
w[i] = 0 .0e0_rt;
86
86
}
87
87
88
88
// the idea here is that w[0] is H, w[1] is He, and w[2] is metals
89
89
for (int i = 0 ; i < NumSpec; i++) {
90
90
int iz = amrex::min (3 , amrex::max (1 , static_cast <int >(zion[i]))) - 1 ;
91
- Real ymass = state.xn [i]*aion_inv[i];
91
+ amrex:: Real ymass = state.xn [i]*aion_inv[i];
92
92
w[iz] += state.xn [i];
93
93
w[iz+3 ] += zion[i] * zion[i] * ymass;
94
94
zbar += zion[i] * ymass;
95
95
ytot1 += ymass;
96
96
}
97
- Real abar = 1 .0e0_rt/ytot1;
97
+ amrex:: Real abar = 1 .0e0_rt/ytot1;
98
98
zbar = zbar * abar;
99
- Real t6 = state.T * 1 .0e-6_rt;
99
+ amrex:: Real t6 = state.T * 1 .0e-6_rt;
100
100
101
- Real xh = w[0 ];
102
- Real xhe = w[1 ];
103
- Real xz = w[2 ];
101
+ amrex:: Real xh = w[0 ];
102
+ amrex:: Real xhe = w[1 ];
103
+ amrex:: Real xz = w[2 ];
104
104
105
105
// radiative section:
106
106
// from iben apj 196 525 1975
107
107
if (xh < 1 .0e-5_rt) {
108
- Real xmu = amrex::max (1 .0e-99_rt, w[3 ] + w[4 ] + w[5 ] - 1 .0e0_rt);
109
- Real xkc = std::pow ((2 .019e-4_rt * state.rho / std::pow (t6, 1 .7_rt)), 2 .425_rt);
110
- Real xkap = 1 .0_rt + xkc * (1 .0_rt + xkc/24 .55_rt);
111
- Real xkb = 3 .86_rt + 0 .252_rt*std::sqrt (xmu) + 0 .018_rt*xmu;
112
- Real xka = 3 .437_rt * (1 .25_rt + 0 .488_rt*std::sqrt (xmu) + 0 .092_rt*xmu);
113
- Real dbar = std::exp (-xka + xkb*std::log (t6));
108
+ amrex:: Real xmu = amrex::max (1 .0e-99_rt, w[3 ] + w[4 ] + w[5 ] - 1 .0e0_rt);
109
+ amrex:: Real xkc = std::pow ((2 .019e-4_rt * state.rho / std::pow (t6, 1 .7_rt)), 2 .425_rt);
110
+ amrex:: Real xkap = 1 .0_rt + xkc * (1 .0_rt + xkc/24 .55_rt);
111
+ amrex:: Real xkb = 3 .86_rt + 0 .252_rt*std::sqrt (xmu) + 0 .018_rt*xmu;
112
+ amrex:: Real xka = 3 .437_rt * (1 .25_rt + 0 .488_rt*std::sqrt (xmu) + 0 .092_rt*xmu);
113
+ amrex:: Real dbar = std::exp (-xka + xkb*std::log (t6));
114
114
oiben1 = xkap * std::pow (state.rho /dbar, 0 .67_rt);
115
115
}
116
116
117
117
if ( !((xh >= 1 .0e-5_rt) && (t6 < t6_switch1)) &&
118
118
!((xh < 1 .0e-5_rt) && (xz > zbound)) ) {
119
- Real d0log;
119
+ amrex:: Real d0log;
120
120
if (t6 > t6_switch1) {
121
121
d0log = -(3 .868_rt + 0 .806_rt*xh) + 1 .8_rt*std::log (t6);
122
122
} else {
123
123
d0log = -(3 .868_rt + 0 .806_rt*xh) + (3 .42_rt - 0 .52_rt*xh)*std::log (t6);
124
124
}
125
- Real xka1 = 2 .809_rt * std::exp (-(1 .74_rt - 0 .755_rt*xh)
125
+ amrex:: Real xka1 = 2 .809_rt * std::exp (-(1 .74_rt - 0 .755_rt*xh)
126
126
* amrex::Math::powi<2 >(std::log10 (t6) - 0 .22_rt + 0 .1375_rt*xh));
127
127
128
- Real xkw = 4 .05_rt * std::exp (-(0 .306_rt - 0 .04125_rt*xh)
128
+ amrex:: Real xkw = 4 .05_rt * std::exp (-(0 .306_rt - 0 .04125_rt*xh)
129
129
* amrex::Math::powi<2 >(std::log10 (t6) - 0 .18_rt + 0 .1625_rt*xh));
130
- Real xkaz = 50 .0_rt*xz*xka1 * std::exp (-0 .5206_rt*amrex::Math::powi<2 >((std::log (state.rho )-d0log)/xkw));
131
- Real dbar2log = -(4 .283_rt + 0 .7196_rt*xh) + 3 .86_rt*std::log (t6);
132
- Real dbar1log = -5 .296_rt + 4 .833_rt*std::log (t6);
130
+ amrex:: Real xkaz = 50 .0_rt*xz*xka1 * std::exp (-0 .5206_rt*amrex::Math::powi<2 >((std::log (state.rho )-d0log)/xkw));
131
+ amrex:: Real dbar2log = -(4 .283_rt + 0 .7196_rt*xh) + 3 .86_rt*std::log (t6);
132
+ amrex:: Real dbar1log = -5 .296_rt + 4 .833_rt*std::log (t6);
133
133
if (dbar2log < dbar1log) {
134
134
dbar1log = dbar2log;
135
135
}
@@ -138,20 +138,20 @@ actual_conductivity (T& state)
138
138
139
139
// from christy apj 144 108 1966
140
140
if ((t6 < t6_switch2) && (xh >= 1 .0e-5_rt)) {
141
- Real t4 = state.T * 1 .0e-4_rt;
142
- Real t4r = std::sqrt (t4);
143
- Real t44 = t4*t4*t4*t4;
144
- Real t45 = t44 * t4;
145
- Real t46 = t45 * t4;
146
- Real ck1 = 2 .0e6_rt/t44 + 2 .1_rt*t46;
147
- Real ck3 = 4 .0e-3_rt/t44 + 2 .0e-4_rt/std::pow (state.rho , 0 .25_rt);
148
- Real ck2 = 4 .5_rt*t46 + 1 .0_rt/(t4*ck3);
149
- Real ck4 = 1 .4e3_rt*t4 + t46;
150
- Real ck5 = 1 .0e6_rt + 0 .1_rt*t46;
151
- Real ck6 = 20 .0_rt*t4 + 5 .0_rt*t44 + t45;
152
- Real xkcx = xh*(t4r/ck1 + 1 .0_rt/ck2);
153
- Real xkcy = xhe*(1 .0_rt/ck4 + 1 .5_rt/ck5);
154
- Real xkcz = xz*(t4r/ck6);
141
+ amrex:: Real t4 = state.T * 1 .0e-4_rt;
142
+ amrex:: Real t4r = std::sqrt (t4);
143
+ amrex:: Real t44 = t4*t4*t4*t4;
144
+ amrex:: Real t45 = t44 * t4;
145
+ amrex:: Real t46 = t45 * t4;
146
+ amrex:: Real ck1 = 2 .0e6_rt/t44 + 2 .1_rt*t46;
147
+ amrex:: Real ck3 = 4 .0e-3_rt/t44 + 2 .0e-4_rt/std::pow (state.rho , 0 .25_rt);
148
+ amrex:: Real ck2 = 4 .5_rt*t46 + 1 .0_rt/(t4*ck3);
149
+ amrex:: Real ck4 = 1 .4e3_rt*t4 + t46;
150
+ amrex:: Real ck5 = 1 .0e6_rt + 0 .1_rt*t46;
151
+ amrex:: Real ck6 = 20 .0_rt*t4 + 5 .0_rt*t44 + t45;
152
+ amrex:: Real xkcx = xh*(t4r/ck1 + 1 .0_rt/ck2);
153
+ amrex:: Real xkcy = xhe*(1 .0_rt/ck4 + 1 .5_rt/ck5);
154
+ amrex:: Real xkcz = xz*(t4r/ck6);
155
155
ochrs = state.pele * (xkcx + xkcy + xkcz);
156
156
}
157
157
@@ -175,30 +175,30 @@ actual_conductivity (T& state)
175
175
}
176
176
177
177
// add in the compton scattering opacity, weaver et al. apj 1978 225 1021
178
- Real th = amrex::min (511 .0_rt, state.T * 8 .617e-8_rt);
179
- Real fact = 1 .0_rt + 2 .75e-2_rt*th - 4 .88e-5_rt*th*th;
180
- Real facetax = 1 .0e100_rt;
178
+ amrex:: Real th = amrex::min (511 .0_rt, state.T * 8 .617e-8_rt);
179
+ amrex:: Real fact = 1 .0_rt + 2 .75e-2_rt*th - 4 .88e-5_rt*th*th;
180
+ amrex:: Real facetax = 1 .0e100_rt;
181
181
if (state.eta <= 500 .0_rt) {
182
182
facetax = std::exp (0 .522e0_rt*state.eta - 1 .563_rt);
183
183
}
184
- Real faceta = 1 .0_rt + facetax;
185
- Real ocompt = 6 .65205e-25_rt/(fact * faceta) * state.xne /state.rho ;
184
+ amrex:: Real faceta = 1 .0_rt + facetax;
185
+ amrex:: Real ocompt = 6 .65205e-25_rt/(fact * faceta) * state.xne /state.rho ;
186
186
orad += ocompt;
187
187
188
188
// cutoff radiative opacity when 4kt/hbar is less than the plasma
189
189
// frequency
190
- Real tcut = con2 * std::sqrt (state.xne );
190
+ amrex:: Real tcut = con2 * std::sqrt (state.xne );
191
191
if (state.T < tcut) {
192
192
if (tcut > 200 .0_rt*state.T ) {
193
193
orad = orad * 2 .658e86_rt;
194
194
} else {
195
- Real cutfac = std::exp (tcut/state.T - 1 .0_rt);
195
+ amrex:: Real cutfac = std::exp (tcut/state.T - 1 .0_rt);
196
196
orad = orad * cutfac;
197
197
}
198
198
}
199
199
200
200
// fudge molecular opacity for low temps
201
- Real xkf = t7peek * state.rho * amrex::Math::powi<4 >(state.T * 1 .0e-7_rt);
201
+ amrex:: Real xkf = t7peek * state.rho * amrex::Math::powi<4 >(state.T * 1 .0e-7_rt);
202
202
orad = xkf * orad/(xkf + orad);
203
203
204
204
@@ -209,31 +209,31 @@ actual_conductivity (T& state)
209
209
// drelim, use the non-degenerate formulas. in between drel and drelim,
210
210
// apply a smooth blending of the two.
211
211
212
- Real dlog10 = std::log10 (state.rho );
212
+ amrex:: Real dlog10 = std::log10 (state.rho );
213
213
214
- Real drel = 2 .4e-7_rt * zbar/abar * state.T * std::sqrt (state.T );
214
+ amrex:: Real drel = 2 .4e-7_rt * zbar/abar * state.T * std::sqrt (state.T );
215
215
if (state.T <= 1 .0e5_rt) {
216
216
drel = drel * 15 .0_rt;
217
217
}
218
- Real drel10 = std::log10 (drel);
219
- Real drelim = drel10 + 1 .0_rt;
218
+ amrex:: Real drel10 = std::log10 (drel);
219
+ amrex:: Real drelim = drel10 + 1 .0_rt;
220
220
221
221
// from iben apj 196 525 1975 for non-degenerate regimes
222
222
if (dlog10 < drelim) {
223
- Real zdel = state.xne /(C::n_A*t6*std::sqrt (t6));
224
- Real zdell10 = std::log10 (zdel);
225
- Real eta0 = std::exp (-1 .20322_rt + twoth * std::log (zdel));
226
- Real eta02 = eta0*eta0;
223
+ amrex:: Real zdel = state.xne /(C::n_A*t6*std::sqrt (t6));
224
+ amrex:: Real zdell10 = std::log10 (zdel);
225
+ amrex:: Real eta0 = std::exp (-1 .20322_rt + twoth * std::log (zdel));
226
+ amrex:: Real eta02 = eta0*eta0;
227
227
228
228
// thpl factor
229
- Real thpl;
229
+ amrex:: Real thpl;
230
230
if (zdell10 < 0 .645_rt) {
231
231
thpl = -7 .5668_rt + std::log (zdel * (1 .0_rt + 0 .024417_rt*zdel));
232
232
} else {
233
233
if (zdell10 < 2 .5_rt) {
234
234
thpl = -7 .58110_rt + std::log (zdel*(1 .0_rt + 0 .02804_rt*zdel));
235
235
if (zdell10 >= 2 .0_rt) {
236
- Real thpla = thpl;
236
+ amrex:: Real thpla = thpl;
237
237
thpl = -11 .0742_rt + std::log (zdel*zdel * (1 .0_rt + 9 .376_rt/eta02));
238
238
thpl = 2 .0_rt*((2 .5_rt-zdell10)*thpla + (zdell10-2 .0_rt)*thpl);
239
239
}
@@ -243,33 +243,33 @@ actual_conductivity (T& state)
243
243
}
244
244
245
245
// pefac and walf factors
246
- Real pefac;
246
+ amrex:: Real pefac;
247
247
if (zdell10 < 2 .0_rt) {
248
248
pefac = 1 .0_rt + 0 .021876_rt*zdel;
249
249
if (zdell10 > 1 .5_rt) {
250
- Real pefacal = std::log (pefac);
251
- Real pefacl = std::log (0 .4_rt * eta0 + 1 .64496_rt/eta0);
252
- Real cfac1 = 2 .0_rt - zdell10;
253
- Real cfac2 = zdell10 - 1 .5_rt;
250
+ amrex:: Real pefacal = std::log (pefac);
251
+ amrex:: Real pefacl = std::log (0 .4_rt * eta0 + 1 .64496_rt/eta0);
252
+ amrex:: Real cfac1 = 2 .0_rt - zdell10;
253
+ amrex:: Real cfac2 = zdell10 - 1 .5_rt;
254
254
pefac = std::exp (2 .0_rt * (cfac1*pefacal + cfac2*pefacl));
255
255
}
256
256
} else {
257
257
pefac = 0 .4_rt * eta0 + 1 .64496_rt/eta0;
258
258
}
259
259
260
- Real dnefac;
260
+ amrex:: Real dnefac;
261
261
if (zdel < 40 .0_rt) {
262
262
dnefac = 1 .0_rt + zdel * (3 .4838e-4_rt * zdel - 2 .8966e-2_rt);
263
263
} else {
264
264
dnefac = 1 .5_rt/eta0 * (1 .0_rt - 0 .8225_rt/eta02);
265
265
}
266
- Real wpar2 = 9 .24735e-3_rt * zdel *
266
+ amrex:: Real wpar2 = 9 .24735e-3_rt * zdel *
267
267
(state.rho *C::n_A*(w[3 ]+w[4 ]+w[5 ])/state.xne + dnefac)/(std::sqrt (t6)*pefac);
268
- Real walf = 0 .5_rt * std::log (wpar2);
269
- Real walf10 = 0 .5_rt * std::log10 (wpar2);
268
+ amrex:: Real walf = 0 .5_rt * std::log (wpar2);
269
+ amrex:: Real walf10 = 0 .5_rt * std::log10 (wpar2);
270
270
271
271
// thx, thy and thc factors
272
- Real thx;
272
+ amrex:: Real thx;
273
273
if (walf10 <= -3 .0_rt) {
274
274
thx = std::exp (2 .413_rt - 0 .124_rt*walf);
275
275
} else if (walf10 <= -1 .0_rt) {
@@ -278,7 +278,7 @@ actual_conductivity (T& state)
278
278
thx = std::exp (0 .426_rt - 0 .558_rt*walf);
279
279
}
280
280
281
- Real thy;
281
+ amrex:: Real thy;
282
282
if (walf10 <= -3 .0_rt) {
283
283
thy = std::exp (2 .158_rt - 0 .111_rt*walf);
284
284
} else if (walf10 <= 0 .0_rt) {
@@ -287,7 +287,7 @@ actual_conductivity (T& state)
287
287
thy = std::exp (0 .553_rt - 0 .6_rt*walf);
288
288
}
289
289
290
- Real thc;
290
+ amrex:: Real thc;
291
291
if (walf10 <= -2 .5_rt) {
292
292
thc = std::exp (2 .924_rt - 0 .1_rt*walf);
293
293
} else if (walf10 <= 0 .5_rt) {
@@ -302,41 +302,41 @@ actual_conductivity (T& state)
302
302
// from yakovlev & urpin soviet astro 1980 24 303 and
303
303
// potekhin et al. 1997 aa 323 415 for degenerate regimes
304
304
if (dlog10 > drel10) {
305
- Real xmas = meff * std::pow (state.xne , third);
306
- Real ymas = std::sqrt (1 .0_rt + xmas*xmas);
307
- Real wfac = weid * state.T /ymas * state.xne ;
308
- Real cint = 1 .0_rt;
305
+ amrex:: Real xmas = meff * std::pow (state.xne , third);
306
+ amrex:: Real ymas = std::sqrt (1 .0_rt + xmas*xmas);
307
+ amrex:: Real wfac = weid * state.T /ymas * state.xne ;
308
+ amrex:: Real cint = 1 .0_rt;
309
309
310
310
// ion-electron collision frequency and the thermal conductivity
311
- Real vie = iec * zbar * ymas * cint;
312
- Real cie = wfac/vie;
311
+ amrex:: Real vie = iec * zbar * ymas * cint;
312
+ amrex:: Real cie = wfac/vie;
313
313
314
314
// electron-electron collision frequency and thermal conductivity
315
- Real tpe = xec * std::sqrt (state.xne /ymas);
316
- Real yg = rt3 * tpe/state.T ;
317
- Real xrel = 1 .009_rt * std::pow (zbar/abar * state.rho * 1 .0e-6_rt, third);
318
- Real beta2 = xrel*xrel/(1 .0_rt + xrel*xrel);
319
- Real jy = (1 .0_rt + 6 .0_rt/(5 .0_rt*xrel*xrel) + 2 .0_rt/(5 .0_rt*xrel*xrel*xrel*xrel))
315
+ amrex:: Real tpe = xec * std::sqrt (state.xne /ymas);
316
+ amrex:: Real yg = rt3 * tpe/state.T ;
317
+ amrex:: Real xrel = 1 .009_rt * std::pow (zbar/abar * state.rho * 1 .0e-6_rt, third);
318
+ amrex:: Real beta2 = xrel*xrel/(1 .0_rt + xrel*xrel);
319
+ amrex:: Real jy = (1 .0_rt + 6 .0_rt/(5 .0_rt*xrel*xrel) + 2 .0_rt/(5 .0_rt*xrel*xrel*xrel*xrel))
320
320
* ( yg*yg*yg / (3 .0_rt * amrex::Math::powi<3 >(1 .0_rt + 0 .07414_rt * yg))
321
321
* std::log ((2 .81_rt - 0 .810_rt*beta2 + yg)/yg)
322
322
+ std::pow (M_PI, 5 /6 .0_rt) * amrex::Math::powi<4 >(yg/(13 .91_rt + yg)));
323
- Real vee = 0 .511_rt * state.T *state.T * xmas/(ymas*ymas) * std::sqrt (xmas/ymas) * jy;
324
- Real cee = wfac/vee;
323
+ amrex:: Real vee = 0 .511_rt * state.T *state.T * xmas/(ymas*ymas) * std::sqrt (xmas/ymas) * jy;
324
+ amrex:: Real cee = wfac/vee;
325
325
326
326
// total electron thermal conductivity and conversion to an opacity
327
- Real ov1 = cie * cee/(cee + cie);
327
+ amrex:: Real ov1 = cie * cee/(cee + cie);
328
328
ov = k2c/(ov1*state.rho ) * state.T *state.T *state.T ;
329
329
}
330
330
331
331
// blend the opacities in the intermediate region
332
332
if (dlog10 <= drel10) {
333
333
ocond = oh;
334
334
} else if (dlog10 > drel10 && dlog10 < drelim) {
335
- Real x = state.rho ;
336
- Real x1 = std::pow (10 .0_rt, drel10);
337
- Real x2 = std::pow (10 .0_rt, drelim);
338
- Real alfa = (x-x2)/(x1-x2);
339
- Real beta = (x-x1)/(x2-x1);
335
+ amrex:: Real x = state.rho ;
336
+ amrex:: Real x1 = std::pow (10 .0_rt, drel10);
337
+ amrex:: Real x2 = std::pow (10 .0_rt, drelim);
338
+ amrex:: Real alfa = (x-x2)/(x1-x2);
339
+ amrex:: Real beta = (x-x1)/(x2-x1);
340
340
ocond = alfa*oh + beta*ov;
341
341
} else if (dlog10 >= drelim) {
342
342
ocond = ov;
0 commit comments