1
2 subroutine sneut(temp,den,abar,zbar,
3 1 1 snu,dsnudt,dsnudd,dsnuda,dsnudz)
4 implicit none
5 save
6
7
8c..this routine computes neutrino losses from the analytic fits of
9c..itoh et al. apjs 102, 411, 1996, and also returns their derivatives.
10
11
12c..input:
13c..temp = temperature
14c..den = density
15c..abar = mean atomic weight
16c..zbar = mean charge
17
18
19c..output:
20c..snu = total neutrino loss rate in erg/g/sec
21c..dsnudt = derivative of snu with temperature
22c..dsnudd = derivative of snu with density
23c..dsnuda = derivative of snu with abar
24c..dsnudz = derivative of snu with zbar
25
26
27
28c..declare the pass
29 double precision temp,den,abar,zbar,
30 1 1 snu,dsnudt,dsnudd,dsnuda,dsnudz
31
32
33c..local variables
34c integer i
35 double precision spair,spairdt,spairdd,spairda,spairdz,
36 1 1 splas,splasdt,splasdd,splasda,splasdz,
37 2 2 sphot,sphotdt,sphotdd,sphotda,sphotdz,
38 3 3 sbrem,sbremdt,sbremdd,sbremda,sbremdz,
39 4 4 sreco,srecodt,srecodd,srecoda,srecodz
40
41
42 double precision t9,xl,xldt,xlp5,xl2,xl3,xl4,xl5,xl6,xl7,xl8,xl9,
43 1 1 xlmp5,xlm1,xlm2,xlm3,xlm4,xlnt,cc,den6,tfermi,
44 2 2 a0,a1,a2,a3,b1,b2,c00,c01,c02,c03,c04,c05,c06, ! b3
45 3 3 c10,c11,c12,c13,c14,c15,c16,c20,c21,c22,c23,c24,
46 4 4 c25,c26,dd00,dd01,dd02,dd03,dd04,dd05,dd11,dd12,
47 5 5 dd13,dd14,dd15,dd21,dd22,dd23,dd24,dd25,b,c,d,f0,
48 6 6 f1,deni,tempi,abari,zbari,f2,f3,z,xmue,ye,
49 7 7 dum,dumdt,dumdd,dumda,dumdz, ! rp1,rn1
50 8 8 gum,gumdt,gumdd,gumda,gumdz
51
52
53
54c..pair production
55 double precision rm,rmdd,rmda,rmdz,rmi,gl,gldt,
56 1 1 zeta,zetadt,zetadd,zetada,zetadz,zeta2,zeta3,
57 2 2 xnum,xnumdt,xnumdd,xnumda,xnumdz,
58 3 3 xden,xdendt,xdendd,xdenda,xdendz,
59 4 4 fpair,fpairdt,fpairdd,fpairda,fpairdz,
60 5 5 qpair,qpairdt,qpairdd,qpairda,qpairdz
61
62
63c..plasma
64 double precision gl2,gl2dt,gl2dd,gl2da,gl2dz,gl12,gl32,gl72,gl6,
65 1 1 ft,ftdt,ftdd,ftda,ftdz,fl,fldt,fldd,flda,fldz,
66 2 2 fxy,fxydt,fxydd,fxyda,fxydz
67
68
69c..photo
70 double precision tau,taudt,cos1,cos2,cos3,cos4,cos5,sin1,sin2,
71 1 1 sin3,sin4,sin5,last,xast,
72 2 2 fphot,fphotdt,fphotdd,fphotda,fphotdz,
73 3 3 qphot,qphotdt,qphotdd,qphotda,qphotdz
74
75
76c..brem
77 double precision t8,t812,t832,t82,t83,t85,t86,t8m1,t8m2,t8m3,t8m5,
78 1 1 t8m6,
79 2 2 eta,etadt,etadd,etada,etadz,etam1,etam2,etam3,
80 3 3 fbrem,fbremdt,fbremdd,fbremda,fbremdz,
81 4 4 gbrem,gbremdt,gbremdd,gbremda,gbremdz,
82 5 5 u,gm1,gm2,gm13,gm23,gm43,gm53,v,w,fb,gt,gb,
83 6 6 fliq,fliqdt,fliqdd,fliqda,fliqdz,
84 7 7 gliq,gliqdt,gliqdd,gliqda,gliqdz
85
86
87c..recomb
88 double precision ifermi12,zfermim12,nu,nudt,nudd,nuda,nudz,
89 1 1 nu2,nu3,bigj,bigjdt,bigjdd,bigjda,bigjdz
90
91
92
93
94c..numerical constants
95 double precision pi,fac1,fac2,fac3,oneth,twoth,con1,sixth,iln10
96 parameter (pi = 3.1415926535897932384d0,
97 1 1 fac1 = 5.0d0 * pi / 3.0d0,
98 2 2 fac2 = 10.0d0 * pi,
99 3 3 fac3 = pi / 5.0d0,
100 4 4 oneth = 1.0d0/3.0d0,
101 5 5 twoth = 2.0d0/3.0d0,
102 6 6 con1 = 1.0d0/5.9302d0,
103 7 7 sixth = 1.0d0/6.0d0,
104 8 8 iln10 = 4.342944819032518d-1)
105
106
107
108c..theta is sin**2(theta_weinberg) = 0.2319 plus/minus 0.00005 (1996)
109c..xnufam is the number of neutrino flavors = 3.02 plus/minus 0.005 (1998)
110c..change theta and xnufam if need be, and the changes will automatically
111c..propagate through the routine. cv and ca are the vector and axial currents.
112
113
114 double precision theta,xnufam,cv,ca,cvp,cap,tfac1,tfac2,tfac3,
115 1 1 tfac4,tfac5,tfac6
116 parameter (theta = 0.2319d0,
117 1 1 xnufam = 3.0d0,
118 2 2 cv = 0.5d0 + 2.0d0 * theta,
119 3 3 cvp = 1.0d0 - cv,
120 4 4 ca = 0.5d0,
121 5 5 cap = 1.0d0 - ca,
122 6 6 tfac1 = cv*cv + ca*ca +
123 7 7 (xnufam-1.0d0) * (cvp*cvp+cap*cap),
124 8 8 tfac2 = cv*cv - ca*ca +
125 9 9 (xnufam-1.0d0) * (cvp*cvp - cap-cap),
126 & & tfac3 = tfac2/tfac1,
127 1 1 tfac4 = 0.5d0 * tfac1,
128 2 2 tfac5 = 0.5d0 * tfac2,
129 3 3 tfac6 = cv*cv + 1.5d0*ca*ca + (xnufam - 1.0d0)*
130 4 4 (cvp*cvp + 1.5d0*cap*cap))
131
132
133
134
135c..initialize
136
137 spair = 0.0d0
138 spairdt = 0.0d0
139 spairdd = 0.0d0
140 spairda = 0.0d0
141 spairdz = 0.0d0
142
143
144 splas = 0.0d0
145 splasdt = 0.0d0
146 splasdd = 0.0d0
147 splasda = 0.0d0
148 splasdz = 0.0d0
149
150
151 sphot = 0.0d0
152 sphotdt = 0.0d0
153 sphotdd = 0.0d0
154 sphotda = 0.0d0
155 sphotdz = 0.0d0
156
157
158 sbrem = 0.0d0
159 sbremdt = 0.0d0
160 sbremdd = 0.0d0
161 sbremda = 0.0d0
162 sbremdz = 0.0d0
163
164
165 sreco = 0.0d0
166 srecodt = 0.0d0
167 srecodd = 0.0d0
168 srecoda = 0.0d0
169 srecodz = 0.0d0
170
171
172 snu = 0.0d0
173 dsnudt = 0.0d0
174 dsnudd = 0.0d0
175 dsnuda = 0.0d0
176 dsnudz = 0.0d0
177
178
179 if (temp .lt. 1.0e7) return
180
181
182
183c..to avoid lots of divisions
184 deni = 1.0d0/den
185 tempi = 1.0d0/temp
186 abari = 1.0d0/abar
187 zbari = 1.0d0/zbar
188
189
190
191c..some composition variables
192 ye = zbar*abari
193 xmue = abar*zbari
194
195
196
197
198
199c..some frequent factors
200 t9 = temp * 1.0d-9
201 xl = t9 * con1
202 xldt = 1.0d-9 * con1
203 xlp5 = sqrt(xl)
204 xl2 = xl*xl
205 xl3 = xl2*xl
206 xl4 = xl3*xl
207 xl5 = xl4*xl
208 xl6 = xl5*xl
209 xl7 = xl6*xl
210 xl8 = xl7*xl
211 xl9 = xl8*xl
212 xlmp5 = 1.0d0/xlp5
213 xlm1 = 1.0d0/xl
214 xlm2 = xlm1*xlm1
215 xlm3 = xlm1*xlm2
216 xlm4 = xlm1*xlm3
217
218
219 rm = den*ye
220 rmdd = ye
221 rmda = -rm*abari
222 rmdz = den*abari
223 rmi = 1.0d0/rm
224
225
226 a0 = rm * 1.0d-9
227 a1 = a0**oneth
228 zeta = a1 * xlm1
229 zetadt = -a1 * xlm2 * xldt
230 a2 = oneth * a1*rmi * xlm1
231 zetadd = a2 * rmdd
232 zetada = a2 * rmda
233 zetadz = a2 * rmdz
234
235 zeta2 = zeta * zeta
236 zeta3 = zeta2 * zeta
237
238
239
240
241
242c..pair neutrino section
243c..for reactions like e+ + e- => nu_e + nubar_e
244
245
246c..equation 2.8
247 gl = 1.0d0 - 13.04d0*xl2 +133.5d0*xl4 +1534.0d0*xl6 +918.6d0*xl8
248 gldt = xldt*(-26.08d0*xl +534.0d0*xl3 +9204.0d0*xl5 +7348.8d0*xl7)
249
250
251c..equation 2.7
252
253
254 a1 = 6.002d19 + 2.084d20*zeta + 1.872d21*zeta2
255 a2 = 2.084d20 + 2.0d0*1.872d21*zeta
256
257
258 if (t9 .lt. 10.0) then
259 b1 = exp(-5.5924d0*zeta)
260 b2 = -b1*5.5924d0
261 else
262 b1 = exp(-4.9924d0*zeta)
263 b2 = -b1*4.9924d0
264 end if
265
266 xnum = a1 * b1
267 c = a2*b1 + a1*b2
268 xnumdt = c*zetadt
269 xnumdd = c*zetadd
270 xnumda = c*zetada
271 xnumdz = c*zetadz
272
273
274 if (t9 .lt. 10.0) then
275 a1 = 9.383d-1*xlm1 - 4.141d-1*xlm2 + 5.829d-2*xlm3
276 a2 = -9.383d-1*xlm2 + 2.0d0*4.141d-1*xlm3 - 3.0d0*5.829d-2*xlm4
277 else
278 a1 = 1.2383d0*xlm1 - 8.141d-1*xlm2
279 a2 = -1.2383d0*xlm2 + 2.0d0*8.141d-1*xlm3
280 end if
281
282
283 b1 = 3.0d0*zeta2
284
285
286 xden = zeta3 + a1
287 xdendt = b1*zetadt + a2*xldt
288 xdendd = b1*zetadd
289 xdenda = b1*zetada
290 xdendz = b1*zetadz
291
292
293 a1 = 1.0d0/xden
294 fpair = xnum*a1
295 fpairdt = (xnumdt - fpair*xdendt)*a1
296 fpairdd = (xnumdd - fpair*xdendd)*a1
297 fpairda = (xnumda - fpair*xdenda)*a1
298 fpairdz = (xnumdz - fpair*xdendz)*a1
299
300
301
302c..equation 2.6
303 a1 = 10.7480d0*xl2 + 0.3967d0*xlp5 + 1.005d0
304 a2 = xldt*(2.0d0*10.7480d0*xl + 0.5d0*0.3967d0*xlmp5)
305 xnum = 1.0d0/a1
306 xnumdt = -xnum*xnum*a2
307
308
309 a1 = 7.692d7*xl3 + 9.715d6*xlp5
310 a2 = xldt*(3.0d0*7.692d7*xl2 + 0.5d0*9.715d6*xlmp5)
311
312
313 c = 1.0d0/a1
314 b1 = 1.0d0 + rm*c
315
316
317 xden = b1**(-0.3d0)
318
319
320 d = -0.3d0*xden/b1
321 xdendt = -d*rm*c*c*a2
322 xdendd = d*rmdd*c
323 xdenda = d*rmda*c
324 xdendz = d*rmdz*c
325
326
327 qpair = xnum*xden
328 qpairdt = xnumdt*xden + xnum*xdendt
329 qpairdd = xnum*xdendd
330 qpairda = xnum*xdenda
331 qpairdz = xnum*xdendz
332
333
334
335
336c..equation 2.5
337 a1 = exp(-2.0d0*xlm1)
338 a2 = a1*2.0d0*xlm2*xldt
339
340
341 spair = a1*fpair
342 spairdt = a2*fpair + a1*fpairdt
343 spairdd = a1*fpairdd
344 spairda = a1*fpairda
345 spairdz = a1*fpairdz
346
347
348 a1 = spair
349 spair = gl*a1
350 spairdt = gl*spairdt + gldt*a1
351 spairdd = gl*spairdd
352 spairda = gl*spairda
353 spairdz = gl*spairdz
354
355
356 a1 = tfac4*(1.0d0 + tfac3 * qpair)
357 a2 = tfac4*tfac3
358
359
360 a3 = spair
361 spair = a1*a3
362 spairdt = a1*spairdt + a2*qpairdt*a3
363 spairdd = a1*spairdd + a2*qpairdd*a3
364 spairda = a1*spairda + a2*qpairda*a3
365 spairdz = a1*spairdz + a2*qpairdz*a3
366
367
368
369
370
371c..plasma neutrino section
372c..for collective reactions like gamma_plasmon => nu_e + nubar_e
373c..equation 4.6
374
375
376 a1 = 1.019d-6*rm
377 a2 = a1**twoth
378 a3 = twoth*a2/a1
379
380
381 b1 = sqrt(1.0d0 + a2)
382 b2 = 1.0d0/b1
383
384 c00 = 1.0d0/(temp*temp*b1)
385
386
387 gl2 = 1.1095d11 * rm * c00
388
389
390 gl2dt = -2.0d0*gl2*tempi
391 d = rm*c00*b2*0.5d0*b2*a3*1.019d-6
392 gl2dd = 1.1095d11 * (rmdd*c00 - d*rmdd)
393 gl2da = 1.1095d11 * (rmda*c00 - d*rmda)
394 gl2dz = 1.1095d11 * (rmdz*c00 - d*rmdz)
395
396
397
398 gl = sqrt(gl2)
399 gl12 = sqrt(gl)
400 gl32 = gl * gl12
401 gl72 = gl2 * gl32
402 gl6 = gl2 * gl2 * gl2
403
404
405
406c..equation 4.7
407 ft = 2.4d0 + 0.6d0*gl12 + 0.51d0*gl + 1.25d0*gl32
408 gum = 1.0d0/gl2
409 a1 =(0.25d0*0.6d0*gl12 +0.5d0*0.51d0*gl +0.75d0*1.25d0*gl32)*gum
410 ftdt = a1*gl2dt
411 ftdd = a1*gl2dd
412 ftda = a1*gl2da
413 ftdz = a1*gl2dz
414
415
416
417c..equation 4.8
418 a1 = 8.6d0*gl2 + 1.35d0*gl72
419 a2 = 8.6d0 + 1.75d0*1.35d0*gl72*gum
420
421
422 b1 = 225.0d0 - 17.0d0*gl + gl2
423 b2 = -0.5d0*17.0d0*gl*gum + 1.0d0
424
425
426 c = 1.0d0/b1
427 fl = a1*c
428
429
430 d = (a2 - fl*b2)*c
431 fldt = d*gl2dt
432 fldd = d*gl2dd
433 flda = d*gl2da
434 fldz = d*gl2dz
435
436
437
438c..equation 4.9 and 4.10
439 cc = log10(2.0d0*rm)
440 xlnt = log10(temp)
441
442
443 xnum = sixth * (17.5d0 + cc - 3.0d0*xlnt)
444 xnumdt = -iln10*0.5d0*tempi
445 a2 = iln10*sixth*rmi
446 xnumdd = a2*rmdd
447 xnumda = a2*rmda
448 xnumdz = a2*rmdz
449
450
451 xden = sixth * (-24.5d0 + cc + 3.0d0*xlnt)
452 xdendt = iln10*0.5d0*tempi
453 xdendd = a2*rmdd
454 xdenda = a2*rmda
455 xdendz = a2*rmdz
456
457
458
459c..equation 4.11
460 if (abs(xnum) .gt. 0.7d0 .or. xden .lt. 0.0d0) then
461 fxy = 1.0d0
462 fxydt = 0.0d0
463 fxydd = 0.0d0
464 fxydz = 0.0d0
465 fxyda = 0.0d0
466
467
468 else
469
470
471 a1 = 0.39d0 - 1.25d0*xnum - 0.35d0*sin(4.5d0*xnum)
472 a2 = -1.25d0 - 4.5d0*0.35d0*cos(4.5d0*xnum)
473
474
475 b1 = 0.3d0 * exp(-1.0d0*(4.5d0*xnum + 0.9d0)**2)
476 b2 = -b1*2.0d0*(4.5d0*xnum + 0.9d0)*4.5d0
477
478
479 c = min(0.0d0, xden - 1.6d0 + 1.25d0*xnum)
480 if (c .eq. 0.0) then
481 dumdt = 0.0d0
482 dumdd = 0.0d0
483 dumda = 0.0d0
484 dumdz = 0.0d0
485 else
486 dumdt = xdendt + 1.25d0*xnumdt
487 dumdd = xdendd + 1.25d0*xnumdd
488 dumda = xdenda + 1.25d0*xnumda
489 dumdz = xdendz + 1.25d0*xnumdz
490 end if
491
492
493 d = 0.57d0 - 0.25d0*xnum
494 a3 = c/d
495 c00 = exp(-1.0d0*a3**2)
496
497
498 f1 = -c00*2.0d0*a3/d
499 c01 = f1*(dumdt + a3*0.25d0*xnumdt)
500 c02 = f1*(dumdd + a3*0.25d0*xnumdd)
501 c03 = f1*(dumda + a3*0.25d0*xnumda)
502 c04 = f1*(dumdz + a3*0.25d0*xnumdz)
503
504
505 fxy = 1.05d0 + (a1 - b1)*c00
506 fxydt = (a2*xnumdt - b2*xnumdt)*c00 + (a1-b1)*c01
507 fxydd = (a2*xnumdd - b2*xnumdd)*c00 + (a1-b1)*c02
508 fxyda = (a2*xnumda - b2*xnumda)*c00 + (a1-b1)*c03
509 fxydz = (a2*xnumdz - b2*xnumdz)*c00 + (a1-b1)*c04
510
511
512 end if
513
514
515
516
517c..equation 4.1 and 4.5
518 splas = (ft + fl) * fxy
519 splasdt = (ftdt + fldt)*fxy + (ft+fl)*fxydt
520 splasdd = (ftdd + fldd)*fxy + (ft+fl)*fxydd
521 splasda = (ftda + flda)*fxy + (ft+fl)*fxyda
522 splasdz = (ftdz + fldz)*fxy + (ft+fl)*fxydz
523
524
525 a2 = exp(-gl)
526 a3 = -0.5d0*a2*gl*gum
527
528
529 a1 = splas
530 splas = a2*a1
531 splasdt = a2*splasdt + a3*gl2dt*a1
532 splasdd = a2*splasdd + a3*gl2dd*a1
533 splasda = a2*splasda + a3*gl2da*a1
534 splasdz = a2*splasdz + a3*gl2dz*a1
535
536
537 a2 = gl6
538 a3 = 3.0d0*gl6*gum
539
540
541 a1 = splas
542 splas = a2*a1
543 splasdt = a2*splasdt + a3*gl2dt*a1
544 splasdd = a2*splasdd + a3*gl2dd*a1
545 splasda = a2*splasda + a3*gl2da*a1
546 splasdz = a2*splasdz + a3*gl2dz*a1
547
548
549
550 a2 = 0.93153d0 * 3.0d21 * xl9
551 a3 = 0.93153d0 * 3.0d21 * 9.0d0*xl8*xldt
552
553
554 a1 = splas
555 splas = a2*a1
556 splasdt = a2*splasdt + a3*a1
557 splasdd = a2*splasdd
558 splasda = a2*splasda
559 splasdz = a2*splasdz
560
561
562
563
564
565c..photoneutrino process section
566c..for reactions like e- + gamma => e- + nu_e + nubar_e
567c.. e+ + gamma => e+ + nu_e + nubar_e
568c..equation 3.8 for tau, equation 3.6 for cc,
569c..and table 2 written out for speed
570 if (temp .ge. 1.0d7 .and. temp .lt. 1.0d8) then
571 tau = log10(temp * 1.0d-7)
572 cc = 0.5654d0 + tau
573 c00 = 1.008d11
574 c01 = 0.0d0
575 c02 = 0.0d0
576 c03 = 0.0d0
577 c04 = 0.0d0
578 c05 = 0.0d0
579 c06 = 0.0d0
580 c10 = 8.156d10
581 c11 = 9.728d8
582 c12 = -3.806d9
583 c13 = -4.384d9
584 c14 = -5.774d9
585 c15 = -5.249d9
586 c16 = -5.153d9
587 c20 = 1.067d11
588 c21 = -9.782d9
589 c22 = -7.193d9
590 c23 = -6.936d9
591 c24 = -6.893d9
592 c25 = -7.041d9
593 c26 = -7.193d9
594 dd01 = 0.0d0
595 dd02 = 0.0d0
596 dd03 = 0.0d0
597 dd04 = 0.0d0
598 dd05 = 0.0d0
599 dd11 = -1.879d10
600 dd12 = -9.667d9
601 dd13 = -5.602d9
602 dd14 = -3.370d9
603 dd15 = -1.825d9
604 dd21 = -2.919d10
605 dd22 = -1.185d10
606 dd23 = -7.270d9
607 dd24 = -4.222d9
608 dd25 = -1.560d9
609
610
611 else if (temp .ge. 1.0d8 .and. temp .lt. 1.0d9) then
612 tau = log10(temp * 1.0d-8)
613 cc = 1.5654d0
614 c00 = 9.889d10
615 c01 = -4.524d8
616 c02 = -6.088d6
617 c03 = 4.269d7
618 c04 = 5.172d7
619 c05 = 4.910d7
620 c06 = 4.388d7
621 c10 = 1.813d11
622 c11 = -7.556d9
623 c12 = -3.304d9
624 c13 = -1.031d9
625 c14 = -1.764d9
626 c15 = -1.851d9
627 c16 = -1.928d9
628 c20 = 9.750d10
629 c21 = 3.484d10
630 c22 = 5.199d9
631 c23 = -1.695d9
632 c24 = -2.865d9
633 c25 = -3.395d9
634 c26 = -3.418d9
635 dd01 = -1.135d8
636 dd02 = 1.256d8
637 dd03 = 5.149d7
638 dd04 = 3.436d7
639 dd05 = 1.005d7
640 dd11 = 1.652d9
641 dd12 = -3.119d9
642 dd13 = -1.839d9
643 dd14 = -1.458d9
644 dd15 = -8.956d8
645 dd21 = -1.549d10
646 dd22 = -9.338d9
647 dd23 = -5.899d9
648 dd24 = -3.035d9
649 dd25 = -1.598d9
650
651
652 else if (temp .ge. 1.0d9) then
653 tau = log10(t9)
654 cc = 1.5654d0
655 c00 = 9.581d10
656 c01 = 4.107d8
657 c02 = 2.305d8
658 c03 = 2.236d8
659 c04 = 1.580d8
660 c05 = 2.165d8
661 c06 = 1.721d8
662 c10 = 1.459d12
663 c11 = 1.314d11
664 c12 = -1.169d11
665 c13 = -1.765d11
666 c14 = -1.867d11
667 c15 = -1.983d11
668 c16 = -1.896d11
669 c20 = 2.424d11
670 c21 = -3.669d9
671 c22 = -8.691d9
672 c23 = -7.967d9
673 c24 = -7.932d9
674 c25 = -7.987d9
675 c26 = -8.333d9
676 dd01 = 4.724d8
677 dd02 = 2.976d8
678 dd03 = 2.242d8
679 dd04 = 7.937d7
680 dd05 = 4.859d7
681 dd11 = -7.094d11
682 dd12 = -3.697d11
683 dd13 = -2.189d11
684 dd14 = -1.273d11
685 dd15 = -5.705d10
686 dd21 = -2.254d10
687 dd22 = -1.551d10
688 dd23 = -7.793d9
689 dd24 = -4.489d9
690 dd25 = -2.185d9
691 end if
692
693
694 taudt = iln10*tempi
695
696
697
698c..equation 3.7, compute the expensive trig functions only one time
699 cos1 = cos(fac1*tau)
700 cos2 = cos(fac1*2.0d0*tau)
701 cos3 = cos(fac1*3.0d0*tau)
702 cos4 = cos(fac1*4.0d0*tau)
703 cos5 = cos(fac1*5.0d0*tau)
704 last = cos(fac2*tau)
705
706
707 sin1 = sin(fac1*tau)
708 sin2 = sin(fac1*2.0d0*tau)
709 sin3 = sin(fac1*3.0d0*tau)
710 sin4 = sin(fac1*4.0d0*tau)
711 sin5 = sin(fac1*5.0d0*tau)
712 xast = sin(fac2*tau)
713
714
715 a0 = 0.5d0*c00
716 1 1 + c01*cos1 + dd01*sin1 + c02*cos2 + dd02*sin2
717 2 2 + c03*cos3 + dd03*sin3 + c04*cos4 + dd04*sin4
718 3 3 + c05*cos5 + dd05*sin5 + 0.5d0*c06*last
719
720
721 f0 = taudt*fac1*(-c01*sin1 + dd01*cos1 - c02*sin2*2.0d0
722 1 1 + dd02*cos2*2.0d0 - c03*sin3*3.0d0 + dd03*cos3*3.0d0
723 2 2 - c04*sin4*4.0d0 + dd04*cos4*4.0d0
724 3 3 - c05*sin5*5.0d0 + dd05*cos5*5.0d0)
725 4 4 - 0.5d0*c06*xast*fac2*taudt
726
727
728 a1 = 0.5d0*c10
729 1 1 + c11*cos1 + dd11*sin1 + c12*cos2 + dd12*sin2
730 2 2 + c13*cos3 + dd13*sin3 + c14*cos4 + dd14*sin4
731 3 3 + c15*cos5 + dd15*sin5 + 0.5d0*c16*last
732
733
734 f1 = taudt*fac1*(-c11*sin1 + dd11*cos1 - c12*sin2*2.0d0
735 1 1 + dd12*cos2*2.0d0 - c13*sin3*3.0d0 + dd13*cos3*3.0d0
736 2 2 - c14*sin4*4.0d0 + dd14*cos4*4.0d0 - c15*sin5*5.0d0
737 3 3 + dd15*cos5*5.0d0) - 0.5d0*c16*xast*fac2*taudt
738
739
740 a2 = 0.5d0*c20
741 1 1 + c21*cos1 + dd21*sin1 + c22*cos2 + dd22*sin2
742 2 2 + c23*cos3 + dd23*sin3 + c24*cos4 + dd24*sin4
743 3 3 + c25*cos5 + dd25*sin5 + 0.5d0*c26*last
744
745
746 f2 = taudt*fac1*(-c21*sin1 + dd21*cos1 - c22*sin2*2.0d0
747 1 1 + dd22*cos2*2.0d0 - c23*sin3*3.0d0 + dd23*cos3*3.0d0
748 2 2 - c24*sin4*4.0d0 + dd24*cos4*4.0d0 - c25*sin5*5.0d0
749 3 3 + dd25*cos5*5.0d0) - 0.5d0*c26*xast*fac2*taudt
750
751
752c..equation 3.4
753 dum = a0 + a1*zeta + a2*zeta2
754 dumdt = f0 + f1*zeta + a1*zetadt + f2*zeta2 + 2.0d0*a2*zeta*zetadt
755 dumdd = a1*zetadd + 2.0d0*a2*zeta*zetadd
756 dumda = a1*zetada + 2.0d0*a2*zeta*zetada
757 dumdz = a1*zetadz + 2.0d0*a2*zeta*zetadz
758
759
760 z = exp(-cc*zeta)
761
762
763 xnum = dum*z
764 xnumdt = dumdt*z - dum*z*cc*zetadt
765 xnumdd = dumdd*z - dum*z*cc*zetadd
766 xnumda = dumda*z - dum*z*cc*zetada
767 xnumdz = dumdz*z - dum*z*cc*zetadz
768
769
770 xden = zeta3 + 6.290d-3*xlm1 + 7.483d-3*xlm2 + 3.061d-4*xlm3
771
772
773 dum = 3.0d0*zeta2
774 xdendt = dum*zetadt - xldt*(6.290d-3*xlm2
775 1 1 + 2.0d0*7.483d-3*xlm3 + 3.0d0*3.061d-4*xlm4)
776 xdendd = dum*zetadd
777 xdenda = dum*zetada
778 xdendz = dum*zetadz
779
780
781 dum = 1.0d0/xden
782 fphot = xnum*dum
783 fphotdt = (xnumdt - fphot*xdendt)*dum
784 fphotdd = (xnumdd - fphot*xdendd)*dum
785 fphotda = (xnumda - fphot*xdenda)*dum
786 fphotdz = (xnumdz - fphot*xdendz)*dum
787
788
789
790c..equation 3.3
791 a0 = 1.0d0 + 2.045d0 * xl
792 xnum = 0.666d0*a0**(-2.066d0)
793 xnumdt = -2.066d0*xnum/a0 * 2.045d0*xldt
794
795
796 dum = 1.875d8*xl + 1.653d8*xl2 + 8.449d8*xl3 - 1.604d8*xl4
797 dumdt = xldt*(1.875d8 + 2.0d0*1.653d8*xl + 3.0d0*8.449d8*xl2
798 1 1 - 4.0d0*1.604d8*xl3)
799
800
801 z = 1.0d0/dum
802 xden = 1.0d0 + rm*z
803 xdendt = -rm*z*z*dumdt
804 xdendd = rmdd*z
805 xdenda = rmda*z
806 xdendz = rmdz*z
807
808
809 z = 1.0d0/xden
810 qphot = xnum*z
811 qphotdt = (xnumdt - qphot*xdendt)*z
812 dum = -qphot*z
813 qphotdd = dum*xdendd
814 qphotda = dum*xdenda
815 qphotdz = dum*xdendz
816
817
818c..equation 3.2
819 sphot = xl5 * fphot
820 sphotdt = 5.0d0*xl4*xldt*fphot + xl5*fphotdt
821 sphotdd = xl5*fphotdd
822 sphotda = xl5*fphotda
823 sphotdz = xl5*fphotdz
824
825
826 a1 = sphot
827 sphot = rm*a1
828 sphotdt = rm*sphotdt
829 sphotdd = rm*sphotdd + rmdd*a1
830 sphotda = rm*sphotda + rmda*a1
831 sphotdz = rm*sphotdz + rmdz*a1
832
833
834 a1 = tfac4*(1.0d0 - tfac3 * qphot)
835 a2 = -tfac4*tfac3
836
837
838 a3 = sphot
839 sphot = a1*a3
840 sphotdt = a1*sphotdt + a2*qphotdt*a3
841 sphotdd = a1*sphotdd + a2*qphotdd*a3
842 sphotda = a1*sphotda + a2*qphotda*a3
843 sphotdz = a1*sphotdz + a2*qphotdz*a3
844
845
846 if (sphot .le. 0.0) then
847 sphot = 0.0d0
848 sphotdt = 0.0d0
849 sphotdd = 0.0d0
850 sphotda = 0.0d0
851 sphotdz = 0.0d0
852 end if
853
854
855
856
857
858
859c..bremsstrahlung neutrino section
860c..for reactions like e- + (z,a) => e- + (z,a) + nu + nubar
861c.. n + n => n + n + nu + nubar
862c.. n + p => n + p + nu + nubar
863c..equation 4.3
864
865
866 den6 = den * 1.0d-6
867 t8 = temp * 1.0d-8
868 t812 = sqrt(t8)
869 t832 = t8 * t812
870 t82 = t8*t8
871 t83 = t82*t8
872 t85 = t82*t83
873 t86 = t85*t8
874 t8m1 = 1.0d0/t8
875 t8m2 = t8m1*t8m1
876 t8m3 = t8m2*t8m1
877 t8m5 = t8m3*t8m2
878 t8m6 = t8m5*t8m1
879
880
881
882 tfermi = 5.9302d9*(sqrt(1.0d0+1.018d0*(den6*ye)**twoth)-1.0d0)
883
884
885c.."weak" degenerate electrons only
886
887
888
889 if (temp .gt. 0.01d0 * tfermi) then
890
891
892c..equation 5.3
893 dum = 7.05d6 * t832 + 5.12d4 * t83
894 dumdt = (1.5d0*7.05d6*t812 + 3.0d0*5.12d4*t82)*1.0d-8
895
896
897 z = 1.0d0/dum
898 eta = rm*z
899 etadt = -rm*z*z*dumdt
900 etadd = rmdd*z
901 etada = rmda*z
902 etadz = rmdz*z
903
904
905 etam1 = 1.0d0/eta
906 etam2 = etam1 * etam1
907 etam3 = etam2 * etam1
908
909
910
911c..equation 5.2
912 a0 = 23.5d0 + 6.83d4*t8m2 + 7.81d8*t8m5
913 f0 = (-2.0d0*6.83d4*t8m3 - 5.0d0*7.81d8*t8m6)*1.0d-8
914 xnum = 1.0d0/a0
915
916
917 dum = 1.0d0 + 1.47d0*etam1 + 3.29d-2*etam2
918 z = -1.47d0*etam2 - 2.0d0*3.29d-2*etam3
919 dumdt = z*etadt
920 dumdd = z*etadd
921 dumda = z*etada
922 dumdz = z*etadz
923
924
925 c00 = 1.26d0 * (1.0d0+etam1)
926 z = -1.26d0*etam2
927 c01 = z*etadt
928 c02 = z*etadd
929 c03 = z*etada
930 c04 = z*etadz
931
932 z = 1.0d0/dum
933 xden = c00*z
934 xdendt = (c01 - xden*dumdt)*z
935 xdendd = (c02 - xden*dumdd)*z
936 xdenda = (c03 - xden*dumda)*z
937 xdendz = (c04 - xden*dumdz)*z
938
939
940 fbrem = xnum + xden
941 fbremdt = -xnum*xnum*f0 + xdendt
942 fbremdd = xdendd
943 fbremda = xdenda
944 fbremdz = xdendz
945
946
947
948c..equation 5.9
949 a0 = 230.0d0 + 6.7d5*t8m2 + 7.66d9*t8m5
950 f0 = (-2.0d0*6.7d5*t8m3 - 5.0d0*7.66d9*t8m6)*1.0d-8
951
952
953 z = 1.0d0 + rm*1.0d-9
954 dum = a0*z
955 dumdt = f0*z
956 z = a0*1.0d-9
957 dumdd = z*rmdd
958 dumda = z*rmda
959 dumdz = z*rmdz
960
961
962 xnum = 1.0d0/dum
963 z = -xnum*xnum
964 xnumdt = z*dumdt
965 xnumdd = z*dumdd
966 xnumda = z*dumda
967 xnumdz = z*dumdz
968
969
970 c00 = 7.75d5*t832 + 247.0d0*t8**(3.85d0)
971 dd00 = (1.5d0*7.75d5*t812 + 3.85d0*247.0d0*t8**(2.85d0))*1.0d-8
972
973
974 c01 = 4.07d0 + 0.0240d0 * t8**(1.4d0)
975 dd01 = 1.4d0*0.0240d0*t8**(0.4d0)*1.0d-8
976
977
978 c02 = 4.59d-5 * t8**(-0.110d0)
979 dd02 = -0.11d0*4.59d-5 * t8**(-1.11d0)*1.0d-8
980
981
982 z = den**(0.656d0)
983 dum = c00*rmi + c01 + c02*z
984 dumdt = dd00*rmi + dd01 + dd02*z
985 z = -c00*rmi*rmi
986 dumdd = z*rmdd + 0.656d0*c02*den**(-0.454d0)
987 dumda = z*rmda
988 dumdz = z*rmdz
989
990
991 xden = 1.0d0/dum
992 z = -xden*xden
993 xdendt = z*dumdt
994 xdendd = z*dumdd
995 xdenda = z*dumda
996 xdendz = z*dumdz
997
998
999 gbrem = xnum + xden
1000 gbremdt = xnumdt + xdendt
1001 gbremdd = xnumdd + xdendd
1002 gbremda = xnumda + xdenda
1003 gbremdz = xnumdz + xdendz
1004
1005
1006
1007c..equation 5.1
1008 dum = 0.5738d0*zbar*ye*t86*den
1009 dumdt = 0.5738d0*zbar*ye*6.0d0*t85*den*1.0d-8
1010 dumdd = 0.5738d0*zbar*ye*t86
1011 dumda = -dum*abari
1012 dumdz = 0.5738d0*2.0d0*ye*t86*den
1013
1014
1015 z = tfac4*fbrem - tfac5*gbrem
1016 sbrem = dum * z
1017 sbremdt = dumdt*z + dum*(tfac4*fbremdt - tfac5*gbremdt)
1018 sbremdd = dumdd*z + dum*(tfac4*fbremdd - tfac5*gbremdd)
1019 sbremda = dumda*z + dum*(tfac4*fbremda - tfac5*gbremda)
1020 sbremdz = dumdz*z + dum*(tfac4*fbremdz - tfac5*gbremdz)
1021
1022
1023
1024
1025
1026c..liquid metal with c12 parameters (not too different for other elements)
1027c..equation 5.18 and 5.16
1028
1029
1030 else
1031 u = fac3 * (log10(den) - 3.0d0)
1032 a0 = iln10*fac3*deni
1033
1034
1035c..compute the expensive trig functions of equation 5.21 only once
1036 cos1 = cos(u)
1037 cos2 = cos(2.0d0*u)
1038 cos3 = cos(3.0d0*u)
1039 cos4 = cos(4.0d0*u)
1040 cos5 = cos(5.0d0*u)
1041
1042
1043 sin1 = sin(u)
1044 sin2 = sin(2.0d0*u)
1045 sin3 = sin(3.0d0*u)
1046 sin4 = sin(4.0d0*u)
1047 sin5 = sin(5.0d0*u)
1048
1049
1050c..equation 5.21
1051 fb = 0.5d0 * 0.17946d0 + 0.00945d0*u + 0.34529d0
1052 1 1 - 0.05821d0*cos1 - 0.04969d0*sin1
1053 2 2 - 0.01089d0*cos2 - 0.01584d0*sin2
1054 3 3 - 0.01147d0*cos3 - 0.00504d0*sin3
1055 4 4 - 0.00656d0*cos4 - 0.00281d0*sin4
1056 5 5 - 0.00519d0*cos5
1057
1058
1059 c00 = a0*(0.00945d0
1060 1 1 + 0.05821d0*sin1 - 0.04969d0*cos1
1061 2 2 + 0.01089d0*sin2*2.0d0 - 0.01584d0*cos2*2.0d0
1062 3 3 + 0.01147d0*sin3*3.0d0 - 0.00504d0*cos3*3.0d0
1063 4 4 + 0.00656d0*sin4*4.0d0 - 0.00281d0*cos4*4.0d0
1064 5 5 + 0.00519d0*sin5*5.0d0)
1065
1066
1067
1068c..equation 5.22
1069 ft = 0.5d0 * 0.06781d0 - 0.02342d0*u + 0.24819d0
1070 1 1 - 0.00944d0*cos1 - 0.02213d0*sin1
1071 2 2 - 0.01289d0*cos2 - 0.01136d0*sin2
1072 3 3 - 0.00589d0*cos3 - 0.00467d0*sin3
1073 4 4 - 0.00404d0*cos4 - 0.00131d0*sin4
1074 5 5 - 0.00330d0*cos5
1075
1076
1077 c01 = a0*(-0.02342d0
1078 1 1 + 0.00944d0*sin1 - 0.02213d0*cos1
1079 2 2 + 0.01289d0*sin2*2.0d0 - 0.01136d0*cos2*2.0d0
1080 3 3 + 0.00589d0*sin3*3.0d0 - 0.00467d0*cos3*3.0d0
1081 4 4 + 0.00404d0*sin4*4.0d0 - 0.00131d0*cos4*4.0d0
1082 5 5 + 0.00330d0*sin5*5.0d0)
1083
1084
1085
1086c..equation 5.23
1087 gb = 0.5d0 * 0.00766d0 - 0.01259d0*u + 0.07917d0
1088 1 1 - 0.00710d0*cos1 + 0.02300d0*sin1
1089 2 2 - 0.00028d0*cos2 - 0.01078d0*sin2
1090 3 3 + 0.00232d0*cos3 + 0.00118d0*sin3
1091 4 4 + 0.00044d0*cos4 - 0.00089d0*sin4
1092 5 5 + 0.00158d0*cos5
1093
1094
1095 c02 = a0*(-0.01259d0
1096 1 1 + 0.00710d0*sin1 + 0.02300d0*cos1
1097 2 2 + 0.00028d0*sin2*2.0d0 - 0.01078d0*cos2*2.0d0
1098 3 3 - 0.00232d0*sin3*3.0d0 + 0.00118d0*cos3*3.0d0
1099 4 4 - 0.00044d0*sin4*4.0d0 - 0.00089d0*cos4*4.0d0
1100 5 5 - 0.00158d0*sin5*5.0d0)
1101
1102
1103
1104c..equation 5.24
1105 gt = -0.5d0 * 0.00769d0 - 0.00829d0*u + 0.05211d0
1106 1 1 + 0.00356d0*cos1 + 0.01052d0*sin1
1107 2 2 - 0.00184d0*cos2 - 0.00354d0*sin2
1108 3 3 + 0.00146d0*cos3 - 0.00014d0*sin3
1109 4 4 + 0.00031d0*cos4 - 0.00018d0*sin4
1110 5 5 + 0.00069d0*cos5
1111
1112
1113 c03 = a0*(-0.00829d0
1114 1 1 - 0.00356d0*sin1 + 0.01052d0*cos1
1115 2 2 + 0.00184d0*sin2*2.0d0 - 0.00354d0*cos2*2.0d0
1116 3 3 - 0.00146d0*sin3*3.0d0 - 0.00014d0*cos3*3.0d0
1117 4 4 - 0.00031d0*sin4*4.0d0 - 0.00018d0*cos4*4.0d0
1118 5 5 - 0.00069d0*sin5*5.0d0)
1119
1120
1121
1122 dum = 2.275d-1 * zbar * zbar*t8m1 * (den6*abari)**oneth
1123 dumdt = -dum*tempi
1124 dumdd = oneth*dum*deni
1125 dumda = -oneth*dum*abari
1126 dumdz = 2.0d0*dum*zbari
1127
1128 gm1 = 1.0d0/dum
1129 gm2 = gm1*gm1
1130 gm13 = gm1**oneth
1131 gm23 = gm13 * gm13
1132 gm43 = gm13*gm1
1133 gm53 = gm23*gm1
1134
1135
1136
1137c..equation 5.25 and 5.26
1138 v = -0.05483d0 - 0.01946d0*gm13 + 1.86310d0*gm23 - 0.78873d0*gm1
1139 a0 = oneth*0.01946d0*gm43 - twoth*1.86310d0*gm53 + 0.78873d0*gm2
1140
1141
1142 w = -0.06711d0 + 0.06859d0*gm13 + 1.74360d0*gm23 - 0.74498d0*gm1
1143 a1 = -oneth*0.06859d0*gm43 - twoth*1.74360d0*gm53 + 0.74498d0*gm2
1144
1145
1146
1147c..equation 5.19 and 5.20
1148 fliq = v*fb + (1.0d0 - v)*ft
1149 fliqdt = a0*dumdt*(fb - ft)
1150 fliqdd = a0*dumdd*(fb - ft) + v*c00 + (1.0d0 - v)*c01
1151 fliqda = a0*dumda*(fb - ft)
1152 fliqdz = a0*dumdz*(fb - ft)
1153
1154
1155 gliq = w*gb + (1.0d0 - w)*gt
1156 gliqdt = a1*dumdt*(gb - gt)
1157 gliqdd = a1*dumdd*(gb - gt) + w*c02 + (1.0d0 - w)*c03
1158 gliqda = a1*dumda*(gb - gt)
1159 gliqdz = a1*dumdz*(gb - gt)
1160
1161
1162
1163c..equation 5.17
1164 dum = 0.5738d0*zbar*ye*t86*den
1165 dumdt = 0.5738d0*zbar*ye*6.0d0*t85*den*1.0d-8
1166 dumdd = 0.5738d0*zbar*ye*t86
1167 dumda = -dum*abari
1168 dumdz = 0.5738d0*2.0d0*ye*t86*den
1169
1170
1171 z = tfac4*fliq - tfac5*gliq
1172 sbrem = dum * z
1173 sbremdt = dumdt*z + dum*(tfac4*fliqdt - tfac5*gliqdt)
1174 sbremdd = dumdd*z + dum*(tfac4*fliqdd - tfac5*gliqdd)
1175 sbremda = dumda*z + dum*(tfac4*fliqda - tfac5*gliqda)
1176 sbremdz = dumdz*z + dum*(tfac4*fliqdz - tfac5*gliqdz)
1177
1178
1179 end if
1180
1181
1182
1183
1184
1185c..recombination neutrino section
1186c..for reactions like e- (continuum) => e- (bound) + nu_e + nubar_e
1187c..equation 6.11 solved for nu
1188 xnum = 1.10520d8 * den * ye /(temp*sqrt(temp))
1189 xnumdt = -1.50d0*xnum*tempi
1190 xnumdd = xnum*deni
1191 xnumda = -xnum*abari
1192 xnumdz = xnum*zbari
1193
1194
1195c..the chemical potential
1196 nu = ifermi12(xnum)
1197
1198
1199c..a0 is d(nu)/d(xnum)
1200 a0 = 1.0d0/(0.5d0*zfermim12(nu))
1201 nudt = a0*xnumdt
1202 nudd = a0*xnumdd
1203 nuda = a0*xnumda
1204 nudz = a0*xnumdz
1205
1206
1207 nu2 = nu * nu
1208 nu3 = nu2 * nu
1209
1210
1211c..table 12
1212 if (nu .ge. -20.0 .and. nu .lt. 0.0) then
1213 a1 = 1.51d-2
1214 a2 = 2.42d-1
1215 a3 = 1.21d0
1216 b = 3.71d-2
1217 c = 9.06D-1
1218 d = 9.28d-1
1219 f1 = 0.0d0
1220 f2 = 0.0d0
1221 f3 = 0.0d0
1222 else if (nu .ge. 0.0 .and. nu .le. 10.0) then
1223 a1 = 1.23d-2
1224 a2 = 2.66d-1
1225 a3 = 1.30d0
1226 b = 1.17d-1
1227 c = 8.97D-1
1228 d = 1.77d-1
1229 f1 = -1.20d-2
1230 f2 = 2.29d-2
1231 f3 = -1.04d-3
1232 end if
1233
1234
1235
1236c..equation 6.7, 6.13 and 6.14
1237 if (nu .ge. -20.0 .and. nu .le. 10.0) then
1238
1239
1240 zeta = 1.579d5*zbar*zbar*tempi
1241 zetadt = -zeta*tempi
1242 zetadd = 0.0d0
1243 zetada = 0.0d0
1244 zetadz = 2.0d0*zeta*zbari
1245
1246
1247 c00 = 1.0d0/(1.0d0 + f1*nu + f2*nu2 + f3*nu3)
1248 c01 = f1 + f2*2.0d0*nu + f3*3.0d0*nu2
1249 dum = zeta*c00
1250 dumdt = zetadt*c00 + zeta*c01*nudt
1251 dumdd = zeta*c01*nudd
1252 dumda = zeta*c01*nuda
1253 dumdz = zetadz*c00 + zeta*c01*nudz
1254
1255
1256
1257 z = 1.0d0/dum
1258 dd00 = dum**(-2.25)
1259 dd01 = dum**(-4.55D0)
1260 c00 = a1*z + a2*dd00 + a3*dd01
1261 c01 = -(a1*z + 2.25*a2*dd00 + 4.55D0*a3*dd01)*z
1262
1263
1264
1265 z = exp(c*nu)
1266 dd00 = b*z*(1.0d0 + d*dum)
1267 gum = 1.0d0 + dd00
1268 gumdt = dd00*c*nudt + b*z*d*dumdt
1269 gumdd = dd00*c*nudd + b*z*d*dumdd
1270 gumda = dd00*c*nuda + b*z*d*dumda
1271 gumdz = dd00*c*nudz + b*z*d*dumdz
1272
1273
1274
1275 z = exp(nu)
1276 a1 = 1.0d0/gum
1277
1278
1279 bigj = c00 * z * a1
1280 bigjdt = c01*dumdt*z*a1 + c00*z*nudt*a1 - c00*z*a1*a1 * gumdt
1281 bigjdd = c01*dumdd*z*a1 + c00*z*nudd*a1 - c00*z*a1*a1 * gumdd
1282 bigjda = c01*dumda*z*a1 + c00*z*nuda*a1 - c00*z*a1*a1 * gumda
1283 bigjdz = c01*dumdz*z*a1 + c00*z*nudz*a1 - c00*z*a1*a1 * gumdz
1284
1285
1286
1287c..equation 6.5
1288 z = exp(zeta + nu)
1289 dum = 1.0d0 + z
1290 a1 = 1.0d0/dum
1291 a2 = 1.0d0/bigj
1292
1293
1294 sreco = tfac6 * 2.649d-18 * ye * zbar**13 * den * bigj*a1
1295 srecodt = sreco*(bigjdt*a2 - z*(zetadt + nudt)*a1)
1296 srecodd = sreco*(1.0d0*deni + bigjdd*a2 - z*(zetadd + nudd)*a1)
1297 srecoda = sreco*(-1.0d0*abari + bigjda*a2 - z*(zetada+nuda)*a1)
1298 srecodz = sreco*(14.0d0*zbari + bigjdz*a2 - z*(zetadz+nudz)*a1)
1299
1300
1301 end if
1302
1303
1304
1305c..convert from erg/cm^3/s to erg/g/s
1306c..comment these out to duplicate the itoh et al plots
1307
1308
1309 spair = spair*deni
1310 spairdt = spairdt*deni
1311 spairdd = spairdd*deni - spair*deni
1312 spairda = spairda*deni
1313 spairdz = spairdz*deni
1314
1315
1316 splas = splas*deni
1317 splasdt = splasdt*deni
1318 splasdd = splasdd*deni - splas*deni
1319 splasda = splasda*deni
1320 splasdz = splasdz*deni
1321
1322
1323 sphot = sphot*deni
1324 sphotdt = sphotdt*deni
1325 sphotdd = sphotdd*deni - sphot*deni
1326 sphotda = sphotda*deni
1327 sphotdz = sphotdz*deni
1328
1329
1330 sbrem = sbrem*deni
1331 sbremdt = sbremdt*deni
1332 sbremdd = sbremdd*deni - sbrem*deni
1333 sbremda = sbremda*deni
1334 sbremdz = sbremdz*deni
1335
1336
1337 sreco = sreco*deni
1338 srecodt = srecodt*deni
1339 srecodd = srecodd*deni - sreco*deni
1340 srecoda = srecoda*deni
1341 srecodz = srecodz*deni
1342
1343
1344
1345c..the total neutrino loss rate
1346 snu = splas + spair + sphot + sbrem + sreco
1347 dsnudt = splasdt + spairdt + sphotdt + sbremdt + srecodt
1348 dsnudd = splasdd + spairdd + sphotdd + sbremdd + srecodd
1349 dsnuda = splasda + spairda + sphotda + sbremda + srecoda
1350 dsnudz = splasdz + spairdz + sphotdz + sbremdz + srecodz
1351
1352
1353
1354 return
1355 end
1"""Python version of sneut.f (YREC 7be4133): the thermal neutrino
2energy-loss rate from the fits of Itoh et al. (1996, ApJS 102, 411), with
3its derivatives."""
4
5from math import cos, exp, log10, sin, sqrt
6
7from pyrec.ifermi12 import ifermi12
8from pyrec.zfermim12 import zfermim12
9
10# The Fortran SAVEs all its locals, but each is set before it is read, so
11# no state is kept between calls here.
12
13# Mathematical constants (PARAMETER, Fortran lines 94–104).
14pi = 3.1415926535897932384
15fac1 = 5.0 * pi / 3.0
16fac2 = 10.0 * pi
17fac3 = pi / 5.0
18oneth = 1.0/3.0
19twoth = 2.0/3.0
20con1 = 1.0/5.9302
21sixth = 1.0/6.0
22iln10 = 4.342944819032518e-1
23
24# Weinberg angle, number of neutrino flavors and the coupling factors
25# (PARAMETER): tfac1 = C+, tfac2 = C-, tfac3 = C-/C+, tfac4 = C+/2,
26# tfac5 = C-/2 (Fortran lines 108–129).
27theta = 0.2319
28# Question (see the page): the comment says 3.02 flavors.
29xnufam = 3.0
30cv = 0.5 + 2.0 * theta
31cvp = 1.0 - cv
32ca = 0.5
33cap = 1.0 - ca
34tfac1 = cv*cv + ca*ca + (xnufam-1.0) * (cvp*cvp+cap*cap)
35# Suspected bug (see the page): cvp*cvp - cap-cap, that is cvp**2 - 1, where
36# cvp*cvp - cap*cap is expected.
37tfac2 = cv*cv - ca*ca + (xnufam-1.0) * (cvp*cvp - cap-cap)
38tfac3 = tfac2/tfac1
39tfac4 = 0.5 * tfac1
40tfac5 = 0.5 * tfac2
41tfac6 = cv*cv + 1.5*ca*ca + (xnufam - 1.0)*(cvp*cvp + 1.5*cap*cap)
42
43
44def sneut(temp: float, den: float, abar: float, zbar: float, snu: float, dsnudt: float, dsnudd: float, dsnuda: float,
45 dsnudz: float) -> tuple[float, float, float, float, float]:
46 """The thermal neutrino loss of stellar matter, the sum of pair,
47 plasma, photo, bremsstrahlung and recombination neutrinos, with its
48 derivatives by the chain rule; zero below 1e7 K.
49
50 Translates: sneut.f#SNEUT (7be4133)
51
52 Arguments: temp (K), den (g/cm^3), abar and zbar (mean atomic weight
53 and charge); snu and its derivatives are only set.
54
55 Returns (snu, dsnudt, dsnudd, dsnuda, dsnudz): the loss in erg/g/s and
56 its derivatives with respect to temp, den, abar and zbar.
57
58 """
59
60 # Initialize (Fortran lines 137–141).
61 spair = 0.0
62 spairdt = 0.0
63 spairdd = 0.0
64 spairda = 0.0
65 spairdz = 0.0
66
67 # Fortran lines 144–148.
68 splas = 0.0
69 splasdt = 0.0
70 splasdd = 0.0
71 splasda = 0.0
72 splasdz = 0.0
73
74 # Fortran lines 151–155.
75 sphot = 0.0
76 sphotdt = 0.0
77 sphotdd = 0.0
78 sphotda = 0.0
79 sphotdz = 0.0
80
81 # Fortran lines 158–162.
82 sbrem = 0.0
83 sbremdt = 0.0
84 sbremdd = 0.0
85 sbremda = 0.0
86 sbremdz = 0.0
87
88 # Fortran lines 165–169.
89 sreco = 0.0
90 srecodt = 0.0
91 srecodd = 0.0
92 srecoda = 0.0
93 srecodz = 0.0
94
95 # Fortran lines 172–176.
96 snu = 0.0
97 dsnudt = 0.0
98 dsnudd = 0.0
99 dsnuda = 0.0
100 dsnudz = 0.0
101
102 # Fortran line 179.
103 if temp < 1.0e7:
104 return snu, dsnudt, dsnudd, dsnuda, dsnudz
105
106 # Some frequent factors (Fortran lines 184–187).
107 deni = 1.0/den
108 tempi = 1.0/temp
109 abari = 1.0/abar
110 zbari = 1.0/zbar
111
112 # Electron mole number and mean molecular weight per electron.
113 # Fortran lines 192–193.
114 ye = zbar*abari
115 xmue = abar*zbari # noqa: F841 (unused in the Fortran too)
116
117 # Temperature and its powers; xl = kT/(m_e c^2) (Fortran lines 200–216).
118 t9 = temp * 1.0e-9
119 xl = t9 * con1
120 xldt = 1.0e-9 * con1
121 xlp5 = sqrt(xl)
122 xl2 = xl*xl
123 xl3 = xl2*xl
124 xl4 = xl3*xl
125 xl5 = xl4*xl
126 xl6 = xl5*xl
127 xl7 = xl6*xl
128 xl8 = xl7*xl
129 xl9 = xl8*xl
130 xlmp5 = 1.0/xlp5
131 xlm1 = 1.0/xl
132 xlm2 = xlm1*xlm1
133 xlm3 = xlm1*xlm2
134 xlm4 = xlm1*xlm3
135
136 # rho * ye and its derivatives (Fortran lines 219–223).
137 rm = den*ye
138 rmdd = ye
139 rmda = -rm*abari
140 rmdz = den*abari
141 rmi = 1.0/rm
142
143 # zeta = (rho ye / 1e9)^(1/3) / lambda (Fortran lines 226–233).
144 a0 = rm * 1.0e-9
145 a1 = a0**oneth
146 zeta = a1 * xlm1
147 zetadt = -a1 * xlm2 * xldt
148 a2 = oneth * a1*rmi * xlm1
149 zetadd = a2 * rmdd
150 zetada = a2 * rmda
151 zetadz = a2 * rmdz
152
153 # Fortran lines 235–236.
154 zeta2 = zeta * zeta
155 zeta3 = zeta2 * zeta
156
157 # ---- Pair neutrinos ----
158 # g(lambda), eq. 2.8 (Fortran lines 247–248).
159 gl = 1.0 - 13.04*xl2 + 133.5*xl4 + 1534.0*xl6 + 918.6*xl8
160 gldt = xldt*(-26.08*xl + 534.0*xl3 + 9204.0*xl5 + 7348.8*xl7)
161
162 # f(pair), eq. 2.7: numerator (Fortran lines 254–255).
163 a1 = 6.002e19 + 2.084e20*zeta + 1.872e21*zeta2
164 a2 = 2.084e20 + 2.0*1.872e21*zeta
165
166 # Fortran lines 258–264.
167 if t9 < 10.0:
168 b1 = exp(-5.5924*zeta)
169 b2 = -b1*5.5924
170 else:
171 b1 = exp(-4.9924*zeta)
172 b2 = -b1*4.9924
173
174 # Fortran lines 266–271.
175 xnum = a1 * b1
176 c = a2*b1 + a1*b2
177 xnumdt = c*zetadt
178 xnumdd = c*zetadd
179 xnumda = c*zetada
180 xnumdz = c*zetadz
181
182 # Denominator (Fortran lines 274–280).
183 if t9 < 10.0:
184 a1 = 9.383e-1*xlm1 - 4.141e-1*xlm2 + 5.829e-2*xlm3
185 a2 = -9.383e-1*xlm2 + 2.0*4.141e-1*xlm3 - 3.0*5.829e-2*xlm4
186 else:
187 a1 = 1.2383*xlm1 - 8.141e-1*xlm2
188 a2 = -1.2383*xlm2 + 2.0*8.141e-1*xlm3
189
190 # Fortran line 283.
191 b1 = 3.0*zeta2
192
193 # Fortran lines 286–290.
194 xden = zeta3 + a1
195 xdendt = b1*zetadt + a2*xldt
196 xdendd = b1*zetadd
197 xdenda = b1*zetada
198 xdendz = b1*zetadz
199
200 # Fortran lines 293–298.
201 a1 = 1.0/xden
202 fpair = xnum*a1
203 fpairdt = (xnumdt - fpair*xdendt)*a1
204 fpairdd = (xnumdd - fpair*xdendd)*a1
205 fpairda = (xnumda - fpair*xdenda)*a1
206 fpairdz = (xnumdz - fpair*xdendz)*a1
207
208 # q(pair), eq. 2.6 (Fortran lines 303–306).
209 a1 = 10.7480*xl2 + 0.3967*xlp5 + 1.005
210 a2 = xldt*(2.0*10.7480*xl + 0.5*0.3967*xlmp5)
211 xnum = 1.0/a1
212 xnumdt = -xnum*xnum*a2
213
214 # Fortran lines 309–310.
215 a1 = 7.692e7*xl3 + 9.715e6*xlp5
216 a2 = xldt*(3.0*7.692e7*xl2 + 0.5*9.715e6*xlmp5)
217
218 # Fortran lines 313–314.
219 c = 1.0/a1
220 b1 = 1.0 + rm*c
221
222 # Fortran line 317.
223 xden = b1**(-0.3)
224
225 # Fortran lines 320–324.
226 d = -0.3*xden/b1
227 xdendt = -d*rm*c*c*a2
228 xdendd = d*rmdd*c
229 xdenda = d*rmda*c
230 xdendz = d*rmdz*c
231
232 # Fortran lines 327–331.
233 qpair = xnum*xden
234 qpairdt = xnumdt*xden + xnum*xdendt
235 qpairdd = xnum*xdendd
236 qpairda = xnum*xdenda
237 qpairdz = xnum*xdendz
238
239 # Eq. 2.5: exp(-2/lambda) * f(pair) (Fortran lines 337–338) ...
240 a1 = exp(-2.0*xlm1)
241 a2 = a1*2.0*xlm2*xldt
242
243 # Fortran lines 341–345.
244 spair = a1*fpair
245 spairdt = a2*fpair + a1*fpairdt
246 spairdd = a1*fpairdd
247 spairda = a1*fpairda
248 spairdz = a1*fpairdz
249
250 # ... times g(lambda) (Fortran lines 348–353) ...
251 a1 = spair
252 spair = gl*a1
253 spairdt = gl*spairdt + gldt*a1
254 spairdd = gl*spairdd
255 spairda = gl*spairda
256 spairdz = gl*spairdz
257
258 # ... times (C+ + C- q(pair)) / 2 (Fortran lines 356–357).
259 a1 = tfac4*(1.0 + tfac3 * qpair)
260 a2 = tfac4*tfac3
261
262 # Fortran lines 360–365.
263 a3 = spair
264 spair = a1*a3
265 spairdt = a1*spairdt + a2*qpairdt*a3
266 spairdd = a1*spairdd + a2*qpairdd*a3
267 spairda = a1*spairda + a2*qpairda*a3
268 spairdz = a1*spairdz + a2*qpairdz*a3
269
270 # ---- Plasma neutrinos ----
271 # gamma, eq. 4.6 (Fortran lines 376–378).
272 a1 = 1.019e-6*rm
273 a2 = a1**twoth
274 a3 = twoth*a2/a1
275
276 # Fortran lines 381–382.
277 b1 = sqrt(1.0 + a2)
278 b2 = 1.0/b1
279
280 # Fortran line 384.
281 c00 = 1.0/(temp*temp*b1)
282
283 # Fortran line 387.
284 gl2 = 1.1095e11 * rm * c00
285
286 # Fortran lines 390–394.
287 gl2dt = -2.0*gl2*tempi
288 d = rm*c00*b2*0.5*b2*a3*1.019e-6
289 gl2dd = 1.1095e11 * (rmdd*c00 - d*rmdd)
290 gl2da = 1.1095e11 * (rmda*c00 - d*rmda)
291 gl2dz = 1.1095e11 * (rmdz*c00 - d*rmdz)
292
293 # Fortran lines 398–402.
294 gl = sqrt(gl2)
295 gl12 = sqrt(gl)
296 gl32 = gl * gl12
297 gl72 = gl2 * gl32
298 gl6 = gl2 * gl2 * gl2
299
300 # Transverse, eq. 4.7 (Fortran lines 407–413).
301 ft = 2.4 + 0.6*gl12 + 0.51*gl + 1.25*gl32
302 gum = 1.0/gl2
303 a1 = (0.25*0.6*gl12 + 0.5*0.51*gl + 0.75*1.25*gl32)*gum
304 ftdt = a1*gl2dt
305 ftdd = a1*gl2dd
306 ftda = a1*gl2da
307 ftdz = a1*gl2dz
308
309 # Longitudinal, eq. 4.8 (Fortran lines 418–419).
310 a1 = 8.6*gl2 + 1.35*gl72
311 a2 = 8.6 + 1.75*1.35*gl72*gum
312
313 # Fortran lines 422–423.
314 b1 = 225.0 - 17.0*gl + gl2
315 b2 = -0.5*17.0*gl*gum + 1.0
316
317 # Fortran lines 426–427.
318 c = 1.0/b1
319 fl = a1*c
320
321 # Fortran lines 430–434.
322 d = (a2 - fl*b2)*c
323 fldt = d*gl2dt
324 fldd = d*gl2dd
325 flda = d*gl2da
326 fldz = d*gl2dz
327
328 # xnum and xden, eqs. 4.9 and 4.10 (Fortran lines 439–440).
329 cc = log10(2.0*rm)
330 xlnt = log10(temp)
331
332 # Fortran lines 443–448.
333 xnum = sixth * (17.5 + cc - 3.0*xlnt)
334 xnumdt = -iln10*0.5*tempi
335 a2 = iln10*sixth*rmi
336 xnumdd = a2*rmdd
337 xnumda = a2*rmda
338 xnumdz = a2*rmdz
339
340 # Fortran lines 451–455.
341 xden = sixth * (-24.5 + cc + 3.0*xlnt)
342 xdendt = iln10*0.5*tempi
343 xdendd = a2*rmdd
344 xdenda = a2*rmda
345 xdendz = a2*rmdz
346
347 # The correction fxy, eq. 4.11 (Fortran lines 460–472).
348 if abs(xnum) > 0.7 or xden < 0.0:
349 fxy = 1.0
350 fxydt = 0.0
351 fxydd = 0.0
352 fxydz = 0.0
353 fxyda = 0.0
354 else:
355 a1 = 0.39 - 1.25*xnum - 0.35*sin(4.5*xnum)
356 a2 = -1.25 - 4.5*0.35*cos(4.5*xnum)
357
358 # Fortran lines 475–476.
359 b1 = 0.3 * exp(-1.0*(4.5*xnum + 0.9)**2)
360 b2 = -b1*2.0*(4.5*xnum + 0.9)*4.5
361
362 # Fortran lines 479–490.
363 c = min(0.0, xden - 1.6 + 1.25*xnum)
364 if c == 0.0:
365 dumdt = 0.0
366 dumdd = 0.0
367 dumda = 0.0
368 dumdz = 0.0
369 else:
370 dumdt = xdendt + 1.25*xnumdt
371 dumdd = xdendd + 1.25*xnumdd
372 dumda = xdenda + 1.25*xnumda
373 dumdz = xdendz + 1.25*xnumdz
374
375 # Fortran lines 493–495.
376 d = 0.57 - 0.25*xnum
377 a3 = c/d
378 c00 = exp(-1.0*a3**2)
379
380 # Fortran lines 498–502.
381 f1 = -c00*2.0*a3/d
382 c01 = f1*(dumdt + a3*0.25*xnumdt)
383 c02 = f1*(dumdd + a3*0.25*xnumdd)
384 c03 = f1*(dumda + a3*0.25*xnumda)
385 c04 = f1*(dumdz + a3*0.25*xnumdz)
386
387 # Fortran lines 505–509.
388 fxy = 1.05 + (a1 - b1)*c00
389 fxydt = (a2*xnumdt - b2*xnumdt)*c00 + (a1-b1)*c01
390 fxydd = (a2*xnumdd - b2*xnumdd)*c00 + (a1-b1)*c02
391 fxyda = (a2*xnumda - b2*xnumda)*c00 + (a1-b1)*c03
392 fxydz = (a2*xnumdz - b2*xnumdz)*c00 + (a1-b1)*c04
393
394 # Eqs. 4.1 and 4.5: (ft + fl) * fxy (Fortran lines 518–522) ...
395 splas = (ft + fl) * fxy
396 splasdt = (ftdt + fldt)*fxy + (ft+fl)*fxydt
397 splasdd = (ftdd + fldd)*fxy + (ft+fl)*fxydd
398 splasda = (ftda + flda)*fxy + (ft+fl)*fxyda
399 splasdz = (ftdz + fldz)*fxy + (ft+fl)*fxydz
400
401 # ... times exp(-gamma) (Fortran lines 525–526) ...
402 a2 = exp(-gl)
403 a3 = -0.5*a2*gl*gum
404
405 # Fortran lines 529–534.
406 a1 = splas
407 splas = a2*a1
408 splasdt = a2*splasdt + a3*gl2dt*a1
409 splasdd = a2*splasdd + a3*gl2dd*a1
410 splasda = a2*splasda + a3*gl2da*a1
411 splasdz = a2*splasdz + a3*gl2dz*a1
412
413 # ... times gamma^6 (Fortran lines 537–538) ...
414 a2 = gl6
415 a3 = 3.0*gl6*gum
416
417 # Fortran lines 541–546.
418 a1 = splas
419 splas = a2*a1
420 splasdt = a2*splasdt + a3*gl2dt*a1
421 splasdd = a2*splasdd + a3*gl2dd*a1
422 splasda = a2*splasda + a3*gl2da*a1
423 splasdz = a2*splasdz + a3*gl2dz*a1
424
425 # ... times the prefactor and lambda^9 (Fortran lines 550–551).
426 a2 = 0.93153 * 3.0e21 * xl9
427 a3 = 0.93153 * 3.0e21 * 9.0*xl8*xldt
428
429 # Fortran lines 554–559.
430 a1 = splas
431 splas = a2*a1
432 splasdt = a2*splasdt + a3*a1
433 splasdd = a2*splasdd
434 splasda = a2*splasda
435 splasdz = a2*splasdz
436
437 # ---- Photoneutrinos ----
438 # tau (eq. 3.8), cc (eq. 3.6) and table 2, for three temperature ranges.
439 # Fortran lines 570–608.
440 if temp >= 1.0e7 and temp < 1.0e8:
441 tau = log10(temp * 1.0e-7)
442 cc = 0.5654 + tau
443 c00 = 1.008e11
444 c01 = 0.0
445 c02 = 0.0
446 c03 = 0.0
447 c04 = 0.0
448 c05 = 0.0
449 c06 = 0.0
450 c10 = 8.156e10
451 c11 = 9.728e8
452 c12 = -3.806e9
453 c13 = -4.384e9
454 c14 = -5.774e9
455 c15 = -5.249e9
456 c16 = -5.153e9
457 c20 = 1.067e11
458 c21 = -9.782e9
459 c22 = -7.193e9
460 c23 = -6.936e9
461 c24 = -6.893e9
462 c25 = -7.041e9
463 c26 = -7.193e9
464 dd01 = 0.0
465 dd02 = 0.0
466 dd03 = 0.0
467 dd04 = 0.0
468 dd05 = 0.0
469 dd11 = -1.879e10
470 dd12 = -9.667e9
471 dd13 = -5.602e9
472 dd14 = -3.370e9
473 dd15 = -1.825e9
474 dd21 = -2.919e10
475 dd22 = -1.185e10
476 dd23 = -7.270e9
477 dd24 = -4.222e9
478 dd25 = -1.560e9
479
480 # Fortran lines 611–649.
481 elif temp >= 1.0e8 and temp < 1.0e9:
482 tau = log10(temp * 1.0e-8)
483 cc = 1.5654
484 c00 = 9.889e10
485 c01 = -4.524e8
486 c02 = -6.088e6
487 c03 = 4.269e7
488 c04 = 5.172e7
489 c05 = 4.910e7
490 c06 = 4.388e7
491 c10 = 1.813e11
492 c11 = -7.556e9
493 c12 = -3.304e9
494 c13 = -1.031e9
495 c14 = -1.764e9
496 c15 = -1.851e9
497 c16 = -1.928e9
498 c20 = 9.750e10
499 c21 = 3.484e10
500 c22 = 5.199e9
501 c23 = -1.695e9
502 c24 = -2.865e9
503 c25 = -3.395e9
504 c26 = -3.418e9
505 dd01 = -1.135e8
506 dd02 = 1.256e8
507 dd03 = 5.149e7
508 dd04 = 3.436e7
509 dd05 = 1.005e7
510 dd11 = 1.652e9
511 dd12 = -3.119e9
512 dd13 = -1.839e9
513 dd14 = -1.458e9
514 dd15 = -8.956e8
515 dd21 = -1.549e10
516 dd22 = -9.338e9
517 dd23 = -5.899e9
518 dd24 = -3.035e9
519 dd25 = -1.598e9
520
521 # Fortran lines 652–691.
522 elif temp >= 1.0e9:
523 tau = log10(t9)
524 cc = 1.5654
525 c00 = 9.581e10
526 c01 = 4.107e8
527 c02 = 2.305e8
528 c03 = 2.236e8
529 c04 = 1.580e8
530 c05 = 2.165e8
531 c06 = 1.721e8
532 c10 = 1.459e12
533 c11 = 1.314e11
534 c12 = -1.169e11
535 c13 = -1.765e11
536 c14 = -1.867e11
537 c15 = -1.983e11
538 c16 = -1.896e11
539 c20 = 2.424e11
540 c21 = -3.669e9
541 c22 = -8.691e9
542 c23 = -7.967e9
543 c24 = -7.932e9
544 c25 = -7.987e9
545 c26 = -8.333e9
546 dd01 = 4.724e8
547 dd02 = 2.976e8
548 dd03 = 2.242e8
549 dd04 = 7.937e7
550 dd05 = 4.859e7
551 dd11 = -7.094e11
552 dd12 = -3.697e11
553 dd13 = -2.189e11
554 dd14 = -1.273e11
555 dd15 = -5.705e10
556 dd21 = -2.254e10
557 dd22 = -1.551e10
558 dd23 = -7.793e9
559 dd24 = -4.489e9
560 dd25 = -2.185e9
561
562 # Fortran line 694.
563 taudt = iln10*tempi
564
565 # The trigonometric terms of eq. 3.7, computed once.
566 # Fortran lines 699–704.
567 cos1 = cos(fac1*tau)
568 cos2 = cos(fac1*2.0*tau)
569 cos3 = cos(fac1*3.0*tau)
570 cos4 = cos(fac1*4.0*tau)
571 cos5 = cos(fac1*5.0*tau)
572 last = cos(fac2*tau)
573
574 # Fortran lines 707–712.
575 sin1 = sin(fac1*tau)
576 sin2 = sin(fac1*2.0*tau)
577 sin3 = sin(fac1*3.0*tau)
578 sin4 = sin(fac1*4.0*tau)
579 sin5 = sin(fac1*5.0*tau)
580 xast = sin(fac2*tau)
581
582 # The three fit functions a0, a1, a2 and their temperature
583 # derivatives f0, f1, f2 (Fortran lines 715–718).
584 a0 = (0.5*c00
585 + c01*cos1 + dd01*sin1 + c02*cos2 + dd02*sin2
586 + c03*cos3 + dd03*sin3 + c04*cos4 + dd04*sin4
587 + c05*cos5 + dd05*sin5 + 0.5*c06*last)
588
589 # Fortran lines 721–725.
590 f0 = (taudt*fac1*(-c01*sin1 + dd01*cos1 - c02*sin2*2.0
591 + dd02*cos2*2.0 - c03*sin3*3.0 + dd03*cos3*3.0
592 - c04*sin4*4.0 + dd04*cos4*4.0
593 - c05*sin5*5.0 + dd05*cos5*5.0)
594 - 0.5*c06*xast*fac2*taudt)
595
596 # Fortran lines 728–731.
597 a1 = (0.5*c10
598 + c11*cos1 + dd11*sin1 + c12*cos2 + dd12*sin2
599 + c13*cos3 + dd13*sin3 + c14*cos4 + dd14*sin4
600 + c15*cos5 + dd15*sin5 + 0.5*c16*last)
601
602 # Fortran lines 734–737.
603 f1 = (taudt*fac1*(-c11*sin1 + dd11*cos1 - c12*sin2*2.0
604 + dd12*cos2*2.0 - c13*sin3*3.0 + dd13*cos3*3.0
605 - c14*sin4*4.0 + dd14*cos4*4.0 - c15*sin5*5.0
606 + dd15*cos5*5.0) - 0.5*c16*xast*fac2*taudt)
607
608 # Fortran lines 740–743.
609 a2 = (0.5*c20
610 + c21*cos1 + dd21*sin1 + c22*cos2 + dd22*sin2
611 + c23*cos3 + dd23*sin3 + c24*cos4 + dd24*sin4
612 + c25*cos5 + dd25*sin5 + 0.5*c26*last)
613
614 # Fortran lines 746–749.
615 f2 = (taudt*fac1*(-c21*sin1 + dd21*cos1 - c22*sin2*2.0
616 + dd22*cos2*2.0 - c23*sin3*3.0 + dd23*cos3*3.0
617 - c24*sin4*4.0 + dd24*cos4*4.0 - c25*sin5*5.0
618 + dd25*cos5*5.0) - 0.5*c26*xast*fac2*taudt)
619
620 # f(photo), eq. 3.4: numerator (Fortran lines 753–757) ...
621 dum = a0 + a1*zeta + a2*zeta2
622 dumdt = f0 + f1*zeta + a1*zetadt + f2*zeta2 + 2.0*a2*zeta*zetadt
623 dumdd = a1*zetadd + 2.0*a2*zeta*zetadd
624 dumda = a1*zetada + 2.0*a2*zeta*zetada
625 dumdz = a1*zetadz + 2.0*a2*zeta*zetadz
626
627 # Fortran line 760.
628 z = exp(-cc*zeta)
629
630 # Fortran lines 763–767.
631 xnum = dum*z
632 xnumdt = dumdt*z - dum*z*cc*zetadt
633 xnumdd = dumdd*z - dum*z*cc*zetadd
634 xnumda = dumda*z - dum*z*cc*zetada
635 xnumdz = dumdz*z - dum*z*cc*zetadz
636
637 # ... denominator (Fortran line 770) ...
638 xden = zeta3 + 6.290e-3*xlm1 + 7.483e-3*xlm2 + 3.061e-4*xlm3
639
640 # Fortran lines 773–778.
641 dum = 3.0*zeta2
642 xdendt = dum*zetadt - xldt*(6.290e-3*xlm2
643 + 2.0*7.483e-3*xlm3 + 3.0*3.061e-4*xlm4)
644 xdendd = dum*zetadd
645 xdenda = dum*zetada
646 xdendz = dum*zetadz
647
648 # Fortran lines 781–786.
649 dum = 1.0/xden
650 fphot = xnum*dum
651 fphotdt = (xnumdt - fphot*xdendt)*dum
652 fphotdd = (xnumdd - fphot*xdendd)*dum
653 fphotda = (xnumda - fphot*xdenda)*dum
654 fphotdz = (xnumdz - fphot*xdendz)*dum
655
656 # q(photo), eq. 3.3: numerator (Fortran lines 791–793) ...
657 a0 = 1.0 + 2.045 * xl
658 xnum = 0.666*a0**(-2.066)
659 xnumdt = -2.066*xnum/a0 * 2.045*xldt
660
661 # ... denominator (Fortran lines 796–798) ...
662 dum = 1.875e8*xl + 1.653e8*xl2 + 8.449e8*xl3 - 1.604e8*xl4
663 dumdt = xldt*(1.875e8 + 2.0*1.653e8*xl + 3.0*8.449e8*xl2
664 - 4.0*1.604e8*xl3)
665
666 # Fortran lines 801–806.
667 z = 1.0/dum
668 xden = 1.0 + rm*z
669 xdendt = -rm*z*z*dumdt
670 xdendd = rmdd*z
671 xdenda = rmda*z
672 xdendz = rmdz*z
673
674 # Fortran lines 809–815.
675 z = 1.0/xden
676 qphot = xnum*z
677 qphotdt = (xnumdt - qphot*xdendt)*z
678 dum = -qphot*z
679 qphotdd = dum*xdendd
680 qphotda = dum*xdenda
681 qphotdz = dum*xdendz
682
683 # Eq. 3.2: lambda^5 * f(photo) (Fortran lines 819–823) ...
684 sphot = xl5 * fphot
685 sphotdt = 5.0*xl4*xldt*fphot + xl5*fphotdt
686 sphotdd = xl5*fphotdd
687 sphotda = xl5*fphotda
688 sphotdz = xl5*fphotdz
689
690 # ... times rho*ye (Fortran lines 826–831) ...
691 a1 = sphot
692 sphot = rm*a1
693 sphotdt = rm*sphotdt
694 sphotdd = rm*sphotdd + rmdd*a1
695 sphotda = rm*sphotda + rmda*a1
696 sphotdz = rm*sphotdz + rmdz*a1
697
698 # ... times (C+ - C- q(photo)) / 2 (Fortran lines 834–835).
699 a1 = tfac4*(1.0 - tfac3 * qphot)
700 a2 = -tfac4*tfac3
701
702 # Fortran lines 838–843.
703 a3 = sphot
704 sphot = a1*a3
705 sphotdt = a1*sphotdt + a2*qphotdt*a3
706 sphotdd = a1*sphotdd + a2*qphotdd*a3
707 sphotda = a1*sphotda + a2*qphotda*a3
708 sphotdz = a1*sphotdz + a2*qphotdz*a3
709
710 # Fortran lines 846–852.
711 if sphot <= 0.0:
712 sphot = 0.0
713 sphotdt = 0.0
714 sphotdd = 0.0
715 sphotda = 0.0
716 sphotdz = 0.0
717
718 # ---- Bremsstrahlung neutrinos ----
719 # Powers of T8 and rho/1e6 (Fortran lines 866–878).
720 den6 = den * 1.0e-6
721 t8 = temp * 1.0e-8
722 t812 = sqrt(t8)
723 t832 = t8 * t812
724 t82 = t8*t8
725 t83 = t82*t8
726 t85 = t82*t83
727 t86 = t85*t8
728 t8m1 = 1.0/t8
729 t8m2 = t8m1*t8m1
730 t8m3 = t8m2*t8m1
731 t8m5 = t8m3*t8m2
732 t8m6 = t8m5*t8m1
733
734 # The Fermi temperature, eq. 4.3 (Fortran line 882).
735 tfermi = 5.9302e9*(sqrt(1.0+1.018*(den6*ye)**twoth)-1.0)
736
737 # Fortran lines 889–894.
738 if temp > 0.01 * tfermi:
739 # "Weak" degenerate electrons only; eta, eq. 5.3.
740 dum = 7.05e6 * t832 + 5.12e4 * t83
741 dumdt = (1.5*7.05e6*t812 + 3.0*5.12e4*t82)*1.0e-8
742
743 # Fortran lines 897–902.
744 z = 1.0/dum
745 eta = rm*z
746 etadt = -rm*z*z*dumdt
747 etadd = rmdd*z
748 etada = rmda*z
749 etadz = rmdz*z
750
751 # Fortran lines 905–907.
752 etam1 = 1.0/eta
753 etam2 = etam1 * etam1
754 etam3 = etam2 * etam1
755
756 # F, eq. 5.2 (Fortran lines 912–914).
757 a0 = 23.5 + 6.83e4*t8m2 + 7.81e8*t8m5
758 f0 = (-2.0*6.83e4*t8m3 - 5.0*7.81e8*t8m6)*1.0e-8
759 xnum = 1.0/a0
760
761 # Fortran lines 917–922.
762 dum = 1.0 + 1.47*etam1 + 3.29e-2*etam2
763 z = -1.47*etam2 - 2.0*3.29e-2*etam3
764 dumdt = z*etadt
765 dumdd = z*etadd
766 dumda = z*etada
767 dumdz = z*etadz
768
769 # Fortran lines 925–930.
770 c00 = 1.26 * (1.0+etam1)
771 z = -1.26*etam2
772 c01 = z*etadt
773 c02 = z*etadd
774 c03 = z*etada
775 c04 = z*etadz
776
777 # Fortran lines 932–937.
778 z = 1.0/dum
779 xden = c00*z
780 xdendt = (c01 - xden*dumdt)*z
781 xdendd = (c02 - xden*dumdd)*z
782 xdenda = (c03 - xden*dumda)*z
783 xdendz = (c04 - xden*dumdz)*z
784
785 # Fortran lines 940–944.
786 fbrem = xnum + xden
787 fbremdt = -xnum*xnum*f0 + xdendt
788 fbremdd = xdendd
789 fbremda = xdenda
790 fbremdz = xdendz
791
792 # G, eq. 5.9 (Fortran lines 949–950).
793 a0 = 230.0 + 6.7e5*t8m2 + 7.66e9*t8m5
794 f0 = (-2.0*6.7e5*t8m3 - 5.0*7.66e9*t8m6)*1.0e-8
795
796 # Fortran lines 953–959.
797 z = 1.0 + rm*1.0e-9
798 dum = a0*z
799 dumdt = f0*z
800 z = a0*1.0e-9
801 dumdd = z*rmdd
802 dumda = z*rmda
803 dumdz = z*rmdz
804
805 # Fortran lines 962–967.
806 xnum = 1.0/dum
807 z = -xnum*xnum
808 xnumdt = z*dumdt
809 xnumdd = z*dumdd
810 xnumda = z*dumda
811 xnumdz = z*dumdz
812
813 # Fortran lines 970–971.
814 c00 = 7.75e5*t832 + 247.0*t8**(3.85)
815 dd00 = (1.5*7.75e5*t812 + 3.85*247.0*t8**(2.85))*1.0e-8
816
817 # Fortran lines 974–975.
818 c01 = 4.07 + 0.0240 * t8**(1.4)
819 dd01 = 1.4*0.0240*t8**(0.4)*1.0e-8
820
821 # Fortran lines 978–979.
822 c02 = 4.59e-5 * t8**(-0.110)
823 dd02 = -0.11*4.59e-5 * t8**(-1.11)*1.0e-8
824
825 # Fortran lines 982–988.
826 z = den**(0.656)
827 dum = c00*rmi + c01 + c02*z
828 dumdt = dd00*rmi + dd01 + dd02*z
829 z = -c00*rmi*rmi
830 dumdd = z*rmdd + 0.656*c02*den**(-0.454)
831 dumda = z*rmda
832 dumdz = z*rmdz
833
834 # Fortran lines 991–996.
835 xden = 1.0/dum
836 z = -xden*xden
837 xdendt = z*dumdt
838 xdendd = z*dumdd
839 xdenda = z*dumda
840 xdendz = z*dumdz
841
842 # Fortran lines 999–1003.
843 gbrem = xnum + xden
844 gbremdt = xnumdt + xdendt
845 gbremdd = xnumdd + xdendd
846 gbremda = xnumda + xdenda
847 gbremdz = xnumdz + xdendz
848
849 # Eq. 5.1 (Fortran lines 1008–1012).
850 dum = 0.5738*zbar*ye*t86*den
851 dumdt = 0.5738*zbar*ye*6.0*t85*den*1.0e-8
852 dumdd = 0.5738*zbar*ye*t86
853 dumda = -dum*abari
854 dumdz = 0.5738*2.0*ye*t86*den
855
856 # Fortran lines 1015–1020.
857 z = tfac4*fbrem - tfac5*gbrem
858 sbrem = dum * z
859 sbremdt = dumdt*z + dum*(tfac4*fbremdt - tfac5*gbremdt)
860 sbremdd = dumdd*z + dum*(tfac4*fbremdd - tfac5*gbremdd)
861 sbremda = dumda*z + dum*(tfac4*fbremda - tfac5*gbremda)
862 sbremdz = dumdz*z + dum*(tfac4*fbremdz - tfac5*gbremdz)
863
864 # Fortran lines 1030–1032.
865 else:
866 # Liquid metal, with C12 parameters (not too different for other
867 # elements); u, eqs. 5.18 and 5.16.
868 u = fac3 * (log10(den) - 3.0)
869 a0 = iln10*fac3*deni
870
871 # Fortran lines 1036–1040.
872 cos1 = cos(u)
873 cos2 = cos(2.0*u)
874 cos3 = cos(3.0*u)
875 cos4 = cos(4.0*u)
876 cos5 = cos(5.0*u)
877
878 # Fortran lines 1043–1047.
879 sin1 = sin(u)
880 sin2 = sin(2.0*u)
881 sin3 = sin(3.0*u)
882 sin4 = sin(4.0*u)
883 sin5 = sin(5.0*u)
884
885 # fb (eq. 5.21), with its density derivative c00.
886 # Fortran lines 1051–1056.
887 fb = (0.5 * 0.17946 + 0.00945*u + 0.34529
888 - 0.05821*cos1 - 0.04969*sin1
889 - 0.01089*cos2 - 0.01584*sin2
890 - 0.01147*cos3 - 0.00504*sin3
891 - 0.00656*cos4 - 0.00281*sin4
892 - 0.00519*cos5)
893
894 # Fortran lines 1059–1064.
895 c00 = a0*(0.00945
896 + 0.05821*sin1 - 0.04969*cos1
897 + 0.01089*sin2*2.0 - 0.01584*cos2*2.0
898 + 0.01147*sin3*3.0 - 0.00504*cos3*3.0
899 + 0.00656*sin4*4.0 - 0.00281*cos4*4.0
900 + 0.00519*sin5*5.0)
901
902 # ft (eq. 5.22), with its derivative c01 (Fortran lines 1069–1074).
903 ft = (0.5 * 0.06781 - 0.02342*u + 0.24819
904 - 0.00944*cos1 - 0.02213*sin1
905 - 0.01289*cos2 - 0.01136*sin2
906 - 0.00589*cos3 - 0.00467*sin3
907 - 0.00404*cos4 - 0.00131*sin4
908 - 0.00330*cos5)
909
910 # Fortran lines 1077–1082.
911 c01 = a0*(-0.02342
912 + 0.00944*sin1 - 0.02213*cos1
913 + 0.01289*sin2*2.0 - 0.01136*cos2*2.0
914 + 0.00589*sin3*3.0 - 0.00467*cos3*3.0
915 + 0.00404*sin4*4.0 - 0.00131*cos4*4.0
916 + 0.00330*sin5*5.0)
917
918 # gb (eq. 5.23), with its derivative c02 (Fortran lines 1087–1092).
919 gb = (0.5 * 0.00766 - 0.01259*u + 0.07917
920 - 0.00710*cos1 + 0.02300*sin1
921 - 0.00028*cos2 - 0.01078*sin2
922 + 0.00232*cos3 + 0.00118*sin3
923 + 0.00044*cos4 - 0.00089*sin4
924 + 0.00158*cos5)
925
926 # Fortran lines 1095–1100.
927 c02 = a0*(-0.01259
928 + 0.00710*sin1 + 0.02300*cos1
929 + 0.00028*sin2*2.0 - 0.01078*cos2*2.0
930 - 0.00232*sin3*3.0 + 0.00118*cos3*3.0
931 - 0.00044*sin4*4.0 - 0.00089*cos4*4.0
932 - 0.00158*sin5*5.0)
933
934 # gt (eq. 5.24), with its derivative c03 (Fortran lines 1105–1110).
935 gt = (-0.5 * 0.00769 - 0.00829*u + 0.05211
936 + 0.00356*cos1 + 0.01052*sin1
937 - 0.00184*cos2 - 0.00354*sin2
938 + 0.00146*cos3 - 0.00014*sin3
939 + 0.00031*cos4 - 0.00018*sin4
940 + 0.00069*cos5)
941
942 # Fortran lines 1113–1118.
943 c03 = a0*(-0.00829
944 - 0.00356*sin1 + 0.01052*cos1
945 + 0.00184*sin2*2.0 - 0.00354*cos2*2.0
946 - 0.00146*sin3*3.0 - 0.00014*cos3*3.0
947 - 0.00031*sin4*4.0 - 0.00018*cos4*4.0
948 - 0.00069*sin5*5.0)
949
950 # dum and the powers of its inverse (Fortran lines 1122–1126).
951 dum = 2.275e-1 * zbar * zbar*t8m1 * (den6*abari)**oneth
952 dumdt = -dum*tempi
953 dumdd = oneth*dum*deni
954 dumda = -oneth*dum*abari
955 dumdz = 2.0*dum*zbari
956
957 # Fortran lines 1128–1133.
958 gm1 = 1.0/dum
959 gm2 = gm1*gm1
960 gm13 = gm1**oneth
961 gm23 = gm13 * gm13
962 gm43 = gm13*gm1
963 gm53 = gm23*gm1
964
965 # v and w, eqs. 5.25 and 5.26, with their derivatives a0, a1.
966 # Fortran lines 1138–1139.
967 v = -0.05483 - 0.01946*gm13 + 1.86310*gm23 - 0.78873*gm1
968 a0 = oneth*0.01946*gm43 - twoth*1.86310*gm53 + 0.78873*gm2
969
970 # Fortran lines 1142–1143.
971 w = -0.06711 + 0.06859*gm13 + 1.74360*gm23 - 0.74498*gm1
972 a1 = -oneth*0.06859*gm43 - twoth*1.74360*gm53 + 0.74498*gm2
973
974 # Eqs. 5.19 and 5.20 (Fortran lines 1148–1152).
975 fliq = v*fb + (1.0 - v)*ft
976 fliqdt = a0*dumdt*(fb - ft)
977 fliqdd = a0*dumdd*(fb - ft) + v*c00 + (1.0 - v)*c01
978 fliqda = a0*dumda*(fb - ft)
979 fliqdz = a0*dumdz*(fb - ft)
980
981 # Fortran lines 1155–1159.
982 gliq = w*gb + (1.0 - w)*gt
983 gliqdt = a1*dumdt*(gb - gt)
984 gliqdd = a1*dumdd*(gb - gt) + w*c02 + (1.0 - w)*c03
985 gliqda = a1*dumda*(gb - gt)
986 gliqdz = a1*dumdz*(gb - gt)
987
988 # Eq. 5.17 (Fortran lines 1164–1168).
989 dum = 0.5738*zbar*ye*t86*den
990 dumdt = 0.5738*zbar*ye*6.0*t85*den*1.0e-8
991 dumdd = 0.5738*zbar*ye*t86
992 dumda = -dum*abari
993 dumdz = 0.5738*2.0*ye*t86*den
994
995 # Fortran lines 1171–1176.
996 z = tfac4*fliq - tfac5*gliq
997 sbrem = dum * z
998 sbremdt = dumdt*z + dum*(tfac4*fliqdt - tfac5*gliqdt)
999 sbremdd = dumdd*z + dum*(tfac4*fliqdd - tfac5*gliqdd)
1000 sbremda = dumda*z + dum*(tfac4*fliqda - tfac5*gliqda)
1001 sbremdz = dumdz*z + dum*(tfac4*fliqdz - tfac5*gliqdz)
1002
1003 # ---- Recombination neutrinos ----
1004 # Eq. 6.11, solved for nu (Fortran lines 1188–1192).
1005 xnum = 1.10520e8 * den * ye / (temp*sqrt(temp))
1006 xnumdt = -1.50*xnum*tempi
1007 xnumdd = xnum*deni
1008 xnumda = -xnum*abari
1009 xnumdz = xnum*zbari
1010
1011 # The chemical potential nu (Fortran line 1196) ...
1012 nu = ifermi12(xnum)
1013
1014 # ... and its derivatives, through the integral of order -1/2.
1015 # Fortran lines 1200–1204.
1016 a0 = 1.0/(0.5*zfermim12(nu))
1017 nudt = a0*xnumdt
1018 nudd = a0*xnumdd
1019 nuda = a0*xnumda
1020 nudz = a0*xnumdz
1021
1022 # Fortran lines 1207–1208.
1023 nu2 = nu * nu
1024 nu3 = nu2 * nu
1025
1026 # Table 12 (Fortran lines 1212–1232).
1027 if nu >= -20.0 and nu < 0.0:
1028 a1 = 1.51e-2
1029 a2 = 2.42e-1
1030 a3 = 1.21
1031 b = 3.71e-2
1032 c = 9.06e-1
1033 d = 9.28e-1
1034 f1 = 0.0
1035 f2 = 0.0
1036 f3 = 0.0
1037 elif nu >= 0.0 and nu <= 10.0:
1038 a1 = 1.23e-2
1039 a2 = 2.66e-1
1040 a3 = 1.30
1041 b = 1.17e-1
1042 c = 8.97e-1
1043 d = 1.77e-1
1044 f1 = -1.20e-2
1045 f2 = 2.29e-2
1046 f3 = -1.04e-3
1047
1048 # The recombination loss, for -20 <= nu <= 10 only (Fortran lines
1049 # 1236–1301).
1050 # Question (see the page): zero outside -20 <= nu <= 10.
1051 if nu >= -20.0 and nu <= 10.0:
1052 # Eqs. 6.7, 6.13 and 6.14 (Fortran lines 1240–1244).
1053 zeta = 1.579e5*zbar*zbar*tempi
1054 zetadt = -zeta*tempi
1055 zetadd = 0.0
1056 zetada = 0.0
1057 zetadz = 2.0*zeta*zbari
1058
1059 # Fortran lines 1247–1253.
1060 c00 = 1.0/(1.0 + f1*nu + f2*nu2 + f3*nu3)
1061 c01 = f1 + f2*2.0*nu + f3*3.0*nu2
1062 dum = zeta*c00
1063 dumdt = zetadt*c00 + zeta*c01*nudt
1064 dumdd = zeta*c01*nudd
1065 dumda = zeta*c01*nuda
1066 dumdz = zetadz*c00 + zeta*c01*nudz
1067
1068 # Fortran lines 1257–1261.
1069 z = 1.0/dum
1070 dd00 = dum**(-2.25)
1071 dd01 = dum**(-4.55)
1072 c00 = a1*z + a2*dd00 + a3*dd01
1073 c01 = -(a1*z + 2.25*a2*dd00 + 4.55*a3*dd01)*z
1074
1075 # Fortran lines 1265–1271.
1076 z = exp(c*nu)
1077 dd00 = b*z*(1.0 + d*dum)
1078 gum = 1.0 + dd00
1079 gumdt = dd00*c*nudt + b*z*d*dumdt
1080 gumdd = dd00*c*nudd + b*z*d*dumdd
1081 gumda = dd00*c*nuda + b*z*d*dumda
1082 gumdz = dd00*c*nudz + b*z*d*dumdz
1083
1084 # Eq. 6.5 (Fortran lines 1275–1276).
1085 z = exp(nu)
1086 a1 = 1.0/gum
1087
1088 # Fortran lines 1279–1283.
1089 bigj = c00 * z * a1
1090 bigjdt = c01*dumdt*z*a1 + c00*z*nudt*a1 - c00*z*a1*a1 * gumdt
1091 bigjdd = c01*dumdd*z*a1 + c00*z*nudd*a1 - c00*z*a1*a1 * gumdd
1092 bigjda = c01*dumda*z*a1 + c00*z*nuda*a1 - c00*z*a1*a1 * gumda
1093 bigjdz = c01*dumdz*z*a1 + c00*z*nudz*a1 - c00*z*a1*a1 * gumdz
1094
1095 # Eq. 6.5 (Fortran lines 1288–1291).
1096 z = exp(zeta + nu)
1097 dum = 1.0 + z
1098 a1 = 1.0/dum
1099 a2 = 1.0/bigj
1100
1101 # Fortran lines 1294–1298.
1102 sreco = tfac6 * 2.649e-18 * ye * zbar**13 * den * bigj*a1
1103 srecodt = sreco*(bigjdt*a2 - z*(zetadt + nudt)*a1)
1104 srecodd = sreco*(1.0*deni + bigjdd*a2 - z*(zetadd + nudd)*a1)
1105 srecoda = sreco*(-1.0*abari + bigjda*a2 - z*(zetada+nuda)*a1)
1106 srecodz = sreco*(14.0*zbari + bigjdz*a2 - z*(zetadz+nudz)*a1)
1107
1108 # Convert from erg/cm^3/s to erg/g/s (comment these out to duplicate
1109 # the Itoh et al. plots; Fortran lines 1309–1313).
1110 spair = spair*deni
1111 spairdt = spairdt*deni
1112 spairdd = spairdd*deni - spair*deni
1113 spairda = spairda*deni
1114 spairdz = spairdz*deni
1115
1116 # Fortran lines 1316–1320.
1117 splas = splas*deni
1118 splasdt = splasdt*deni
1119 splasdd = splasdd*deni - splas*deni
1120 splasda = splasda*deni
1121 splasdz = splasdz*deni
1122
1123 # Fortran lines 1323–1327.
1124 sphot = sphot*deni
1125 sphotdt = sphotdt*deni
1126 sphotdd = sphotdd*deni - sphot*deni
1127 sphotda = sphotda*deni
1128 sphotdz = sphotdz*deni
1129
1130 # Fortran lines 1330–1334.
1131 sbrem = sbrem*deni
1132 sbremdt = sbremdt*deni
1133 sbremdd = sbremdd*deni - sbrem*deni
1134 sbremda = sbremda*deni
1135 sbremdz = sbremdz*deni
1136
1137 # Fortran lines 1337–1341.
1138 sreco = sreco*deni
1139 srecodt = srecodt*deni
1140 srecodd = srecodd*deni - sreco*deni
1141 srecoda = srecoda*deni
1142 srecodz = srecodz*deni
1143
1144 # The total and its derivatives (Fortran lines 1346–1350).
1145 snu = splas + spair + sphot + sbrem + sreco
1146 dsnudt = splasdt + spairdt + sphotdt + sbremdt + srecodt
1147 dsnudd = splasdd + spairdd + sphotdd + sbremdd + srecodd
1148 dsnuda = splasda + spairda + sphotda + sbremda + srecoda
1149 dsnudz = splasdz + spairdz + sphotdz + sbremdz + srecodz
1150
1151 # Fortran line 1354.
1152 return snu, dsnudt, dsnudd, dsnuda, dsnudz