SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler/Sources - UniformAcceleration.hpp Hit Total Coverage
Commit: 9a905b0737f373631c1b8e8389b8f26e67fa5313 Lines: 2 20 10.0 %
Date: 2024-03-28 09:03:18
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             : 
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "Evolution/Systems/NewtonianEuler/Sources/Source.hpp"
      11             : #include "Evolution/Systems/NewtonianEuler/TagsDeclarations.hpp"
      12             : #include "Options/String.hpp"
      13             : #include "Utilities/MakeArray.hpp"
      14             : #include "Utilities/TMPL.hpp"
      15             : 
      16             : /// \cond
      17             : class DataVector;
      18             : 
      19             : namespace PUP {
      20             : class er;
      21             : }  // namespace PUP
      22             : 
      23             : namespace gsl {
      24             : template <typename>
      25             : struct not_null;
      26             : }  // namespace gsl
      27             : /// \endcond
      28             : 
      29             : namespace NewtonianEuler::Sources {
      30             : 
      31             : /*!
      32             :  * \brief Source generated from an external uniform acceleration.
      33             :  *
      34             :  * The NewtonianEuler system with source terms is written as
      35             :  *
      36             :  * \f{align*}
      37             :  * \partial_t\rho + \partial_i F^i(\rho) &= S(\rho)\\
      38             :  * \partial_t S^i + \partial_j F^{j}(S^i) &= S(S^i)\\
      39             :  * \partial_t e + \partial_i F^i(e) &= S(e),
      40             :  * \f}
      41             :  *
      42             :  * where \f$F^i(u)\f$ is the volume flux of the conserved quantity \f$u\f$
      43             :  * (see ComputeFluxes). For an external acceleration \f$a^i\f$, one has
      44             :  *
      45             :  * \f{align*}
      46             :  * S(\rho) &= 0\\
      47             :  * S(S^i) &= \rho a^i\\
      48             :  * S(e) &= S_ia^i,
      49             :  * \f}
      50             :  *
      51             :  * where \f$\rho\f$ is the mass density, \f$S^i\f$ is the momentum density,
      52             :  * and \f$e\f$ is the energy density.
      53             :  */
      54             : template <size_t Dim>
      55           1 : class UniformAcceleration : public Source<Dim> {
      56             :  public:
      57             :   /// The applied acceleration
      58           1 :   struct Acceleration {
      59           0 :     using type = std::array<double, Dim>;
      60           0 :     static constexpr Options::String help = {"The applied accerelation."};
      61             :   };
      62             : 
      63           0 :   using options = tmpl::list<Acceleration>;
      64             : 
      65           0 :   static constexpr Options::String help = {
      66             :       "Source terms corresponding to a uniform acceleration."};
      67             : 
      68           0 :   UniformAcceleration() = default;
      69           0 :   UniformAcceleration(const UniformAcceleration& /*rhs*/) = default;
      70           0 :   UniformAcceleration& operator=(const UniformAcceleration& /*rhs*/) = default;
      71           0 :   UniformAcceleration(UniformAcceleration&& /*rhs*/) = default;
      72           0 :   UniformAcceleration& operator=(UniformAcceleration&& /*rhs*/) = default;
      73           0 :   ~UniformAcceleration() override = default;
      74             : 
      75           0 :   explicit UniformAcceleration(
      76             :       const std::array<double, Dim>& acceleration_field);
      77             : 
      78             :   /// \cond
      79             :   explicit UniformAcceleration(CkMigrateMessage* msg);
      80             :   using PUP::able::register_constructor;
      81             :   WRAPPED_PUPable_decl_template(UniformAcceleration);
      82             :   /// \endcond
      83             : 
      84             :   // NOLINTNEXTLINE(google-runtime-references)
      85           0 :   void pup(PUP::er& p) override;
      86             : 
      87           0 :   auto get_clone() const -> std::unique_ptr<Source<Dim>> override;
      88             : 
      89           0 :   void operator()(
      90             :       gsl::not_null<Scalar<DataVector>*> source_mass_density_cons,
      91             :       gsl::not_null<tnsr::I<DataVector, Dim>*> source_momentum_density,
      92             :       gsl::not_null<Scalar<DataVector>*> source_energy_density,
      93             :       const Scalar<DataVector>& mass_density_cons,
      94             :       const tnsr::I<DataVector, Dim>& momentum_density,
      95             :       const Scalar<DataVector>& energy_density,
      96             :       const tnsr::I<DataVector, Dim>& velocity,
      97             :       const Scalar<DataVector>& pressure,
      98             :       const Scalar<DataVector>& specific_internal_energy,
      99             :       const EquationsOfState::EquationOfState<false, 2>& eos,
     100             :       const tnsr::I<DataVector, Dim>& coords, double time) const override;
     101             : 
     102             :  private:
     103             :   template <size_t SpatialDim>
     104           0 :   friend bool operator==(  // NOLINT(readability-redundant-declaration)
     105             :       const UniformAcceleration<SpatialDim>& lhs,
     106             :       const UniformAcceleration<SpatialDim>& rhs);
     107             : 
     108           0 :   std::array<double, Dim> acceleration_field_ =
     109             :       make_array<Dim>(std::numeric_limits<double>::signaling_NaN());
     110             : };
     111             : 
     112             : template <size_t Dim>
     113           0 : bool operator!=(const UniformAcceleration<Dim>& lhs,
     114             :                 const UniformAcceleration<Dim>& rhs);
     115             : }  // namespace NewtonianEuler::Sources

Generated by: LCOV version 1.14