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 
10 
11 /// \cond
12 class DataVector;
13 namespace gsl {
14 template <class>
15 class not_null;
16 } // namespace gsl
17 /// \endcond
18 
19 // IWYU pragma: no_forward_declare Tensor
20 
21 namespace RelativisticEuler {
22 namespace Valencia {
23 
24 /*!
25  * \brief Compute the characteristic speeds for the Valencia formulation
26  * of the relativistic Euler system.
27  *
28  * The principal symbol of the system is diagonalized so that the elements of
29  * the diagonal matrix are the \f$(\text{Dim} + 2)\f$ characteristic speeds
30  *
31  * \f{align*}
32  * \lambda_1 &= \alpha \Lambda^- - \beta_n,\\
33  * \lambda_{i + 1} &= \alpha v_n - \beta_n,\quad i = 1,...,\text{Dim}\\
34  * \lambda_{\text{Dim} + 2} &= \alpha \Lambda^+ - \beta_n,
35  * \f}
36  *
37  * where \f$\alpha\f$ is the lapse, \f$\beta_n = n_i \beta^i\f$ and
38  * \f$v_n = n_i v^i\f$ are the projections of the shift \f$\beta^i\f$ and the
39  * spatial velocity \f$v^i\f$ onto the normal one-form \f$n_i\f$, respectively,
40  * and
41  *
42  * \f{align*}
43  * \Lambda^{\pm} &= \dfrac{1}{1 - v^2 c_s^2}\left[ v_n (1- c_s^2) \pm
44  * c_s\sqrt{\left(1 - v^2\right)\left[1 - v^2 c_s^2 - v_n^2(1 - c_s^2)\right]}
45  * \right],
46  * \f}
47  *
48  * where \f$v^2 = \gamma_{ij}v^iv^j\f$ is the magnitude squared of the spatial
49  * velocity, and \f$c_s\f$ is the sound speed.
50  */
51 template <size_t Dim>
52 void characteristic_speeds(
54  const Scalar<DataVector>& lapse, const tnsr::I<DataVector, Dim>& shift,
55  const tnsr::I<DataVector, Dim>& spatial_velocity,
56  const Scalar<DataVector>& spatial_velocity_squared,
57  const Scalar<DataVector>& sound_speed_squared,
58  const tnsr::i<DataVector, Dim>& normal) noexcept;
59 
60 template <size_t Dim>
61 std::array<DataVector, Dim + 2> characteristic_speeds(
62  const Scalar<DataVector>& lapse, const tnsr::I<DataVector, Dim>& shift,
63  const tnsr::I<DataVector, Dim>& spatial_velocity,
64  const Scalar<DataVector>& spatial_velocity_squared,
65  const Scalar<DataVector>& sound_speed_squared,
66  const tnsr::i<DataVector, Dim>& normal) noexcept;
67 
68 } // namespace Valencia
69 } // namespace RelativisticEuler
Implementations from the Guideline Support Library.
Definition: ConservativeFromPrimitive.hpp:10
Items related to evolving the relativistic Euler system.
Definition: Characteristics.hpp:21
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:98
Defines a list of useful type aliases for tensors.
tnsr::I< DataType, SpatialDim, Frame > shift(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute shift from spacetime metric and inverse spatial metric.
Definition: ComputeSpacetimeQuantities.cpp:82
Stores a collection of function values.
Definition: DataVector.hpp:46
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12