SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticSolutions/ForceFree - FastWave.hpp Hit Total Coverage
Commit: 52f20d7d69c179a8fabd675cc9d8c5355c7d621c Lines: 8 23 34.8 %
Date: 2024-04-17 15:32:38
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             : 
       8             : #include "DataStructures/Tensor/TypeAliases.hpp"
       9             : #include "Evolution/Systems/ForceFree/Tags.hpp"
      10             : #include "Options/String.hpp"
      11             : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
      12             : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
      13             : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
      14             : #include "Utilities/Serialization/CharmPupable.hpp"
      15             : #include "Utilities/TMPL.hpp"
      16             : #include "Utilities/TaggedTuple.hpp"
      17             : 
      18             : /// \cond
      19             : class DataVector;
      20             : // IWYU pragma: no_forward_declare Tensor
      21             : namespace PUP {
      22             : class er;
      23             : }  // namespace PUP
      24             : /// \endcond
      25             : 
      26             : namespace ForceFree::Solutions {
      27             : 
      28             : /*!
      29             :  * \brief An electromagnetic wave propagating into \f$+x\f$ direction in flat
      30             :  * spacetime.
      31             :  *
      32             :  * The initial data is given by \cite Komissarov2002
      33             :  *
      34             :  * \f{align*}{
      35             :  *  B^x & = 1.0 , \\
      36             :  *  B^y & = \left\{\begin{array}{ll}
      37             :  *  1.0          & \text{if } x < -0.1 \\
      38             :  *  -1.5x + 0.85 & \text{if } -0.1 \leq x \leq 0.1 \\
      39             :  *  0.7          & \text{if } x > 0.1 \\
      40             :  * \end{array}\right\}, \\
      41             :  *  B^z & = 0 , \\
      42             :  *  E^x & = E^y = 0 , \\
      43             :  *  E^z & = -B^y .
      44             :  * \f}
      45             :  *
      46             :  * The electric and magnetic fields are advected to \f$+x\f$ direction with the
      47             :  * speed of light (\f$\lambda=+1\f$), and the solution at \f$(\vec{x},t)\f$ is
      48             :  *
      49             :  * \f{align*}{
      50             :  *  E^i(x,y,z,t) & = E^i(x-t,y,z,0) , \\
      51             :  *  B^i(x,y,z,t) & = B^i(x-t,y,z,0) .
      52             :  * \f}
      53             :  *
      54             :  * Electric charge density \f$q\f$ is zero everywhere.
      55             :  *
      56             :  */
      57           1 : class FastWave : public evolution::initial_data::InitialData,
      58             :                  public MarkAsAnalyticSolution {
      59             :  public:
      60           0 :   using options = tmpl::list<>;
      61           0 :   static constexpr Options::String help{
      62             :       "A fast mode wave propagating +x direction in flat spacetime"};
      63             : 
      64           0 :   FastWave() = default;
      65           0 :   FastWave(const FastWave&) = default;
      66           0 :   FastWave& operator=(const FastWave&) = default;
      67           0 :   FastWave(FastWave&&) = default;
      68           0 :   FastWave& operator=(FastWave&&) = default;
      69           0 :   ~FastWave() override = default;
      70             : 
      71           0 :   auto get_clone() const
      72             :       -> std::unique_ptr<evolution::initial_data::InitialData> override;
      73             : 
      74             :   /// \cond
      75             :   explicit FastWave(CkMigrateMessage* msg);
      76             :   using PUP::able::register_constructor;
      77             :   WRAPPED_PUPable_decl_template(FastWave);
      78             :   /// \endcond
      79             : 
      80             :   // NOLINTNEXTLINE(google-runtime-references)
      81           0 :   void pup(PUP::er& p) override;
      82             : 
      83             :   /// @{
      84             :   /// Retrieve the EM variables at (x,t).
      85           1 :   static auto variables(const tnsr::I<DataVector, 3>& x, double t,
      86             :                         tmpl::list<Tags::TildeE> /*meta*/)
      87             :       -> tuples::TaggedTuple<Tags::TildeE>;
      88             : 
      89           1 :   static auto variables(const tnsr::I<DataVector, 3>& x, double t,
      90             :                         tmpl::list<Tags::TildeB> /*meta*/)
      91             :       -> tuples::TaggedTuple<Tags::TildeB>;
      92             : 
      93           1 :   static auto variables(const tnsr::I<DataVector, 3>& x, double t,
      94             :                         tmpl::list<Tags::TildePsi> /*meta*/)
      95             :       -> tuples::TaggedTuple<Tags::TildePsi>;
      96             : 
      97           1 :   static auto variables(const tnsr::I<DataVector, 3>& x, double t,
      98             :                         tmpl::list<Tags::TildePhi> /*meta*/)
      99             :       -> tuples::TaggedTuple<Tags::TildePhi>;
     100             : 
     101           1 :   static auto variables(const tnsr::I<DataVector, 3>& x, double t,
     102             :                         tmpl::list<Tags::TildeQ> /*meta*/)
     103             :       -> tuples::TaggedTuple<Tags::TildeQ>;
     104             :   /// @}
     105             : 
     106             :   /// Retrieve a collection of EM variables at `(x, t)`
     107             :   template <typename... Tags>
     108           1 :   tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataVector, 3>& x,
     109             :                                          const double t,
     110             :                                          tmpl::list<Tags...> /*meta*/) const {
     111             :     static_assert(sizeof...(Tags) > 1,
     112             :                   "The generic template will recurse infinitely if only one "
     113             :                   "tag is being retrieved.");
     114             :     return {get<Tags>(variables(x, t, tmpl::list<Tags>{}))...};
     115             :   }
     116             : 
     117             :   /// Retrieve the metric variables
     118             :   template <typename Tag>
     119           1 :   tuples::TaggedTuple<Tag> variables(const tnsr::I<DataVector, 3>& x, double t,
     120             :                                      tmpl::list<Tag> /*meta*/) const {
     121             :     return background_spacetime_.variables(x, t, tmpl::list<Tag>{});
     122             :   }
     123             : 
     124             :  private:
     125             :   // Computes the initial profile
     126           0 :   static DataVector initial_profile(const DataVector& coords);
     127           0 :   gr::Solutions::Minkowski<3> background_spacetime_{};
     128             : 
     129           0 :   friend bool operator==(const FastWave& lhs, const FastWave& rhs);
     130           0 :   friend bool operator!=(const FastWave& lhs, const FastWave& rhs);
     131             : };
     132             : 
     133             : }  // namespace ForceFree::Solutions

Generated by: LCOV version 1.14