SpECTRE Documentation Coverage Report
Current view: top level - Evolution/VariableFixing - LimitLorentzFactor.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 12.9 % 31 4
Test Date: 2026-10-22 17:29:42
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 "DataStructures/Tensor/TypeAliases.hpp"
       7              : #include "Options/String.hpp"
       8              : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
       9              : #include "Utilities/Gsl.hpp"
      10              : #include "Utilities/TMPL.hpp"
      11              : 
      12              : /// \cond
      13              : class DataVector;
      14              : 
      15              : namespace PUP {
      16              : class er;
      17              : }  // namespace PUP
      18              : /// \endcond
      19              : 
      20              : namespace VariableFixing {
      21              : /*!
      22              :  *\ingroup VariableFixingGroup
      23              :  * \brief Limit the maximum Lorentz factor to LorentzFactorCap in regions where
      24              :  * the density is below MaxDensityCutoff.
      25              :  *
      26              :  * The Lorentz factor is set to LorentzFactorCap and the spatial velocity is
      27              :  * adjusted according to:
      28              :  * \f{align}
      29              :  * v^i_{(\textrm{new})} = \sqrt{\left(1 - \frac{1}{W_{(\textrm{new})}^2}\right)
      30              :  * \left(1 - \frac{1}{W_{(\textrm{old})}^2}\right)^{-1}} v^i_{(\textrm{old})}
      31              :  * \f}
      32              :  */
      33            1 : class LimitLorentzFactor {
      34              :  public:
      35              :   /// Do not apply the Lorentz factor cap above this density
      36            1 :   struct MaxDensityCutoff {
      37            0 :     using type = double;
      38            0 :     static type lower_bound() { return 0.0; }
      39            0 :     static constexpr Options::String help = {
      40              :         "Do not apply the Lorentz factor cap above this density"};
      41              :   };
      42              :   /// Largest Lorentz factor allowed. If a larger one is found, normalize
      43              :   /// velocity to have the Lorentz factor be this value.
      44            1 :   struct LorentzFactorCap {
      45            0 :     using type = double;
      46            0 :     static type lower_bound() { return 1.0; }
      47            0 :     static constexpr Options::String help = {"Largest Lorentz factor allowed."};
      48              :   };
      49              :   /// Whether or not the limiting is enabled
      50            1 :   struct Enable {
      51            0 :     using type = bool;
      52            0 :     static constexpr Options::String help = {
      53              :         "If true then the limiting is applied."};
      54              :   };
      55              : 
      56            0 :   using options = tmpl::list<MaxDensityCutoff, LorentzFactorCap, Enable>;
      57            0 :   static constexpr Options::String help = {
      58              :       "Limit the maximum Lorentz factor to LorentzFactorCap in regions where "
      59              :       "the\n"
      60              :       "density is below MaxDensityCutoff. The Lorentz factor is set to\n"
      61              :       "LorentzFactorCap and the spatial velocity is adjusted accordingly."};
      62              : 
      63            0 :   LimitLorentzFactor(double max_density_cutoff, double lorentz_factor_cap,
      64              :                      bool enable);
      65              : 
      66            0 :   LimitLorentzFactor() = default;
      67            0 :   LimitLorentzFactor(const LimitLorentzFactor& /*rhs*/) = default;
      68            0 :   LimitLorentzFactor& operator=(const LimitLorentzFactor& /*rhs*/) = default;
      69            0 :   LimitLorentzFactor(LimitLorentzFactor&& /*rhs*/) = default;
      70            0 :   LimitLorentzFactor& operator=(LimitLorentzFactor&& /*rhs*/) = default;
      71            0 :   ~LimitLorentzFactor() = default;
      72              : 
      73              :   // NOLINTNEXTLINE(google-runtime-references)
      74            0 :   void pup(PUP::er& p);
      75              : 
      76            0 :   using return_tags = tmpl::list<hydro::Tags::LorentzFactor<DataVector>,
      77              :                                  hydro::Tags::SpatialVelocity<DataVector, 3>>;
      78              : 
      79            0 :   using argument_tags = tmpl::list<hydro::Tags::RestMassDensity<DataVector>>;
      80              : 
      81            0 :   void operator()(
      82              :       gsl::not_null<Scalar<DataVector>*> lorentz_factor,
      83              :       gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> spatial_velocity,
      84              :       const Scalar<DataVector>& rest_mass_density) const;
      85              : 
      86              :  private:
      87            0 :   friend bool operator==(const LimitLorentzFactor& lhs,
      88              :                          const LimitLorentzFactor& rhs);
      89              : 
      90            0 :   double max_density_cuttoff_;
      91            0 :   double lorentz_factor_cap_;
      92            0 :   bool enable_;
      93              : };
      94              : 
      95            0 : bool operator!=(const LimitLorentzFactor& lhs, const LimitLorentzFactor& rhs);
      96              : }  // namespace VariableFixing
        

Generated by: LCOV version 2.0-1