UniformAcceleration.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <limits>
8 
10 #include "Evolution/Systems/NewtonianEuler/TagsDeclarations.hpp"
11 #include "Utilities/MakeArray.hpp"
12 #include "Utilities/TMPL.hpp"
13 
14 /// \cond
15 class DataVector;
16 
17 namespace PUP {
18 class er;
19 } // namespace PUP
20 
21 namespace gsl {
22 template <typename>
23 struct not_null;
24 } // namespace gsl
25 /// \endcond
26 
27 namespace NewtonianEuler {
28 namespace Sources {
29 
30 /*!
31  * \brief Source generated from an external uniform acceleration.
32  *
33  * The NewtonianEuler system with source terms is written as
34  *
35  * \f{align*}
36  * \partial_t\rho + \partial_i F^i(\rho) &= S(\rho)\\
37  * \partial_t S^i + \partial_j F^{j}(S^i) &= S(S^i)\\
38  * \partial_t e + \partial_i F^i(e) &= S(e),
39  * \f}
40  *
41  * where \f$F^i(u)\f$ is the volume flux of the conserved quantity \f$u\f$
42  * (see ComputeFluxes). For an external acceleration \f$a^i\f$, one has
43  *
44  * \f{align*}
45  * S(\rho) &= 0\\
46  * S(S^i) &= \rho a^i\\
47  * S(e) &= S_ia^i,
48  * \f}
49  *
50  * where \f$\rho\f$ is the mass density, \f$S^i\f$ is the momentum density,
51  * and \f$e\f$ is the energy density.
52  */
53 template <size_t Dim>
55  UniformAcceleration() noexcept = default;
56  UniformAcceleration(const UniformAcceleration& /*rhs*/) = default;
57  UniformAcceleration& operator=(const UniformAcceleration& /*rhs*/) = default;
58  UniformAcceleration(UniformAcceleration&& /*rhs*/) noexcept = default;
59  UniformAcceleration& operator=(UniformAcceleration&& /*rhs*/) noexcept =
60  default;
61  ~UniformAcceleration() = default;
62 
63  explicit UniformAcceleration(
64  const std::array<double, Dim>& acceleration_field) noexcept;
65 
66  // clang-tidy: google-runtime-references
67  void pup(PUP::er& /*p*/) noexcept; // NOLINT
68 
69  using sourced_variables = tmpl::list<Tags::MomentumDensity<DataVector, Dim>,
71 
72  using argument_tags = tmpl::list<Tags::MassDensityCons<DataVector>,
74 
75  void apply(gsl::not_null<tnsr::I<DataVector, Dim>*> source_momentum_density,
76  gsl::not_null<Scalar<DataVector>*> source_energy_density,
77  const Scalar<DataVector>& mass_density_cons,
78  const tnsr::I<DataVector, Dim>& momentum_density) const noexcept;
79 
80  private:
81  template <size_t SpatialDim>
82  friend bool operator==( // NOLINT(readability-redundant-declaration)
84  const UniformAcceleration<SpatialDim>& rhs) noexcept;
85 
86  std::array<double, Dim> acceleration_field_ =
88 };
89 
90 template <size_t Dim>
91 bool operator!=(const UniformAcceleration<Dim>& lhs,
92  const UniformAcceleration<Dim>& rhs) noexcept;
93 } // namespace Sources
94 } // namespace NewtonianEuler
The momentum density of the fluid.
Definition: Tags.hpp:43
Definition: Strahlkorper.hpp:14
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
T signaling_NaN(T... args)
Defines function make_array.
Source generated from an external uniform acceleration.
Definition: UniformAcceleration.hpp:54
The energy density of the fluid.
Definition: Tags.hpp:52
Defines a list of useful type aliases for tensors.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1623
Stores a collection of function values.
Definition: DataVector.hpp:42
Wraps the template metaprogramming library used (brigand)
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12
Items related to evolving the Newtonian Euler system.
Definition: EvolveNewtonianEulerFwd.hpp:8