SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticData/Xcts - CommonVariables.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 9.4 % 32 3
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 <cstddef>
       7              : #include <functional>
       8              : #include <optional>
       9              : 
      10              : #include "DataStructures/DataBox/Prefixes.hpp"
      11              : #include "DataStructures/Tensor/Tensor.hpp"
      12              : #include "Elliptic/Systems/Xcts/Tags.hpp"
      13              : #include "NumericalAlgorithms/LinearOperators/Divergence.hpp"
      14              : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      15              : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
      16              : #include "PointwiseFunctions/Hydro/Tags.hpp"
      17              : #include "Utilities/Gsl.hpp"
      18              : 
      19              : namespace Xcts::AnalyticData {
      20              : 
      21              : /// Tags for variables that analytic-data classes can share
      22              : template <typename DataType>
      23            1 : using common_tags = tmpl::list<
      24              :     // Background quantities
      25              :     Tags::ConformalMetric<DataType, 3, Frame::Inertial>,
      26              :     gr::Tags::TraceExtrinsicCurvature<DataType>,
      27              :     ::Tags::dt<gr::Tags::TraceExtrinsicCurvature<DataType>>,
      28              :     Tags::ShiftBackground<DataType, 3, Frame::Inertial>,
      29              :     ::Tags::deriv<Tags::ShiftBackground<DataType, 3, Frame::Inertial>,
      30              :                   tmpl::size_t<3>, Frame::Inertial>,
      31              :     Tags::LongitudinalShiftBackgroundMinusDtConformalMetric<DataType, 3,
      32              :                                                             Frame::Inertial>,
      33              :     // Analytic derivatives
      34              :     ::Tags::deriv<Tags::ConformalMetric<DataType, 3, Frame::Inertial>,
      35              :                   tmpl::size_t<3>, Frame::Inertial>,
      36              :     // Background quantities derived from the above
      37              :     Tags::InverseConformalMetric<DataType, 3, Frame::Inertial>,
      38              :     Tags::ConformalChristoffelFirstKind<DataType, 3, Frame::Inertial>,
      39              :     Tags::ConformalChristoffelSecondKind<DataType, 3, Frame::Inertial>,
      40              :     Tags::ConformalChristoffelContracted<DataType, 3, Frame::Inertial>,
      41              :     // Fixed sources
      42              :     ::Tags::FixedSource<Tags::ConformalFactorMinusOne<DataType>>,
      43              :     ::Tags::FixedSource<Tags::LapseTimesConformalFactorMinusOne<DataType>>,
      44              :     ::Tags::FixedSource<Tags::ShiftExcess<DataType, 3, Frame::Inertial>>,
      45              :     // These tags require numerical differentiation
      46              :     ::Tags::deriv<
      47              :         Tags::ConformalChristoffelSecondKind<DataType, 3, Frame::Inertial>,
      48              :         tmpl::size_t<3>, Frame::Inertial>,
      49              :     Tags::ConformalRicciTensor<DataType, 3, Frame::Inertial>,
      50              :     Tags::ConformalRicciScalar<DataType>,
      51              :     ::Tags::deriv<gr::Tags::TraceExtrinsicCurvature<DataType>, tmpl::size_t<3>,
      52              :                   Frame::Inertial>,
      53              :     ::Tags::div<Tags::LongitudinalShiftBackgroundMinusDtConformalMetric<
      54              :         DataType, 3, Frame::Inertial>>>;
      55              : 
      56              : /// Tags for hydro variables that are typically retrieved from a hydro solution
      57              : template <typename DataType>
      58            1 : using hydro_tags = tmpl::list<hydro::Tags::RestMassDensity<DataType>,
      59              :                               hydro::Tags::SpecificEnthalpy<DataType>,
      60              :                               hydro::Tags::Pressure<DataType>,
      61              :                               hydro::Tags::SpatialVelocity<DataType, 3>,
      62              :                               hydro::Tags::LorentzFactor<DataType>,
      63              :                               hydro::Tags::MagneticField<DataType, 3>>;
      64              : 
      65              : /*!
      66              :  * \brief Implementations for variables that analytic-data classes can share
      67              :  *
      68              :  * Analytic-data classes can derive their variable computers from this class to
      69              :  * inherit implementations for the `common_tags`. Note that some variables
      70              :  * require a numeric differentiation. To compute those variables, a `mesh` and
      71              :  * an `inv_jacobian` must be passed to the constructor. The `mesh` and the
      72              :  * `inv_jacobian` can be set to `std::nullopt` if no variables with numeric
      73              :  * derivatives are requested.
      74              :  *
      75              :  * \tparam DataType `double` or `DataVector`. Must be `DataVector` if variables
      76              :  * with numeric derivatives are requested.
      77              :  * \tparam Cache The `CachedTempBuffer` used by the analytic-data class.
      78              :  */
      79              : template <typename DataType, typename Cache>
      80            1 : struct CommonVariables {
      81            0 :   static constexpr size_t Dim = 3;
      82              : 
      83            0 :   CommonVariables(const CommonVariables&) = default;
      84            0 :   CommonVariables& operator=(const CommonVariables&) = default;
      85            0 :   CommonVariables(CommonVariables&&) = default;
      86            0 :   CommonVariables& operator=(CommonVariables&&) = default;
      87            0 :   virtual ~CommonVariables() = default;
      88              : 
      89            0 :   CommonVariables(
      90              :       std::optional<std::reference_wrapper<const Mesh<Dim>>> local_mesh,
      91              :       std::optional<std::reference_wrapper<const InverseJacobian<
      92              :           DataType, Dim, Frame::ElementLogical, Frame::Inertial>>>
      93              :           local_inv_jacobian)
      94              :       : mesh(std::move(local_mesh)),
      95              :         inv_jacobian(std::move(local_inv_jacobian)) {}
      96              : 
      97            0 :   virtual void operator()(
      98              :       gsl::not_null<tnsr::ii<DataType, Dim>*> conformal_metric,
      99              :       gsl::not_null<Cache*> cache,
     100              :       Tags::ConformalMetric<DataType, Dim, Frame::Inertial> /*meta*/) const = 0;
     101            0 :   virtual void operator()(
     102              :       gsl::not_null<Scalar<DataType>*> extrinsic_curvature_trace,
     103              :       gsl::not_null<Cache*> cache,
     104              :       gr::Tags::TraceExtrinsicCurvature<DataType> /*meta*/) const = 0;
     105            0 :   virtual void operator()(
     106              :       gsl::not_null<Scalar<DataType>*> dt_extrinsic_curvature_trace,
     107              :       gsl::not_null<Cache*> cache,
     108              :       ::Tags::dt<gr::Tags::TraceExtrinsicCurvature<DataType>> /*meta*/)
     109              :       const = 0;
     110            0 :   virtual void operator()(
     111              :       gsl::not_null<tnsr::I<DataType, Dim>*> shift_background,
     112              :       gsl::not_null<Cache*> cache,
     113              :       Tags::ShiftBackground<DataType, Dim, Frame::Inertial> /*meta*/) const = 0;
     114            0 :   virtual void operator()(
     115              :       gsl::not_null<tnsr::iJ<DataType, Dim>*> deriv_shift_background,
     116              :       gsl::not_null<Cache*> cache,
     117              :       ::Tags::deriv<Tags::ShiftBackground<DataType, Dim, Frame::Inertial>,
     118              :                     tmpl::size_t<3>, Frame::Inertial> /*meta*/) const = 0;
     119            0 :   virtual void operator()(
     120              :       gsl::not_null<tnsr::II<DataType, Dim>*> longitudinal_shift_background,
     121              :       gsl::not_null<Cache*> cache,
     122              :       Tags::LongitudinalShiftBackgroundMinusDtConformalMetric<
     123              :           DataType, Dim, Frame::Inertial> /*meta*/) const;
     124            0 :   virtual void operator()(
     125              :       gsl::not_null<tnsr::ijj<DataType, Dim>*> deriv_conformal_metric,
     126              :       gsl::not_null<Cache*> cache,
     127              :       ::Tags::deriv<Tags::ConformalMetric<DataType, Dim, Frame::Inertial>,
     128              :                     tmpl::size_t<Dim>, Frame::Inertial> /*meta*/) const = 0;
     129            0 :   virtual void operator()(
     130              :       gsl::not_null<tnsr::II<DataType, Dim>*> inv_conformal_metric,
     131              :       gsl::not_null<Cache*> cache,
     132              :       Tags::InverseConformalMetric<DataType, Dim, Frame::Inertial> /*meta*/)
     133              :       const;
     134            0 :   virtual void operator()(
     135              :       gsl::not_null<tnsr::ijj<DataType, Dim>*> conformal_christoffel_first_kind,
     136              :       gsl::not_null<Cache*> cache,
     137              :       Tags::ConformalChristoffelFirstKind<DataType, Dim,
     138              :                                           Frame::Inertial> /*meta*/) const;
     139            0 :   virtual void operator()(gsl::not_null<tnsr::Ijj<DataType, Dim>*>
     140              :                               conformal_christoffel_second_kind,
     141              :                           gsl::not_null<Cache*> cache,
     142              :                           Tags::ConformalChristoffelSecondKind<
     143              :                               DataType, Dim, Frame::Inertial> /*meta*/) const;
     144            0 :   virtual void operator()(
     145              :       gsl::not_null<tnsr::i<DataType, Dim>*> conformal_christoffel_contracted,
     146              :       gsl::not_null<Cache*> cache,
     147              :       Tags::ConformalChristoffelContracted<DataType, Dim,
     148              :                                            Frame::Inertial> /*meta*/) const;
     149            0 :   void operator()(
     150              :       gsl::not_null<Scalar<DataType>*> fixed_source_for_hamiltonian_constraint,
     151              :       gsl::not_null<Cache*> cache,
     152              :       ::Tags::FixedSource<Tags::ConformalFactorMinusOne<DataType>> /*meta*/)
     153              :       const;
     154            0 :   void operator()(
     155              :       gsl::not_null<Scalar<DataType>*> fixed_source_for_lapse_equation,
     156              :       gsl::not_null<Cache*> cache,
     157              :       ::Tags::FixedSource<
     158              :           Tags::LapseTimesConformalFactorMinusOne<DataType>> /*meta*/) const;
     159            0 :   void operator()(
     160              :       gsl::not_null<tnsr::I<DataType, 3>*> fixed_source_momentum_constraint,
     161              :       gsl::not_null<Cache*> cache,
     162              :       ::Tags::FixedSource<
     163              :           Tags::ShiftExcess<DataType, 3, Frame::Inertial>> /*meta*/) const;
     164            0 :   virtual void operator()(
     165              :       gsl::not_null<tnsr::iJkk<DataType, Dim>*>
     166              :           deriv_conformal_christoffel_second_kind,
     167              :       gsl::not_null<Cache*> cache,
     168              :       ::Tags::deriv<
     169              :           Tags::ConformalChristoffelSecondKind<DataType, Dim, Frame::Inertial>,
     170              :           tmpl::size_t<Dim>, Frame::Inertial> /*meta*/) const;
     171            0 :   virtual void operator()(
     172              :       gsl::not_null<tnsr::ii<DataType, Dim>*> conformal_ricci_tensor,
     173              :       gsl::not_null<Cache*> cache,
     174              :       Tags::ConformalRicciTensor<DataType, Dim, Frame::Inertial> /*meta*/)
     175              :       const;
     176            0 :   virtual void operator()(
     177              :       gsl::not_null<Scalar<DataType>*> conformal_ricci_scalar,
     178              :       gsl::not_null<Cache*> cache,
     179              :       Tags::ConformalRicciScalar<DataType> /*meta*/) const;
     180            0 :   virtual void operator()(
     181              :       gsl::not_null<tnsr::i<DataType, Dim>*> deriv_extrinsic_curvature_trace,
     182              :       gsl::not_null<Cache*> cache,
     183              :       ::Tags::deriv<gr::Tags::TraceExtrinsicCurvature<DataType>,
     184              :                     tmpl::size_t<Dim>, Frame::Inertial> /*meta*/) const;
     185            0 :   virtual void operator()(
     186              :       gsl::not_null<tnsr::I<DataType, Dim>*> div_longitudinal_shift_background,
     187              :       gsl::not_null<Cache*> cache,
     188              :       ::Tags::div<Tags::LongitudinalShiftBackgroundMinusDtConformalMetric<
     189              :           DataType, Dim, Frame::Inertial>> /*meta*/) const;
     190              : 
     191            0 :   std::optional<std::reference_wrapper<const Mesh<Dim>>> mesh;
     192              :   std::optional<std::reference_wrapper<const InverseJacobian<
     193              :       DataType, Dim, Frame::ElementLogical, Frame::Inertial>>>
     194            0 :       inv_jacobian;
     195              : };
     196              : 
     197              : }  // namespace Xcts::AnalyticData
        

Generated by: LCOV version 2.0-1