SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/ScalarTensor/ScalarGaussBonnet/CouplingFunctions - QuarticPolynomial.hpp Hit Total Coverage
Commit: c3e43f8d41800b0ecefb9d1393f1de1d5a280c8f Lines: 8 37 21.6 %
Date: 2026-07-24 22:09:25
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <limits>
       7             : #include <pup.h>
       8             : 
       9             : #include "DataStructures/DataVector.hpp"
      10             : #include "DataStructures/Tensor/Tensor.hpp"
      11             : #include "Options/String.hpp"
      12             : #include "PointwiseFunctions/ScalarTensor/ScalarGaussBonnet/CouplingFunctions/CouplingFunction.hpp"
      13             : #include "Utilities/Gsl.hpp"
      14             : #include "Utilities/Serialization/CharmPupable.hpp"
      15             : #include "Utilities/TMPL.hpp"
      16             : 
      17             : namespace ScalarTensor::sgb::CouplingFunctions {
      18             : 
      19             : /*!
      20             :  * \brief Coupling function of polynomial type with degree up to four:
      21             :  * \f$F[\Psi] = \sum_{i = 1}^4 a_i \Psi^i\f$.
      22             :  *
      23             :  * \details This expression can be used to model the weak-field limit of a
      24             :  * generic coupling. Also, by appropriately setting the values of the
      25             :  * coefficients \f$a_i\f$ it can be used to study different phenomenological
      26             :  * scenario. For example, the theory admits the Kerr metric with vanishing
      27             :  * scalar field as a stationary solution in the case \f$a_1 = 0\f$, and can
      28             :  * feature spontanous scalarization for sufficiently large values of \f$a_2\f$.
      29             :  * Furthermore, if \f$a_2 = 0\f$, the theory can feature nonlinear
      30             :  * scalarization. See \cite Doneva:2022ewd for a review on spontanous
      31             :  * scalarization.
      32             :  */
      33           1 : class QuarticPolynomial : public CouplingFunction {
      34             :  public:
      35           0 :   static constexpr Options::String help = {
      36             :       "Coupling function of polynomial type with degree up to four"};
      37             : 
      38           0 :   struct Linear {
      39           0 :     using type = double;
      40           0 :     static constexpr Options::String help = {
      41             :         "Coefficient of the linear term in the scalar field"};
      42             :   };
      43             : 
      44           0 :   struct Quadratic {
      45           0 :     using type = double;
      46           0 :     static constexpr Options::String help = {
      47             :         "Coefficient of the quadratic term in the scalar field"};
      48             :   };
      49             : 
      50           0 :   struct Cubic {
      51           0 :     using type = double;
      52           0 :     static constexpr Options::String help = {
      53             :         "Coefficient of the cubic term in the scalar field"};
      54             :   };
      55             : 
      56           0 :   struct Quartic {
      57           0 :     using type = double;
      58           0 :     static constexpr Options::String help = {
      59             :         "Coefficient of the quartic term in the scalar field"};
      60             :   };
      61             : 
      62           0 :   using options = tmpl::list<Linear, Quadratic, Cubic, Quartic>;
      63             : 
      64           0 :   QuarticPolynomial() = default;
      65           0 :   QuarticPolynomial(double linear, double quadratic, double cubic,
      66             :                     double quartic);
      67           0 :   QuarticPolynomial(const QuarticPolynomial&) = default;
      68           0 :   QuarticPolynomial& operator=(const QuarticPolynomial&) = default;
      69           0 :   QuarticPolynomial(QuarticPolynomial&&) = default;
      70           0 :   QuarticPolynomial& operator=(QuarticPolynomial&&) = default;
      71           0 :   ~QuarticPolynomial() override = default;
      72             : 
      73           0 :   explicit QuarticPolynomial(CkMigrateMessage* m) : CouplingFunction(m) {}
      74           0 :   WRAPPED_PUPable_decl_template(QuarticPolynomial);
      75           0 :   void pup(PUP::er& p) override;
      76             : 
      77           0 :   double get_linear() const { return linear_; }
      78           0 :   double get_quadratic() const { return quadratic_; }
      79           0 :   double get_cubic() const { return cubic_; }
      80           0 :   double get_quartic() const { return quartic_; }
      81             : 
      82             :  protected:
      83             :   /*!
      84             :    * \brief Specialization of the function that evaluates the coupling function
      85             :    * on a scalar field profile.
      86             :    *
      87             :    * It returns the profile
      88             :    * \f$F[\Psi] = a_1 \Psi + a_2 \Psi^2 + a_3 \Psi^3 + a_4 \Psi^4\f$.
      89             :    */
      90           1 :   void coupling_function_impl(
      91             :       gsl::not_null<Scalar<DataVector>*> function_values,
      92             :       const Scalar<DataVector>& scalar_field) const override;
      93             : 
      94             :   /*!
      95             :    * \brief Specialization of the function that evaluates the first functional
      96             :    * derivative of the coupling function on a scalar field profile.
      97             :    *
      98             :    * It returns the profile
      99             :    * \f$\frac{\delta F[\Psi]}{\delta \Psi} = a_1 + 2 a_2 \Psi + 3 a_3 \Psi^2
     100             :    * + 4 a_4 \Psi^3\f$.
     101             :    */
     102           1 :   void coupling_function_prime_impl(
     103             :       gsl::not_null<Scalar<DataVector>*> function_values,
     104             :       const Scalar<DataVector>& scalar_field) const override;
     105             : 
     106             :   /*!
     107             :    * \brief Specialization of the function that evaluates the second functional
     108             :    * derivative of the coupling function on a scalar field profile.
     109             :    *
     110             :    * It returns the profile
     111             :    * \f$\frac{\delta^2 F[\Psi]}{\delta \Psi^2} = 2 a_2 + 6 a_3 \Psi
     112             :    * + 12 a_4 \Psi^2\f$.
     113             :    */
     114           1 :   void coupling_function_prime_prime_impl(
     115             :       gsl::not_null<Scalar<DataVector>*> function_values,
     116             :       const Scalar<DataVector>& scalar_field) const override;
     117             : 
     118             :  private:
     119             :   /*!
     120             :    * \brief Coefficient of the term linear in the scalar field, \f$a_1\f$.
     121             :    */
     122           1 :   double linear_{std::numeric_limits<double>::signaling_NaN()};
     123             : 
     124             :   /*!
     125             :    * \brief Coefficient of the term quadratic in the scalar field, \f$a_2\f$.
     126             :    */
     127           1 :   double quadratic_{std::numeric_limits<double>::signaling_NaN()};
     128             : 
     129             :   /*!
     130             :    * \brief Coefficient of the term cubic in the scalar field, \f$a_3\f$.
     131             :    */
     132           1 :   double cubic_{std::numeric_limits<double>::signaling_NaN()};
     133             : 
     134             :   /*!
     135             :    * \brief Coefficient of the term quartic in the scalar field, \f$a_4\f$.
     136             :    */
     137           1 :   double quartic_{std::numeric_limits<double>::signaling_NaN()};
     138             : };
     139             : 
     140             : }  // namespace ScalarTensor::sgb::CouplingFunctions

Generated by: LCOV version 1.14