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/DataVector.hpp"
10 : #include "DataStructures/Tensor/EagerMath/Magnitude.hpp"
11 : #include "DataStructures/Tensor/Tensor.hpp"
12 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
13 : #include "Utilities/Gsl.hpp"
14 : #include "Utilities/TMPL.hpp"
15 :
16 1 : namespace grmhd::GhValenciaDivClean::Tags {
17 0 : struct LargestCharacteristicSpeed : db::SimpleTag {
18 0 : using type = double;
19 : };
20 :
21 : /*!
22 : * \brief Computes the largest magnitude of the characteristic speeds.
23 : *
24 : * \warning Assumes \f$-1\le\gamma_1\le0\f$.
25 : */
26 : template <typename Frame = Frame::Inertial>
27 1 : struct ComputeLargestCharacteristicSpeed : db::ComputeTag,
28 : LargestCharacteristicSpeed {
29 0 : using argument_tags =
30 : tmpl::list<gr::Tags::Lapse<DataVector>,
31 : gr::Tags::Shift<DataVector, 3, Frame>,
32 : gr::Tags::SpatialMetric<DataVector, 3, Frame>>;
33 0 : using return_type = double;
34 0 : using base = LargestCharacteristicSpeed;
35 0 : static void function(const gsl::not_null<double*> speed,
36 : const Scalar<DataVector>& lapse,
37 : const tnsr::I<DataVector, 3, Frame>& shift,
38 : const tnsr::ii<DataVector, 3, Frame>& spatial_metric) {
39 : const auto shift_magnitude = magnitude(shift, spatial_metric);
40 : *speed = max(get(shift_magnitude) + get(lapse));
41 : }
42 : };
43 : } // namespace grmhd::GhValenciaDivClean::Tags
|