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 
25 namespace Tags {
26 template <typename SolutionType>
27 struct AnalyticSolution;
28 } // namespace Tags
29 
30 namespace domain {
31 namespace Tags {
32 template <size_t Dim, typename Frame>
33 struct Coordinates;
34 } // namespace Tags
35 } // namespace domain
36 
37 namespace gsl {
38 template <typename T>
39 class not_null;
40 } // namespace gsl
41 /// \endcond
42 
43 // IWYU pragma: no_include "Evolution/Systems/NewtonianEuler/Tags.hpp"
44 
45 // IWYU pragma: no_forward_declare Tensor
46 
47 namespace NewtonianEuler {
48 namespace Sources {
49 
50 /*!
51  * \brief Source giving the acceleration due to gravity in the spherical,
52  * Newtonian Lane-Emden star solution.
53  *
54  * The gravitational field \f$g^i\f$ enters the NewtonianEuler system as source
55  * terms for the conserved momentum and energy:
56  *
57  * \f{align*}
58  * \partial_t S^i + \partial_j F^{j}(S^i) &= S(S^i) = \rho g^i
59  * \partial_t e + \partial_j F^{j}(e) &= S(e) = S_i g^i,
60  * \f}
61  *
62  * where \f$S^i\f$ is the conserved momentum density, \f$e\f$ is the conserved
63  * energy, \f$F^{j}(u)\f$ is the flux of the conserved quantity \f$u\f$, and
64  * \f$\rho\f$ is the fluid mass density.
65  *
66  * \note This source is specialized to the Lane-Emden solution because it
67  * queries a LaneEmdenStar analytic solution for the gravitational field that
68  * generates the fluid acceleration. This source does *not* integrate the fluid
69  * density to compute a self-consistent gravitational field (i.e., as if one
70  * were solving a coupled Euler + Poisson system).
71  */
73  LaneEmdenGravitationalField() noexcept = default;
75  default;
76  LaneEmdenGravitationalField& operator=(
77  const LaneEmdenGravitationalField& /*rhs*/) = default;
79  default;
80  LaneEmdenGravitationalField& operator=(
81  LaneEmdenGravitationalField&& /*rhs*/) noexcept = default;
82  ~LaneEmdenGravitationalField() = default;
83 
84  // clang-tidy: google-runtime-references
85  void pup(PUP::er& /*p*/) noexcept {} // NOLINT
86 
87  using sourced_variables =
88  tmpl::list<Tags::MomentumDensity<3>, Tags::EnergyDensity>;
89 
90  using argument_tags = tmpl::list<
94 
95  static void apply(
96  gsl::not_null<tnsr::I<DataVector, 3>*> source_momentum_density,
97  gsl::not_null<Scalar<DataVector>*> source_energy_density,
98  const Scalar<DataVector>& mass_density_cons,
99  const tnsr::I<DataVector, 3>& momentum_density,
101  const tnsr::I<DataVector, 3>& x) noexcept;
102 };
103 
104 } // namespace Sources
105 } // namespace NewtonianEuler
domain::Tags::Coordinates
Definition: Tags.hpp:129
NewtonianEuler
Items related to evolving the Newtonian Euler system.
Definition: EvolveNewtonianEulerFwd.hpp:8
NewtonianEuler::Tags::MassDensityCons
The mass density of the fluid (as a conservative variable).
Definition: Tags.hpp:37
cstddef
Tags::AnalyticSolution
Definition: Tags.hpp:52
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
NewtonianEuler::Tags::EnergyDensity
The energy density of the fluid.
Definition: Tags.hpp:51
NewtonianEuler::Tags::MomentumDensity
The momentum density of the fluid.
Definition: Tags.hpp:43
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
TypeAliases.hpp
NewtonianEuler::Sources::LaneEmdenGravitationalField
Source giving the acceleration due to gravity in the spherical, Newtonian Lane-Emden star solution.
Definition: LaneEmdenGravitationalField.hpp:72
NewtonianEuler::Solutions::LaneEmdenStar
A static spherically symmetric star in Newtonian gravity.
Definition: LaneEmdenStar.hpp:47
gsl
Implementations from the Guideline Support Library.
Definition: Gsl.hpp:80
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183