Flatness.hpp
1 // 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 
12 #include "Elliptic/BoundaryConditions/BoundaryCondition.hpp"
13 #include "Options/Options.hpp"
15 #include "Utilities/Gsl.hpp"
16 #include "Utilities/TMPL.hpp"
17 
18 /// \cond
19 class DataVector;
20 /// \endcond
21 
22 namespace Xcts::BoundaryConditions {
23 namespace detail {
24 
25 struct FlatnessImpl {
26  using options = tmpl::list<>;
27  static constexpr Options::String help =
28  "Impose flat spacetime at this boundary.";
29 
30  using argument_tags = tmpl::list<>;
31  using volume_tags = tmpl::list<>;
32 
33  static void apply(gsl::not_null<Scalar<DataVector>*> conformal_factor,
35  n_dot_conformal_factor_gradient) noexcept;
36 
37  static void apply(
38  gsl::not_null<Scalar<DataVector>*> conformal_factor,
39  gsl::not_null<Scalar<DataVector>*> lapse_times_conformal_factor,
40  gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
42  n_dot_lapse_times_conformal_factor_gradient) noexcept;
43 
44  static void apply(
45  gsl::not_null<Scalar<DataVector>*> conformal_factor,
46  gsl::not_null<Scalar<DataVector>*> lapse_times_conformal_factor,
47  gsl::not_null<tnsr::I<DataVector, 3>*> shift_excess,
48  gsl::not_null<Scalar<DataVector>*> n_dot_conformal_factor_gradient,
50  n_dot_lapse_times_conformal_factor_gradient,
51  gsl::not_null<tnsr::I<DataVector, 3>*>
52  n_dot_longitudinal_shift_excess) noexcept;
53 
54  using argument_tags_linearized = tmpl::list<>;
55  using volume_tags_linearized = tmpl::list<>;
56 
57  static void apply_linearized(
58  gsl::not_null<Scalar<DataVector>*> conformal_factor_correction,
60  n_dot_conformal_factor_gradient_correction) noexcept;
61 
62  static void apply_linearized(
63  gsl::not_null<Scalar<DataVector>*> conformal_factor_correction,
65  lapse_times_conformal_factor_correction,
67  n_dot_conformal_factor_gradient_correction,
69  n_dot_lapse_times_conformal_factor_gradient_correction) noexcept;
70 
71  static void apply_linearized(
72  gsl::not_null<Scalar<DataVector>*> conformal_factor_correction,
74  lapse_times_conformal_factor_correction,
75  gsl::not_null<tnsr::I<DataVector, 3>*> shift_excess_correction,
77  n_dot_conformal_factor_gradient_correction,
79  n_dot_lapse_times_conformal_factor_gradient_correction,
80  gsl::not_null<tnsr::I<DataVector, 3>*>
81  n_dot_longitudinal_shift_excess_correction) noexcept;
82 };
83 
84 bool operator==(const FlatnessImpl& lhs, const FlatnessImpl& rhs) noexcept;
85 
86 bool operator!=(const FlatnessImpl& lhs, const FlatnessImpl& rhs) noexcept;
87 
88 } // namespace detail
89 
90 // The following implements the registration and factory-creation mechanism
91 
92 /// \cond
93 template <typename Registrars>
94 struct Flatness;
95 
96 namespace Registrars {
97 struct Flatness {
98  template <typename Registrars>
100 };
101 } // namespace Registrars
102 /// \endcond
103 
104 /*!
105  * \brief Impose flat spacetime at this boundary
106  *
107  * Impose \f$\psi=1\f$, \f$\alpha\psi=1\f$, \f$\beta_\mathrm{excess}^i=0\f$ on
108  * this boundary, where \f$\psi\f$ is the conformal factor, \f$\alpha\f$ is the
109  * lapse and \f$\beta_\mathrm{excess}^i=\beta^i-\beta_\mathrm{background}^i\f$
110  * is the shift excess (see `Xcts::Tags::ShiftExcess` for details on the split
111  * of the shift in background and excess). Note that this choice only truly
112  * represents flatness if the conformal background metric is flat.
113  */
114 template <typename Registrars = tmpl::list<Registrars::Flatness>>
115 class Flatness
116  : public elliptic::BoundaryConditions::BoundaryCondition<3, Registrars>,
117  public detail::FlatnessImpl {
118  private:
120 
121  public:
122  Flatness() = default;
123  Flatness(const Flatness&) noexcept = default;
124  Flatness& operator=(const Flatness&) noexcept = default;
125  Flatness(Flatness&&) noexcept = default;
126  Flatness& operator=(Flatness&&) noexcept = default;
127  ~Flatness() noexcept = default;
128 
129  /// \cond
130  explicit Flatness(CkMigrateMessage* m) noexcept : Base(m) {}
131  using PUP::able::register_constructor;
133  /// \endcond
134 
136  const noexcept override {
137  return std::make_unique<Flatness>(*this);
138  }
139 };
140 
141 /// \cond
142 template <typename Registrars>
143 PUP::able::PUP_ID Flatness<Registrars>::my_PUP_ID = 0; // NOLINT
144 /// \endcond
145 
146 } // namespace Xcts::BoundaryConditions
CharmPupable.hpp
Options.hpp
Xcts::BoundaryConditions::Flatness
Impose flat spacetime at this boundary.
Definition: Flatness.hpp:115
WRAPPED_PUPable_decl_template
#define WRAPPED_PUPable_decl_template(className)
Mark derived classes as serializable.
Definition: CharmPupable.hpp:22
cstddef
elliptic::BoundaryConditions::BoundaryCondition
Base class for boundary conditions for elliptic systems.
Definition: BoundaryCondition.hpp:91
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
memory
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
TypeAliases.hpp
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
std::unique_ptr< domain::BoundaryConditions::BoundaryCondition >
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13
string