1c..
2c..
3c.. neutrino loss subroutine modified by G. Newsham
4c.. from codes of N. Itoh & F. Timmes
5c.. (9/06)
6c..
7c..
8c.. Currently uses just the carbon coefficients for the bremsstrahlung
9c.. neutrino losses (the differences for other elements is slight.)
10c.. We also currently set the fermi temperature cuttoff at 0.01 Tfermi.
11c.. This is applicable for helium but will need to be amended for
12c.. carbon and oxygen white dwarfs and cores of AGB stars.
13c..
14c..
15
16
17
18
19 subroutine nulosses(temp,den,snu,xmass,ymass,aion,zion,
20 & & dsnudt,dsnudd)
21
22
23 implicit none
24 save
25
26
27c..tests the neutrino loss rate routine
28
29
30c..ionmax = number of isotopes in the network
31c..xmass = mass fractions
32c..ymass = molar fractions
33c..aion = number of nucleons
34c..zion = number of protons
35
36
37 integer ionmax
38 parameter (ionmax=4)
39 double precision xmass(ionmax),ymass(ionmax),
40 1 1 aion(ionmax),zion(ionmax),temp,den,abar,zbar,
41 2 2 snu,dsnudt,dsnudd,dsnuda,dsnudz
42
43
44
45c..get abar and zbar
46 call azbar(xmass,aion,zion,ionmax,
47 1 1 ymass,abar,zbar)
48
49
50
51c..get the neutrino losses
52 call sneut(temp,den,abar,zbar,
53 1 1 snu,dsnudt,dsnudd,dsnuda,dsnudz)
54
55
56
57 return
58 end
59
60
61 subroutine azbar(xmass,aion,zion,ionmax,
62 1 1 ymass,abar,zbar)
63 implicit none
64 save
65
66
67c..input
68c..mass fractions = xmass(1:ionmax)
69c..number of nucleons = aion(1:ionmax)
70c..charge of nucleus = zion(1:ionmax)
71c..number of isotopes = ionmax
72
73
74c..output:
75c..molar abundances = ymass(1:ionmax),
76c..mean number of nucleons = abar
77c..mean nucleon charge = zbar
78
79
80
81c..declare
82 integer i,ionmax
83 double precision xmass(ionmax),aion(ionmax),zion(ionmax),
84 1 1 ymass(ionmax),abar,zbar,zbarxx,ytot1
85
86
87 zbarxx = 0.0d0
88 ytot1 = 0.0d0
89 do i=1,ionmax
90 ymass(i) = xmass(i)/aion(i)
91 ytot1 = ytot1 + ymass(i)
92 zbarxx = zbarxx + zion(i) * ymass(i)
93 enddo
94 abar = 1.0d0/ytot1
95 zbar = zbarxx * abar
96 return
97 end
1"""Python version of nulosses.f (YREC 7be4133): the neutrino energy-loss
2rate of a mixture, from Timmes' code (Grant Newsham 9/06)."""
3
4import numpy as np
5
6from pyrec.sneut import sneut
7
8# PARAMETER (Fortran lines 37–38).
9IONMAX = 4
10
11
12def nulosses(temp: float, den: float, snu: float, xmass: np.ndarray, ymass: np.ndarray, aion: np.ndarray,
13 zion: np.ndarray, dsnudt: float, dsnudd: float) -> tuple[float, float, float]:
14 """The mean nucleon number and charge of the mixture (azbar), then the
15 neutrino loss rate and its derivatives in T and rho (sneut).
16
17 Translates: nulosses.f#NULOSSES (7be4133)
18
19 Arguments: temp (K) and den (g/cm^3), unlogged; the mass fractions
20 xmass, atomic masses aion and charges zion of the IONMAX species
21 (index 0 unused); ymass, set in place to the molar abundances; snu,
22 dsnudt and dsnudd are passed in with any value.
23
24 Returns (snu, dsnudt, dsnudd).
25
26 """
27
28 # abar and zbar (Fortran lines 45–47).
29 abar = zbar = 0.0
30 abar, zbar = azbar(xmass, aion, zion, IONMAX, ymass, abar, zbar)
31
32 # The neutrino losses (Fortran lines 51–53); the derivatives in abar
33 # and zbar are dropped.
34 # Question (see the page): the Fermi-temperature cutoff inside sneut.
35 dsnuda = dsnudz = 0.0
36 snu, dsnudt, dsnudd, dsnuda, dsnudz = sneut(
37 temp, den, abar, zbar, snu, dsnudt, dsnudd, dsnuda, dsnudz)
38 return snu, dsnudt, dsnudd
39
40
41def azbar(xmass: np.ndarray, aion: np.ndarray, zion: np.ndarray, ionmax: int, ymass: np.ndarray, abar: float,
42 zbar: float) -> tuple[float, float]:
43 """The mean nucleon number abar = 1/sum(X_i/A_i) and mean charge
44 zbar = abar*sum(Z_i X_i/A_i) of the mixture.
45
46 Translates: nulosses.f#AZBAR (7be4133)
47
48 Arguments: xmass, aion, zion (index 0 unused); ionmax, the number of
49 species; ymass, set in place to X_i/A_i; abar and zbar are passed in
50 with any value.
51
52 Returns (abar, zbar).
53
54 """
55
56 # Fortran lines 87–95.
57 zbarxx = 0.0
58 ytot1 = 0.0
59 for i in range(1, ionmax + 1):
60 ymass[i] = xmass[i] / aion[i]
61 ytot1 = ytot1 + ymass[i]
62 zbarxx = zbarxx + zion[i] * ymass[i]
63 abar = 1.0 / ytot1
64 zbar = zbarxx * abar
65 return abar, zbar