nmbackend 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nmbackend/__init__.py +22 -0
- nmbackend/adapters/__init__.py +4 -0
- nmbackend/adapters/rift.py +95 -0
- nmbackend/constants.py +55 -0
- nmbackend/cooling/README.md +159 -0
- nmbackend/cooling/__init__.py +13 -0
- nmbackend/cooling/build_nscool.sh +51 -0
- nmbackend/cooling/isothermal.py +76 -0
- nmbackend/cooling/nscool_nmbackend.patch +310 -0
- nmbackend/cooling/physics/__init__.py +18 -0
- nmbackend/cooling/physics/_spline.py +71 -0
- nmbackend/cooling/physics/blanket.py +66 -0
- nmbackend/cooling/physics/conduct.py +196 -0
- nmbackend/cooling/physics/core_conduct.py +68 -0
- nmbackend/cooling/physics/core_nu.py +268 -0
- nmbackend/cooling/physics/crust.py +113 -0
- nmbackend/cooling/physics/crust_nu.py +93 -0
- nmbackend/cooling/physics/curve.py +42 -0
- nmbackend/cooling/physics/envelope.py +37 -0
- nmbackend/cooling/physics/gaps.py +164 -0
- nmbackend/cooling/physics/geometry.py +131 -0
- nmbackend/cooling/physics/heat.py +125 -0
- nmbackend/cooling/physics/native.py +138 -0
- nmbackend/cooling/physics/reference.py +53 -0
- nmbackend/cooling/physics/star.py +225 -0
- nmbackend/cooling/physics/superfluid.py +41 -0
- nmbackend/cooling/physics/whole.py +136 -0
- nmbackend/cooling/runner.py +583 -0
- nmbackend/cooling/validate.py +120 -0
- nmbackend/data/crust_sly_dh2001.dat +81 -0
- nmbackend/data/frib_scenario_ladder.yaml +100 -0
- nmbackend/durca.py +111 -0
- nmbackend/ejecta.py +614 -0
- nmbackend/eos/__init__.py +19 -0
- nmbackend/eos/base.py +523 -0
- nmbackend/eos/compose.py +251 -0
- nmbackend/eos/coolcomp.py +67 -0
- nmbackend/eos/crust.py +318 -0
- nmbackend/eos/ddrmf.py +388 -0
- nmbackend/eos/hybrid.py +173 -0
- nmbackend/eos/leptons.py +74 -0
- nmbackend/eos/metamodel.py +303 -0
- nmbackend/eos/polytrope.py +33 -0
- nmbackend/eos/rmft.py +450 -0
- nmbackend/eos/skyrme.py +352 -0
- nmbackend/inference/__init__.py +13 -0
- nmbackend/inference/fisher.py +174 -0
- nmbackend/inference/synthetic.py +83 -0
- nmbackend/ipad.py +102 -0
- nmbackend/lab_likelihood.py +587 -0
- nmbackend/nscool_io.py +112 -0
- nmbackend/postmerger.py +264 -0
- nmbackend/priors/__init__.py +16 -0
- nmbackend/priors/bridge.py +437 -0
- nmbackend/priors/bridge_jax.py +435 -0
- nmbackend/priors/gp_pca.py +325 -0
- nmbackend/reference/__init__.py +11 -0
- nmbackend/reference/reprimand.py +108 -0
- nmbackend/reference/scipy_tov.py +289 -0
- nmbackend/rift/__init__.py +26 -0
- nmbackend/rift/compressed.py +194 -0
- nmbackend/rift/evidence.py +276 -0
- nmbackend/rift/sequence.py +428 -0
- nmbackend/rotating/__init__.py +7 -0
- nmbackend/rotating/rns.py +197 -0
- nmbackend/rotating/tabulated.py +249 -0
- nmbackend/thermal/__init__.py +1 -0
- nmbackend/thermal/diffusion.py +86 -0
- nmbackend/tov/__init__.py +15 -0
- nmbackend/tov/central.py +72 -0
- nmbackend/tov/family.py +155 -0
- nmbackend/tov/phase_transition.py +93 -0
- nmbackend/tov/solver.py +475 -0
- nmbackend/validation/__init__.py +5 -0
- nmbackend/validation/model_diagnostic.py +67 -0
- nmbackend/validation/reference_matrix.py +216 -0
- nmbackend-0.4.0.dist-info/METADATA +168 -0
- nmbackend-0.4.0.dist-info/RECORD +81 -0
- nmbackend-0.4.0.dist-info/WHEEL +5 -0
- nmbackend-0.4.0.dist-info/licenses/LICENSE +21 -0
- nmbackend-0.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
diff --git a/Code/NSCool_READ.inc.f b/Code/NSCool_READ.inc.f
|
|
2
|
+
index 753db72..2e06189 100644
|
|
3
|
+
--- a/Code/NSCool_READ.inc.f
|
|
4
|
+
+++ b/Code/NSCool_READ.inc.f
|
|
5
|
+
@@ -106,6 +106,17 @@ c READ PAIRING PARAMETERS: ********************************************
|
|
6
|
+
read(20,*)delkf_n3p2
|
|
7
|
+
read(20,*)tcmax_n3p2
|
|
8
|
+
end if
|
|
9
|
+
+c nmbackend patch: optional trailing lines SXP1S0, SXN3P2 (default 1)
|
|
10
|
+
+c and CA3P2 (default 0.5, Leinson; the 2010 release used 2)
|
|
11
|
+
+ sxp1s0=1.d0
|
|
12
|
+
+ sxn3p2=1.d0
|
|
13
|
+
+ ca3p2=0.5d0
|
|
14
|
+
+ read(20,*,end=1901)sxp1s0
|
|
15
|
+
+ read(20,*,end=1901)sxn3p2
|
|
16
|
+
+ read(20,*,end=1901)ca3p2
|
|
17
|
+
+ 1901 continue
|
|
18
|
+
+ print '(a,1p2e14.6)',' nmbackend sx_p1s0 sx_n3p2 =',sxp1s0,sxn3p2
|
|
19
|
+
+ print '(a,1p1e14.6)',' nmbackend ca_n3p2 =',ca3p2
|
|
20
|
+
close(unit=20,status='keep')
|
|
21
|
+
|
|
22
|
+
c READ NEUTRINO PARAMETERS: ********************************************
|
|
23
|
+
diff --git a/Code/neutrino_core.f b/Code/neutrino_core.f
|
|
24
|
+
index cacda6a..2e5fbf5 100644
|
|
25
|
+
--- a/Code/neutrino_core.f
|
|
26
|
+
+++ b/Code/neutrino_core.f
|
|
27
|
+
@@ -775,12 +775,15 @@ c
|
|
28
|
+
c For the j=2 m=0 gap
|
|
29
|
+
implicit real*8 (a-h,k-z)
|
|
30
|
+
parameter (pi = 3.14159265d0,rhonucl=2.8d14)
|
|
31
|
+
+c nmbackend patch: a_A = c_A g_A^2 with c_A from the pairing file
|
|
32
|
+
+c (default 0.5: Leinson 2010, as in A. W. Steiner's fork; release: 2)
|
|
33
|
+
+ common/gapscale/sxp1s0,sxn3p2,ca3p2
|
|
34
|
+
if (T.le.Tc) then
|
|
35
|
+
pf=kf*197.d0
|
|
36
|
+
vf=pf/mst/940.d0
|
|
37
|
+
g_A=1.26d0
|
|
38
|
+
a_v=0.d0
|
|
39
|
+
- a_a=2.d0*g_A**2
|
|
40
|
+
+ a_a=ca3p2*g_A**2
|
|
41
|
+
a=a_v+a_a
|
|
42
|
+
c The vector part in "a" has been put to zero !
|
|
43
|
+
tau=T/Tc
|
|
44
|
+
diff --git a/Code/pairing.inc.f b/Code/pairing.inc.f
|
|
45
|
+
index e25d565..2fe52b1 100644
|
|
46
|
+
--- a/Code/pairing.inc.f
|
|
47
|
+
+++ b/Code/pairing.inc.f
|
|
48
|
+
@@ -25,3 +25,6 @@ c 3 T0_p ,k0_p ,k1_p ,k2_ p,k3_p
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
+c nmbackend patch: density scale factors s_x (Zhou+2026 Eq. 10) and the
|
|
53
|
+
+c axial coefficient c_A of n3P2 pair breaking, a_A = c_A g_A^2
|
|
54
|
+
+ common/gapscale/sxp1s0,sxn3p2,ca3p2
|
|
55
|
+
diff --git a/Code/precool.f b/Code/precool.f
|
|
56
|
+
index 111fcd6..909bab8 100644
|
|
57
|
+
--- a/Code/precool.f
|
|
58
|
+
+++ b/Code/precool.f
|
|
59
|
+
@@ -1301,6 +1301,7 @@ c *********************************************************************
|
|
60
|
+
c INCLUDE 'files_phys.inc.f'
|
|
61
|
+
INCLUDE 'files.inc.f'
|
|
62
|
+
dimension tcrit(10),rho_lo(10),rho_hi(10)
|
|
63
|
+
+ dimension kfn_s(0:isize),kfp_s(0:isize)
|
|
64
|
+
c Just to be safe:
|
|
65
|
+
do i=0,imax
|
|
66
|
+
tcn(i) =1.0d0
|
|
67
|
+
@@ -1351,12 +1352,16 @@ c Ioffe gaps:
|
|
68
|
+
tcn(i)=max(1.d0,Tc_Ioffe_3ns(kfn(i)))*fn1s0
|
|
69
|
+
end do
|
|
70
|
+
end if
|
|
71
|
+
+c nmbackend patch: gap scaling Delta(n)=s_y*Delta_0(n/s_x) (Zhou+2026
|
|
72
|
+
+c Eq. 10); s_y is fn3p2/fp1s0, s_x enters through kF at n/s_x:
|
|
73
|
+
+ call get_kf_scaled(sxn3p2,kfn,kfn_s)
|
|
74
|
+
+ call get_kf_scaled(sxp1s0,kfp,kfp_s)
|
|
75
|
+
c ***** 3p2 neutron superfluidity *************************************
|
|
76
|
+
isf=-1
|
|
77
|
+
c isf will be the largest zone number at which triplet pairing is present
|
|
78
|
+
if(sfn3p2.eq.1.)then
|
|
79
|
+
do i=0,idrip
|
|
80
|
+
- temp=tcn3_hgrr(kfn(i))*fn3p2
|
|
81
|
+
+ temp=tcn3_hgrr(kfn_s(i))*fn3p2
|
|
82
|
+
if (temp.ge.tcn(i)) then
|
|
83
|
+
tcn(i)=temp
|
|
84
|
+
isf=i
|
|
85
|
+
@@ -1364,7 +1369,7 @@ c isf will be the largest zone number at which triplet pairing is present
|
|
86
|
+
end do
|
|
87
|
+
else if(sfn3p2.eq.2.)then
|
|
88
|
+
do i=0,idrip
|
|
89
|
+
- temp=tcn3_ao(kfn(i))*fn3p2
|
|
90
|
+
+ temp=tcn3_ao(kfn_s(i))*fn3p2
|
|
91
|
+
if (temp.ge.tcn(i)) then
|
|
92
|
+
tcn(i)=temp
|
|
93
|
+
isf=i
|
|
94
|
+
@@ -1372,7 +1377,7 @@ c isf will be the largest zone number at which triplet pairing is present
|
|
95
|
+
end do
|
|
96
|
+
else if(sfn3p2.eq.3.)then
|
|
97
|
+
do i=0,idrip
|
|
98
|
+
- temp=tcn3_ao_m1(kfn(i))*fn3p2
|
|
99
|
+
+ temp=tcn3_ao_m1(kfn_s(i))*fn3p2
|
|
100
|
+
if (temp.ge.tcn(i)) then
|
|
101
|
+
tcn(i)=temp
|
|
102
|
+
isf=i
|
|
103
|
+
@@ -1380,14 +1385,14 @@ c isf will be the largest zone number at which triplet pairing is present
|
|
104
|
+
end do
|
|
105
|
+
else if(sfn3p2.eq.4.)then
|
|
106
|
+
do i=0,idrip
|
|
107
|
+
- temp=tcn3_t72(kfn(i))*fn3p2
|
|
108
|
+
+ temp=tcn3_t72(kfn_s(i))*fn3p2
|
|
109
|
+
if (temp.ge.tcn(i)) then
|
|
110
|
+
tcn(i)=temp
|
|
111
|
+
isf=i
|
|
112
|
+
end if
|
|
113
|
+
end do
|
|
114
|
+
else if(sfn3p2.eq.5.)then
|
|
115
|
+
- temp=tcn3_t72_m1(kfn(i))*fn3p2
|
|
116
|
+
+ temp=tcn3_t72_m1(kfn_s(i))*fn3p2
|
|
117
|
+
do i=0,idrip
|
|
118
|
+
if (temp.ge.tcn(i)) then
|
|
119
|
+
tcn(i)=temp
|
|
120
|
+
@@ -1396,7 +1401,7 @@ c isf will be the largest zone number at which triplet pairing is present
|
|
121
|
+
end do
|
|
122
|
+
else if(sfn3p2.eq.6.)then
|
|
123
|
+
do i=0,idrip
|
|
124
|
+
- temp=tcn3_bcll92(kfn(i))*fn3p2
|
|
125
|
+
+ temp=tcn3_bcll92(kfn_s(i))*fn3p2
|
|
126
|
+
if (temp.ge.tcn(i)) then
|
|
127
|
+
tcn(i)=temp
|
|
128
|
+
isf=i
|
|
129
|
+
@@ -1404,7 +1409,7 @@ c isf will be the largest zone number at which triplet pairing is present
|
|
130
|
+
end do
|
|
131
|
+
else if(sfn3p2.eq.7.)then
|
|
132
|
+
do i=0,idrip
|
|
133
|
+
- temp=tcn3_eehjo96_nr(kfn(i))*fn3p2
|
|
134
|
+
+ temp=tcn3_eehjo96_nr(kfn_s(i))*fn3p2
|
|
135
|
+
if (temp.ge.tcn(i)) then
|
|
136
|
+
tcn(i)=temp
|
|
137
|
+
isf=i
|
|
138
|
+
@@ -1412,7 +1417,7 @@ c isf will be the largest zone number at which triplet pairing is present
|
|
139
|
+
end do
|
|
140
|
+
else if(sfn3p2.eq.8.)then
|
|
141
|
+
do i=0,idrip
|
|
142
|
+
- temp=tcn3_eehjo96_r(kfn(i))*fn3p2
|
|
143
|
+
+ temp=tcn3_eehjo96_r(kfn_s(i))*fn3p2
|
|
144
|
+
if (temp.ge.tcn(i)) then
|
|
145
|
+
tcn(i)=temp
|
|
146
|
+
isf=i
|
|
147
|
+
@@ -1437,7 +1442,7 @@ c Minimal Cooling paper gaps:
|
|
148
|
+
end if
|
|
149
|
+
do i=0,idrip
|
|
150
|
+
temp=tcmax_n3p2*
|
|
151
|
+
- 1 exp(-(kfn(i)-kfmax_n3p2)**2/delkf_n3p2**2)*fn3p2
|
|
152
|
+
+ 1 exp(-(kfn_s(i)-kfmax_n3p2)**2/delkf_n3p2**2)*fn3p2
|
|
153
|
+
if (temp.ge.tcn(i)) then
|
|
154
|
+
tcn(i)=temp
|
|
155
|
+
if (isf.eq.i-1) isf=i
|
|
156
|
+
@@ -1446,7 +1451,7 @@ c Minimal Cooling paper gaps:
|
|
157
|
+
c Ioffe gaps:
|
|
158
|
+
else if (sfn3p2.eq.201.) then
|
|
159
|
+
do i=0,idrip
|
|
160
|
+
- temp=max(1.d0,Tc_Ioffe_1nt(kfn(i)))*fn3p2
|
|
161
|
+
+ temp=max(1.d0,Tc_Ioffe_1nt(kfn_s(i)))*fn3p2
|
|
162
|
+
if (temp.ge.tcn(i)) then
|
|
163
|
+
tcn(i)=temp
|
|
164
|
+
isf=i
|
|
165
|
+
@@ -1454,7 +1459,7 @@ c Ioffe gaps:
|
|
166
|
+
end do
|
|
167
|
+
else if (sfn3p2.eq.202.) then
|
|
168
|
+
do i=0,idrip
|
|
169
|
+
- temp=max(1.d0,Tc_Ioffe_2nt(kfn(i)))*fn3p2
|
|
170
|
+
+ temp=max(1.d0,Tc_Ioffe_2nt(kfn_s(i)))*fn3p2
|
|
171
|
+
if (temp.ge.tcn(i)) then
|
|
172
|
+
tcn(i)=temp
|
|
173
|
+
isf=i
|
|
174
|
+
@@ -1462,7 +1467,7 @@ c Ioffe gaps:
|
|
175
|
+
end do
|
|
176
|
+
else if (sfn3p2.eq.203.) then
|
|
177
|
+
do i=0,idrip
|
|
178
|
+
- temp=max(1.d0,Tc_Ioffe_3nt(kfn(i)))*fn3p2
|
|
179
|
+
+ temp=max(1.d0,Tc_Ioffe_3nt(kfn_s(i)))*fn3p2
|
|
180
|
+
if (temp.ge.tcn(i)) then
|
|
181
|
+
tcn(i)=temp
|
|
182
|
+
isf=i
|
|
183
|
+
@@ -1478,44 +1483,44 @@ c Uniform Tc gap:
|
|
184
|
+
c ***** 1s0 proton superconductivity **********************************
|
|
185
|
+
if(sfp1s0.eq.1.)then
|
|
186
|
+
do i=0,icore
|
|
187
|
+
- tcp(i)=max(1.d0,tcp1_ccy_ms(kfp(i)))*fp1s0
|
|
188
|
+
+ tcp(i)=max(1.d0,tcp1_ccy_ms(kfp_s(i)))*fp1s0
|
|
189
|
+
end do
|
|
190
|
+
else if(sfp1s0.eq.2.)then
|
|
191
|
+
do i=0,icore
|
|
192
|
+
- tcp(i)=max(1.d0,tcp1_ccy_ps(kfp(i)))*fp1s0
|
|
193
|
+
+ tcp(i)=max(1.d0,tcp1_ccy_ps(kfp_s(i)))*fp1s0
|
|
194
|
+
end do
|
|
195
|
+
else if(sfp1s0.eq.3.)then
|
|
196
|
+
do i=0,icore
|
|
197
|
+
- tcp(i)=max(1.d0,tcp1_t73(kfp(i)))*fp1s0
|
|
198
|
+
+ tcp(i)=max(1.d0,tcp1_t73(kfp_s(i)))*fp1s0
|
|
199
|
+
end do
|
|
200
|
+
else if(sfp1s0.eq.4.)then
|
|
201
|
+
do i=0,icore
|
|
202
|
+
- tcp(i)=max(1.d0,tcp1_ns(kfp(i)))*fp1s0
|
|
203
|
+
+ tcp(i)=max(1.d0,tcp1_ns(kfp_s(i)))*fp1s0
|
|
204
|
+
end do
|
|
205
|
+
else if(sfp1s0.eq.5.)then
|
|
206
|
+
do i=0,icore
|
|
207
|
+
- tcp(i)=max(1.d0,tcp1_ao(kfp(i)))*fp1s0
|
|
208
|
+
+ tcp(i)=max(1.d0,tcp1_ao(kfp_s(i)))*fp1s0
|
|
209
|
+
end do
|
|
210
|
+
else if(sfp1s0.eq.6.)then
|
|
211
|
+
do i=0,icore
|
|
212
|
+
- tcp(i)=max(1.d0,tcp1_bcll92(kfp(i)))*fp1s0
|
|
213
|
+
+ tcp(i)=max(1.d0,tcp1_bcll92(kfp_s(i)))*fp1s0
|
|
214
|
+
end do
|
|
215
|
+
else if(sfp1s0.eq.7.)then
|
|
216
|
+
do i=0,icore
|
|
217
|
+
- tcp(i)=max(1.d0,tcp1_ccdk(kfp(i)))*fp1s0
|
|
218
|
+
+ tcp(i)=max(1.d0,tcp1_ccdk(kfp_s(i)))*fp1s0
|
|
219
|
+
end do
|
|
220
|
+
c Using Neutron 1S0 gaps for Protons:
|
|
221
|
+
else if(sfp1s0.eq.21.)then
|
|
222
|
+
do i=0,icore
|
|
223
|
+
- tcp(i)=max(1.d0,tcn1_t72(kfp(i)))*fp1s0
|
|
224
|
+
+ tcp(i)=max(1.d0,tcn1_t72(kfp_s(i)))*fp1s0
|
|
225
|
+
end do
|
|
226
|
+
else if(sfp1s0.eq.22.)then
|
|
227
|
+
do i=0,icore
|
|
228
|
+
- tcp(i)=max(1.d0,tcn1_awp_2(kfp(i)))*fp1s0
|
|
229
|
+
+ tcp(i)=max(1.d0,tcn1_awp_2(kfp_s(i)))*fp1s0
|
|
230
|
+
end do
|
|
231
|
+
else if(sfp1s0.eq.23.)then
|
|
232
|
+
do i=0,icore
|
|
233
|
+
- tcp(i)=max(1.d0,tcn1_awp_3(kfp(i)))*fp1s0
|
|
234
|
+
+ tcp(i)=max(1.d0,tcn1_awp_3(kfp_s(i)))*fp1s0
|
|
235
|
+
end do
|
|
236
|
+
c Ioffe gaps:
|
|
237
|
+
else if (sfp1s0.eq.201.) then
|
|
238
|
+
@@ -1814,3 +1819,39 @@ c**************************************************************c
|
|
239
|
+
c***************************************************************************
|
|
240
|
+
c***************************************************************************
|
|
241
|
+
|
|
242
|
+
+c *********************************************************************
|
|
243
|
+
+c nmbackend patch: Fermi momentum at baryon density bar(i)/sx, for the
|
|
244
|
+
+c core zones i=0..icore, interpolated in the core zones only. Outside
|
|
245
|
+
+c the core range (above the centre, or below the crust-core boundary,
|
|
246
|
+
+c where the star's kF is that of nuclei or zero) kF is scaled as
|
|
247
|
+
+c n^(1/3) from the nearest core zone: uniform matter at fixed
|
|
248
|
+
+c composition. Crust zones keep their own kF.
|
|
249
|
+
+c *********************************************************************
|
|
250
|
+
+ subroutine get_kf_scaled(sx,kf,kfs)
|
|
251
|
+
+ implicit real*8 (a-h,k-z)
|
|
252
|
+
+ INCLUDE 'size.inc.f'
|
|
253
|
+
+ INCLUDE 'profile_star.inc.f'
|
|
254
|
+
+ INCLUDE 'profile_comp.inc.f'
|
|
255
|
+
+ dimension kf(0:isize),kfs(0:isize)
|
|
256
|
+
+ do i=0,imax
|
|
257
|
+
+ kfs(i)=kf(i)
|
|
258
|
+
+ end do
|
|
259
|
+
+ if (sx.eq.1.d0) return
|
|
260
|
+
+ do i=0,icore
|
|
261
|
+
+ b=bar(i)/sx
|
|
262
|
+
+ if (b.ge.bar(0)) then
|
|
263
|
+
+ kfs(i)=kf(0)*(b/bar(0))**(1.d0/3.d0)
|
|
264
|
+
+ else if (b.le.bar(icore)) then
|
|
265
|
+
+ kfs(i)=kf(icore)*(b/bar(icore))**(1.d0/3.d0)
|
|
266
|
+
+ else
|
|
267
|
+
+ j=0
|
|
268
|
+
+ 100 if (bar(j+1).ge.b) then
|
|
269
|
+
+ j=j+1
|
|
270
|
+
+ goto 100
|
|
271
|
+
+ end if
|
|
272
|
+
+ w=(bar(j)-b)/(bar(j)-bar(j+1))
|
|
273
|
+
+ kfs(i)=(1.d0-w)*kf(j)+w*kf(j+1)
|
|
274
|
+
+ end if
|
|
275
|
+
+ end do
|
|
276
|
+
+ return
|
|
277
|
+
+ end
|
|
278
|
+
diff --git a/TOV/TOV.f b/TOV/TOV.f
|
|
279
|
+
index b3ead9c..0ff4e89 100644
|
|
280
|
+
--- a/TOV/TOV.f
|
|
281
|
+
+++ b/TOV/TOV.f
|
|
282
|
+
@@ -15,7 +15,7 @@
|
|
283
|
+
common/eos_dat/ peos(50000),eeos(50000),deos(50000),const
|
|
284
|
+
common/prof/r,den,e,p,em,phi,rhoc,baryden,propmas,delta,stepi
|
|
285
|
+
|
|
286
|
+
- logical iread, fread, cread, dread, sread,
|
|
287
|
+
+ logical iread, fread, cread, dread, sread, gread,
|
|
288
|
+
C prod, output, stndrd, qseek, seek,
|
|
289
|
+
C dum_l
|
|
290
|
+
c data prho/.1,.11,.12,.135,.15,.165,.18,.2,.22,.246,.27,.3,
|
|
291
|
+
@@ -69,7 +69,8 @@ C ***** Initializes result arrays ****************************************
|
|
292
|
+
|
|
293
|
+
C ***** Waits for instructions *********************************************
|
|
294
|
+
|
|
295
|
+
-5 call gread(5,6,.true.,.true.)
|
|
296
|
+
+c nmbackend patch: gread is a LOGICAL FUNCTION (gfortran rejects CALL)
|
|
297
|
+
+5 dum_l=gread(5,6,.true.,.true.)
|
|
298
|
+
if(cread('go')) go to 10
|
|
299
|
+
if(cread('production')) then
|
|
300
|
+
open (unit=7,file=
|
|
301
|
+
@@ -406,7 +407,8 @@ c *************************************************************************
|
|
302
|
+
common/eos_dat/ peos(50000),eeos(50000),deos(50000),const
|
|
303
|
+
common/interp/ i1,i2,i3,limit
|
|
304
|
+
c write(6,*) c2
|
|
305
|
+
- title='/Users/dany/Work/NStar/EOS/'//title
|
|
306
|
+
+c nmbackend patch: EOS path used as given
|
|
307
|
+
+c title='/Users/dany/Work/NStar/EOS/'//title
|
|
308
|
+
open (unit=15, file=title, status='old')
|
|
309
|
+
c read(15,*) itext,limit
|
|
310
|
+
itext=6
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""JAX physics of NSCool's cooling runs (paper 7, step C2).
|
|
2
|
+
|
|
3
|
+
Each process follows NSCool's own routine, the reference, and is tested
|
|
4
|
+
zone by zone against ``NSCool.zone_dump``. Inputs are per-zone arrays,
|
|
5
|
+
and every function works under jit, vmap and grad. Importing this
|
|
6
|
+
package turns on JAX double precision. README.md lists the processes
|
|
7
|
+
and where NSCool departs from its cited papers.
|
|
8
|
+
"""
|
|
9
|
+
import jax
|
|
10
|
+
|
|
11
|
+
jax.config.update("jax_enable_x64", True)
|
|
12
|
+
|
|
13
|
+
from . import conduct, core_conduct, core_nu, crust_nu, envelope, gaps, heat # noqa: E402
|
|
14
|
+
from .curve import isothermal_curve # noqa: E402
|
|
15
|
+
from .star import IsoSums, Star, isothermal_sums, zone_terms # noqa: E402
|
|
16
|
+
|
|
17
|
+
__all__ = ["IsoSums", "Star", "conduct", "core_conduct", "core_nu", "crust_nu", "envelope", "gaps",
|
|
18
|
+
"heat", "isothermal_curve", "isothermal_sums", "zone_terms"]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Cubic splines as NSCool evaluates them (Numerical Recipes SPLINE/SPLINT).
|
|
2
|
+
|
|
3
|
+
The second derivatives depend only on the tabulated data, so they are
|
|
4
|
+
computed once in numpy; evaluation is jnp and differentiable in x.
|
|
5
|
+
Outside the table NSCool's SPLINT extrapolates the end interval's cubic,
|
|
6
|
+
and so does ``splint``.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import jax.numpy as jnp
|
|
11
|
+
import numpy as np
|
|
12
|
+
|
|
13
|
+
__all__ = ["spline_y2", "splint", "natural_y2_matrix", "splint2"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def spline_y2(x, y, yp1=None, ypn=None) -> np.ndarray:
|
|
17
|
+
"""NR SPLINE: second derivatives; ``None`` end slope means natural."""
|
|
18
|
+
x, y = np.asarray(x, float), np.asarray(y, float)
|
|
19
|
+
n = x.size
|
|
20
|
+
y2, u = np.zeros(n), np.zeros(n)
|
|
21
|
+
if yp1 is not None:
|
|
22
|
+
y2[0] = -0.5
|
|
23
|
+
u[0] = (3.0 / (x[1] - x[0])) * ((y[1] - y[0]) / (x[1] - x[0]) - yp1)
|
|
24
|
+
for i in range(1, n - 1):
|
|
25
|
+
sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1])
|
|
26
|
+
p = sig * y2[i - 1] + 2.0
|
|
27
|
+
y2[i] = (sig - 1.0) / p
|
|
28
|
+
u[i] = (6.0 * ((y[i + 1] - y[i]) / (x[i + 1] - x[i])
|
|
29
|
+
- (y[i] - y[i - 1]) / (x[i] - x[i - 1]))
|
|
30
|
+
/ (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p
|
|
31
|
+
qn = un = 0.0
|
|
32
|
+
if ypn is not None:
|
|
33
|
+
qn = 0.5
|
|
34
|
+
un = (3.0 / (x[-1] - x[-2])) * (ypn - (y[-1] - y[-2]) / (x[-1] - x[-2]))
|
|
35
|
+
y2[-1] = (un - qn * u[-2]) / (qn * y2[-2] + 1.0)
|
|
36
|
+
for k in range(n - 2, -1, -1):
|
|
37
|
+
y2[k] = y2[k] * y2[k + 1] + u[k]
|
|
38
|
+
return y2
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def splint(xa, ya, y2a, x):
|
|
42
|
+
"""NR SPLINT at x; xa ascending.
|
|
43
|
+
|
|
44
|
+
Either x has any shape and ya, y2a are 1D, or x is a scalar and ya, y2a
|
|
45
|
+
are tables of rows sharing xa (the result has one value per row).
|
|
46
|
+
"""
|
|
47
|
+
xa, ya, y2a = (jnp.asarray(v) for v in (xa, ya, y2a))
|
|
48
|
+
# NR bisection: largest k with xa[k] <= x, clipped to [0, n-2]
|
|
49
|
+
k = jnp.clip(jnp.searchsorted(xa, x, side="right") - 1, 0, xa.shape[0] - 2)
|
|
50
|
+
h = xa[k + 1] - xa[k]
|
|
51
|
+
a = (xa[k + 1] - x) / h
|
|
52
|
+
b = (x - xa[k]) / h
|
|
53
|
+
at = lambda v, j: jnp.take(v, j, axis=-1)
|
|
54
|
+
return (a * at(ya, k) + b * at(ya, k + 1)
|
|
55
|
+
+ ((a ** 3 - a) * at(y2a, k) + (b ** 3 - b) * at(y2a, k + 1)) * h ** 2 / 6.0)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def natural_y2_matrix(x) -> np.ndarray:
|
|
59
|
+
"""Matrix M with natural-spline second derivatives y2 = M @ y."""
|
|
60
|
+
return np.stack([spline_y2(x, e) for e in np.eye(len(x))], axis=1)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def splint2(x1a, x2a, ya, y2a, m1, x1, x2):
|
|
64
|
+
"""NR SPLINT2 (NSCool Tools.f) at scalar (x1, x2).
|
|
65
|
+
|
|
66
|
+
Splines along x2 for each x1 row (``y2a``, rows from ``spline_y2``),
|
|
67
|
+
then a natural spline along x1 built at run time (``m1`` =
|
|
68
|
+
``natural_y2_matrix(x1a)``).
|
|
69
|
+
"""
|
|
70
|
+
yy = splint(x2a, ya, y2a, x2)
|
|
71
|
+
return splint(x1a, yy, jnp.asarray(m1) @ yy, x1)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Smooth-branch steady conduction in prescribed spherical geometry."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from typing import NamedTuple
|
|
5
|
+
import jax
|
|
6
|
+
import jax.numpy as jnp
|
|
7
|
+
|
|
8
|
+
_K = 4*jnp.pi*1e5 # km radius and cm conductivity units
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class _LayerSolution(NamedTuple):
|
|
12
|
+
T_inner: jax.Array
|
|
13
|
+
residual: jax.Array
|
|
14
|
+
slope: jax.Array
|
|
15
|
+
conductivity: jax.Array
|
|
16
|
+
valid: jax.Array
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _steady_layer(radii, luminosity, boundary_T, geometry, conductivity):
|
|
20
|
+
"""Steady constant-flux layer with descending radii in km and redshifted T.
|
|
21
|
+
|
|
22
|
+
Geometry returns (lapse, 2m/r); conductivity takes local T and radius,
|
|
23
|
+
returning erg cm^-1 s^-1 K^-1. Requires a smooth conductivity branch and
|
|
24
|
+
unique non-tangent step roots. No storage, heating or neutrino sinks.
|
|
25
|
+
Invalid numerical domains return NaN temperature and false step validity.
|
|
26
|
+
"""
|
|
27
|
+
if radii.ndim != 1 or radii.size < 2:
|
|
28
|
+
raise ValueError('Layer requires at least two one-dimensional radii')
|
|
29
|
+
def step(yout, shell):
|
|
30
|
+
rout,rin=shell
|
|
31
|
+
r=.5*(rin+rout)
|
|
32
|
+
phi,compactness=geometry(r)
|
|
33
|
+
scale=(rout-rin)*luminosity/(_K*r*r*phi*jnp.sqrt(1-compactness))
|
|
34
|
+
def residual(yin):
|
|
35
|
+
temperature=jnp.exp(.5*(yin+yout))
|
|
36
|
+
lam=conductivity(temperature/phi,r)
|
|
37
|
+
return yin-yout-scale/(lam*temperature)
|
|
38
|
+
def solve(fun,initial):
|
|
39
|
+
def expand(_,hi):
|
|
40
|
+
return jax.lax.cond(fun(hi)<0,lambda x:yout+2*(x-yout),lambda x:x,hi)
|
|
41
|
+
hi=jax.lax.fori_loop(0,8,expand,yout+.05)
|
|
42
|
+
def bisect(_,bounds):
|
|
43
|
+
lo,hi=bounds
|
|
44
|
+
mid=.5*(lo+hi)
|
|
45
|
+
above=fun(mid)>0
|
|
46
|
+
return jnp.where(above,lo,mid),jnp.where(above,mid,hi)
|
|
47
|
+
lo,upper=jax.lax.fori_loop(0,48,bisect,(yout,hi))
|
|
48
|
+
root=jnp.where(fun(initial)==0,initial,.5*(lo+upper))
|
|
49
|
+
supported=jnp.isfinite(fun(hi))&(fun(hi)>=0)&jnp.isfinite(fun(yout))&(fun(yout)<=0)
|
|
50
|
+
return jnp.where(supported,root,jnp.nan)
|
|
51
|
+
root=jax.lax.custom_root(residual,yout,solve,lambda g,y:y/g(jnp.ones_like(y)))
|
|
52
|
+
slope=jax.grad(residual)(root)
|
|
53
|
+
local_T=jnp.exp(.5*(root+yout))/phi
|
|
54
|
+
inner_T=jnp.exp(root)
|
|
55
|
+
lam=conductivity(local_T,r)
|
|
56
|
+
error=jnp.abs(residual(root))
|
|
57
|
+
valid=(jnp.isfinite(root)&jnp.isfinite(local_T)&(local_T>0)
|
|
58
|
+
&jnp.isfinite(inner_T)&(inner_T>0)&jnp.isfinite(error)&(error<3e-12)&jnp.isfinite(slope)&(slope>1e-8)
|
|
59
|
+
&jnp.isfinite(lam)&(lam>0)&jnp.isfinite(rout)&jnp.isfinite(rin)&(rout>rin)&(rin>0)
|
|
60
|
+
&jnp.isfinite(phi)&(phi>0)&jnp.isfinite(compactness)&(compactness>=0)&(compactness<1))
|
|
61
|
+
return jnp.where(valid,root,jnp.nan),(error,slope,lam,valid)
|
|
62
|
+
y,diagnostic=jax.lax.scan(step,jnp.log(boundary_T),(radii[:-1],radii[1:]))
|
|
63
|
+
valid=(jnp.all(jnp.isfinite(radii))&jnp.all(jnp.diff(radii)<0)
|
|
64
|
+
&jnp.isfinite(luminosity)&(luminosity>=0)&jnp.isfinite(boundary_T)&(boundary_T>0))
|
|
65
|
+
return _LayerSolution(jnp.where(valid,jnp.exp(y),jnp.nan),
|
|
66
|
+
*diagnostic[:3], diagnostic[3]&valid)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""Crust thermal conductivity (erg cm^-1 s^-1 K^-1), NSCool ICON_CRUST = 3.
|
|
2
|
+
|
|
3
|
+
``con_crust`` with ICON_CRUST = 3 (``conductivity_crust.f``), for
|
|
4
|
+
rho >= 6e7 g/cm^3:
|
|
5
|
+
|
|
6
|
+
| Piece | NSCool routine | Source cited there |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| electron-phonon (solid) and electron-ion (liquid) | con_e_phon_ion_GYP, OYAFORM | Gnedin, Yakovlev & Potekhin 2001 App.; Potekhin+1999 |
|
|
9
|
+
| electron-impurity (solid only) | con_crust_e_imp_YU | Yakovlev & Urpin 1980 |
|
|
10
|
+
| electron-electron | con_crust_ee | Shternin & Yakovlev 2006 |
|
|
11
|
+
|
|
12
|
+
The GYP piece takes the nuclear composition from the smooth-composition
|
|
13
|
+
model of OYAFORM (Oyamatsu), not from the zone's A and Z; the solid test
|
|
14
|
+
(Gamma > 210) and the impurity term use the zone's a_cell and Z. Most
|
|
15
|
+
literals of OYAFORM are single precision and are kept so.
|
|
16
|
+
"""
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import jax.numpy as jnp
|
|
20
|
+
|
|
21
|
+
from .superfluid import f32
|
|
22
|
+
|
|
23
|
+
__all__ = ["oyaform", "lambda_gyp", "lambda_imp", "lambda_ee", "lambda_crust"]
|
|
24
|
+
|
|
25
|
+
_F = f32
|
|
26
|
+
_TH = _F(.333333)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _soyam(t, x):
|
|
30
|
+
return (x ** 3 - 9.0 * x ** (3.0 + t) / (3.0 + t)
|
|
31
|
+
+ 9.0 * x ** (3.0 + 2.0 * t) / (3.0 + 2.0 * t) - x ** (3.0 + 3.0 * t) / (1.0 + t))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def oyaform(bard, after_drip):
|
|
35
|
+
"""Smooth composition (OYAFORM): Z, A_nuc, A_cell, xnuc, xnuct at baryon
|
|
36
|
+
density ``bard`` (fm^-3); ``after_drip`` selects NSCool's Index 3 over 30."""
|
|
37
|
+
pi = 3.14159265
|
|
38
|
+
v = pi / _F(.75)
|
|
39
|
+
# Index 30: below neutron drip
|
|
40
|
+
f = jnp.log(1.0 + bard / 5.0e-9)
|
|
41
|
+
rp = _F(5.688) + _F(0.02628) * f + _F(0.009468) * f * f
|
|
42
|
+
rn = _F(5.788) + _F(0.02077) * f + _F(0.01489) * f * f
|
|
43
|
+
np_in = _F(0.0738) + _F(1.22e-4) * f - _F(1.641e-4) * f * f
|
|
44
|
+
nn_in = _F(0.0808) + _F(1.688e-4) * f + _F(9.439e-5) * f * f
|
|
45
|
+
tp30 = 6.0
|
|
46
|
+
nin = v * rn ** 3 * nn_in * _soyam(tp30, 1.0)
|
|
47
|
+
z30 = v * rp ** 3 * np_in * _soyam(tp30, 1.0)
|
|
48
|
+
a30 = z30 + nin
|
|
49
|
+
rws30 = (a30 * _F(.75) / pi / bard) ** _TH
|
|
50
|
+
# Index 3: spheres after drip
|
|
51
|
+
g = bard * 100.0
|
|
52
|
+
f = jnp.log(g)
|
|
53
|
+
rws = _F(31.68) - _F(8.400) * f - _F(0.2380) * f * f + _F(0.1152) * f ** 3
|
|
54
|
+
tn = 1.0 / (_F(0.2027) + _F(0.004506) * g)
|
|
55
|
+
rn3 = _F(9.406) + _F(1.481) * f + _F(0.4625) * f * f + _F(0.05738) * f ** 3
|
|
56
|
+
dn_n = (_F(9.761) - _F(1.322) * f - _F(0.5544) * f * f - _F(0.07624) * f ** 3) / 100.0
|
|
57
|
+
nin3 = v * rn3 ** 3 * dn_n * _soyam(tn, jnp.minimum(1.0, rws / rn3))
|
|
58
|
+
tp3 = 1.0 / (_F(0.1558) + _F(2.225e-3) * g + _F(9.452e-4) * g * g)
|
|
59
|
+
rp3 = _F(8.345) + _F(0.7767) * f + _F(0.1333) * f * f + _F(0.008707) * f ** 3
|
|
60
|
+
np3 = (_F(4.040) - _F(1.097) * f - _F(0.0723) * f * f + _F(0.0225) * f ** 3) / 100.0
|
|
61
|
+
z3 = v * rp3 ** 3 * np3 * _soyam(tp3, jnp.minimum(1.0, rws / rp3))
|
|
62
|
+
nfree = bard * v * rws ** 3 - z3 - nin3
|
|
63
|
+
a3 = z3 + nfree + nin3
|
|
64
|
+
anuc3 = jnp.where(rn3 > rws, a3, z3 + nin3 + nfree * (rn3 / rws) ** 3)
|
|
65
|
+
w = lambda a, b: jnp.where(after_drip, a, b)
|
|
66
|
+
z, anuc, a = w(z3, z30), w(anuc3, a30), w(a3, a30)
|
|
67
|
+
tp, rp, npi, rws = w(tp3, tp30), w(rp3, rp), w(np3, np_in), w(rws, rws30)
|
|
68
|
+
rp2 = rp * jnp.sqrt((1.0 - 15.0 / (5.0 + tp) + 15.0 / (5.0 + 2.0 * tp)
|
|
69
|
+
- 5.0 / (5.0 + 3.0 * tp)) / _soyam(tp, 1.0))
|
|
70
|
+
xnuc = rp2 / rws
|
|
71
|
+
return z, anuc, a, xnuc, xnuc * tp / (_F(.6) + tp)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _e1(x):
|
|
75
|
+
"""exp_int: E1(x), NSCool's rational / series fit."""
|
|
76
|
+
xs = jnp.maximum(x, 1.0)
|
|
77
|
+
num = xs ** 4 + 8.5733287401 * xs ** 3 + 18.0590169730 * xs ** 2 + 8.6347608925 * xs + 0.2677737343
|
|
78
|
+
den = xs ** 4 + 9.5733223454 * xs ** 3 + 25.6329561486 * xs ** 2 + 21.0996530827 * xs + 3.9584969228
|
|
79
|
+
big = num / den / xs * jnp.exp(-xs) # NSCool: / (x exp(x)); no overflow
|
|
80
|
+
xl = jnp.clip(x, 1e-300, 1.0)
|
|
81
|
+
small = (-0.57721566 + 0.99999193 * xl - 0.24991055 * xl ** 2 + 0.05519968 * xl ** 3
|
|
82
|
+
- 0.00976004 * xl ** 4 + 0.00107857 * xl ** 5 - jnp.log(xl))
|
|
83
|
+
return jnp.where(x >= 1.0, big, small)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _get_lam(s, w):
|
|
87
|
+
eps = 0.05
|
|
88
|
+
l = jnp.log((s + 1.0) / s)
|
|
89
|
+
ws = jnp.where(w > 0, w, 1.0)
|
|
90
|
+
a1 = 0.5 * (_e1(ws) + jnp.log(ws) + 0.5772156)
|
|
91
|
+
a2 = (jnp.exp(-ws) - 1.0 + ws) / (2.0 * ws)
|
|
92
|
+
b1 = w * ((2.0 * s + 1.0) / (2.0 * s + 2.0) - s * l)
|
|
93
|
+
b2 = w * ((1.0 - 3.0 * s - 6.0 * s ** 2) / (4.0 * s + 4.0) + 1.5 * l)
|
|
94
|
+
c1 = 0.5 * (l - 1.0 / (s + 1.0))
|
|
95
|
+
c2 = (2.0 * s + 1.0) / (2.0 * s + 2.0) - s * l
|
|
96
|
+
c_a = (s <= eps) & (s * w <= eps)
|
|
97
|
+
c_b = w <= eps
|
|
98
|
+
c_c = w > 1.0 / eps
|
|
99
|
+
# the general branch only for w <= 1/eps: keep its exp(s w) finite elsewhere
|
|
100
|
+
ws = jnp.where(c_c, 1.0, ws)
|
|
101
|
+
sw = s * ws
|
|
102
|
+
de = jnp.exp(sw) * (_e1(sw) - _e1(sw + ws))
|
|
103
|
+
d1 = 0.5 * (l + s / (s + 1.0) * (1.0 - jnp.exp(-ws)) - (1.0 + sw) * de)
|
|
104
|
+
d2 = 0.5 * ((jnp.exp(-ws) - 1.0 + ws) / ws - s ** 2 / (s + 1.0) * (1.0 - jnp.exp(-ws))
|
|
105
|
+
- 2.0 * s * l + s * (2.0 + sw) * de)
|
|
106
|
+
pick = lambda a, b, c, d: jnp.where(c_a, a, jnp.where(c_b, b, jnp.where(c_c, c, d)))
|
|
107
|
+
return pick(a1, b1, c1, d1), pick(a2, b2, c2, d2)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def lambda_gyp(T, rho, rhodrip):
|
|
111
|
+
"""Electron-phonon (solid) or electron-ion (liquid) conductivity, GYP."""
|
|
112
|
+
pi, c, kb, hb, a_f = 3.14159265, 2.99e10, 1.380e-16, 1.054e-27, 1.0 / 137.0
|
|
113
|
+
e, me, mu = 4.803e-10, 9.109e-28, 1.66e-24
|
|
114
|
+
u_1, u_2 = 2.80, 13.00
|
|
115
|
+
third = _F(1.0 / 3.0)
|
|
116
|
+
z, a1, a, xnuc, xnuct = oyaform(rho / mu * 1e-39, rho > rhodrip)
|
|
117
|
+
n_i = rho / (a * mu)
|
|
118
|
+
n_e = z * n_i
|
|
119
|
+
kf = (3.0 * pi ** 2 * n_e) ** third
|
|
120
|
+
pf = hb * kf
|
|
121
|
+
m_st = jnp.sqrt(me ** 2 + (pf / c) ** 2)
|
|
122
|
+
ef = m_st * c ** 2
|
|
123
|
+
vf = pf / m_st
|
|
124
|
+
x = pf / me / c
|
|
125
|
+
t_p = hb * jnp.sqrt(4.0 * pi * e ** 2 * z ** 2 * n_i / a1 / mu) / kb
|
|
126
|
+
tp = T / t_p
|
|
127
|
+
bz = pi * a_f * z * vf / c
|
|
128
|
+
ai = (3.0 / (4.0 * pi * n_i)) ** third
|
|
129
|
+
gam = z ** 2 * e ** 2 / (kb * T * ai)
|
|
130
|
+
s_d = 1.0 / (2.0 * kf * ai / jnp.sqrt(3.0 * gam)) ** 2
|
|
131
|
+
s_i = s_d * (1.0 + 0.06 * gam) * jnp.exp(-jnp.sqrt(gam))
|
|
132
|
+
s = (s_i + a_f / pi * c / vf) * jnp.exp(-bz)
|
|
133
|
+
w = (u_2 / s_d) * (1.0 + bz / 3.0)
|
|
134
|
+
w1 = 14.73 * xnuc ** 2 * (1.0 + z * jnp.sqrt(xnuc) / 13.0) * (1.0 + bz / 3.0)
|
|
135
|
+
g_s = 1.0 / jnp.sqrt(1.0 + 0.0361 / z ** third / tp ** 2) * (1.0 + 0.122 * bz ** 2)
|
|
136
|
+
g_l = g_s + (0.0105 * tp / (tp ** 2 + 0.0081) ** 1.5 * (1.0 + (vf / c) ** 3 * bz)
|
|
137
|
+
* (1.0 - 1.0 / z) * (1.0 + xnuct ** 2 * jnp.sqrt(2.0 * z)))
|
|
138
|
+
d = jnp.exp(-0.42 * jnp.sqrt(x / a / z) * u_1 * jnp.exp(-9.1 * tp))
|
|
139
|
+
l1a, l2a = _get_lam(s, w + w1)
|
|
140
|
+
l1b, l2b = _get_lam(s, w1)
|
|
141
|
+
lam = (l1a - (vf / c) ** 2 * l2a) - (l1b - (vf / c) ** 2 * l2b)
|
|
142
|
+
t_u = t_p * z ** third * a_f / 3.0 / vf * c
|
|
143
|
+
lam0 = 50.0 * x ** 0.5 / a1 ** 0.5 / z
|
|
144
|
+
ww = jnp.exp(-t_u / T)
|
|
145
|
+
lam_s = lam * g_s * d * ww + lam0 * _F(4.0 / 3.0) * a_f * c / vf * tp ** 5 * (1.0 - ww)
|
|
146
|
+
lam_l = lam * g_l * d * ww + lam0 * tp ** 3 * (1.0 - ww)
|
|
147
|
+
nu0 = 4.0 * z * ef * a_f ** 2 / 3.0 / pi / hb
|
|
148
|
+
del lam_s # electrical conductivity only
|
|
149
|
+
return pi ** 2 * kb ** 2 * T * n_e / (3.0 * m_st * nu0 * lam_l)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def lambda_imp(T, rho, A, Z, qimp):
|
|
153
|
+
"""Electron-impurity conductivity (con_crust_e_imp_YU); A = a_cell."""
|
|
154
|
+
x = 1.00884 * (Z / A * rho / 1e6) ** _F(1.0 / 3.0)
|
|
155
|
+
beta = x / jnp.sqrt(1.0 + x ** 2)
|
|
156
|
+
clog = jnp.log(1.0 / (0.048196 / jnp.sqrt(beta))) - 0.5 * (1.0 + beta ** 2)
|
|
157
|
+
nu = 1.75e16 * jnp.sqrt(1.0 + x ** 2) * qimp / Z * clog
|
|
158
|
+
return 4.04e17 * x ** 3 / jnp.sqrt(1.0 + x ** 2) * (T / 1e8) * (1e16 / nu)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def lambda_ee(T, kfe):
|
|
162
|
+
"""Electron-electron conductivity (con_crust_ee, Shternin & Yakovlev 2006)."""
|
|
163
|
+
pi = jnp.pi
|
|
164
|
+
kb, me, e, hbar, cl = 1.380e-16, 9.109e-28, 4.803206e-10, 1.054572e-27, 2.99792458e10
|
|
165
|
+
ne = kfe ** 3 / 3.0 / pi ** 2 * 1e39
|
|
166
|
+
xe = 197.3 * kfe / 0.511
|
|
167
|
+
ge = jnp.sqrt(1.0 + xe ** 2)
|
|
168
|
+
u = xe / ge
|
|
169
|
+
om = jnp.sqrt(4.0 * pi * e ** 2 * ne / (ge * me))
|
|
170
|
+
th = jnp.sqrt(3.0) * hbar * om / kb / T
|
|
171
|
+
i_l = ((0.1587 - 0.02538 / (1.0 + 0.0435 * th))
|
|
172
|
+
* jnp.log(1.0 + 128.56 / (37.1 * th + 10.83 * th ** 2 + th ** 3)) / u)
|
|
173
|
+
a = 20.0 + 450.0 * u ** 3
|
|
174
|
+
c1, c2 = 0.05067 + 0.03216 * u ** 2, 0.0254 + 0.04127 * u ** 4
|
|
175
|
+
c = a * jnp.exp(c1 / c2)
|
|
176
|
+
i_t = (u ** 3 * (2.404 / c + (c2 - 2.404 / c) / (1.0 + 0.1 * th * u))
|
|
177
|
+
* jnp.log(1.0 + c / (a * th * u + th ** 2 * u ** 2)))
|
|
178
|
+
a = 12.2 + 25.2 * u ** 3
|
|
179
|
+
b = 1.0 - 0.75 * u
|
|
180
|
+
c1, c2 = 0.123636 + 0.016234 * u ** 2, 0.0762 + 0.05714 * u ** 4
|
|
181
|
+
c = a * jnp.exp(c1 / c2)
|
|
182
|
+
i_lt = (u * (18.52 * u ** 2 / c + (c2 - 18.52 * u ** 2 / c) / (1.0 + 0.1558 * th ** b))
|
|
183
|
+
* jnp.log(1.0 + c / (a * th + 10.83 * th ** 2 * u ** 2 + (th * u) ** _F(8.0 / 3.0))))
|
|
184
|
+
alpha = 1.0 / 137.036
|
|
185
|
+
return pi ** 3 * kb ** 3 * T ** 2 / (108.0 * alpha ** 2 * hbar ** 2 * cl * (i_l + i_t + i_lt))
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def lambda_crust(T, rho, A, Z, kfe, qimp, rhodrip):
|
|
189
|
+
"""con_crust, ICON_CRUST = 3, rho >= 6e7 g/cm^3. A = a_cell, Z per nucleus."""
|
|
190
|
+
gamma = _F(2.273e5) * Z ** 2 * (rho / A) ** _F(1.0 / 3.0) / T
|
|
191
|
+
lam = lambda_gyp(T, rho, rhodrip)
|
|
192
|
+
li = lambda_imp(T, rho, A, Z, qimp)
|
|
193
|
+
solid = 1.0 / (1.0 / lam + 1.0 / li)
|
|
194
|
+
lam = jnp.where(gamma > 210.0, solid, lam)
|
|
195
|
+
lee = lambda_ee(T, kfe)
|
|
196
|
+
return lam * lee / (lam + lee)
|