SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/ScalarTensor - Characteristics.hpp Hit Total Coverage
Commit: 965048f86d23c819715b3af1ca3f880c8145d4bb Lines: 1 10 10.0 %
Date: 2024-05-16 17:00:40
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 <cstddef>
       7             : 
       8             : #include "DataStructures/DataBox/Tag.hpp"
       9             : #include "DataStructures/DataVector.hpp"
      10             : #include "DataStructures/Tensor/Tensor.hpp"
      11             : #include "Evolution/Systems/CurvedScalarWave/Characteristics.hpp"
      12             : #include "Evolution/Systems/GeneralizedHarmonic/Characteristics.hpp"
      13             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      14             : #include "Utilities/Gsl.hpp"
      15             : #include "Utilities/TMPL.hpp"
      16             : 
      17           0 : namespace ScalarTensor::Tags {
      18           0 : struct LargestCharacteristicSpeed : db::SimpleTag {
      19           0 :   using type = double;
      20             : };
      21             : 
      22             : /*!
      23             :  * \brief Computes the largest magnitude of the characteristic speeds.
      24             :  *
      25             :  * \details Compute the maximum of the largest characteristic speed of each
      26             :  * component system, i.e. the largest speed between ::gh and ::CurvedScalarWave.
      27             :  */
      28             : template <typename Frame = Frame::Inertial>
      29           1 : struct ComputeLargestCharacteristicSpeed : db::ComputeTag,
      30             :                                            LargestCharacteristicSpeed {
      31           0 :   static constexpr size_t Dim = 3_st;
      32           0 :   using argument_tags =
      33             :       tmpl::list<::gh::ConstraintDamping::Tags::ConstraintGamma1,
      34             :                  gr::Tags::Lapse<DataVector>,
      35             :                  gr::Tags::Shift<DataVector, Dim, Frame>,
      36             :                  gr::Tags::SpatialMetric<DataVector, Dim, Frame>,
      37             :                  CurvedScalarWave::Tags::ConstraintGamma1>;
      38           0 :   using return_type = double;
      39           0 :   using base = LargestCharacteristicSpeed;
      40           0 :   static void function(const gsl::not_null<double*> speed,
      41             :                        // GH arguments
      42             :                        const Scalar<DataVector>& gamma_1,
      43             :                        const Scalar<DataVector>& lapse,
      44             :                        const tnsr::I<DataVector, Dim, Frame>& shift,
      45             :                        const tnsr::ii<DataVector, Dim, Frame>& spatial_metric,
      46             :                        // Scalar arguments
      47             :                        const Scalar<DataVector>& gamma_1_scalar) {
      48             :     // Largest speed in for Generalized Harmonic
      49             :     double gh_largest_speed = 0.0;
      50             :     gh::Tags::ComputeLargestCharacteristicSpeed<Dim, Frame>::function(
      51             :         make_not_null(&gh_largest_speed), gamma_1, lapse, shift,
      52             :         spatial_metric);
      53             :     // Largest speed for CurvedScalarWave
      54             :     double scalar_largest_speed = 0.0;
      55             :     CurvedScalarWave::Tags::ComputeLargestCharacteristicSpeed<Dim>::function(
      56             :         make_not_null(&scalar_largest_speed), gamma_1_scalar, lapse, shift,
      57             :         spatial_metric);
      58             :     // Compute the maximum speed
      59             :     *speed = std::max(gh_largest_speed, scalar_largest_speed);
      60             :   }
      61             : };
      62             : }  // namespace ScalarTensor::Tags

Generated by: LCOV version 1.14