Characteristics.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <cstddef>
8 
11 #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp"
12 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" // IWYU pragma: keep
13 #include "Utilities/Gsl.hpp"
14 #include "Utilities/TMPL.hpp"
15 
16 /// \cond
17 class DataVector;
18 /// \endcond
19 
20 namespace RadiationTransport {
21 namespace M1Grey {
22 
23 // @{
24 /*!
25  * \brief Compute the characteristic speeds for the M1 system
26  *
27  * At this point, for testing purposes, we just set all
28  * speeds to 1... this needs to be fixed in the future to
29  * use the correct speed values.
30  */
32  const gsl::not_null<std::array<DataVector, 4>*> pchar_speeds,
33  const Scalar<DataVector>& lapse) noexcept {
34  const size_t num_grid_points = get(lapse).size();
35  auto& char_speeds = *pchar_speeds;
36  if (char_speeds[0].size() != num_grid_points) {
37  char_speeds[0] = DataVector(num_grid_points);
38  }
39  char_speeds[0] = 1.;
40  if (char_speeds[1].size() != num_grid_points) {
41  char_speeds[1] = DataVector(num_grid_points);
42  }
43  char_speeds[1] = -1.;
44  for (size_t i = 2; i < 4; i++) {
45  char_speeds[i] = char_speeds[0];
46  }
47 }
48 // @}
49 
50 namespace Tags {
51 /// \brief Compute the characteristic speeds for the M1 system
52 ///
55  using argument_tags = tmpl::list<gr::Tags::Lapse<>>;
56 
58 
59  static constexpr auto function = characteristic_speeds;
60 };
61 } // namespace Tags
62 
64  using argument_tags = tmpl::list<>;
65  static double apply() noexcept { return 1.0; }
66 };
67 
68 } // namespace M1Grey
69 } // namespace RadiationTransport
void characteristic_speeds(const gsl::not_null< std::array< DataVector, 4 > *> pchar_speeds, const Scalar< DataVector > &lapse) noexcept
Compute the characteristic speeds for the M1 system.
Definition: Characteristics.hpp:31
The characteristic speeds.
Definition: Tags.hpp:24
Items related to general relativistic radiation transport.
Definition: Characteristics.hpp:20
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:154
Compute the characteristic speeds for the M1 system.
Definition: Characteristics.hpp:53
Definition: DataBoxTag.hpp:29
Scalar< DataType > lapse(const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute lapse from shift and spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:117
Defines a list of useful type aliases for tensors.
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:1623
Stores a collection of function values.
Definition: DataVector.hpp:42
Wraps the template metaprogramming library used (brigand)
Defines functions and classes from the GSL.
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12