Metric

class Metric

The base class of all kinds of metrics.

Subclassed by SBody::Newton, SBody::Schwarzschild

Public Functions

virtual std::string Name() = 0

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) = 0

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) = 0

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) = 0

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

int LocalInertialFrame(const double position[], TimeSystem time, gsl_matrix *coordinate)

Calculate the local inertial frame coordinate of the object at position, stored in coordinate.

Parameters:
  • position – 8 dimensional vector

  • time – time systme of the object

  • coordinate – matrix with size 4×4

Returns:

status

virtual int LagrangianToHamiltonian(double y[]) = 0

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) = 0

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) = 0

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) = 0

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) = 0

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) = 0

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double Redshift(const double y[], const double photon[], TimeSystem object_time, TimeSystem photon_time)

Calculate the redshift of the object, \(1+z\).

Parameters:
  • y – 8 dimensional vector of the object

  • photon – photon traced to the object

  • object_time – time system of the object

  • photon_time – time system of the photon

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) = 0

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) = 0

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) = 0

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Newton & Post-Newtonian

class Newton : public SBody::Metric

Post-Newtonian.

Subclassed by SBody::PN1

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double Redshift(const double y[], const double photon[], TimeSystem object_time, TimeSystem photon_time) override

Calculate the redshift of the object, \(1+z\).

Parameters:
  • y – 8 dimensional vector of the object

  • photon – photon traced to the object

  • object_time – time system of the object

  • photon_time – time system of the photon

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

class PN1 : public SBody::Newton

Public Functions

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Schwarzschild

class Schwarzschild : public SBody::Metric

Subclassed by SBody::Kerr, SBody::ReissnerNordstrom

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Reissner-Nördstrom

class ReissnerNordstrom : public SBody::Schwarzschild

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Kerr

class Kerr : public SBody::Schwarzschild

Subclassed by SBody::Hayward, SBody::KerrNewman, SBody::KerrTaubNUT

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Kerr-Newman

class KerrNewman : public SBody::Kerr

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Kerr-Taub-NUT

class KerrTaubNUT : public SBody::Kerr

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator

Hayward

class Hayward : public SBody::Kerr

Public Functions

virtual std::string Name() override

Return the name of the metric.

Returns:

name of the metric.

virtual int MetricTensor(const double position[], gsl_matrix *metric) override

Calculate the metric tensor at position, stored in metric.

Parameters:
  • position – 4 dimensional vector

  • metric – matrix with size 4×4

Returns:

status

virtual double DotProduct(const double position[], const double x[], const double y[], const size_t dimension) override

Dot product of vector x and y at position. \(g_{\mu\nu}x^\mu y^\nu\).

Parameters:
  • position – 4 dimensional vector, position to calcuate the dot product of x and y.

  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector, should be 3 or 4.

Returns:

result

virtual double DistanceSquare(const double x[], const double y[], const size_t dimension) override

Calculate the square of the distance between x and y at x. \(g_{\mu\nu}(x^\mu-y^\mu)(x^\nu-y^\nu)\).

Parameters:
  • x – 4 dimensional vector

  • y – 4 dimensional vector

  • dimension – dimension of the vector

Returns:

result

virtual int LagrangianToHamiltonian(double y[]) override

Convert the coordinate system from Lagrangian to Hamiltonian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int HamiltonianToLagrangian(double y[]) override

Convert the coordinate system from Hamiltonian to Lagrangian.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int FastTrace(const double r_observer, const double theta_observer, const double sin_theta_observer, const double cos_theta_observer, const double r_target, const double theta_target, const double phi_target, double &alpha, double &beta, double photon[]) override

Trace the photon from the observer to the target, using elliptic integrals.

Parameters:
  • r_observer – radius of the observer, \(r_\text{obs}\).

  • theta_observer – theta of the observer, \(\theta_\text{obs}\).

  • sin_theta_observer – sin(theta_observer), \(\sin\theta_\text{obs}\).

  • cos_theta_observer – cos(theta_observer), \(\cos\theta_\text{obs}\).

  • r_target – radius of the target, \(r_\text{tar}\).

  • theta_target – theta of the target, \(\theta_\text{tar}\).

  • phi_target – phi of the target, \(\phi_\text{tar}\).

  • alpha – x position of the target in the observer’s view.

  • beta – y position of the target in the observer’s view.

  • photon – 9 dimensional vector, position and the velocity of the photon traced to the target. photon[8] is used to store the look back time.

Returns:

status

virtual double Energy(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the energy of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double AngularMomentum(const double y[], TimeSystem time, DynamicalSystem dynamics) override

Calculate the angular momentum of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual double CarterConstant(const double y[], const double mu2, TimeSystem time, DynamicalSystem dynamics) override

Calculate the Carter constant of the object.

Parameters:
  • y – 8 dimensional vector

  • time – time system of the object

  • dynamics – dynamical system of the object

Returns:

result

virtual int NormalizeTimelikeGeodesic(double y[]) override

Normalize the timelike geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual int NormalizeNullGeodesic(double y[], double frequency = 1.) override

Normalize the null geodesic.

Parameters:

y – 8 dimensional vector

Returns:

status

virtual std::unique_ptr<Integrator> GetIntegrator(TimeSystem time, DynamicalSystem dynamics, MotionMode motion = GEODESIC) override

Get the integrator to calculate the motion of the object.

Parameters:
  • time – time system of the object

  • dynamics – dynamical system of the object

  • motion – motion mode of the object

Returns:

pointer to the integrator