SpECTRE  v2024.04.12
RelativisticEuler::Solutions::RotatingStar Class Reference

A solution obtained by reading in rotating neutron star initial data from the RotNS code based on [42] and [43]. More...

#include <RotatingStar.hpp>

Classes

struct  PolytropicConstant
 The polytropic constant of the fluid. More...
 
struct  RotNsFilename
 The path to the RotNS data file. More...
 

Public Types

using equation_of_state_type = EquationsOfState::PolytropicFluid< true >
 
using options = tmpl::list< RotNsFilename, PolytropicConstant >
 
- Public Types inherited from RelativisticEuler::AnalyticSolution< 3 >
using tags = tmpl::push_back< typename gr::AnalyticSolution< Dim >::template tags< DataType >, hydro::Tags::RestMassDensity< DataType >, hydro::Tags::ElectronFraction< DataType >, hydro::Tags::SpecificInternalEnergy< DataType >, hydro::Tags::Temperature< DataType >, hydro::Tags::Pressure< DataType >, hydro::Tags::SpatialVelocity< DataType, Dim >, hydro::Tags::MagneticField< DataType, Dim >, hydro::Tags::DivergenceCleaningField< DataType >, hydro::Tags::LorentzFactor< DataType >, hydro::Tags::SpecificEnthalpy< DataType > >
 

Public Member Functions

 RotatingStar (const RotatingStar &)=default
 
RotatingStaroperator= (const RotatingStar &)=default
 
 RotatingStar (RotatingStar &&)=default
 
RotatingStaroperator= (RotatingStar &&)=default
 
 RotatingStar (std::string rot_ns_filename, double polytropic_constant)
 
auto get_clone () const -> std::unique_ptr< evolution::initial_data::InitialData > override
 
template<typename DataType , typename... Tags>
tuples::TaggedTuple< Tags... > variables (const tnsr::I< DataType, 3 > &x, const double, tmpl::list< Tags... >) const
 Retrieve a collection of variables at (x, t)
 
void pup (PUP::er &p) override
 
const EquationsOfState::PolytropicFluid< true > & equation_of_state () const
 
double equatorial_radius () const
 
virtual auto get_clone () const -> std::unique_ptr< InitialData >=0
 
- Public Member Functions inherited from hydro::TemperatureInitialization< RotatingStar >
auto variables (const tnsr::I< DataType, Dim > &x, tmpl::list< hydro::Tags::Temperature< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::Temperature< DataType > >
 
auto variables (const tnsr::I< DataType, Dim > &x, const double t, tmpl::list< hydro::Tags::Temperature< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::Temperature< DataType > >
 
auto variables (ExtraVars &extra_variables, const tnsr::I< DataType, Dim > &x, Args &... extra_args, tmpl::list< hydro::Tags::Temperature< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::Temperature< DataType > >
 

Static Public Attributes

static constexpr Options::String help
 
- Static Public Attributes inherited from RelativisticEuler::AnalyticSolution< 3 >
static constexpr size_t volume_dim
 

Protected Types

template<typename DataType >
using DerivLapse = ::Tags::deriv< gr::Tags::Lapse< DataType >, tmpl::size_t< 3 >, Frame::Inertial >
 
template<typename DataType >
using DerivShift = ::Tags::deriv< gr::Tags::Shift< DataType, 3 >, tmpl::size_t< 3 >, Frame::Inertial >
 
template<typename DataType >
using DerivSpatialMetric = ::Tags::deriv< gr::Tags::SpatialMetric< DataType, 3 >, tmpl::size_t< 3 >, Frame::Inertial >
 

Protected Member Functions

template<typename DataType >
void interpolate_vars_if_necessary (gsl::not_null< IntermediateVariables< DataType > * > vars) const
 
template<typename DataType >
void interpolate_deriv_vars_if_necessary (gsl::not_null< IntermediateVariables< DataType > * > vars) const
 
template<typename DataType >
Scalar< DataType > lapse (const DataType &gamma, const DataType &rho) const
 
template<typename DataType >
tnsr::I< DataType, 3, Frame::Inertialshift (const DataType &omega, const DataType &phi, const DataType &radius, const DataType &sin_theta) const
 
template<typename DataType >
tnsr::ii< DataType, 3, Frame::Inertialspatial_metric (const DataType &gamma, const DataType &rho, const DataType &alpha, const DataType &phi) const
 
template<typename DataType >
tnsr::II< DataType, 3, Frame::Inertialinverse_spatial_metric (const DataType &gamma, const DataType &rho, const DataType &alpha, const DataType &phi) const
 
template<typename DataType >
Scalar< DataType > sqrt_det_spatial_metric (const DataType &gamma, const DataType &rho, const DataType &alpha) const
 
template<typename DataType >
auto make_metric_data (size_t num_points) const -> typename IntermediateVariables< DataType >::MetricData
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::RestMassDensity< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::RestMassDensity< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::ElectronFraction< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::ElectronFraction< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::SpecificEnthalpy< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::SpecificEnthalpy< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::Temperature< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::Temperature< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::Pressure< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::Pressure< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::SpecificInternalEnergy< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::SpecificInternalEnergy< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::SpatialVelocity< DataType, 3 > >) const -> tuples::TaggedTuple< hydro::Tags::SpatialVelocity< DataType, 3 > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::LorentzFactor< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::LorentzFactor< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::MagneticField< DataType, 3 > >) const -> tuples::TaggedTuple< hydro::Tags::MagneticField< DataType, 3 > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< hydro::Tags::DivergenceCleaningField< DataType > >) const -> tuples::TaggedTuple< hydro::Tags::DivergenceCleaningField< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< gr::Tags::Lapse< DataType > >) const -> tuples::TaggedTuple< gr::Tags::Lapse< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< gr::Tags::Shift< DataType, 3 > >) const -> tuples::TaggedTuple< gr::Tags::Shift< DataType, 3 > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< gr::Tags::SpatialMetric< DataType, 3 > >) const -> tuples::TaggedTuple< gr::Tags::SpatialMetric< DataType, 3 > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< gr::Tags::SqrtDetSpatialMetric< DataType > >) const -> tuples::TaggedTuple< gr::Tags::SqrtDetSpatialMetric< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< gr::Tags::InverseSpatialMetric< DataType, 3 > >) const -> tuples::TaggedTuple< gr::Tags::InverseSpatialMetric< DataType, 3 > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list<::Tags::dt< gr::Tags::Lapse< DataType > > >) const -> tuples::TaggedTuple<::Tags::dt< gr::Tags::Lapse< DataType > > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< DerivLapse< DataType > >) const -> tuples::TaggedTuple< DerivLapse< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list<::Tags::dt< gr::Tags::Shift< DataType, 3 > > >) const -> tuples::TaggedTuple<::Tags::dt< gr::Tags::Shift< DataType, 3 > > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< DerivShift< DataType > >) const -> tuples::TaggedTuple< DerivShift< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list<::Tags::dt< gr::Tags::SpatialMetric< DataType, 3 > > >) const -> tuples::TaggedTuple<::Tags::dt< gr::Tags::SpatialMetric< DataType, 3 > > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< DerivSpatialMetric< DataType > >) const -> tuples::TaggedTuple< DerivSpatialMetric< DataType > >
 
template<typename DataType >
auto variables (gsl::not_null< IntermediateVariables< DataType > * > vars, const tnsr::I< DataType, 3 > &x, tmpl::list< gr::Tags::ExtrinsicCurvature< DataType, 3 > >) const -> tuples::TaggedTuple< gr::Tags::ExtrinsicCurvature< DataType, 3 > >
 

Protected Attributes

std::string rot_ns_filename_ {}
 
detail::CstSolution cst_solution_ {}
 
double polytropic_constant_ = std::numeric_limits<double>::signaling_NaN()
 
double polytropic_exponent_ = std::numeric_limits<double>::signaling_NaN()
 
EquationsOfState::PolytropicFluid< true > equation_of_state_ {}
 

Friends

bool operator== (const RotatingStar &lhs, const RotatingStar &rhs)
 

Detailed Description

A solution obtained by reading in rotating neutron star initial data from the RotNS code based on [42] and [43].

The code that generates the initial data is part of a private SXS repository called RotNS.

The metric in spherical coordinates is given by [42]

\begin{align} ds^2=-e^{\gamma+\rho}dt^2+e^{2\alpha}(dr^2+r^2d\theta^2) +e^{\gamma-\rho}r^2\sin^2(\theta)(d\phi-\omega dt)^2. \end{align}

We use rotation about the \(z\)-axis. That is,

\begin{align} g_{tt} &=-e^{\gamma+\rho} + e^{\gamma-\rho}r^2\sin^2(\theta)\omega^2 \\ g_{rr} &=e^{2\alpha} \\ g_{\theta\theta} &=e^{2\alpha}r^2 \\ g_{\phi\phi} &=e^{\gamma-\rho}r^2\sin^2(\theta) \\ g_{t\phi} &=-e^{\gamma-\rho}r^2\sin^2(\theta)\omega. \end{align}

We can transform from spherical to Cartesian coordinates using

\begin{align} \label{eq:Jacobian} \frac{\partial (r,\theta,\phi)}{\partial (x,y,z)}= \begin{pmatrix} \cos(\phi) \sin(\theta) & \sin(\theta)\sin(\phi) & \cos(\theta) \\ \tfrac{\cos(\phi)\cos(\theta)}{r} & \tfrac{\sin(\phi)\cos(\theta)}{r} & -\tfrac{\sin(\theta)}{r} \\ -\tfrac{\sin(\phi)}{r\sin(\theta)} & \tfrac{\cos(\phi)}{r\sin(\theta)} & 0 \end{pmatrix} \end{align}

and

\begin{align} \frac{\partial (x,y,z)}{\partial (r,\theta,\phi)}= \begin{pmatrix} \cos(\phi) \sin(\theta) & r\cos(\phi)\cos(\theta) & -r\sin(\theta)\sin(\phi) \\ \sin(\theta)\sin(\phi) & r\sin(\phi)\cos(\theta) & r\cos(\phi)\sin(\theta) \\ \cos(\theta) & -r\sin(\theta) & 0 \end{pmatrix} \end{align}

We denote the lapse as \(N\) since \(\alpha\) is already being used,

\begin{align} N = e^{(\gamma+\rho)/2}. \end{align}

The shift is

\begin{align} \beta^\phi =& -\omega \end{align}

so

\begin{align} \beta^x &= \partial_\phi x \beta^\phi = \sin(\phi)\omega r \sin(\theta), \\ \beta^y &= \partial_\phi y \beta^\phi = -\cos(\phi)\omega r \sin(\theta), \\ \beta^z &= 0. \end{align}

The spatial metric is

\begin{align} \gamma_{xx} &= \sin^2(\theta)\cos^2(\phi) e^{(2 \alpha)} + \cos^2(\theta)\cos^2(\phi) e^{(2 \alpha)} + \sin^2(\phi) e^{(\gamma-\rho)} \notag \\ &=\cos^2(\phi)e^{2\alpha} + \sin^2(\phi) e^{(\gamma-\rho)} \\ \gamma_{xy} &= \sin^2(\theta)\cos(\phi)\sin(\phi) e^{(2 \alpha)} + \cos^2(\theta)\cos(\phi)\sin(\phi) e^{(2 \alpha)} - \sin(\phi)\cos(\phi) e^{(\gamma-\rho)} \notag \\ &=\cos(\phi)\sin(\phi)e^{2\alpha} - \sin(\phi)\cos(\phi) e^{(\gamma-\rho)} \\ \gamma_{yy} &= \sin^2(\theta)\sin^2(\phi) e^{(2 \alpha)} + \cos^2(\theta)\sin^2(\phi) e^{(2 \alpha)} + \cos^2(\phi) e^{(\gamma-\rho)} \notag \\ &=\sin^2(\phi)e^{2\alpha} + \cos^2(\phi) e^{(\gamma-\rho)} \\ \gamma_{xz} &= \sin(\theta)\cos(\phi)\cos(\theta) e^{2\alpha} -\cos(\theta)\cos(\phi)\sin(\theta)e^{2\alpha} = 0 \\ \gamma_{yz} &= \sin(\theta)\sin(\phi)\cos(\theta) e^{2\alpha} -\cos(\theta)\sin(\phi)\sin(\theta)e^{2\alpha} = 0 \\ \gamma_{zz} &=\cos^2(\theta)e^{2\alpha} + \sin^2(\theta) e^{2\alpha} = e^{2\alpha} \end{align}

and its determinant is

\begin{align} \gamma = e^{4\alpha + (\gamma-\rho)} = e^{4\alpha}e^{(\gamma-\rho)}. \end{align}

At \(r=0\) we have \(2\alpha=\gamma-\rho\) and so the \(\gamma_{xx}=\gamma_{yy}=\gamma_{zz} = e^{2\alpha}\) and all other components are zero. The inverse spatial metric is given by

\begin{align} \gamma^{xx} &= \frac{\gamma_{yy}}{e^{2\alpha}e^{(\gamma-\rho)}} = \left[\sin^2(\phi)e^{2\alpha} + \cos^2(\phi) e^{(\gamma-\rho)}\right] e^{-2\alpha} e^{-(\gamma-\rho)} \notag \\ &=\sin^2(\phi)e^{-(\gamma-\rho)} + \cos^2(\phi) e^{-2\alpha} \\ \gamma^{yy} &= \frac{\gamma_{xx}}{e^{2\alpha}e^{(\gamma-\rho)}} = \left[\cos^2(\phi)e^{2\alpha} + \sin^2(\phi) e^{(\gamma-\rho)}\right] e^{-2\alpha} e^{-(\gamma-\rho)} \notag \\ &=\cos^2(\phi) e^{-(\gamma-\rho)} + \sin^2(\phi) e^{-2\alpha} \\ \gamma^{xy} &=\frac{-\gamma_{xy}}{e^{2\alpha}e^{(\gamma-\rho)}} = -\left[\cos(\phi)\sin(\phi)e^{2\alpha} - \sin(\phi)\cos(\phi) e^{(\gamma-\rho)}\right] e^{-2\alpha} e^{-(\gamma-\rho)} \notag \\ &=-\cos(\phi)\sin(\phi)e^{-(\gamma-\rho)} - \sin(\phi)\cos(\phi)e^{-2\alpha} \notag \\ &=\cos(\phi)\sin(\phi) \left[e^{-2\alpha} - e^{-(\gamma-\rho)}\right] \\ \gamma^{xz} &= 0 \\ \gamma^{yz} &= 0 \\ \gamma^{zz} &= e^{-2\alpha}. \end{align}

The 4-velocity in spherical coordinates is given by

\begin{align} u^{\bar{a}}=\frac{e^{-(\rho+\gamma)/2}}{\sqrt{1-v^2}} \left[1,0,0,\Omega\right], \end{align}

where

\begin{align} v=(\Omega-\omega)r\sin(\theta)e^{-\rho}. \end{align}

Transforming to Cartesian coordinates we have

\begin{align} u^t &=\frac{e^{-(\rho+\gamma)/2}}{\sqrt{1-v^2}} \\ u^x &=\partial_\phi x u^\phi = -r\sin(\theta)\sin(\phi) u^t\Omega \\ u^y &=\partial_\phi y u^\phi = r\sin(\theta)\cos(\phi) u^t\Omega \\ u^z &= 0. \end{align}

The Lorentz factor is given by

\begin{align} W &=Nu^t=e^{(\gamma+\rho)/2}\frac{e^{-(\rho+\gamma)/2}}{\sqrt{1-v^2}} \notag \\ &=\frac{1}{\sqrt{1-v^2}}. \end{align}

Using

\begin{align} v^i = \frac{1}{N}\left(\frac{u^i}{u^t} + \beta^i\right) \end{align}

we get

\begin{align} v^x &= -e^{-(\gamma+\rho)/2}r\sin(\theta)\sin(\phi)(\Omega-\omega) =-e^{-(\gamma-\rho)/2}\sin(\phi) v\\ v^y &= e^{-(\gamma+\rho)/2}r\sin(\theta)\cos(\phi)(\Omega-\omega) = e^{-(\gamma-\rho)/2}\cos(\phi)v \\ v^z&=0. \end{align}

Lowering with the spatial metric we get

\begin{align} v_x &=\gamma_{xx} v^x + \gamma_{xy} v^y \notag \\ &=-\left[\cos^2(\phi)e^{2\alpha}+\sin^2(\phi)e^{\gamma-\rho}\right] e^{-(\gamma-\rho)/2}\sin(\phi) v \notag \\ &+\left[\cos(\phi)\sin(\phi)e^{2\alpha} - \sin(\phi)\cos(\phi)e^{\gamma-\rho}\right] e^{-(\gamma-\rho)/2}\cos(\phi)v \notag \\ &=-e^{-(\gamma-\rho)/2}v\sin(\phi)e^{\gamma-\rho} \left[\sin^2(\phi)+\cos^2(\phi)\right] \notag \\ &=-e^{(\gamma-\rho)/2}v\sin(\phi) \\ v_y &=\gamma_{yx} v^x + \gamma_{yy} v^y \notag \\ &=-\left[\cos(\phi)\sin(\phi)e^{2\alpha} - \sin(\phi)\cos(\phi) e^{(\gamma-\rho)}\right] e^{-(\gamma-\rho)/2}\sin(\phi) v \notag \\ &+\left[\sin^2(\phi)e^{2\alpha} + \cos^2(\phi) e^{(\gamma-\rho)}\right] e^{-(\gamma-\rho)/2}\cos(\phi)v \notag \\ &=e^{(\gamma-\rho)/2}v\cos(\phi) \\ v_z &= 0. \end{align}

This is consistent with the Lorentz factor read off from \(u^t\) since \(v^iv_i=v^2\). For completeness, \(u_i=Wv_i\) so

\begin{align} u_x &=-\frac{e^{(\gamma-\rho)/2}v\sin(\phi)}{\sqrt{1-v^2}} \\ u_y &=\frac{e^{(\gamma-\rho)/2}v\cos(\phi)}{\sqrt{1-v^2}} \\ u_z&=0. \end{align}

Warning
Near (within 1e-2) \(r=0\) the numerical errors from interpolation and computing the metric derivatives by finite difference no longer cancel out and so the tilde_s time derivative only vanishes to roughly 1e-8 rather than machine precision. Computing the Cartesian derivatives from analytic differentiation of the radial and angular polynomial fits might improve the situation but is a decent about of work to implement.

Member Function Documentation

◆ get_clone()

auto RelativisticEuler::Solutions::RotatingStar::get_clone ( ) const -> std::unique_ptr< evolution::initial_data::InitialData >
overridevirtual

Member Data Documentation

◆ help

constexpr Options::String RelativisticEuler::Solutions::RotatingStar::help
staticconstexpr
Initial value:
= {
"Rotating neutron star initial data solved by the RotNS solver. The data "
"is read in from disk."}

The documentation for this class was generated from the following file: