Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <memory> 8 : #include <pup.h> 9 : #include <string> 10 : 11 : #include "DataStructures/Tensor/TypeAliases.hpp" 12 : #include "Evolution/Systems/GeneralizedHarmonic/GaugeSourceFunctions/Gauges.hpp" 13 : #include "Options/String.hpp" 14 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp" 15 : #include "Utilities/TMPL.hpp" 16 : 17 : /// \cond 18 : class DataVector; 19 : namespace gsl { 20 : template <class T> 21 : class not_null; 22 : } // namespace gsl 23 : template <size_t Dim> 24 : class Mesh; 25 : /// \endcond 26 : 27 1 : namespace gh::gauges { 28 : /*! 29 : * \brief Imposes the analytic gauge condition, 30 : * \f$H_a=\Gamma_a^{\mathrm{analytic}}\f$ from an analytic solution or analytic 31 : * data. 32 : * 33 : * \warning Assumes \f$\partial_t \Gamma_a=0\f$ i.e. the solution is static or 34 : * in harmonic gauge. 35 : */ 36 1 : class AnalyticChristoffel final : public GaugeCondition { 37 : public: 38 : /// \brief What analytic solution/data to prescribe. 39 1 : struct AnalyticPrescription { 40 0 : static constexpr Options::String help = 41 : "What analytic solution/data to prescribe."; 42 0 : using type = std::unique_ptr<evolution::initial_data::InitialData>; 43 : }; 44 : 45 0 : using options = tmpl::list<AnalyticPrescription>; 46 : 47 0 : static constexpr Options::String help{ 48 : "Apply the analytic gauge condition H_a = Gamma_a, where Gamma_a comes " 49 : "from the AnalyticPrescription."}; 50 : 51 0 : AnalyticChristoffel() = default; 52 0 : AnalyticChristoffel(const AnalyticChristoffel&); 53 0 : AnalyticChristoffel& operator=(const AnalyticChristoffel&); 54 0 : AnalyticChristoffel(AnalyticChristoffel&&) = default; 55 0 : AnalyticChristoffel& operator=(AnalyticChristoffel&&) = default; 56 0 : ~AnalyticChristoffel() override = default; 57 : 58 0 : explicit AnalyticChristoffel( 59 : std::unique_ptr<evolution::initial_data::InitialData> 60 : analytic_prescription); 61 : 62 : /// \cond 63 : explicit AnalyticChristoffel(CkMigrateMessage* msg); 64 : using PUP::able::register_constructor; 65 : WRAPPED_PUPable_decl_template(AnalyticChristoffel); // NOLINT 66 : /// \endcond 67 : 68 : template <size_t SpatialDim> 69 0 : void gauge_and_spacetime_derivative( 70 : gsl::not_null<tnsr::a<DataVector, SpatialDim, Frame::Inertial>*> gauge_h, 71 : gsl::not_null<tnsr::ab<DataVector, SpatialDim, Frame::Inertial>*> 72 : d4_gauge_h, 73 : const Mesh<SpatialDim>& mesh, const double time, 74 : const tnsr::I<DataVector, SpatialDim, Frame::Inertial>& inertial_coords, 75 : const InverseJacobian<DataVector, SpatialDim, Frame::ElementLogical, 76 : Frame::Inertial>& inverse_jacobian) const; 77 : 78 : // NOLINTNEXTLINE(google-runtime-references) 79 0 : void pup(PUP::er& p) override; 80 : 81 0 : std::unique_ptr<GaugeCondition> get_clone() const override; 82 : 83 : private: 84 0 : std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_; 85 : }; 86 : } // namespace gh::gauges