SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/GhValenciaDivClean - TimeDerivativeTerms.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 1 17 5.9 %
Date: 2025-12-05 05:03:31
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 <limits>
       8             : #include <utility>
       9             : 
      10             : #include "DataStructures/DataBox/PrefixHelpers.hpp"
      11             : #include "DataStructures/DataBox/Prefixes.hpp"
      12             : #include "DataStructures/DataVector.hpp"
      13             : #include "DataStructures/TaggedContainers.hpp"
      14             : #include "DataStructures/Tensor/Tensor.hpp"
      15             : #include "Evolution/DiscontinuousGalerkin/TimeDerivativeDecisions.hpp"
      16             : #include "Evolution/PassVariables.hpp"
      17             : #include "Evolution/Systems/GeneralizedHarmonic/GaugeSourceFunctions/Harmonic.hpp"
      18             : #include "Evolution/Systems/GeneralizedHarmonic/System.hpp"
      19             : #include "Evolution/Systems/GeneralizedHarmonic/TimeDerivative.hpp"
      20             : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/AllSolutions.hpp"
      21             : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/StressEnergy.hpp"
      22             : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/System.hpp"
      23             : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/Tags.hpp"
      24             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/System.hpp"
      25             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/TimeDerivativeTerms.hpp"
      26             : #include "Evolution/VariableFixing/FixToAtmosphere.hpp"
      27             : #include "Evolution/VariableFixing/Tags.hpp"
      28             : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      29             : // Tag obtained from gh::TimeDerivative needs to be complete here to
      30             : // be used in TemporaryReference.
      31             : #include "PointwiseFunctions/Hydro/Tags.hpp"
      32             : #include "Time/Tags/Time.hpp"
      33             : #include "Utilities/Gsl.hpp"
      34             : #include "Utilities/Literals.hpp"
      35             : #include "Utilities/TMPL.hpp"
      36             : #include "Utilities/TaggedTuple.hpp"
      37             : 
      38             : namespace grmhd::GhValenciaDivClean {
      39             : namespace detail {
      40             : // Some temporary tags appear both in the GRMHD temporary list and the
      41             : // GeneralizedHarmonic temporary list, so we wrap the GRMHD temporaries in this
      42             : // prefix tag to avoid collisions in data structures used to store the
      43             : // temporaries.
      44             : template <typename Tag>
      45             : struct ValenciaTempTag : db::SimpleTag, db::PrefixTag {
      46             :   using tag = Tag;
      47             :   using type = typename Tag::type;
      48             : };
      49             : 
      50             : namespace dt_type_aliases {
      51             : using gh_dt_tags =
      52             :     db::wrap_tags_in<::Tags::dt,
      53             :                      typename gh::System<3_st>::variables_tag::tags_list>;
      54             : using valencia_dt_tags = db::wrap_tags_in<
      55             :     ::Tags::dt,
      56             :     typename grmhd::ValenciaDivClean::System::variables_tag::tags_list>;
      57             : 
      58             : using dt_tags = tmpl::append<gh_dt_tags, valencia_dt_tags>;
      59             : }  // namespace dt_type_aliases
      60             : 
      61             : struct TimeDerivativeTermsImpl;
      62             : struct TimeDerivativeTermsImpl {
      63             :   // Tags related to GeneralizedHarmonic system
      64             :   using gh_arg_tags = typename gh::TimeDerivative<
      65             :       ghmhd::GhValenciaDivClean::InitialData::analytic_solutions_and_data_list,
      66             :       3_st>::argument_tags;
      67             : 
      68             :   using gh_temp_tags = typename gh::TimeDerivative<
      69             :       ghmhd::GhValenciaDivClean::InitialData::analytic_solutions_and_data_list,
      70             :       3_st>::temporary_tags;
      71             : 
      72             :   using valencia_flux_tags = db::wrap_tags_in<
      73             :       ::Tags::Flux,
      74             :       typename grmhd::ValenciaDivClean::System::variables_tag::tags_list,
      75             :       tmpl::size_t<3>, Frame::Inertial>;
      76             : 
      77             :   using valencia_temp_tags =
      78             :       typename grmhd::ValenciaDivClean::TimeDerivativeTerms::temporary_tags;
      79             : 
      80             :   using valencia_time_derivative_arg_tags =
      81             :       typename grmhd::ValenciaDivClean::TimeDerivativeTerms::argument_tags;
      82             : 
      83             :   using trace_reversed_stress_result_tags =
      84             :       tmpl::list<Tags::TraceReversedStressEnergy, Tags::FourVelocityOneForm,
      85             :                  Tags::ComovingMagneticFieldOneForm>;
      86             :   using trace_reversed_stress_argument_tags = tmpl::list<
      87             :       hydro::Tags::RestMassDensity<DataVector>,
      88             :       hydro::Tags::SpatialVelocityOneForm<DataVector, 3_st, Frame::Inertial>,
      89             :       hydro::Tags::MagneticFieldOneForm<DataVector, 3_st, Frame::Inertial>,
      90             :       hydro::Tags::MagneticFieldSquared<DataVector>,
      91             :       hydro::Tags::MagneticFieldDotSpatialVelocity<DataVector>,
      92             :       hydro::Tags::LorentzFactor<DataVector>,
      93             :       grmhd::ValenciaDivClean::TimeDerivativeTerms::OneOverLorentzFactorSquared,
      94             :       hydro::Tags::Pressure<DataVector>,
      95             :       hydro::Tags::SpecificInternalEnergy<DataVector>,
      96             :       gr::Tags::SpacetimeMetric<DataVector, 3>,
      97             :       gr::Tags::Shift<DataVector, 3_st>, gr::Tags::Lapse<DataVector>>;
      98             : 
      99             :   template <typename TemporaryTagsList, typename... ExtraTags>
     100             :   static evolution::dg::TimeDerivativeDecisions<3> apply(
     101             :       const gsl::not_null<Variables<dt_type_aliases::dt_tags>*> dt_vars_ptr,
     102             :       const gsl::not_null<Variables<db::wrap_tags_in<
     103             :           ::Tags::Flux, typename ValenciaDivClean::System::flux_variables,
     104             :           tmpl::size_t<3>, Frame::Inertial>>*>
     105             :           fluxes_ptr,
     106             :       const gsl::not_null<Variables<TemporaryTagsList>*> temps_ptr,
     107             : 
     108             :       const tnsr::iaa<DataVector, 3>& d_spacetime_metric,
     109             :       const tnsr::iaa<DataVector, 3>& d_pi,
     110             :       const tnsr::ijaa<DataVector, 3>& d_phi,
     111             : 
     112             :       const tuples::TaggedTuple<ExtraTags...>& arguments) {
     113             :     generalized_harmonic_time_derivative(
     114             :         dt_vars_ptr, temps_ptr, d_spacetime_metric, d_pi, d_phi, arguments,
     115             :         dt_type_aliases::gh_dt_tags{}, gh_temp_tags{}, gh_arg_tags{});
     116             : 
     117             :     // Track whether or not we extracted the 3+1 quantities
     118             :     bool three_plus_one_extracted = false;
     119             : 
     120             :     // If we are in the atmosphere, then we can skip the evolution
     121             :     // of the GRMHD system completely. This inevitably depends on parameters
     122             :     // of the FixToAtmosphere code, so we grab those directly.
     123             :     if (const auto& fix_to_atmosphere = get<Tags::detail::TemporaryReference<
     124             :             ::Tags::VariableFixer<::VariableFixing::FixToAtmosphere<3>>>>(
     125             :             arguments);
     126             :         max(get(get<Tags::detail::TemporaryReference<
     127             :                     hydro::Tags::RestMassDensity<DataVector>>>(arguments))) <=
     128             :         std::min({fix_to_atmosphere.density_of_atmosphere(),
     129             :                   (fix_to_atmosphere.velocity_limiting().has_value()
     130             :                        ? fix_to_atmosphere.velocity_limiting()
     131             :                              ->atmosphere_density_cutoff
     132             :                        : std::numeric_limits<double>::infinity()),
     133             :                   (fix_to_atmosphere.kappa_limiting().has_value()
     134             :                        ? fix_to_atmosphere.kappa_limiting()->density_lower_bound
     135             :                        : std::numeric_limits<double>::infinity())}) *
     136             :             (1.0 + 10.0 * std::numeric_limits<double>::epsilon())) {
     137             :       // Point into the right memory, then set it to zero.
     138             : 
     139             :       ASSERT(
     140             :           max(get(get<tmpl::front<dt_type_aliases::valencia_dt_tags>>(
     141             :               *dt_vars_ptr))) == 0.0,
     142             :           "GH+GRMHD assumes the time derivatives are set to zero in general."
     143             :           " If this is no longer the case, please set them to zero in "
     144             :           "atmosphere by changing the code where this ASSERT was triggered.");
     145             :       // Code that we could use to set the sources to zero if needed.
     146             :       // Variables<tmpl::list<ValenciaDtTags...>> dt_div_clean(
     147             :       //     get<tmpl::front<tmpl::list<ValenciaDtTags...>>>(*dt_vars_ptr)[0]
     148             :       //         .data(),
     149             :       //     0.0);
     150             :       fluxes_ptr->initialize(fluxes_ptr->number_of_grid_points(), 0.0);
     151             :       return evolution::dg::TimeDerivativeDecisions<3>{false};
     152             :     } else {
     153             :       // MHD calls
     154             : 
     155             :       // extracting 3+1 quantities to assign spacetime spatial derivatives
     156             :       extract_three_plus_one_quantities(temps_ptr, arguments);
     157             :       three_plus_one_extracted = true;
     158             : 
     159             :       // MHD computation
     160             :       aggregate_time_derivative_terms(
     161             :           dt_vars_ptr, fluxes_ptr, temps_ptr, arguments,
     162             :           dt_type_aliases::valencia_dt_tags{}, valencia_flux_tags{},
     163             :           valencia_temp_tags{}, valencia_time_derivative_arg_tags{},
     164             :           trace_reversed_stress_result_tags{},
     165             :           trace_reversed_stress_argument_tags{});
     166             :     }
     167             : 
     168             :     if (!three_plus_one_extracted) {
     169             :       // If in atmosphere, extract 3+1 quantities for neutrino
     170             :       // evolution
     171             :       extract_three_plus_one_quantities(temps_ptr, arguments);
     172             :       three_plus_one_extracted = true;
     173             :       // Neutrino evolution will be called below
     174             :     }
     175             : 
     176             :     return evolution::dg::TimeDerivativeDecisions<3>{true};
     177             :   }
     178             : 
     179             :   template <typename OutputTags, typename TemporaryTagsList,
     180             :             typename... ExtraTags, typename... GhDtTags, typename... GhTempTags,
     181             :             typename... GhArgTags>
     182             :   static void generalized_harmonic_time_derivative(
     183             :       const gsl::not_null<Variables<OutputTags>*> dt_vars_ptr,
     184             :       const gsl::not_null<Variables<TemporaryTagsList>*> temps_ptr,
     185             :       const tnsr::iaa<DataVector, 3>& d_spacetime_metric,
     186             :       const tnsr::iaa<DataVector, 3>& d_pi,
     187             :       const tnsr::ijaa<DataVector, 3>& d_phi,
     188             :       const tuples::TaggedTuple<ExtraTags...>& arguments,
     189             :       tmpl::list<GhDtTags...> /*meta*/, tmpl::list<GhTempTags...> /*meta*/,
     190             :       tmpl::list<GhArgTags...> /*meta*/) {
     191             :     gh::TimeDerivative<
     192             :         ghmhd::GhValenciaDivClean::InitialData::
     193             :             analytic_solutions_and_data_list,
     194             :         3_st>::apply(get<GhDtTags>(dt_vars_ptr)...,
     195             :                      get<GhTempTags>(temps_ptr)..., d_spacetime_metric, d_pi,
     196             :                      d_phi,
     197             :                      get<Tags::detail::TemporaryReference<GhArgTags>>(
     198             :                          arguments)...);
     199             :   }
     200             : 
     201             :   template <typename TemporaryTagsList, typename... ExtraTags>
     202             :   static void extract_three_plus_one_quantities(
     203             :       const gsl::not_null<Variables<TemporaryTagsList>*> temps_ptr,
     204             :       const tuples::TaggedTuple<ExtraTags...>& arguments) {
     205             :     // Extract the 3+1 quantities from the spacetime metric
     206             : 
     207             :     // Check whether or not sqrt(det(g)) exists based on gauge condition
     208             :     if (get<Tags::detail::TemporaryReference<gh::gauges::Tags::GaugeCondition>>(
     209             :             arguments)
     210             :             .is_harmonic()) {
     211             :       get(get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(*temps_ptr)) =
     212             :           sqrt(get(get<gr::Tags::DetSpatialMetric<DataVector>>(*temps_ptr)));
     213             :     }
     214             : 
     215             :     // extract spatial derivative of lapse
     216             :     for (size_t i = 0; i < 3; ++i) {
     217             :       get<::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>,
     218             :                         Frame::Inertial>>(*temps_ptr)
     219             :           .get(i) = -get(get<gr::Tags::Lapse<DataVector>>(*temps_ptr)) *
     220             :                     get<gh::Tags::HalfPhiTwoNormals<3>>(*temps_ptr).get(i);
     221             :     }
     222             : 
     223             :     const auto& phi =
     224             :         get<Tags::detail::TemporaryReference<gh::Tags::Phi<DataVector, 3>>>(
     225             :             arguments);
     226             :     const auto& inv_spatial_metric =
     227             :         get<gr::Tags::InverseSpatialMetric<DataVector, 3>>(*temps_ptr);
     228             :     const auto& shift = get<gr::Tags::Shift<DataVector, 3>>(*temps_ptr);
     229             : 
     230             :     // extract spatial derivative of shift
     231             :     for (size_t i = 0; i < 3; ++i) {
     232             :       for (size_t j = 0; j < 3; ++j) {
     233             :         get<::Tags::deriv<gr::Tags::Shift<DataVector, 3>, tmpl::size_t<3>,
     234             :                           Frame::Inertial>>(*temps_ptr)
     235             :             .get(i, j) = inv_spatial_metric.get(j, 0) * phi.get(i, 0, 1);
     236             :         for (size_t k = 1; k < 3; ++k) {
     237             :           get<::Tags::deriv<gr::Tags::Shift<DataVector, 3>, tmpl::size_t<3>,
     238             :                             Frame::Inertial>>(*temps_ptr)
     239             :               .get(i, j) += inv_spatial_metric.get(j, k) * phi.get(i, 0, k + 1);
     240             :         }
     241             :         for (size_t k = 0; k < 3; ++k) {
     242             :           for (size_t l = 0; l < 3; ++l) {
     243             :             get<::Tags::deriv<gr::Tags::Shift<DataVector, 3>, tmpl::size_t<3>,
     244             :                               Frame::Inertial>>(*temps_ptr)
     245             :                 .get(i, j) -= shift.get(k) * inv_spatial_metric.get(j, l) *
     246             :                               phi.get(i, l + 1, k + 1);
     247             :           }
     248             :         }
     249             :       }
     250             :     }
     251             : 
     252             :     const auto& pi =
     253             :         get<Tags::detail::TemporaryReference<gh::Tags::Pi<DataVector, 3>>>(
     254             :             arguments);
     255             :     for (size_t i = 0; i < 3; ++i) {
     256             :       for (size_t j = i; j < 3; ++j) {
     257             :         get<gr::Tags::ExtrinsicCurvature<DataVector, 3>>(*temps_ptr).get(i, j) =
     258             :             0.5 * (pi.get(i + 1, j + 1) +
     259             :                    get<gh::Tags::PhiOneNormal<3>>(*temps_ptr).get(i, j + 1) +
     260             :                    get<gh::Tags::PhiOneNormal<3>>(*temps_ptr).get(j, i + 1));
     261             :       }
     262             :     }
     263             : 
     264             :   }  // end extract3plus1
     265             : 
     266             :   template <typename OutputTags, typename TemporaryTagsList,
     267             :             typename... ExtraTags, typename... ValenciaDtTags,
     268             :             typename... ValenciaFluxTags, typename... ValenciaTempTags,
     269             :             typename... ValenciaTimeDerivativeArgTags,
     270             :             typename... TraceReversedStressResultTags,
     271             :             typename... TraceReversedStressArgumentTags>
     272             :   static void aggregate_time_derivative_terms(
     273             :       const gsl::not_null<Variables<OutputTags>*> dt_vars_ptr,
     274             :       const gsl::not_null<Variables<db::wrap_tags_in<
     275             :           ::Tags::Flux, typename ValenciaDivClean::System::flux_variables,
     276             :           tmpl::size_t<3>, Frame::Inertial>>*>
     277             :           fluxes_ptr,
     278             :       const gsl::not_null<Variables<TemporaryTagsList>*> temps_ptr,
     279             :       const tuples::TaggedTuple<ExtraTags...>& arguments,
     280             :       tmpl::list<ValenciaDtTags...> /*meta*/,
     281             :       tmpl::list<ValenciaFluxTags...> /*meta*/,
     282             :       tmpl::list<ValenciaTempTags...> /*meta*/,
     283             :       tmpl::list<ValenciaTimeDerivativeArgTags...> /*meta*/,
     284             :       tmpl::list<TraceReversedStressResultTags...> /*meta*/,
     285             :       tmpl::list<TraceReversedStressArgumentTags...> /*meta*/) {
     286             :     using extra_tags_list = tmpl::list<ExtraTags...>;
     287             : 
     288             :     grmhd::ValenciaDivClean::TimeDerivativeTerms::apply(
     289             :         get<ValenciaDtTags>(dt_vars_ptr)...,
     290             :         get<ValenciaFluxTags>(fluxes_ptr)...,
     291             :         get<ValenciaTempTags>(temps_ptr)...,
     292             : 
     293             :         get<tmpl::conditional_t<
     294             :             tmpl::list_contains_v<extra_tags_list,
     295             :                                   Tags::detail::TemporaryReference<
     296             :                                       ValenciaTimeDerivativeArgTags>>,
     297             :             Tags::detail::TemporaryReference<ValenciaTimeDerivativeArgTags>,
     298             :             ValenciaTimeDerivativeArgTags>>(arguments, *temps_ptr)...);
     299             : 
     300             :     trace_reversed_stress_energy(
     301             :         get<TraceReversedStressResultTags>(temps_ptr)...,
     302             :         get<tmpl::conditional_t<
     303             :             tmpl::list_contains_v<extra_tags_list,
     304             :                                   Tags::detail::TemporaryReference<
     305             :                                       TraceReversedStressArgumentTags>>,
     306             :             Tags::detail::TemporaryReference<TraceReversedStressArgumentTags>,
     307             :             TraceReversedStressArgumentTags>>(*temps_ptr, arguments)...);
     308             : 
     309             :     add_stress_energy_term_to_dt_pi(
     310             :         get<::Tags::dt<gh::Tags::Pi<DataVector, 3>>>(dt_vars_ptr),
     311             :         get<grmhd::GhValenciaDivClean::Tags::TraceReversedStressEnergy>(
     312             :             *temps_ptr),
     313             :         get<gr::Tags::Lapse<DataVector>>(*temps_ptr));
     314             :   }
     315             : };  // namespace detail
     316             : }  // namespace detail
     317             : 
     318             : /*!
     319             :  * \brief Compute the RHS terms and flux values for both the Generalized
     320             :  * Harmonic formulation of Einstein's equations and the Valencia formulation of
     321             :  * the GRMHD equations with divergence cleaning.
     322             :  *
     323             :  * \details The bulk of the computations in this class dispatch to
     324             :  * `gh::TimeDerivative` and
     325             :  * `grmhd::ValenciaDivClean::TimeDerivativeTerms` as a 'product system' -- each
     326             :  * independently operating on its own subset of the supplied variable
     327             :  * collections.
     328             :  * The additional step is taken to compute the trace-reversed stress energy
     329             :  * tensor associated with the GRMHD part of the system and add its contribution
     330             :  * to the \f$\partial_t \Pi_{a b}\f$ variable in the Generalized Harmonic
     331             :  * system, which is the only explicit coupling required to back-react the effect
     332             :  * of matter on the spacetime solution.
     333             :  *
     334             :  * \note The MHD calculation reuses any spacetime quantities in its
     335             :  * argument_tags that are computed by the GH time derivative. However, other
     336             :  * quantities that aren't computed by the GH time derivative like the extrinsic
     337             :  * curvature are currently still retrieved from the DataBox. Those calculations
     338             :  * can be explicitly inlined here to reduce memory pressure and the number of
     339             :  * compute tags.
     340             :  */
     341           1 : struct TimeDerivativeTerms : evolution::PassVariables {
     342           0 :   using gh_dt_tags =
     343             :       db::wrap_tags_in<::Tags::dt,
     344             :                        typename gh::System<3_st>::variables_tag::tags_list>;
     345           0 :   using valencia_dt_tags = db::wrap_tags_in<
     346             :       ::Tags::dt,
     347             :       typename grmhd::ValenciaDivClean::System::variables_tag::tags_list>;
     348             : 
     349           0 :   using dt_tags = tmpl::append<gh_dt_tags, valencia_dt_tags>;
     350             : 
     351           0 :   using d_spatial_metric = ::Tags::deriv<gr::Tags::SpatialMetric<DataVector, 3>,
     352             :                                          tmpl::size_t<3>, Frame::Inertial>;
     353             : 
     354           0 :   using gh_temp_tags = typename gh::TimeDerivative<
     355             :       ghmhd::GhValenciaDivClean::InitialData::analytic_solutions_and_data_list,
     356             :       3_st>::temporary_tags;
     357           0 :   using gh_gradient_tags = typename gh::System<3_st>::gradients_tags;
     358           0 :   using gh_arg_tags = typename gh::TimeDerivative<
     359             :       ghmhd::GhValenciaDivClean::InitialData::analytic_solutions_and_data_list,
     360             :       3_st>::argument_tags;
     361             : 
     362           0 :   using valencia_temp_tags =
     363             :       typename grmhd::ValenciaDivClean::TimeDerivativeTerms::temporary_tags;
     364             :   // Additional temp tags are the derivatives of the metric since GH doesn't
     365             :   // explicitly calculate those.
     366           0 :   using valencia_extra_temp_tags =
     367             :       tmpl::list<::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>,
     368             :                                Frame::Inertial>,
     369             :                  ::Tags::deriv<gr::Tags::Shift<DataVector, 3>, tmpl::size_t<3>,
     370             :                                Frame::Inertial>,
     371             :                  gr::Tags::ExtrinsicCurvature<DataVector, 3>>;
     372           0 :   using valencia_arg_tags = tmpl::list_difference<
     373             :       typename grmhd::ValenciaDivClean::TimeDerivativeTerms::argument_tags,
     374             :       tmpl::append<gh_temp_tags, valencia_extra_temp_tags>>;
     375             : 
     376           0 :   using trace_reversed_stress_result_tags =
     377             :       tmpl::list<Tags::TraceReversedStressEnergy, Tags::FourVelocityOneForm,
     378             :                  Tags::ComovingMagneticFieldOneForm>;
     379           0 :   using extra_temp_tags = tmpl::list<gr::Tags::SpatialMetric<DataVector, 3>>;
     380             : 
     381           0 :   using temporary_tags = tmpl::remove<
     382             :       tmpl::remove_duplicates<tmpl::append<
     383             :           gh_temp_tags, valencia_temp_tags, valencia_extra_temp_tags,
     384             :           trace_reversed_stress_result_tags, extra_temp_tags>>,
     385             :       gr::Tags::SpatialMetric<DataVector, 3>>;
     386           0 :   using argument_tags = tmpl::remove<
     387             :       tmpl::remove<tmpl::append<gh_arg_tags,
     388             : 
     389             :                                 valencia_arg_tags,
     390             : 
     391             :                                 tmpl::list<::Tags::VariableFixer<
     392             :                                     ::VariableFixing::FixToAtmosphere<3>>>>,
     393             :                    gr::Tags::SpatialMetric<DataVector, 3>>,
     394             :       d_spatial_metric>;
     395             : 
     396             :   template <typename... Args>
     397           0 :   static evolution::dg::TimeDerivativeDecisions<3> apply(
     398             :       const gsl::not_null<Variables<dt_tags>*> dt_vars_ptr,
     399             :       const gsl::not_null<Variables<db::wrap_tags_in<
     400             :           ::Tags::Flux, typename ValenciaDivClean::System::flux_variables,
     401             :           tmpl::size_t<3>, Frame::Inertial>>*>
     402             :           fluxes_ptr,
     403             :       const gsl::not_null<Variables<temporary_tags>*> temps_ptr,
     404             :       const tnsr::iaa<DataVector, 3>& d_spacetime_metric,
     405             :       const tnsr::iaa<DataVector, 3>& d_pi,
     406             :       const tnsr::ijaa<DataVector, 3>& d_phi, const Args&... args) {
     407             :     using args_list = tmpl::push_back<
     408             :         db::wrap_tags_in<Tags::detail::TemporaryReference, argument_tags>,
     409             :         gr::Tags::SpatialMetric<DataVector, 3>, d_spatial_metric>;
     410             :     tuples::tagged_tuple_from_typelist<args_list> arguments{
     411             :         args..., typename gr::Tags::SpatialMetric<DataVector, 3>::type{},
     412             :         typename d_spatial_metric::type{}};
     413             :     const size_t number_of_points = get<Tags::detail::TemporaryReference<
     414             :         gr::Tags::SpacetimeMetric<DataVector, 3>>>(arguments)[0]
     415             :                                         .size();
     416             :     for (size_t i = 0; i < 3; ++i) {
     417             :       for (size_t j = i; j < 3; ++j) {
     418             :         make_const_view(
     419             :             make_not_null(
     420             :                 &std::as_const(
     421             :                      get<gr::Tags::SpatialMetric<DataVector, 3>>(arguments))
     422             :                      .get(i, j)),
     423             :             get<Tags::detail::TemporaryReference<
     424             :                 gr::Tags::SpacetimeMetric<DataVector, 3>>>(arguments)
     425             :                 .get(i + 1, j + 1),
     426             :             0, number_of_points);
     427             :       }
     428             :     }
     429             :     for (size_t i = 0; i < 3; ++i) {
     430             :       for (size_t j = 0; j < 3; ++j) {
     431             :         for (size_t k = j; k < 3; ++k) {
     432             :           make_const_view(
     433             :               make_not_null(&std::as_const(get<d_spatial_metric>(arguments))
     434             :                                  .get(i, j, k)),
     435             :               get<Tags::detail::TemporaryReference<
     436             :                   gh::Tags::Phi<DataVector, 3>>>(arguments)
     437             :                   .get(i, j + 1, k + 1),
     438             :               0, number_of_points);
     439             :         }
     440             :       }
     441             :     }
     442             : 
     443             :     return detail::TimeDerivativeTermsImpl::apply(dt_vars_ptr, fluxes_ptr,
     444             :                                                   temps_ptr, d_spacetime_metric,
     445             :                                                   d_pi, d_phi, arguments);
     446             :   }
     447             : };
     448             : }  // namespace grmhd::GhValenciaDivClean

Generated by: LCOV version 1.14