All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
nstar_cold.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2014, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 /** \file nstar_cold.h
24  \brief File defining \ref o2scl::nstar_cold
25 */
26 #ifndef O2SCL_COLD_NSTAR_H
27 #define O2SCL_COLD_NSTAR_H
28 
29 #include <o2scl/eos_had_base.h>
30 #include <o2scl/tov_solve.h>
31 #include <o2scl/tov_solve.h>
32 #include <o2scl/table.h>
33 #include <o2scl/fermion.h>
34 #include <o2scl/root_cern.h>
35 #include <o2scl/mroot_cern.h>
36 #include <o2scl/mroot_hybrids.h>
37 #include <o2scl/eos_tov.h>
38 
39 #ifndef DOXYGEN_NO_O2NS
40 namespace o2scl {
41 #endif
42 
43  /** \brief Naive static cold neutron star
44 
45  This uses eos_had_base::calc_e() to compute the equation of
46  state of zero-temperature beta-equilibrated neutron star
47  matter and tov_solve::mvsr() to compute the mass versus
48  radius curve.
49 
50  The electron and muon are given masses \ref
51  o2scl_mks::mass_electron and \ref o2scl_mks::mass_muon,
52  after a conversion to units of \f$ 1/\mathrm{fm} \f$.
53 
54  There is an example for the usage of this class given
55  in the \ref ex_nstar_cold_sect.
56 
57  \hline
58  \b EOS \b Output
59 
60  The function calc_eos() generates an object of type
61  \ref table_units, which contains the following columns
62  - \c ed in units of \f$ 1/\mathrm{fm}^4 \f$, the total energy
63  density of neutron star matter
64  - \c pr in units of \f$ 1/\mathrm{fm}^4 \f$, the total pressure
65  of neutron star matter
66  - \c nb in units of \f$ 1/\mathrm{fm}^3 \f$, the baryon
67  number density
68  - \c mun in units of \f$ 1/\mathrm{fm} \f$, the neutron
69  chemical potential
70  - \c mup in units of \f$ 1/\mathrm{fm} \f$, the proton chemical
71  potential
72  - \c mue in units of \f$ 1/\mathrm{fm} \f$, the electron
73  chemical potential
74  - \c nn in units of \f$ 1/\mathrm{fm}^3 \f$, the neutron number
75  density
76  - \c np in units of \f$ 1/\mathrm{fm}^3 \f$, the proton number
77  density
78  - \c ne in units of \f$ 1/\mathrm{fm}^3 \f$, the electron
79  number density
80  - \c kfn in units of \f$ 1/\mathrm{fm} \f$, the neutron Fermi
81  momentum
82  - \c kfp in units of \f$ 1/\mathrm{fm} \f$, the proton Fermi
83  momentum
84  - \c kfe in units of \f$ 1/\mathrm{fm} \f$, the electron
85  Fermi momentum.
86 
87  If \ref include_muons is true, the table has
88  additional columns
89  - \c mumu in units of \f$ 1/\mathrm{fm} \f$, the muon chemical
90  potential
91  - \c nmu in units of \f$ 1/\mathrm{fm}^3 \f$, the muon number
92  density
93  - \c kfmu in units of \f$ 1/\mathrm{fm} \f$, the muon Fermi
94  momentum
95 
96  If the energy density is always positive and increasing, and the
97  pressure is always positive and increasing, then the EOS is
98  well-formed and \ref well_formed is \c true. The variable \ref
99  pressure_flat records the lowest baryon density where the
100  pressure decreases with increasing density.
101 
102  After computing the equation of state, \ref calc_eos()
103  also adds the following columns
104  - \c cs2 (unitless), the squared speed of sound
105  - \c logp, the logarithm of the pressure stored in \c pr
106  - \c loge, the logarithm of the energy density
107  stored in \c ed
108  - \c s in units of \f$ 1/\mathrm{fm} \f$,
109  the semi-perimeter of the Urca triangle
110  - \c urca in units of \f$ 1/\mathrm{fm}^4 \f$,
111  the squared area of the Urca triangle
112  - \c ad_index, the adiabatic index
113 
114  The condition for the direct Urca process is the area of the
115  triangle formed by the neutron, proton, and electron Fermi
116  momenta. Using the definition of the semi-perimeter,
117  \f[
118  s \equiv \left( k_{F,n}+k_{F,p}+k_{F,e} \right)/2
119  \f]
120  Heron's formula gives the triangle area as
121  \f[
122  a=\sqrt{s(s-k_{F,n})(s-k_{F,p})(s-k_{F,e})} \, .
123  \f]
124  The column in the eos \ref table labeled \c urca is \f$ a^2 \f$
125  . If this quantity is positive, then direct Urca is allowed. The
126  variable \ref allow_urca is the smallest density for which the
127  direct Urca process turns on, and \ref deny_urca is the smallest
128  density for which the direct Urca process turns off.
129 
130  The squared speed of sound (in units of \f$ c \f$ )
131  is calculated by
132  \f[
133  c_s^2 = \frac{ d P }{d \varepsilon}
134  \f]
135  and this is placed in the column labeled \c cs2. If the
136  EOS is not well-formed, then this column is set to zero. If
137  \c cs2 is larger than 1, the EOS is said to be "acausal". The
138  variables \ref acausal, \ref acausal_ed, and \ref acausal_pr
139  record the baryon density, energy density, and pressure where
140  the EOS becomes acausal. The adabatic index is calculated by
141  \f[
142  \Gamma = \frac{ d \ln P} { d \ln \varepsilon}
143  \f]
144  Note that \f$ \Gamma \f$ must be greater than \f$ 4/3 \f$
145  at the center of the neutron star for stability. (This
146  is a necessary, but not sufficient condition.) If
147  the EOS is not well-formed then this column is set to zero.
148 
149  \hline
150  \b TOV \b Output
151 
152  The TOV table contains all the columns typically
153  generated for mass versus radius tables in \ref tov_solve,
154  as well as columns containing the central values of
155  al the densities and chemical potentials, and all the
156  other columns computed for the EOS above.
157 
158  \hline
159 
160  \future Warn if the EOS becomes pure neutron matter.
161  */
162 
163  class nstar_cold {
164 
165  public:
166 
167  nstar_cold();
168 
169  /// \name Basic operation
170  //@{
171  /** \brief Set the equation of state
172 
173  This should be set before calling calc_eos().
174  */
175  void set_eos(eos_had_base &he) {
176  hep=&he;
177  eos_set=true;
178  return;
179  }
180 
181  /** \brief Calculate the given equation of state
182  */
183  void calc_eos(double np_0=0.0);
184 
185  /** \brief Compute the density at which the direct Urca process is allowe
186 
187  This is faster than using calc_eos() since it does nothing
188  other than computes the critical density. It does not store
189  the equation of state.
190  */
191  double calc_urca(double np_0=0.0);
192 
193  /** \brief Calculate the M vs. R curve
194  */
195  void calc_nstar();
196 
197  /** \brief Calculate the profile for a fixed gravitational mass
198  */
199  void fixed(double target_mass);
200  //@}
201 
202  /// \name Output
203  //@{
204  /// If true, the last call of calc_eos() succeeded.
206 
207  /** \brief If true, the energy density of the EOS is monotonically
208  increasing and the pressure is always positive
209  */
211 
212  /** \brief The smallest baryon density where the pressure starts
213  to decrease
214 
215  If this is zero after calling calc_eos(), then
216  the pressure does not decrease in the specified range
217  of baryon density
218  */
220 
221  /** \brief The smallest density where Urca becomes allowed
222 
223  If this is zero after calling calc_eos(), then direct
224  Urca is never allowed.
225  */
226  double allow_urca;
227 
228  /** \brief The smallest density where Urca becomes disallowed
229 
230  If this is zero after calling calc_eos(), then direct
231  Urca is not disallowed at a higher density than
232  it becomes allowed.
233  */
234  double deny_urca;
235 
236  /** \brief The density at which the EOS becomes acausal
237 
238  If this is zero, then the EOS is causal at all baryon densities
239  in the specified range
240  */
241  double acausal;
242 
243  /** \brief The pressure at which the EOS becomes acausal
244 
245  If this is zero, then the EOS is causal at all baryon densities
246  in the specified range
247  */
248  double acausal_pr;
249 
250  /** \brief The energy density at which the EOS becomes acausal
251 
252  If this is zero, then the EOS is causal at all baryon densities
253  in the specified range
254  */
255  double acausal_ed;
256 
257  /** \brief Solver tolerance (default \f$ 10^{-4} \f$)
258  */
259  double solver_tol;
260 
261  /// Verbosity parameter (default 0)
262  int verbose;
263 
264  /** \brief Get the eos table (after having called calc_eos())
265  */
267  return eost;
268  }
269 
270  /** \brief Get the results from the TOV (after having called calc_nstar())
271  */
273  return tp->get_results();
274  }
275  //@}
276 
277  /** \name Configuration
278  */
279  //@{
280  /** \brief The starting baryon density (default 0.05)
281  */
282  double nb_start;
283 
284  /** \brief The final baryon density (default 2.0)
285  */
286  double nb_end;
287 
288  /** \brief The baryon density stepsize (default 0.01)
289  */
290  double dnb;
291 
292  /** \brief If true, include muons (default false)
293  */
295 
296  /// If true, throw an exception if the calculation fails (default true)
298 
299  /** \brief Set the neutron and proton
300 
301  The default objects are of type \ref fermion, with mass \ref
302  o2scl_mks::mass_neutron and \ref o2scl_mks::mass_proton. These
303  defaults will give incorrect results for non-relativistic
304  equations of state.
305  */
307  np=&n;
308  pp=&p;
309  return 0;
310  }
311 
312  /** \brief Set the equation solver for the EOS
313  */
314  int set_root(root<> &rf) {
315  rp=&rf;
316  return 0;
317  }
318 
319  /** \brief Specify the object for solving the TOV equations
320 
321  The default uses the low-density equation of state with
322  tov::verbose=0. In calc_nstar(), the units are set by calling
323  tov_solve::set_units().
324  */
325  int set_tov(tov_solve &ts) {
326  tp=&ts;
327  return 0;
328  }
329  //@}
330 
331  /** \name Default objects */
332  //@{
333  /// The default neutron
335 
336  /// The default proton
338 
339  /// Zero-temperature fermion thermodynamics
341 
342  /** \brief The default TOV equation solver
343  */
345 
346  /** \brief The default equation solver for the EOS
347  */
349 
350  /// Default EOS object for the TOV solver
352  //@}
353 
354 #ifndef DOXYGEN_INTERNAL
355 
356  protected:
357 
358  /// \name The thermodynamic information
359  //@{
360  thermo hb, h, l;
361  //@}
362 
363  /// Solve to ensure zero charge in \f$ \beta \f$-equilibrium
364  double solve_fun(double x);
365 
366  /// True if equation of state has been set
367  bool eos_set;
368 
369  /// The electron
371 
372  /// The muon
374 
375  /// A pointer to the equation of state
377 
378  /// A pointer to the neutron
380 
381  /// A pointer to the proton
383 
384  /// A pointer to the TOV object
386 
387  /// A pointer to the solver
389 
390  /// Storage for the EOS table
392 
393  /// The baryon density
394  double barn;
395 
396 #endif
397 
398  };
399 
400 
401 #ifndef DOXYGEN_NO_O2NS
402 }
403 #endif
404 
405 #endif
eos_tov_interp def_eos_tov
Default EOS object for the TOV solver.
Definition: nstar_cold.h:351
eos_had_base * hep
A pointer to the equation of state.
Definition: nstar_cold.h:376
Naive static cold neutron star.
Definition: nstar_cold.h:163
int set_root(root<> &rf)
Set the equation solver for the EOS.
Definition: nstar_cold.h:314
void fixed(double target_mass)
Calculate the profile for a fixed gravitational mass.
int verbose
Verbosity parameter (default 0)
Definition: nstar_cold.h:262
tov_solve * tp
A pointer to the TOV object.
Definition: nstar_cold.h:385
o2_shared_ptr< table_units<> >::type get_results()
Return the results data table.
Definition: tov_solve.h:591
double deny_urca
The smallest density where Urca becomes disallowed.
Definition: nstar_cold.h:234
void calc_nstar()
Calculate the M vs. R curve.
fermion * pp
A pointer to the proton.
Definition: nstar_cold.h:382
fermion def_p
The default proton.
Definition: nstar_cold.h:337
double acausal_ed
The energy density at which the EOS becomes acausal.
Definition: nstar_cold.h:255
root_cern def_root
The default equation solver for the EOS.
Definition: nstar_cold.h:348
int set_tov(tov_solve &ts)
Specify the object for solving the TOV equations.
Definition: nstar_cold.h:325
bool well_formed
If true, the energy density of the EOS is monotonically increasing and the pressure is always positiv...
Definition: nstar_cold.h:210
fermion def_n
The default neutron.
Definition: nstar_cold.h:334
double solver_tol
Solver tolerance (default )
Definition: nstar_cold.h:259
bool eos_set
True if equation of state has been set.
Definition: nstar_cold.h:367
fermion e
The electron.
Definition: nstar_cold.h:370
double solve_fun(double x)
Solve to ensure zero charge in -equilibrium.
An EOS for the TOV solver using simple linear interpolation and an optional crust EOS...
Definition: eos_tov.h:527
fermion_zerot fzt
Zero-temperature fermion thermodynamics.
Definition: nstar_cold.h:340
Hadronic equation of state [abstract base].
Definition: eos_had_base.h:310
o2_shared_ptr< table_units<> >::type eost
Storage for the EOS table.
Definition: nstar_cold.h:391
fermion * np
A pointer to the neutron.
Definition: nstar_cold.h:379
tov_solve def_tov
The default TOV equation solver.
Definition: nstar_cold.h:344
Class to solve the Tolman-Oppenheimer-Volkov equations.
Definition: tov_solve.h:273
void calc_eos(double np_0=0.0)
Calculate the given equation of state.
double nb_end
The final baryon density (default 2.0)
Definition: nstar_cold.h:286
double calc_urca(double np_0=0.0)
Compute the density at which the direct Urca process is allowe.
o2_shared_ptr< table_units<> >::type get_eos_results()
Get the eos table (after having called calc_eos())
Definition: nstar_cold.h:266
double barn
The baryon density.
Definition: nstar_cold.h:394
void set_eos(eos_had_base &he)
Set the equation of state.
Definition: nstar_cold.h:175
int set_n_and_p(fermion &n, fermion &p)
Set the neutron and proton.
Definition: nstar_cold.h:306
fermion mu
The muon.
Definition: nstar_cold.h:373
bool solver_success
If true, the last call of calc_eos() succeeded.
Definition: nstar_cold.h:205
double acausal_pr
The pressure at which the EOS becomes acausal.
Definition: nstar_cold.h:248
double acausal
The density at which the EOS becomes acausal.
Definition: nstar_cold.h:241
double dnb
The baryon density stepsize (default 0.01)
Definition: nstar_cold.h:290
double nb_start
The starting baryon density (default 0.05)
Definition: nstar_cold.h:282
double allow_urca
The smallest density where Urca becomes allowed.
Definition: nstar_cold.h:226
bool err_nonconv
If true, throw an exception if the calculation fails (default true)
Definition: nstar_cold.h:297
bool include_muons
If true, include muons (default false)
Definition: nstar_cold.h:294
root * rp
A pointer to the solver.
Definition: nstar_cold.h:388
o2_shared_ptr< table_units<> >::type get_tov_results()
Get the results from the TOV (after having called calc_nstar())
Definition: nstar_cold.h:272
double pressure_flat
The smallest baryon density where the pressure starts to decrease.
Definition: nstar_cold.h:219

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..