StressEnergy.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include "DataStructures/DataVector.hpp"
8 #include "Utilities/Gsl.hpp"
9 
10 namespace grmhd::GhValenciaDivClean {
11 
12 /*!
13  * \brief Add in the trace-reversed stress-energy source term to the \f$\Pi\f$
14  * evolved variable of the Generalized Harmonic system.
15  *
16  * \details The only stress energy source term in the Generalized Harmonic
17  * evolution equations is in the equation for \f$\Pi_{a b}\f$:
18  *
19  * \f[
20  * \partial_t \Pi_{ab} + \text{(spatial derivative terms)} =
21  * \text{(GH source terms)}
22  * - 16 \pi \alpha (T_{ab} - \frac{1}{2} g_{a b} T^c{}_c)
23  * \f]
24  *
25  * (note that this function takes as argument the trace-reversed stress energy
26  * tensor)
27  *
28  * This function adds that contribution to the existing value of `dt_pi`. The
29  * spacetime terms in the GH equation should be computed before passing the
30  * `dt_pi` to this function for updating.
31  *
32  * \see `GeneralizedHarmonic::TimeDerivative` for details about the spacetime
33  * part of the time derivative calculation.
34  */
36  gsl::not_null<tnsr::aa<DataVector, 3>*> dt_pi,
37  const tnsr::aa<DataVector, 3>& trace_reversed_stress_energy,
38  const Scalar<DataVector>& lapse) noexcept;
39 
40 /*!
41  * \brief Calculate the trace-reversed stress-energy tensor \f$(T_{\mu \nu} -
42  * 1/2 g_{\mu \nu} g^{\lambda \sigma} T_{\lambda \sigma}) \f$ associated with
43  * the matter part of the GRMHD system.
44  *
45  * \details The stress energy tensor is needed to compute the backreaction of
46  * the matter to the spacetime degrees of freedom. The stress energy is
47  * calculated as described in \cite Moesta2013dna :
48  *
49  * \f[
50  * T_{\mu \nu} = \rho h^* u_\mu u_\nu + p^* g_{\mu \nu} - b_\mu b_\nu,
51  * \f]
52  *
53  * where \f$u_\mu\f$ is the four-velocity, \f$\rho\f$ is the rest mass density,
54  * \f$h^*\f$ is the magnetically modified enthalpy, \f$p^*\f$ is the
55  * magnetically modified pressure, and \f$b_{\mu}\f$ is the comoving magnetic
56  * field (note that we deviate from the notation of \cite Moesta2013dna by
57  * denoting the pressure with a lower-case \f$p\f$ instead of an upper-case
58  * \f$P\f$).
59  *
60  * The spatial components of the four velocity \f$u_\mu\f$ are
61  *
62  * \f[
63  * u_i = W v_i,
64  * \f]
65  *
66  * and the time component is
67  *
68  * \f[
69  * u_0 = - \alpha W + \beta^i u_i.
70  * \f].
71  *
72  * The magnetically modified enthalpy is
73  *
74  * \f[
75  * h^* = 1 + \epsilon + (p + b^2) / \rho.
76  * \f]
77  *
78  * The magnetically modified pressure is
79  *
80  * \f[
81  * p^* = p + b^2 / 2.
82  * \f]
83  *
84  *
85  * The comoving magnetic field is computed via
86  *
87  * \f{align}{
88  * b_i &= B_i / W + v_i W v^k B_k\\
89  * b_0 &= - \alpha W v^i B_i + \beta^i b_i
90  * \f}
91  *
92  * Therefore, the trace-reversed stress energy simplifies to
93  *
94  * \f[
95  * (T_{\mu \nu} - \frac{1}{2} g_{\mu \nu} g^{\lambda \sigma} T_{\lambda \sigma})
96  * = \rho h^* u_\mu u_\nu + \left(\frac{1}{2} \rho h^* - p\right) g_{\mu \nu}
97  * - b_\mu b_\nu
98  * \f]
99  */
101  gsl::not_null<tnsr::aa<DataVector, 3>*> stress_energy,
102  gsl::not_null<tnsr::a<DataVector, 3>*> four_velocity_one_form_buffer,
103  gsl::not_null<tnsr::a<DataVector, 3>*>
104  comoving_magnetic_field_one_form_buffer,
105  const Scalar<DataVector>& rest_mass_density,
106  const Scalar<DataVector>& specific_enthalpy,
107  const tnsr::i<DataVector, 3, Frame::Inertial>& spatial_velocity_one_form,
108  const tnsr::i<DataVector, 3, Frame::Inertial>& magnetic_field_one_form,
109  const Scalar<DataVector>& magnetic_field_squared,
110  const Scalar<DataVector>& magnetic_field_dot_spatial_velocity,
111  const Scalar<DataVector>& lorentz_factor,
112  const Scalar<DataVector>& one_over_w_squared,
113  const Scalar<DataVector>& pressure,
114  const tnsr::aa<DataVector, 3, Frame::Inertial>& spacetime_metric,
115  const tnsr::I<DataVector, 3, Frame::Inertial>& shift,
116  const Scalar<DataVector>& lapse) noexcept;
117 } // namespace grmhd::GhValenciaDivClean
grmhd::GhValenciaDivClean::add_stress_energy_term_to_dt_pi
void add_stress_energy_term_to_dt_pi(gsl::not_null< tnsr::aa< DataVector, 3 > * > dt_pi, const tnsr::aa< DataVector, 3 > &trace_reversed_stress_energy, const Scalar< DataVector > &lapse) noexcept
Add in the trace-reversed stress-energy source term to the evolved variable of the Generalized Harmo...
gr::lapse
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.
grmhd::GhValenciaDivClean::trace_reversed_stress_energy
void trace_reversed_stress_energy(gsl::not_null< tnsr::aa< DataVector, 3 > * > stress_energy, gsl::not_null< tnsr::a< DataVector, 3 > * > four_velocity_one_form_buffer, gsl::not_null< tnsr::a< DataVector, 3 > * > comoving_magnetic_field_one_form_buffer, const Scalar< DataVector > &rest_mass_density, const Scalar< DataVector > &specific_enthalpy, const tnsr::i< DataVector, 3, Frame::Inertial > &spatial_velocity_one_form, const tnsr::i< DataVector, 3, Frame::Inertial > &magnetic_field_one_form, const Scalar< DataVector > &magnetic_field_squared, const Scalar< DataVector > &magnetic_field_dot_spatial_velocity, const Scalar< DataVector > &lorentz_factor, const Scalar< DataVector > &one_over_w_squared, const Scalar< DataVector > &pressure, const tnsr::aa< DataVector, 3, Frame::Inertial > &spacetime_metric, const tnsr::I< DataVector, 3, Frame::Inertial > &shift, const Scalar< DataVector > &lapse) noexcept
Calculate the trace-reversed stress-energy tensor associated with the matter part of the GRMHD syste...
gr::shift
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.
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
gr::spacetime_metric
void spacetime_metric(gsl::not_null< tnsr::aa< DataType, Dim, Frame > * > spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const tnsr::ii< DataType, Dim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
Tensor.hpp
grmhd::GhValenciaDivClean
Namespace associated with utilities for the combined Generalized Harmonic and Valencia formulation of...
Definition: BoundaryCorrection.hpp:17
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13