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

Generated by: LCOV version 1.14