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

Generated by: LCOV version 1.14