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 : #include <vector>
11 :
12 : #include "DataStructures/Tensor/TypeAliases.hpp"
13 : #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp"
14 : #include "Elliptic/BoundaryConditions/BoundaryConditionType.hpp"
15 : #include "Elliptic/Systems/Xcts/FluxesAndSources.hpp"
16 : #include "Options/String.hpp"
17 : #include "Utilities/Gsl.hpp"
18 : #include "Utilities/Serialization/CharmPupable.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 : /// \cond
22 : class DataVector;
23 : /// \endcond
24 :
25 : namespace Xcts::BoundaryConditions {
26 :
27 : /*!
28 : * \brief Impose flat spacetime at this boundary
29 : *
30 : * Impose \f$\psi=1\f$, \f$\alpha\psi=1\f$, \f$\beta_\mathrm{excess}^i=0\f$ on
31 : * this boundary, where \f$\psi\f$ is the conformal factor, \f$\alpha\f$ is the
32 : * lapse and \f$\beta_\mathrm{excess}^i=\beta^i-\beta_\mathrm{background}^i\f$
33 : * is the shift excess (see `Xcts::Tags::ShiftExcess` for details on the split
34 : * of the shift in background and excess). Note that this choice only truly
35 : * represents flatness if the conformal background metric is flat.
36 : *
37 : * \tparam EnabledEquations The subset of XCTS equations that are being solved
38 : */
39 : template <Xcts::Equations EnabledEquations>
40 1 : class Flatness : public elliptic::BoundaryConditions::BoundaryCondition<3> {
41 : private:
42 0 : using Base = elliptic::BoundaryConditions::BoundaryCondition<3>;
43 :
44 : public:
45 0 : using options = tmpl::list<>;
46 0 : static constexpr Options::String help =
47 : "Impose flat spacetime at this boundary.";
48 :
49 0 : Flatness() = default;
50 0 : Flatness(const Flatness&) = default;
51 0 : Flatness& operator=(const Flatness&) = default;
52 0 : Flatness(Flatness&&) = default;
53 0 : Flatness& operator=(Flatness&&) = default;
54 0 : ~Flatness() = default;
55 :
56 : /// \cond
57 : explicit Flatness(CkMigrateMessage* m) : Base(m) {}
58 : using PUP::able::register_constructor;
59 : WRAPPED_PUPable_decl_template(Flatness);
60 : /// \endcond
61 :
62 0 : std::unique_ptr<domain::BoundaryConditions::BoundaryCondition> get_clone()
63 : const override {
64 : return std::make_unique<Flatness>(*this);
65 : }
66 :
67 0 : std::vector<elliptic::BoundaryConditionType> boundary_condition_types()
68 : const override {
69 : return {[]() {
70 : if constexpr (EnabledEquations == Xcts::Equations::Hamiltonian) {
71 : return 1;
72 : } else if constexpr (EnabledEquations ==
73 : Xcts::Equations::HamiltonianAndLapse) {
74 : return 2;
75 : } else {
76 : return 5;
77 : }
78 : }(),
79 : elliptic::BoundaryConditionType::Dirichlet};
80 : }
81 :
82 0 : using argument_tags = tmpl::list<>;
83 0 : using volume_tags = tmpl::list<>;
84 :
85 0 : static void apply(
86 : gsl::not_null<Scalar<DataVector>*> conformal_factor_minus_one,
87 : gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
88 : const tnsr::i<DataVector, 3>& deriv_conformal_factor);
89 :
90 0 : static void apply(
91 : gsl::not_null<Scalar<DataVector>*> conformal_factor_minus_one,
92 : gsl::not_null<Scalar<DataVector>*> lapse_times_conformal_factor_minus_one,
93 : gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
94 : gsl::not_null<Scalar<DataVector>*>
95 : n_dot_lapse_times_conformal_factor_gradient,
96 : const tnsr::i<DataVector, 3>& deriv_conformal_factor,
97 : const tnsr::i<DataVector, 3>& deriv_lapse_times_conformal_factor);
98 :
99 0 : static void apply(
100 : gsl::not_null<Scalar<DataVector>*> conformal_factor_minus_one,
101 : gsl::not_null<Scalar<DataVector>*> lapse_times_conformal_factor_minus_one,
102 : gsl::not_null<tnsr::I<DataVector, 3>*> shift_excess,
103 : gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
104 : gsl::not_null<Scalar<DataVector>*>
105 : n_dot_lapse_times_conformal_factor_gradient,
106 : gsl::not_null<tnsr::I<DataVector, 3>*> n_dot_longitudinal_shift_excess,
107 : const tnsr::i<DataVector, 3>& deriv_conformal_factor,
108 : const tnsr::i<DataVector, 3>& deriv_lapse_times_conformal_factor,
109 : const tnsr::iJ<DataVector, 3>& deriv_shift_excess);
110 :
111 0 : using argument_tags_linearized = tmpl::list<>;
112 0 : using volume_tags_linearized = tmpl::list<>;
113 :
114 0 : static void apply_linearized(
115 : gsl::not_null<Scalar<DataVector>*> conformal_factor_correction,
116 : gsl::not_null<Scalar<DataVector>*>
117 : n_dot_conformal_factor_gradient_correction,
118 : const tnsr::i<DataVector, 3>& deriv_conformal_factor_correction);
119 :
120 0 : static void apply_linearized(
121 : gsl::not_null<Scalar<DataVector>*> conformal_factor_correction,
122 : gsl::not_null<Scalar<DataVector>*>
123 : lapse_times_conformal_factor_correction,
124 : gsl::not_null<Scalar<DataVector>*>
125 : n_dot_conformal_factor_gradient_correction,
126 : gsl::not_null<Scalar<DataVector>*>
127 : n_dot_lapse_times_conformal_factor_gradient_correction,
128 : const tnsr::i<DataVector, 3>& deriv_conformal_factor_correction,
129 : const tnsr::i<DataVector, 3>&
130 : deriv_lapse_times_conformal_factor_correction);
131 :
132 0 : static void apply_linearized(
133 : gsl::not_null<Scalar<DataVector>*> conformal_factor_correction,
134 : gsl::not_null<Scalar<DataVector>*>
135 : lapse_times_conformal_factor_correction,
136 : gsl::not_null<tnsr::I<DataVector, 3>*> shift_excess_correction,
137 : gsl::not_null<Scalar<DataVector>*>
138 : n_dot_conformal_factor_gradient_correction,
139 : gsl::not_null<Scalar<DataVector>*>
140 : n_dot_lapse_times_conformal_factor_gradient_correction,
141 : gsl::not_null<tnsr::I<DataVector, 3>*>
142 : n_dot_longitudinal_shift_excess_correction,
143 : const tnsr::i<DataVector, 3>& deriv_conformal_factor_correction,
144 : const tnsr::i<DataVector, 3>&
145 : deriv_lapse_times_conformal_factor_correction,
146 : const tnsr::iJ<DataVector, 3>& deriv_shift_excess_correction);
147 : };
148 :
149 : template <Xcts::Equations EnabledEquations>
150 0 : bool operator==(const Flatness<EnabledEquations>& lhs,
151 : const Flatness<EnabledEquations>& rhs);
152 :
153 : template <Xcts::Equations EnabledEquations>
154 0 : bool operator!=(const Flatness<EnabledEquations>& lhs,
155 : const Flatness<EnabledEquations>& rhs);
156 :
157 : } // namespace Xcts::BoundaryConditions
|