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

Generated by: LCOV version 2.0-1