Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "DataStructures/Tensor/TypeAliases.hpp"
7 : #include "Utilities/Gsl.hpp"
8 :
9 : namespace hydro {
10 :
11 : /*!
12 : * \brief The total mass-energy density measured by a normal observer, $E = n_a
13 : * n_b T^{ab}$
14 : *
15 : * This quantity sources the gravitational field equations in the 3+1
16 : * decomposition (see Eq. (2.138) in \cite BaumgarteShapiro).
17 : *
18 : * Perfect fluid contribution (Eq. (5.33) in \cite BaumgarteShapiro):
19 : *
20 : * \begin{equation}
21 : * E_\mathrm{fluid} = \rho h W^2 - p
22 : * \end{equation}
23 : *
24 : * Magnetic field contribution (Eq. (5.152) in \cite BaumgarteShapiro):
25 : *
26 : * \begin{equation}
27 : * E_\mathrm{em} = b^2 \left(W^2 - \frac{1}{2}\right) - (\alpha b^t)^2
28 : * \end{equation}
29 : *
30 : * where $\alpha b^t = W B^k v_k$.
31 : *
32 : * \param result Output buffer. Will be resized if needed.
33 : * \param rest_mass_density $\rho$
34 : * \param specific_enthalpy $h$
35 : * \param pressure $p$
36 : * \param lorentz_factor $W$
37 : * \param magnetic_field_dot_spatial_velocity $B^k v_k$
38 : * \param comoving_magnetic_field_squared $b^2$
39 : *
40 : * \see gr::Tags::EnergyDensity
41 : */
42 : template <typename DataType>
43 1 : void energy_density(gsl::not_null<Scalar<DataType>*> result,
44 : const Scalar<DataType>& rest_mass_density,
45 : const Scalar<DataType>& specific_enthalpy,
46 : const Scalar<DataType>& pressure,
47 : const Scalar<DataType>& lorentz_factor,
48 : const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
49 : const Scalar<DataType>& comoving_magnetic_field_squared);
50 :
51 : /*!
52 : * \brief The spatial momentum density $S^i = -\gamma^{ij} n^a T_{aj}$
53 : *
54 : * This quantity sources the gravitational field equations in the 3+1
55 : * decomposition (see Eq. (2.138) in \cite BaumgarteShapiro).
56 : *
57 : * Perfect fluid contribution (Eq. (5.34) in \cite BaumgarteShapiro):
58 : *
59 : * \begin{equation}
60 : * S^i_\mathrm{fluid} = \rho h W^2 v^i
61 : * \end{equation}
62 : *
63 : * Magnetic field contribution (Eq. (5.153) in \cite BaumgarteShapiro):
64 : *
65 : * \begin{equation}
66 : * S^i_\mathrm{em} = b^2 W^2 v^i - \alpha b^t \gamma^{ij} b_j
67 : * \end{equation}
68 : *
69 : * where $\alpha b^t \gamma^{ij} b_j = B^k v_k B^i + (B^k v_k)^2 W^2 v^i$.
70 : *
71 : * \param result Output buffer. Will be resized if needed.
72 : * \param rest_mass_density $\rho$
73 : * \param specific_enthalpy $h$
74 : * \param spatial_velocity $v^i$
75 : * \param lorentz_factor $W$
76 : * \param magnetic_field $B^i$
77 : * \param magnetic_field_dot_spatial_velocity $B^k v_k$
78 : * \param comoving_magnetic_field_squared $b^2$
79 : *
80 : * \see gr::Tags::MomentumDensity
81 : */
82 : template <typename DataType>
83 1 : void momentum_density(
84 : gsl::not_null<tnsr::I<DataType, 3>*> result,
85 : const Scalar<DataType>& rest_mass_density,
86 : const Scalar<DataType>& specific_enthalpy,
87 : const tnsr::I<DataType, 3>& spatial_velocity,
88 : const Scalar<DataType>& lorentz_factor,
89 : const tnsr::I<DataType, 3>& magnetic_field,
90 : const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
91 : const Scalar<DataType>& comoving_magnetic_field_squared);
92 :
93 : /*!
94 : * \brief The trace of the spatial stress tensor, $S =
95 : * \gamma^{ij}\gamma_{ia}\gamma_{jb}T^{ab}$
96 : *
97 : * This quantity sources the gravitational field equations in the 3+1
98 : * decomposition (see Eq. (2.138) in \cite BaumgarteShapiro).
99 : *
100 : * Perfect fluid contribution (Eq. (5.36) in \cite BaumgarteShapiro):
101 : *
102 : * \begin{equation}
103 : * S_\mathrm{fluid} = 3 p + \rho h (W^2 - 1)
104 : * \end{equation}
105 : *
106 : * The kinetic term is evaluated as \f$\rho h W^2 v^2\f$ to avoid
107 : * cancellation in \f$W^2 - 1\f$ at small velocities. The supplied Lorentz
108 : * factor and squared velocity must describe the same physical state.
109 : *
110 : * Magnetic field contribution (Eq. (5.155) in \cite BaumgarteShapiro):
111 : *
112 : * \begin{equation}
113 : * S_\mathrm{em} = b^2 (W^2 v^2 + \frac{3}{2}) - \gamma^{ij} b_i b_j
114 : * \end{equation}
115 : *
116 : * where $\gamma^{ij} b_i b_j = b^2 + (B^k v_k)^2 (W^2 v^2 + 1)$.
117 : *
118 : * \param result Output buffer. Will be resized if needed.
119 : * \param rest_mass_density $\rho$
120 : * \param specific_enthalpy $h$
121 : * \param pressure $p$
122 : * \param spatial_velocity_squared $v^2 = \gamma_{ij} v^i v^j$
123 : * \param lorentz_factor $W$
124 : * \param magnetic_field_dot_spatial_velocity $B^k v_k$
125 : * \param comoving_magnetic_field_squared $b^2$
126 : *
127 : * \see gr::Tags::StressTrace
128 : */
129 : template <typename DataType>
130 1 : void stress_trace(gsl::not_null<Scalar<DataType>*> result,
131 : const Scalar<DataType>& rest_mass_density,
132 : const Scalar<DataType>& specific_enthalpy,
133 : const Scalar<DataType>& pressure,
134 : const Scalar<DataType>& spatial_velocity_squared,
135 : const Scalar<DataType>& lorentz_factor,
136 : const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
137 : const Scalar<DataType>& comoving_magnetic_field_squared);
138 :
139 : /*!
140 : * \brief Stress Energy Tesnor, $T^{ab}=
141 : * (\rho h)^{*} u^a u ^b + p^{*} g^{ab} - b^{a} b^{b}$,
142 : *
143 : * where $(\rho h)^{*} = \rho h + b^{2}$ and $p^{*} = p + b^{2}/2$
144 : * are the enthalpy density and fluid pressure augmented by contributions of
145 : * magnetic pressure $p_{mag}$ = b^{2}/2, respectively.
146 : *
147 : * $b$ refers to magnetic field measured in the comoving frame of the fluid
148 : * $b^{a} = ^{*}F^{ab} u_{b}$.
149 : */
150 : template <typename DataType>
151 1 : void stress_energy_tensor(
152 : gsl::not_null<tnsr::AA<DataType, 3>*> result,
153 : const Scalar<DataType>& rest_mass_density,
154 : const Scalar<DataType>& specific_internal_energy,
155 : const Scalar<DataType>& pressure, const Scalar<DataType>& lorentz_factor,
156 : const Scalar<DataType>& lapse,
157 : const Scalar<DataType>& comoving_magnetic_field_magnitude,
158 : const tnsr::I<DataType, 3>& spatial_velocity,
159 : const tnsr::I<DataType, 3>& shift,
160 : const tnsr::I<DataType, 3>& magnetic_field,
161 : const tnsr::ii<DataType, 3>& spatial_metric,
162 : const tnsr::II<DataType, 3>& inverse_spatial_metric);
163 : } // namespace hydro
|