LaneEmdenGravitationalField.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 #include "DataStructures/Tensor/TypeAliases.hpp" // IWYU pragma: keep
9 #include "Evolution/Systems/NewtonianEuler/TagsDeclarations.hpp" // IWYU pragma: keep
10 #include "Utilities/TMPL.hpp"
11 
12 /// \cond
13 class DataVector;
14 
15 namespace NewtonianEuler {
16 namespace Solutions {
17 struct LaneEmdenStar;
18 } // namespace Solutions
19 } // namespace NewtonianEuler
20 
21 namespace PUP {
22 class er;
23 } // namespace PUP
24 namespace Tags {
25 template <size_t Dim, typename Frame>
26 struct Coordinates;
27 template <typename SolutionType>
28 struct AnalyticSolution;
29 } // namespace Tags
30 
31 namespace gsl {
32 template <typename T>
33 class not_null;
34 } // namespace gsl
35 /// \endcond
36 
37 // IWYU pragma: no_include "Evolution/Systems/NewtonianEuler/Tags.hpp"
38 
39 // IWYU pragma: no_forward_declare Tensor
40 
41 namespace NewtonianEuler {
42 namespace Sources {
43 
44 /*!
45  * \brief Source giving the acceleration due to gravity in the spherical,
46  * Newtonian Lane-Emden star solution.
47  *
48  * The gravitational field \f$g^i\f$ enters the NewtonianEuler system as source
49  * terms for the conserved momentum and energy:
50  *
51  * \f{align*}
52  * \partial_t S^i + \partial_j F^{j}(S^i) &= S(S^i) = \rho g^i
53  * \partial_t e + \partial_j F^{j}(e) &= S(e) = S_i g^i,
54  * \f}
55  *
56  * where \f$S^i\f$ is the conserved momentum density, \f$e\f$ is the conserved
57  * energy, \f$F^{j}(u)\f$ is the flux of the conserved quantity \f$u\f$, and
58  * \f$\rho\f$ is the fluid mass density.
59  *
60  * \note This source is specialized to the Lane-Emden solution because it
61  * queries a LaneEmdenStar analytic solution for the gravitational field that
62  * generates the fluid acceleration. This source does *not* integrate the fluid
63  * density to compute a self-consistent gravitational field (i.e., as if one
64  * were solving a coupled Euler + Poisson system).
65  */
67  LaneEmdenGravitationalField() noexcept = default;
69  default;
70  LaneEmdenGravitationalField& operator=(
71  const LaneEmdenGravitationalField& /*rhs*/) = default;
73  default;
74  LaneEmdenGravitationalField& operator=(
75  LaneEmdenGravitationalField&& /*rhs*/) noexcept = default;
76  ~LaneEmdenGravitationalField() = default;
77 
78  // clang-tidy: google-runtime-references
79  void pup(PUP::er& /*p*/) noexcept {} // NOLINT
80 
81  using sourced_variables = tmpl::list<Tags::MomentumDensity<DataVector, 3>,
83 
84  using argument_tags = tmpl::list<
88 
89  static void apply(
90  gsl::not_null<tnsr::I<DataVector, 3>*> source_momentum_density,
91  gsl::not_null<Scalar<DataVector>*> source_energy_density,
92  const Scalar<DataVector>& mass_density_cons,
93  const tnsr::I<DataVector, 3>& momentum_density,
95  const tnsr::I<DataVector, 3>& x) noexcept;
96 };
97 
98 } // namespace Sources
99 } // namespace NewtonianEuler
The momentum density of the fluid.
Definition: Tags.hpp:43
Definition: Strahlkorper.hpp:14
Implementations from the Guideline Support Library.
Definition: Gsl.hpp:79
The energy density of the fluid.
Definition: Tags.hpp:52
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
The coordinates in a given frame.
Definition: Tags.hpp:133
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:1628
Stores a collection of function values.
Definition: DataVector.hpp:42
Wraps the template metaprogramming library used (brigand)
Source giving the acceleration due to gravity in the spherical, Newtonian Lane-Emden star solution...
Definition: LaneEmdenGravitationalField.hpp:66
The analytic solution, with the type of the analytic solution set as the template parameter...
Definition: Tags.hpp:50
A static spherically symmetric star in Newtonian gravity.
Definition: LaneEmdenStar.hpp:47
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
The mass density of the fluid (as a conservative variable).
Definition: Tags.hpp:36
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182
Items related to evolving the Newtonian Euler system.
Definition: EvolveNewtonianEulerFwd.hpp:8