SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro - ComovingMagneticField.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 6 7 85.7 %
Date: 2025-12-05 05:03:31
Legend: Lines: hit not hit

          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             : /*!
      13             :  * \brief The comoving magnetic field vector $b^\mu$ and one-form $b_\mu$
      14             :  *
      15             :  * The components of the comoving magnetic field vector are:
      16             :  *
      17             :  * \begin{align}
      18             :  * b^0 &= W B^j v^k \gamma_{j k} / \alpha \\
      19             :  * b^i &= B^i / W + B^j v^k \gamma_{j k} u^i
      20             :  * \end{align}
      21             :  *
      22             :  * where $u^i = W(v^i - \beta^i/\alpha)$.
      23             :  *
      24             :  * Using the spacetime metric, the corresponding one-form components are:
      25             :  *
      26             :  * \begin{align}
      27             :  * b_0 &= - \alpha W v^i B_i + \beta^i b_i \\
      28             :  * b_i &= B_i / W + B^j v^k \gamma_{j k} W v_i
      29             :  * \end{align}
      30             :  *
      31             :  * The square of the vector is:
      32             :  *
      33             :  * \begin{equation}
      34             :  * b^2 = B^i B^j \gamma_{i j} / W^2 + (B^i v^j \gamma_{i j})^2
      35             :  * \end{equation}
      36             :  *
      37             :  * See also Eq. (5.173) in \cite BaumgarteShapiro, with the difference that we
      38             :  * work in Heaviside-Lorentz units where the magnetic field is rescaled by
      39             :  * $1/\sqrt{4\pi}$, following \cite Moesta2013dna .
      40             :  */
      41             : template <typename DataType>
      42           1 : void comoving_magnetic_field(
      43             :     gsl::not_null<tnsr::A<DataType, 3>*> result,
      44             :     const tnsr::I<DataType, 3>& spatial_velocity,
      45             :     const tnsr::I<DataType, 3>& magnetic_field,
      46             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      47             :     const Scalar<DataType>& lorentz_factor, const tnsr::I<DataType, 3>& shift,
      48             :     const Scalar<DataType>& lapse);
      49             : 
      50             : template <typename DataType>
      51           1 : tnsr::A<DataType, 3> comoving_magnetic_field(
      52             :     const tnsr::I<DataType, 3>& spatial_velocity,
      53             :     const tnsr::I<DataType, 3>& magnetic_field,
      54             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      55             :     const Scalar<DataType>& lorentz_factor, const tnsr::I<DataType, 3>& shift,
      56             :     const Scalar<DataType>& lapse);
      57             : 
      58             : template <typename DataType>
      59           1 : void comoving_magnetic_field_one_form(
      60             :     gsl::not_null<tnsr::a<DataType, 3>*> result,
      61             :     const tnsr::i<DataType, 3>& spatial_velocity_one_form,
      62             :     const tnsr::i<DataType, 3>& magnetic_field_one_form,
      63             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      64             :     const Scalar<DataType>& lorentz_factor, const tnsr::I<DataType, 3>& shift,
      65             :     const Scalar<DataType>& lapse);
      66             : 
      67             : template <typename DataType>
      68           1 : tnsr::a<DataType, 3> comoving_magnetic_field_one_form(
      69             :     const tnsr::i<DataType, 3>& spatial_velocity_one_form,
      70             :     const tnsr::i<DataType, 3>& magnetic_field_one_form,
      71             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      72             :     const Scalar<DataType>& lorentz_factor, const tnsr::I<DataType, 3>& shift,
      73             :     const Scalar<DataType>& lapse);
      74             : 
      75             : template <typename DataType>
      76           1 : void comoving_magnetic_field_squared(
      77             :     gsl::not_null<Scalar<DataType>*> result,
      78             :     const Scalar<DataType>& magnetic_field_squared,
      79             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      80             :     const Scalar<DataType>& lorentz_factor);
      81             : 
      82             : template <typename DataType>
      83           1 : Scalar<DataType> comoving_magnetic_field_squared(
      84             :     const Scalar<DataType>& magnetic_field_squared,
      85             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      86             :     const Scalar<DataType>& lorentz_factor);
      87             : /// @}
      88             : 
      89             : }  // namespace hydro

Generated by: LCOV version 1.14