SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler - TimeDerivativeTerms.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 14.3 % 7 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/DataBox/Tag.hpp"
      10              : #include "DataStructures/Tensor/TypeAliases.hpp"
      11              : #include "Domain/Tags.hpp"
      12              : #include "Evolution/DiscontinuousGalerkin/TimeDerivativeDecisions.hpp"
      13              : #include "Evolution/Systems/NewtonianEuler/Sources/Source.hpp"
      14              : #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
      15              : #include "PointwiseFunctions/Hydro/Tags.hpp"
      16              : #include "Time/Tags/Time.hpp"
      17              : #include "Utilities/TMPL.hpp"
      18              : 
      19              : /// \cond
      20              : namespace gsl {
      21              : template <typename T>
      22              : class not_null;
      23              : }  // namespace gsl
      24              : class DataVector;
      25              : /// \endcond
      26              : 
      27              : namespace NewtonianEuler {
      28              : namespace detail {
      29              : template <size_t Dim>
      30              : void fluxes_impl(
      31              :     gsl::not_null<tnsr::I<DataVector, Dim>*> mass_density_cons_flux,
      32              :     gsl::not_null<tnsr::IJ<DataVector, Dim>*> momentum_density_flux,
      33              :     gsl::not_null<tnsr::I<DataVector, Dim>*> energy_density_flux,
      34              :     gsl::not_null<Scalar<DataVector>*> enthalpy_density,
      35              :     const tnsr::I<DataVector, Dim>& momentum_density,
      36              :     const Scalar<DataVector>& energy_density,
      37              :     const tnsr::I<DataVector, Dim>& velocity,
      38              :     const Scalar<DataVector>& pressure);
      39              : }  // namespace detail
      40              : 
      41              : /*!
      42              :  * \brief Compute the time derivative of the conserved variables for the
      43              :  * Newtonian Euler system
      44              :  */
      45              : template <size_t Dim>
      46            1 : struct TimeDerivativeTerms {
      47              :  private:
      48            0 :   struct EnthalpyDensity : db::SimpleTag {
      49            0 :     using type = Scalar<DataVector>;
      50              :   };
      51              : 
      52              :  public:
      53            0 :   using temporary_tags = tmpl::list<EnthalpyDensity>;
      54            0 :   using argument_tags =
      55              :       tmpl::list<Tags::MassDensityCons, Tags::MomentumDensity<Dim>,
      56              :                  Tags::EnergyDensity,
      57              :                  hydro::Tags::SpatialVelocity<DataVector, Dim>,
      58              :                  hydro::Tags::Pressure<DataVector>,
      59              :                  hydro::Tags::SpecificInternalEnergy<DataVector>,
      60              :                  hydro::Tags::EquationOfState<false, 2>,
      61              :                  domain::Tags::Coordinates<Dim, Frame::Inertial>, ::Tags::Time,
      62              :                  NewtonianEuler::Tags::SourceTerm<Dim>>;
      63              : 
      64            0 :   static evolution::dg::TimeDerivativeDecisions<Dim> apply(
      65              :       // Time derivatives returned by reference. All the tags in the
      66              :       // variables_tag in the system struct.
      67              :       const gsl::not_null<Scalar<DataVector>*> non_flux_terms_dt_mass_density,
      68              :       const gsl::not_null<tnsr::I<DataVector, Dim>*>
      69              :           non_flux_terms_dt_momentum_density,
      70              :       const gsl::not_null<Scalar<DataVector>*> non_flux_terms_dt_energy_density,
      71              : 
      72              :       // Fluxes returned by reference. Listed in the system struct as
      73              :       // flux_variables.
      74              :       const gsl::not_null<tnsr::I<DataVector, Dim>*> mass_density_cons_flux,
      75              :       const gsl::not_null<tnsr::IJ<DataVector, Dim>*> momentum_density_flux,
      76              :       const gsl::not_null<tnsr::I<DataVector, Dim>*> energy_density_flux,
      77              : 
      78              :       // Temporaries returned by reference. Listed in temporary_tags above.
      79              :       const gsl::not_null<Scalar<DataVector>*> enthalpy_density,
      80              : 
      81              :       // Arguments listed in argument_tags above
      82              :       const Scalar<DataVector>& mass_density_cons,
      83              :       const tnsr::I<DataVector, Dim>& momentum_density,
      84              :       const Scalar<DataVector>& energy_density,
      85              :       const tnsr::I<DataVector, Dim>& velocity,
      86              :       const Scalar<DataVector>& pressure,
      87              :       const Scalar<DataVector>& specific_internal_energy,
      88              :       const EquationsOfState::EquationOfState<false, 2>& eos,
      89              :       const tnsr::I<DataVector, Dim>& coords, const double time,
      90              :       const Sources::Source<Dim>& source) {
      91              :     detail::fluxes_impl(mass_density_cons_flux, momentum_density_flux,
      92              :                         energy_density_flux, enthalpy_density, momentum_density,
      93              :                         energy_density, velocity, pressure);
      94              : 
      95              :     get(*non_flux_terms_dt_mass_density) = 0.0;
      96              :     for (size_t i = 0; i < Dim; ++i) {
      97              :       non_flux_terms_dt_momentum_density->get(i) = 0.0;
      98              :     }
      99              :     get(*non_flux_terms_dt_energy_density) = 0.0;
     100              :     const auto eos_2d = eos.promote_to_2d_eos();
     101              :     source(non_flux_terms_dt_mass_density, non_flux_terms_dt_momentum_density,
     102              :            non_flux_terms_dt_energy_density, mass_density_cons,
     103              :            momentum_density, energy_density, velocity, pressure,
     104              :            specific_internal_energy, *eos_2d, coords, time);
     105              :     return {true};
     106              :   }
     107              : };
     108              : 
     109              : }  // namespace NewtonianEuler
        

Generated by: LCOV version 2.0-1