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 :
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "DataStructures/DataVector.hpp"
11 : #include "DataStructures/Tensor/TypeAliases.hpp"
12 : #include "DataStructures/Variables.hpp"
13 : #include "DataStructures/VariablesTag.hpp"
14 : #include "Domain/Tags.hpp"
15 : #include "Evolution/Systems/GeneralizedHarmonic/GaugeSourceFunctions/Gauges.hpp"
16 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
17 : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
18 : #include "Options/String.hpp"
19 : #include "ParallelAlgorithms/Events/Tags.hpp"
20 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
21 : #include "Utilities/Gsl.hpp"
22 :
23 : /// \cond
24 : namespace Tags {
25 : struct Time;
26 : } // namespace Tags
27 : namespace gh::OptionTags {
28 : struct Group;
29 : } // namespace gh::OptionTags
30 : /// \endcond
31 :
32 : namespace gh::gauges {
33 : namespace OptionTags {
34 0 : struct GaugeCondition {
35 0 : using type = std::unique_ptr<gauges::GaugeCondition>;
36 0 : static constexpr Options::String help{"The gauge condition to impose."};
37 0 : using group = gh::OptionTags::Group;
38 : };
39 : } // namespace OptionTags
40 :
41 : namespace Tags {
42 : /// \brief The gauge condition to impose.
43 1 : struct GaugeCondition : db::SimpleTag {
44 0 : using type = std::unique_ptr<gauges::GaugeCondition>;
45 0 : using option_tags = tmpl::list<gh::gauges::OptionTags::GaugeCondition>;
46 :
47 0 : static constexpr bool pass_metavariables = false;
48 0 : static std::unique_ptr<gauges::GaugeCondition> create_from_options(
49 : const std::unique_ptr<gauges::GaugeCondition>& gauge_condition) {
50 : return gauge_condition->get_clone();
51 : }
52 : };
53 :
54 : /// \brief Gauge condition \f$H_a\f$ and its spacetime derivative
55 : /// \f$\partial_b H_a\f$
56 : template <size_t Dim>
57 1 : struct GaugeAndDerivativeCompute
58 : : ::Tags::Variables<
59 : tmpl::list<::gh::Tags::GaugeH<DataVector, Dim>,
60 : ::gh::Tags::SpacetimeDerivGaugeH<DataVector, Dim>>>,
61 : db::ComputeTag {
62 0 : using base = ::Tags::Variables<
63 : tmpl::list<::gh::Tags::GaugeH<DataVector, Dim>,
64 : ::gh::Tags::SpacetimeDerivGaugeH<DataVector, Dim>>>;
65 0 : using return_type = typename base::type;
66 0 : using argument_tags = tmpl::list<
67 : gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, Dim>,
68 : gr::Tags::SpacetimeNormalVector<DataVector, Dim>,
69 : gr::Tags::SqrtDetSpatialMetric<DataVector>,
70 : gr::Tags::InverseSpatialMetric<DataVector, Dim>,
71 : gr::Tags::SpacetimeMetric<DataVector, Dim>, gh::Tags::Pi<DataVector, Dim>,
72 : gh::Tags::Phi<DataVector, Dim>, ::Events::Tags::ObserverMesh<Dim>,
73 : ::Tags::Time, ::Events::Tags::ObserverCoordinates<Dim, Frame::Inertial>,
74 : ::Events::Tags::ObserverInverseJacobian<Dim, Frame::ElementLogical,
75 : Frame::Inertial>,
76 : Tags::GaugeCondition>;
77 :
78 0 : static void function(
79 : gsl::not_null<return_type*> gauge_and_deriv,
80 : const Scalar<DataVector>& lapse,
81 : const tnsr::I<DataVector, Dim, Frame::Inertial>& shift,
82 : const tnsr::A<DataVector, Dim, Frame::Inertial>& spacetime_unit_normal,
83 : const Scalar<DataVector>& sqrt_det_spatial_metric,
84 : const tnsr::II<DataVector, Dim, Frame::Inertial>& inverse_spatial_metric,
85 : const tnsr::aa<DataVector, Dim, Frame::Inertial>& spacetime_metric,
86 : const tnsr::aa<DataVector, Dim, Frame::Inertial>& pi,
87 : const tnsr::iaa<DataVector, Dim, Frame::Inertial>& phi,
88 : const Mesh<Dim>& mesh, double time,
89 : const tnsr::I<DataVector, Dim, Frame::Inertial>& inertial_coords,
90 : const InverseJacobian<DataVector, Dim, Frame::ElementLogical,
91 : Frame::Inertial>& inverse_jacobian,
92 : const gauges::GaugeCondition& gauge_condition);
93 : };
94 : } // namespace Tags
95 : } // namespace gh::gauges
|