EnergyDensity.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/DataBox/Tag.hpp"
11 #include "Utilities/TMPL.hpp"
12 
13 /// \cond
14 class DataVector;
15 namespace gsl {
16 template <typename T>
17 class not_null;
18 } // namespace gsl
19 /// \endcond
20 
21 namespace ScalarWave {
22 /// @{
23 /*!
24  * \brief Computes the energy density of the scalar wave system.
25  *
26  * Below is the function used to calculate the energy density.
27  *
28  * \f{align*}
29  * \epsilon = \frac{1}{2}\left( \Pi^{2} + \abs{\Phi}^{2} \right)
30  * \f}
31  */
32 template <size_t SpatialDim>
33 void energy_density(
35  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi) noexcept;
36 
37 template <size_t SpatialDim>
39  const Scalar<DataVector>& pi,
40  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi) noexcept;
41 /// @}
42 
43 namespace Tags {
44 /// \brief Computes the energy density using ScalarWave::energy_density()
45 template <size_t SpatialDim>
47  using argument_tags = tmpl::list<ScalarWave::Pi, ScalarWave::Phi<SpatialDim>>;
48 
49  using return_type = Scalar<DataVector>;
50 
51  static constexpr auto function = static_cast<void (*)(
53  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&) noexcept>(
54  &energy_density<SpatialDim>);
55 
57 };
58 } // namespace Tags
59 } // namespace ScalarWave
db::ComputeTag
Mark a struct as a compute tag by inheriting from this.
Definition: Tag.hpp:157
GeneralizedHarmonic::pi
void pi(gsl::not_null< tnsr::aa< DataType, SpatialDim, Frame > * > pi, const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the conjugate momentum of the spacetime metric .
Tags.hpp
ScalarWave::energy_density
void energy_density(gsl::not_null< Scalar< DataVector > * > result, const Scalar< DataVector > &pi, const tnsr::i< DataVector, SpatialDim, Frame::Inertial > &phi) noexcept
Computes the energy density of the scalar wave system.
cstddef
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
GeneralizedHarmonic::phi
void phi(gsl::not_null< tnsr::iaa< DataType, SpatialDim, Frame > * > phi, const Scalar< DataType > &lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes the auxiliary variable used by the generalized harmonic formulation of Einstein's equations...
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
TypeAliases.hpp
ScalarWave::Tags::EnergyDensity
The energy density of the scalar wave.
Definition: Tags.hpp:110
ScalarWave
Items related to evolving the scalar wave equation.
Definition: BoundaryCondition.hpp:24
ScalarWave::Tags::EnergyDensityCompute
Computes the energy density using ScalarWave::energy_density()
Definition: EnergyDensity.hpp:46
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13