SpECTRE Documentation Coverage Report
Current view: top level - Elliptic/Systems/Xcts - FirstOrderSystem.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 6.7 % 15 1
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              : 
       8              : #include "DataStructures/DataBox/Prefixes.hpp"
       9              : #include "DataStructures/Tensor/EagerMath/Magnitude.hpp"
      10              : #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp"
      11              : #include "Elliptic/Protocols/FirstOrderSystem.hpp"
      12              : #include "Elliptic/Systems/Xcts/FluxesAndSources.hpp"
      13              : #include "Elliptic/Systems/Xcts/Geometry.hpp"
      14              : #include "Elliptic/Systems/Xcts/Tags.hpp"
      15              : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      16              : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      17              : #include "PointwiseFunctions/GeneralRelativity/Tags/Conformal.hpp"
      18              : #include "Utilities/ProtocolHelpers.hpp"
      19              : #include "Utilities/TMPL.hpp"
      20              : 
      21              : namespace Xcts {
      22              : 
      23              : /*!
      24              :  * \brief The Extended Conformal Thin Sandwich (XCTS) decomposition of the
      25              :  * Einstein constraint equations, formulated as a set of coupled first-order
      26              :  * partial differential equations
      27              :  *
      28              :  * See \ref Xcts for details on the XCTS equations.
      29              :  * The system can be formulated in terms of these fluxes and sources (see
      30              :  * `elliptic::protocols::FirstOrderSystem`):
      31              :  *
      32              :  * \f{align}
      33              :  * F^i_\psi ={} &\bar{\gamma}^{ij} \partial_j \psi \\
      34              :  * S_\psi ={} &-\bar{\Gamma}^i_{ij} F^j_\psi
      35              :  * + \frac{1}{8}\psi\bar{R} + \frac{1}{12}\psi^5 K^2
      36              :  * - \frac{1}{8}\psi^{-7}\bar{A}^2 - 2\pi\psi^5\rho
      37              :  * \f}
      38              :  *
      39              :  * for the Hamiltonian constraint,
      40              :  *
      41              :  * \f{align}
      42              :  * F^i_{\alpha\psi} ={} &\bar{\gamma}^{ij} \partial_j \alpha\psi \\
      43              :  * S_{\alpha\psi} ={} &-\bar{\Gamma}^i_{ij} F^j_{\alpha\psi}
      44              :  * + \alpha\psi \left(\frac{7}{8}\psi^{-8} \bar{A}^2
      45              :  * + \frac{5}{12} \psi^4 K^2 + \frac{1}{8}\bar{R}
      46              :  * + 2\pi\psi^4\left(\rho + 2S\right) \right) \\
      47              :  * &- \psi^5\partial_t K + \psi^5\left(\beta^i\bar{D}_i K
      48              :  * + \beta_\mathrm{background}^i\bar{D}_i K\right)
      49              :  * \f}
      50              :  *
      51              :  * for the lapse equation, and
      52              :  *
      53              :  * \f{align}
      54              :  * F^{ij}_\beta ={} &\left(\bar{L}\beta\right)^{ij} = \bar{\nabla}^i \beta^j
      55              :  * + \bar{\nabla}^j \beta^i
      56              :  * - \frac{2}{3} \bar{\gamma}^{ij} \bar{\nabla}_k \beta^k \\
      57              :  * S^i_\beta ={} &-\bar{\Gamma}^j_{jk} F^{ik}_\beta
      58              :  * - \bar{\Gamma}^i_{jk} F^{jk}_\beta
      59              :  * + \left(F^{ij}_\beta
      60              :  * + \left(\bar{L}\beta_\mathrm{background}\right)^{ij} - \bar{u}^{ij}\right)
      61              :  * \bar{\gamma}_{jk} \left(\frac{F^k_{\alpha\psi}}{\alpha\psi}
      62              :  * - 7 \frac{F^k_\psi}{\psi}\right) \\
      63              :  * &- \bar{D}_j\left(\left(\bar{L}\beta_\mathrm{background}\right)^{ij}
      64              :  * - \bar{u}^{ij}\right)
      65              :  * + \frac{4}{3}\frac{\alpha\psi}{\psi}\bar{D}^i K
      66              :  * + 16\pi\left(\alpha\psi\right)\psi^3 S^i
      67              :  * \f}
      68              :  *
      69              :  * for the momentum constraint, with
      70              :  *
      71              :  * \f{align}
      72              :  * \bar{A}^{ij} ={} &\frac{\psi^7}{2\alpha\psi}\left(
      73              :  * \left(\bar{L}\beta\right)^{ij} +
      74              :  * \left(\bar{L}\beta_\mathrm{background}\right)^{ij} - \bar{u}^{ij} \right)
      75              :  * \f}
      76              :  *
      77              :  * and all \f$f_\alpha=0\f$.
      78              :  *
      79              :  * Note that the symbol \f$\beta\f$ in the equations above means
      80              :  * \f$\beta_\mathrm{excess}\f$. The full shift is \f$\beta_\mathrm{excess} +
      81              :  * \beta_\mathrm{background}\f$. See `Xcts::Tags::ShiftBackground` and
      82              :  * `Xcts::Tags::ShiftExcess` for details on this split. Also note that the
      83              :  * background shift is degenerate with \f$\bar{u}\f$ so we treat the quantity
      84              :  * \f$\left(\bar{L}\beta_\mathrm{background}\right)^{ij} - \bar{u}^{ij}\f$ as a
      85              :  * single background field (see
      86              :  * `Xcts::Tags::LongitudinalShiftBackgroundMinusDtConformalMetric`). The
      87              :  * covariant divergence of this quantity w.r.t. the conformal metric is also a
      88              :  * background field.
      89              :  *
      90              :  * \par Solving a subset of equations:
      91              :  * This system allows you to select a subset of `Xcts::Equations` so you don't
      92              :  * have to solve for all variables if some are analytically known. Specify the
      93              :  * set of enabled equations as the first template parameter. The set of required
      94              :  * background fields depends on your choice of equations.
      95              :  *
      96              :  * \par Conformal background geometry:
      97              :  * The equations simplify significantly if the conformal metric is flat
      98              :  * ("conformal flatness") and in Cartesian coordinates. In this case you can
      99              :  * specify `Xcts::Geometry::FlatCartesian` as the second template parameter so
     100              :  * computations are optimized for a flat background geometry and you don't have
     101              :  * to supply geometric background fields. Else, specify
     102              :  * `Xcts::Geometry::Curved`.
     103              :  *
     104              :  * \par Conformal matter scale:
     105              :  * The matter source terms in the XCTS equations have the known defect that they
     106              :  * can spoil uniqueness of the solutions. See e.g. \cite Baumgarte2006ug for a
     107              :  * detailed study. To cure this defect one can conformally re-scale the matter
     108              :  * source terms as \f$\bar{\rho}=\psi^n\rho\f$, \f$\bar{S}=\psi^n S\f$ and
     109              :  * \f$\bar{S^i}=\psi^n S^i\f$ and treat the re-scaled fields as
     110              :  * freely-specifyable background data for the XCTS equations. You can select the
     111              :  * `ConformalMatterScale` \f$n\f$ as the third template parameter. Common
     112              :  * choices are \f$n=0\f$ for vacuum systems where the matter sources are
     113              :  * irrelevant, \f$n=6\f$ as suggested in \cite Foucart2008qt or \f$n=8\f$ as
     114              :  * suggested in \cite Baumgarte2006ug.
     115              :  */
     116              : template <Equations EnabledEquations, Geometry ConformalGeometry,
     117              :           int ConformalMatterScale>
     118            1 : struct FirstOrderSystem
     119              :     : tt::ConformsTo<elliptic::protocols::FirstOrderSystem> {
     120            0 :   static constexpr Equations enabled_equations = EnabledEquations;
     121            0 :   static constexpr Geometry conformal_geometry = ConformalGeometry;
     122            0 :   static constexpr int conformal_matter_scale = ConformalMatterScale;
     123            0 :   static constexpr size_t volume_dim = 3;
     124              : 
     125            0 :   using primal_fields = tmpl::flatten<tmpl::list<
     126              :       Tags::ConformalFactorMinusOne<DataVector>,
     127              :       tmpl::conditional_t<
     128              :           EnabledEquations == Equations::HamiltonianAndLapse or
     129              :               EnabledEquations == Equations::HamiltonianLapseAndShift,
     130              :           Tags::LapseTimesConformalFactorMinusOne<DataVector>, tmpl::list<>>,
     131              :       tmpl::conditional_t<
     132              :           EnabledEquations == Equations::HamiltonianLapseAndShift,
     133              :           Tags::ShiftExcess<DataVector, 3, Frame::Inertial>, tmpl::list<>>>>;
     134              : 
     135              :   // As fluxes we use the gradients with raised indices for the Hamiltonian and
     136              :   // lapse equation, and the longitudinal shift excess for the momentum
     137              :   // constraint. The gradient fluxes don't have symmetries and no particular
     138              :   // meaning so we use the standard `Flux` tags, but for the symmetric
     139              :   // longitudinal shift we use the corresponding symmetric tag.
     140            0 :   using primal_fluxes = tmpl::flatten<tmpl::list<
     141              :       ::Tags::Flux<Tags::ConformalFactorMinusOne<DataVector>, tmpl::size_t<3>,
     142              :                    Frame::Inertial>,
     143              :       tmpl::conditional_t<
     144              :           EnabledEquations == Equations::HamiltonianAndLapse or
     145              :               EnabledEquations == Equations::HamiltonianLapseAndShift,
     146              :           ::Tags::Flux<Tags::LapseTimesConformalFactorMinusOne<DataVector>,
     147              :                        tmpl::size_t<3>, Frame::Inertial>,
     148              :           tmpl::list<>>,
     149              :       tmpl::conditional_t<
     150              :           EnabledEquations == Equations::HamiltonianLapseAndShift,
     151              :           Tags::LongitudinalShiftExcess<DataVector, 3, Frame::Inertial>,
     152              :           tmpl::list<>>>>;
     153              : 
     154            0 :   using background_fields = tmpl::flatten<tmpl::list<
     155              :       // Quantities for Hamiltonian constraint
     156              :       gr::Tags::Conformal<gr::Tags::EnergyDensity<DataVector>,
     157              :                           ConformalMatterScale>,
     158              :       gr::Tags::TraceExtrinsicCurvature<DataVector>,
     159              :       tmpl::conditional_t<
     160              :           ConformalGeometry == Geometry::Curved,
     161              :           tmpl::list<
     162              :               Tags::InverseConformalMetric<DataVector, 3, Frame::Inertial>,
     163              :               Tags::ConformalRicciTensor<DataVector, 3, Frame::Inertial>,
     164              :               Tags::ConformalRicciScalar<DataVector>,
     165              :               Tags::ConformalChristoffelContracted<DataVector, 3,
     166              :                                                    Frame::Inertial>,
     167              :               ::Tags::deriv<
     168              :                   Tags::ConformalMetric<DataVector, 3, Frame::Inertial>,
     169              :                   tmpl::size_t<3>, Frame::Inertial>>,
     170              :           tmpl::list<>>,
     171              :       tmpl::conditional_t<
     172              :           EnabledEquations ==
     173              :               Equations::Hamiltonian,
     174              :           Tags::LongitudinalShiftMinusDtConformalMetricOverLapseSquare<
     175              :               DataVector>,
     176              :           tmpl::list<>>,
     177              :       // Additional quantities for lapse equation
     178              :       tmpl::conditional_t<
     179              :           EnabledEquations == Equations::HamiltonianAndLapse or
     180              :               EnabledEquations ==
     181              :                   Equations::HamiltonianLapseAndShift,
     182              :           tmpl::list<gr::Tags::Conformal<gr::Tags::StressTrace<DataVector>,
     183              :                                          ConformalMatterScale>,
     184              :                      ::Tags::dt<gr::Tags::TraceExtrinsicCurvature<DataVector>>>,
     185              :           tmpl::list<>>,
     186              :       tmpl::conditional_t<
     187              :           EnabledEquations ==
     188              :               Equations::HamiltonianAndLapse,
     189              :           tmpl::list<
     190              :               Tags::LongitudinalShiftMinusDtConformalMetricSquare<DataVector>,
     191              :               Tags::ShiftDotDerivExtrinsicCurvatureTrace<DataVector>>,
     192              :           tmpl::list<>>,
     193              :       // Additional quantities for momentum constraint
     194              :       tmpl::conditional_t<
     195              :           EnabledEquations ==
     196              :               Equations::HamiltonianLapseAndShift,
     197              :           tmpl::list<
     198              :               gr::Tags::Conformal<gr::Tags::MomentumDensity<DataVector, 3>,
     199              :                                   ConformalMatterScale>,
     200              :               ::Tags::deriv<gr::Tags::TraceExtrinsicCurvature<DataVector>,
     201              :                             tmpl::size_t<3>, Frame::Inertial>,
     202              :               Tags::ShiftBackground<DataVector, 3, Frame::Inertial>,
     203              :               // The deriv(ShiftBackground) is only needed for some observables,
     204              :               // not to evaluate the equations
     205              :               ::Tags::deriv<
     206              :                   Tags::ShiftBackground<DataVector, 3, Frame::Inertial>,
     207              :                   tmpl::size_t<3>, Frame::Inertial>,
     208              :               Tags::LongitudinalShiftBackgroundMinusDtConformalMetric<
     209              :                   DataVector, 3, Frame::Inertial>,
     210              :               // Note that this is the plain divergence, i.e. with no
     211              :               // Christoffel symbol terms added
     212              :               ::Tags::div<
     213              :                   Tags::LongitudinalShiftBackgroundMinusDtConformalMetric<
     214              :                       DataVector, 3, Frame::Inertial>>,
     215              :               tmpl::conditional_t<
     216              :                   ConformalGeometry == Geometry::Curved,
     217              :                   tmpl::list<
     218              :                       Tags::ConformalMetric<DataVector, 3, Frame::Inertial>,
     219              :                       Tags::ConformalChristoffelFirstKind<DataVector, 3,
     220              :                                                           Frame::Inertial>,
     221              :                       Tags::ConformalChristoffelSecondKind<DataVector, 3,
     222              :                                                            Frame::Inertial>>,
     223              :                   tmpl::list<>>>,
     224              :           tmpl::list<>>>>;
     225            0 :   using inv_metric_tag = tmpl::conditional_t<
     226              :       ConformalGeometry == Geometry::FlatCartesian, void,
     227              :       Tags::InverseConformalMetric<DataVector, 3, Frame::Inertial>>;
     228              : 
     229            0 :   using fluxes_computer = Fluxes<EnabledEquations, ConformalGeometry>;
     230            0 :   using sources_computer =
     231              :       Sources<EnabledEquations, ConformalGeometry, ConformalMatterScale>;
     232            0 :   using sources_computer_linearized =
     233              :       LinearizedSources<EnabledEquations, ConformalGeometry,
     234              :                         ConformalMatterScale>;
     235              : 
     236            0 :   using boundary_conditions_base =
     237              :       elliptic::BoundaryConditions::BoundaryCondition<3>;
     238            0 :   using modify_boundary_data = void;
     239              : };
     240              : 
     241              : }  // namespace Xcts
        

Generated by: LCOV version 2.0-1