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 :
8 : #include "DataStructures/DataBox/Tag.hpp"
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "Evolution/Systems/ScalarWave/Tags.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 momentum density of the scalar wave system.
25 : *
26 : * Below is the function used to calculate the momentum density.
27 : *
28 : * \f{align*}
29 : * P_i = \Pi \times \Phi_i
30 : * \f}
31 : */
32 : template <size_t SpatialDim>
33 1 : void momentum_density(
34 : gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame::Inertial>*> result,
35 : const Scalar<DataVector>& pi,
36 : const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi);
37 :
38 : template <size_t SpatialDim>
39 1 : tnsr::i<DataVector, SpatialDim, Frame::Inertial> momentum_density(
40 : const Scalar<DataVector>& pi,
41 : const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi);
42 : /// @}
43 :
44 : namespace Tags {
45 : /// \brief Computes the momentum density using ScalarWave::momentum_density()
46 : template <size_t SpatialDim>
47 1 : struct MomentumDensityCompute : MomentumDensity<SpatialDim>, db::ComputeTag {
48 0 : using argument_tags = tmpl::list<Pi, Phi<SpatialDim>>;
49 :
50 0 : using return_type = tnsr::i<DataVector, SpatialDim, Frame::Inertial>;
51 :
52 0 : static constexpr auto function = static_cast<void (*)(
53 : gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame::Inertial>*> result,
54 : const Scalar<DataVector>&,
55 : const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&)>(
56 : &momentum_density<SpatialDim>);
57 :
58 0 : using base = MomentumDensity<SpatialDim>;
59 : };
60 : } // namespace Tags
61 : } // namespace ScalarWave
|