SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticSolutions/GeneralRelativity - KerrHorizon.cpp Hit Total Coverage
Commit: 2db722c93a8e9b106e406b439b79c8e05c2057fb Lines: 1 4 25.0 %
Date: 2021-03-03 22:01:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/KerrHorizon.hpp"
       5             : 
       6             : #include <cmath>
       7             : 
       8             : #include "DataStructures/DataVector.hpp"                 // IWYU pragma: keep
       9             : #include "DataStructures/Tensor/EagerMath/Magnitude.hpp" // IWYU pragma: keep
      10             : #include "Utilities/ConstantExpressions.hpp"
      11             : #include "Utilities/MakeWithValue.hpp"
      12             : #include "Utilities/StdArrayHelpers.hpp"
      13             : 
      14             : namespace gr {
      15             : namespace Solutions {
      16             : 
      17             : template <typename DataType>
      18           1 : Scalar<DataType> kerr_horizon_radius(
      19             :     const std::array<DataType, 2>& theta_phi, const double mass,
      20             :     const std::array<double, 3>& dimensionless_spin) noexcept {
      21             :   const double spin_magnitude_squared = square(magnitude(dimensionless_spin));
      22             :   const double mass_squared = square(mass);
      23             : 
      24             :   const double equatorial_radius_squared =
      25             :       2.0 * mass_squared * (1.0 + sqrt(1.0 - spin_magnitude_squared));
      26             :   const double polar_radius_squared =
      27             :       mass_squared * square(1.0 + sqrt(1.0 - spin_magnitude_squared));
      28             : 
      29             :   const auto& theta = theta_phi[0];
      30             :   const auto& phi = theta_phi[1];
      31             :   const DataType sin_theta = sin(theta);
      32             :   const DataType cos_theta = cos(theta);
      33             :   const DataType sin_phi = sin(phi);
      34             :   const DataType cos_phi = cos(phi);
      35             : 
      36             :   auto denominator =
      37             :       make_with_value<DataType>(theta_phi[0], polar_radius_squared);
      38             :   denominator += mass_squared * dimensionless_spin[0] * dimensionless_spin[0] *
      39             :                  square(sin_theta * cos_phi);
      40             :   denominator += mass_squared * dimensionless_spin[1] * dimensionless_spin[1] *
      41             :                  square(sin_theta * sin_phi);
      42             :   denominator += mass_squared * dimensionless_spin[2] * dimensionless_spin[2] *
      43             :                  square(cos_theta);
      44             :   denominator += 2.0 * mass_squared * dimensionless_spin[0] *
      45             :                  dimensionless_spin[1] * square(sin_theta) * sin_phi * cos_phi;
      46             :   denominator += 2.0 * mass_squared * dimensionless_spin[0] *
      47             :                  dimensionless_spin[2] * sin_theta * cos_theta * cos_phi;
      48             :   denominator += 2.0 * mass_squared * dimensionless_spin[1] *
      49             :                  dimensionless_spin[2] * sin_theta * cos_theta * sin_phi;
      50             : 
      51             :   auto radius_squared =
      52             :       make_with_value<DataType>(theta_phi[0], polar_radius_squared);
      53             :   radius_squared *= equatorial_radius_squared;
      54             :   radius_squared /= denominator;
      55             : 
      56             :   return Scalar<DataType>{sqrt(radius_squared)};
      57             : }
      58             : 
      59           0 : template Scalar<DataVector> kerr_horizon_radius(
      60             :     const std::array<DataVector, 2>& theta_phi, const double mass,
      61             :     const std::array<double, 3>& dimensionless_spin) noexcept;
      62             : 
      63           0 : template Scalar<double> kerr_horizon_radius(
      64             :     const std::array<double, 2>& theta_phi, const double mass,
      65             :     const std::array<double, 3>& dimensionless_spin) noexcept;
      66             : 
      67             : }  // namespace Solutions
      68             : }  // namespace gr
      69             : 

Generated by: LCOV version 1.14