Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <array> 7 : #include <cstddef> 8 : #include <limits> 9 : 10 : #include "DataStructures/DataVector.hpp" 11 : #include "DataStructures/Tensor/EagerMath/DotProduct.hpp" 12 : #include "DataStructures/Tensor/Tensor.hpp" 13 : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp" 14 : #include "Evolution/Systems/CurvedScalarWave/Worldtube/PunctureField.hpp" 15 : #include "Options/Context.hpp" 16 : #include "Options/String.hpp" 17 : #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp" 18 : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/KerrSchild.hpp" 19 : #include "PointwiseFunctions/GeneralRelativity/GeodesicAcceleration.hpp" 20 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 21 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp" 22 : #include "Utilities/MakeWithValue.hpp" 23 : #include "Utilities/TMPL.hpp" 24 : #include "Utilities/TaggedTuple.hpp" 25 : 26 1 : namespace CurvedScalarWave::AnalyticData { 27 : 28 : /*! 29 : * \brief Analytic initial data for a scalar point charge in Kerr-Schild 30 : * coordinates. This assumes the charge is initially on a geodesic orbit. 31 : * 32 : * \details The initial data corresponds to the zeroth order puncture field 33 : * which is effectively the Lorentz-boosted solution of a scalar charge in flat 34 : * space. 35 : */ 36 : 37 1 : class ZerothOrderPuncture : public evolution::initial_data::InitialData, 38 : public MarkAsAnalyticData { 39 : public: 40 0 : struct ParticlePosition { 41 0 : using type = std::array<double, 3>; 42 0 : static constexpr Options::String help = { 43 : "The initial position of the scalar charge."}; 44 : }; 45 : 46 0 : struct ParticleVelocity { 47 0 : using type = std::array<double, 3>; 48 0 : static constexpr Options::String help = { 49 : "The initial velocity of the scalar charge"}; 50 : }; 51 : 52 0 : struct ParticleCharge { 53 0 : using type = double; 54 0 : static constexpr Options::String help = { 55 : "The value of the particle's charge."}; 56 0 : static constexpr double lower_bound() { return 0.; } 57 0 : static constexpr double upper_bound() { return 1.; } 58 : }; 59 : 60 0 : using options = 61 : tmpl::list<ParticlePosition, ParticleVelocity, ParticleCharge>; 62 : 63 0 : static constexpr Options::String help = { 64 : "Initial data for a scalar charge in Kerr-Schild coordinates. It " 65 : "corresponds to the zeroth order puncture field which is the " 66 : "Lorentz-boosted solution of a scalar charge in flat space."}; 67 : 68 0 : ZerothOrderPuncture() = default; 69 : 70 0 : ZerothOrderPuncture(std::array<double, 3> particle_position, 71 : std::array<double, 3> particle_velocity, 72 : double particle_charge, 73 : const Options::Context& context = {}); 74 0 : ZerothOrderPuncture(const ZerothOrderPuncture&) = default; 75 0 : ZerothOrderPuncture& operator=(const ZerothOrderPuncture&) = default; 76 0 : ZerothOrderPuncture(ZerothOrderPuncture&&) = default; 77 0 : ZerothOrderPuncture& operator=(ZerothOrderPuncture&&) = default; 78 0 : ~ZerothOrderPuncture() override = default; 79 : 80 0 : auto get_clone() const 81 : -> std::unique_ptr<evolution::initial_data::InitialData> override; 82 : 83 : /// \cond 84 : explicit ZerothOrderPuncture(CkMigrateMessage* msg); 85 : using PUP::able::register_constructor; 86 : WRAPPED_PUPable_decl_template(ZerothOrderPuncture); 87 : /// \endcond 88 : 89 0 : static constexpr size_t volume_dim = 3; 90 0 : using tags = 91 : tmpl::list<CurvedScalarWave::Tags::Psi, CurvedScalarWave::Tags::Pi, 92 : CurvedScalarWave::Tags::Phi<3>>; 93 : 94 : /// Retrieve the evolution variables at spatial coordinates `x` 95 : tuples::TaggedTuple<CurvedScalarWave::Tags::Psi, CurvedScalarWave::Tags::Pi, 96 : CurvedScalarWave::Tags::Phi<3>> 97 1 : variables(const tnsr::I<DataVector, 3>& x, tags /*meta*/) const; 98 : 99 : // NOLINTNEXTLINE(google-runtime-references) 100 0 : void pup(PUP::er& /*p*/) override; 101 : 102 : private: 103 : // assume a non-spinning black hole of mass 1M centered on the coordinate 104 : // origin 105 0 : gr::Solutions::KerrSchild kerr_schild_{1., {{0., 0., 0.}}, {{0., 0., 0.}}}; 106 0 : tnsr::I<double, 3> particle_position_{ 107 : std::numeric_limits<double>::signaling_NaN()}; 108 0 : tnsr::I<double, 3> particle_velocity_{ 109 : std::numeric_limits<double>::signaling_NaN()}; 110 0 : tnsr::I<double, 3> geodesic_acceleration_{ 111 : std::numeric_limits<double>::signaling_NaN()}; 112 0 : double particle_charge_{std::numeric_limits<double>::signaling_NaN()}; 113 : 114 0 : friend bool operator==(const ZerothOrderPuncture& lhs, 115 : const ZerothOrderPuncture& rhs); 116 : 117 0 : friend bool operator!=(const ZerothOrderPuncture& lhs, 118 : const ZerothOrderPuncture& rhs); 119 : }; 120 : 121 : } // namespace CurvedScalarWave::AnalyticData