Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ok-landscape
GitHub Repository: Ok-landscape/computational-pipeline
Path: blob/main/latex-templates/templates/astrophysics/neutron_stars.tex
51 views
unlisted
1
% Neutron Star Physics
2
\documentclass[11pt,a4paper]{article}
3
\usepackage[utf8]{inputenc}
4
\usepackage[T1]{fontenc}
5
\usepackage{amsmath,amssymb}
6
\usepackage{graphicx}
7
\usepackage{booktabs}
8
\usepackage{siunitx}
9
\usepackage{geometry}
10
\geometry{margin=1in}
11
\usepackage{pythontex}
12
\usepackage{hyperref}
13
\usepackage{float}
14
15
\title{Neutron Star Physics\\Equation of State and Structure}
16
\author{Nuclear Astrophysics Group}
17
\date{\today}
18
19
\begin{document}
20
\maketitle
21
22
\begin{abstract}
23
Analysis of neutron star structure including mass-radius relations, equation of state, and magnetic field properties.
24
\end{abstract}
25
26
\section{Introduction}
27
28
Neutron stars are ultra-dense remnants of massive stars.
29
30
\begin{pycode}
31
import numpy as np
32
import matplotlib.pyplot as plt
33
from scipy.integrate import odeint
34
plt.rcParams['text.usetex'] = True
35
plt.rcParams['font.family'] = 'serif'
36
37
G = 6.674e-11
38
c = 2.998e8
39
M_sun = 1.989e30
40
hbar = 1.055e-34
41
m_n = 1.675e-27
42
\end{pycode}
43
44
\section{Equation of State}
45
46
\begin{pycode}
47
# Polytropic EOS
48
K = 1e11 # Polytropic constant
49
Gamma = 2.0 # Adiabatic index
50
51
rho = np.logspace(14, 16, 100) # kg/m^3
52
P = K * rho**Gamma
53
54
fig, ax = plt.subplots(figsize=(10, 6))
55
ax.loglog(rho, P, 'b-', linewidth=2)
56
ax.set_xlabel('Density (kg/m$^3$)')
57
ax.set_ylabel('Pressure (Pa)')
58
ax.set_title('Polytropic Equation of State')
59
ax.grid(True, alpha=0.3, which='both')
60
plt.tight_layout()
61
plt.savefig('eos.pdf', dpi=150, bbox_inches='tight')
62
plt.close()
63
\end{pycode}
64
65
\begin{figure}[H]
66
\centering
67
\includegraphics[width=0.9\textwidth]{eos.pdf}
68
\caption{Polytropic equation of state.}
69
\end{figure}
70
71
\section{TOV Equation}
72
73
\begin{pycode}
74
def tov(y, r, K, Gamma):
75
P, m = y
76
if P <= 0:
77
return [0, 0]
78
rho = (P / K)**(1/Gamma)
79
eps = rho * c**2 + P / (Gamma - 1)
80
dPdr = -G * (eps + P) * (m + 4*np.pi*r**3*P/c**2) / (r**2 * (1 - 2*G*m/(r*c**2)))
81
dmdr = 4 * np.pi * r**2 * eps / c**2
82
return [dPdr, dmdr]
83
84
# Solve for different central densities
85
rho_c_range = np.logspace(14.5, 15.5, 20)
86
masses = []
87
radii = []
88
89
for rho_c in rho_c_range:
90
P_c = K * rho_c**Gamma
91
r = np.linspace(1, 20000, 10000)
92
y0 = [P_c, 0]
93
sol = odeint(tov, y0, r, args=(K, Gamma))
94
P_sol = sol[:, 0]
95
m_sol = sol[:, 1]
96
97
idx = np.where(P_sol > 0)[0]
98
if len(idx) > 0:
99
R = r[idx[-1]]
100
M = m_sol[idx[-1]]
101
masses.append(M / M_sun)
102
radii.append(R / 1000)
103
104
fig, ax = plt.subplots(figsize=(10, 6))
105
ax.plot(radii, masses, 'b-o', linewidth=1.5, markersize=4)
106
ax.set_xlabel('Radius (km)')
107
ax.set_ylabel('Mass ($M_\\odot$)')
108
ax.set_title('Mass-Radius Relation')
109
ax.grid(True, alpha=0.3)
110
ax.set_xlim([8, 16])
111
ax.set_ylim([0, 3])
112
plt.tight_layout()
113
plt.savefig('mass_radius.pdf', dpi=150, bbox_inches='tight')
114
plt.close()
115
\end{pycode}
116
117
\begin{figure}[H]
118
\centering
119
\includegraphics[width=0.9\textwidth]{mass_radius.pdf}
120
\caption{Neutron star mass-radius relation.}
121
\end{figure}
122
123
\section{Density Profile}
124
125
\begin{pycode}
126
rho_c = 1e15
127
P_c = K * rho_c**Gamma
128
r = np.linspace(1, 12000, 5000)
129
sol = odeint(tov, [P_c, 0], r, args=(K, Gamma))
130
P_profile = sol[:, 0]
131
rho_profile = np.where(P_profile > 0, (P_profile / K)**(1/Gamma), 0)
132
133
fig, ax = plt.subplots(figsize=(10, 6))
134
ax.plot(r / 1000, rho_profile / 1e15, 'b-', linewidth=2)
135
ax.set_xlabel('Radius (km)')
136
ax.set_ylabel('Density ($10^{15}$ kg/m$^3$)')
137
ax.set_title('Neutron Star Density Profile')
138
ax.grid(True, alpha=0.3)
139
plt.tight_layout()
140
plt.savefig('density_profile.pdf', dpi=150, bbox_inches='tight')
141
plt.close()
142
\end{pycode}
143
144
\begin{figure}[H]
145
\centering
146
\includegraphics[width=0.9\textwidth]{density_profile.pdf}
147
\caption{Internal density profile.}
148
\end{figure}
149
150
\section{Magnetic Field}
151
152
\begin{pycode}
153
# Pulsar spindown
154
P = np.logspace(-3, 1, 100) # Period in seconds
155
P_dot = np.logspace(-20, -10, 100) # Period derivative
156
157
PP, PP_dot = np.meshgrid(P, P_dot)
158
B_surf = 3.2e19 * np.sqrt(PP * PP_dot) # Surface magnetic field in Gauss
159
160
fig, ax = plt.subplots(figsize=(10, 8))
161
levels = [1e8, 1e10, 1e12, 1e14, 1e16]
162
cs = ax.contour(np.log10(PP), np.log10(PP_dot), np.log10(B_surf), levels=np.log10(levels))
163
ax.clabel(cs, fmt='$10^{%.0f}$ G')
164
ax.set_xlabel('log$_{10}$ Period (s)')
165
ax.set_ylabel('log$_{10}$ $\\dot{P}$ (s/s)')
166
ax.set_title('Pulsar Magnetic Field')
167
ax.grid(True, alpha=0.3)
168
plt.tight_layout()
169
plt.savefig('magnetic_field.pdf', dpi=150, bbox_inches='tight')
170
plt.close()
171
\end{pycode}
172
173
\begin{figure}[H]
174
\centering
175
\includegraphics[width=0.9\textwidth]{magnetic_field.pdf}
176
\caption{P-$\dot{P}$ diagram with magnetic field lines.}
177
\end{figure}
178
179
\section{Spin-down Age}
180
181
\begin{pycode}
182
P_values = np.array([0.001, 0.01, 0.1, 1.0]) # Periods
183
P_dot_values = np.array([1e-15, 1e-14, 1e-13, 1e-12]) # Period derivatives
184
185
tau_c = P_values / (2 * P_dot_values) # Characteristic age
186
187
fig, ax = plt.subplots(figsize=(10, 6))
188
ax.loglog(P_values, tau_c / (365.25 * 24 * 3600), 'b-o', linewidth=1.5, markersize=8)
189
ax.set_xlabel('Period (s)')
190
ax.set_ylabel('Characteristic Age (years)')
191
ax.set_title('Pulsar Spin-down Age')
192
ax.grid(True, alpha=0.3, which='both')
193
plt.tight_layout()
194
plt.savefig('spindown_age.pdf', dpi=150, bbox_inches='tight')
195
plt.close()
196
\end{pycode}
197
198
\begin{figure}[H]
199
\centering
200
\includegraphics[width=0.9\textwidth]{spindown_age.pdf}
201
\caption{Characteristic age vs period.}
202
\end{figure}
203
204
\section{Compactness}
205
206
\begin{pycode}
207
compactness = np.array(masses) * M_sun * G / (np.array(radii) * 1000 * c**2)
208
209
fig, ax = plt.subplots(figsize=(10, 6))
210
ax.plot(masses, compactness, 'b-o', linewidth=1.5, markersize=4)
211
ax.axhline(y=0.5, color='r', linestyle='--', label='Black hole limit')
212
ax.set_xlabel('Mass ($M_\\odot$)')
213
ax.set_ylabel('Compactness $GM/Rc^2$')
214
ax.set_title('Neutron Star Compactness')
215
ax.legend()
216
ax.grid(True, alpha=0.3)
217
plt.tight_layout()
218
plt.savefig('compactness.pdf', dpi=150, bbox_inches='tight')
219
plt.close()
220
\end{pycode}
221
222
\begin{figure}[H]
223
\centering
224
\includegraphics[width=0.9\textwidth]{compactness.pdf}
225
\caption{Compactness parameter.}
226
\end{figure}
227
228
\section{Results}
229
230
\begin{pycode}
231
M_max = max(masses)
232
R_at_max = radii[masses.index(M_max)]
233
print(r'\begin{table}[H]')
234
print(r'\centering')
235
print(r'\caption{Neutron Star Properties}')
236
print(r'\begin{tabular}{@{}lc@{}}')
237
print(r'\toprule')
238
print(r'Property & Value \\')
239
print(r'\midrule')
240
print(f'Maximum mass & {M_max:.2f} $M_\\odot$ \\\\')
241
print(f'Radius at max mass & {R_at_max:.1f} km \\\\')
242
print(f'Central density & $10^{{15}}$ kg/m$^3$ \\\\')
243
print(r'\bottomrule')
244
print(r'\end{tabular}')
245
print(r'\end{table}')
246
\end{pycode}
247
248
\section{Conclusions}
249
250
Neutron star structure depends critically on the equation of state of ultra-dense matter.
251
252
\end{document}
253
254