SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticData/GrMhd/InitialMagneticFields - InitialMagneticField.hpp Hit Total Coverage
Commit: 1c32b58340e006addc79befb2cdaa7547247e09c Lines: 2 10 20.0 %
Date: 2024-04-19 07:30:15
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 <memory>
       7             : #include <pup.h>
       8             : 
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "Utilities/Serialization/CharmPupable.hpp"
      11             : #include "Utilities/TMPL.hpp"
      12             : 
      13             : /// \cond
      14             : class DataVector;
      15             : namespace grmhd::AnalyticData::InitialMagneticFields {
      16             : class Poloidal;
      17             : class Toroidal;
      18             : }  // namespace grmhd::AnalyticData::InitialMagneticFields
      19             : 
      20             : namespace gsl {
      21             : template <typename T>
      22             : class not_null;
      23             : }  // namespace gsl
      24             : /// \endcond
      25             : 
      26             : namespace grmhd::AnalyticData {
      27             : 
      28             : /*!
      29             :  * \brief Things related to the initial (seed) magnetic field that can be
      30             :  * superposed on GRMHD initial data.
      31             :  *
      32             :  * In many cases we assign magnetic fields in terms of the vector potential,
      33             :  * which can be computed as
      34             :  *
      35             :  * \f{align*}{
      36             :  *   B^i & = n_a\epsilon^{aijk}\partial_jA_k \\
      37             :  *       & = \frac{1}{\sqrt{\gamma}}[ijk]\partial_j A_k,
      38             :  * \f}
      39             :  *
      40             :  * where \f$[ijk]\f$ is the total anti-symmetric symbol.
      41             :  *
      42             :  * For example, in the Cartesian coordinates,
      43             :  *
      44             :  * \f{align*}{
      45             :  *   B^x & = \frac{1}{\sqrt{\gamma}} (\partial_y A_z - \partial_z A_y), \\
      46             :  *   B^y & = \frac{1}{\sqrt{\gamma}} (\partial_z A_x - \partial_x A_z), \\
      47             :  *   B^z & = \frac{1}{\sqrt{\gamma}} (\partial_x A_y - \partial_y A_x).
      48             :  * \f}
      49             :  *
      50             :  *
      51             :  * \warning The magnetic field classes assume the magnetic field is initialized,
      52             :  * both in size and value, before being passed into the `variables` function.
      53             :  * This is so that multiple magnetic fields can be superposed. Each magnetic
      54             :  * field configuration does a `+=` to make this possible.
      55             :  */
      56           1 : namespace InitialMagneticFields {
      57             : 
      58             : /*!
      59             :  * \brief The abstract base class for initial magnetic field configurations.
      60             :  *
      61             :  * \warning This assumes the magnetic field is initialized, both in size and
      62             :  * value, before being passed into the `variables` function. This is so that
      63             :  * multiple magnetic fields can be superposed. Each magnetic field
      64             :  * configuration does a `+=` to make this possible.
      65             :  */
      66           1 : class InitialMagneticField : public PUP::able {
      67             :  protected:
      68           0 :   InitialMagneticField() = default;
      69             : 
      70             :  public:
      71           0 :   using creatable_classes = tmpl::list<Poloidal, Toroidal>;
      72             : 
      73           0 :   ~InitialMagneticField() override = default;
      74             : 
      75           0 :   virtual auto get_clone() const -> std::unique_ptr<InitialMagneticField> = 0;
      76             : 
      77           0 :   virtual void variables(
      78             :       gsl::not_null<tnsr::I<DataVector, 3>*> result,
      79             :       const tnsr::I<DataVector, 3>& coords, const Scalar<DataVector>& pressure,
      80             :       const Scalar<DataVector>& sqrt_det_spatial_metric,
      81             :       const tnsr::i<DataVector, 3>& deriv_pressure) const = 0;
      82             : 
      83           0 :   virtual void variables(gsl::not_null<tnsr::I<double, 3>*> result,
      84             :                          const tnsr::I<double, 3>& coords,
      85             :                          const Scalar<double>& pressure,
      86             :                          const Scalar<double>& sqrt_det_spatial_metric,
      87             :                          const tnsr::i<double, 3>& deriv_pressure) const = 0;
      88             : 
      89           0 :   virtual bool is_equal(const InitialMagneticField& rhs) const = 0;
      90             : 
      91             :   /// \cond
      92             :   explicit InitialMagneticField(CkMigrateMessage* msg) : PUP::able(msg) {}
      93             :   WRAPPED_PUPable_abstract(InitialMagneticField);
      94             :   /// \endcond
      95             : };
      96             : 
      97             : }  // namespace InitialMagneticFields
      98             : }  // namespace grmhd::AnalyticData

Generated by: LCOV version 1.14