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 <string>
9 :
10 : #include "DataStructures/SpinWeighted.hpp"
11 : #include "DataStructures/Tensor/TypeAliases.hpp"
12 : #include "Evolution/Systems/Cce/Initialize/InitializeJ.hpp"
13 : #include "Utilities/Gsl.hpp"
14 : #include "Utilities/Serialization/CharmPupable.hpp"
15 : #include "Utilities/TMPL.hpp"
16 :
17 : /// \cond
18 : class ComplexDataVector;
19 : /// \endcond
20 :
21 : namespace Cce {
22 : namespace InitializeJ {
23 :
24 : /*!
25 : * \brief Initialize \f$J\f$ on the first hypersurface from provided boundary
26 : * values of \f$J\f$, \f$R\f$, and \f$\partial_r J\f$.
27 : *
28 : * \details This initial data is chosen to take the function:
29 : *
30 : * \f[ J = \frac{A}{r} + \frac{B}{r^3},\f]
31 : *
32 : * where
33 : *
34 : * \f{align*}{
35 : * A &= R \left( \frac{3}{2} J|_{r = R} + \frac{1}{2} R \partial_r J|_{r =
36 : * R}\right) \notag\\
37 : * B &= - \frac{1}{2} R^3 (J|_{r = R} + R \partial_r J|_{r = R})
38 : * \f}
39 : */
40 : template <>
41 1 : struct InverseCubic<true> : InitializeJ<true> {
42 0 : using options = tmpl::list<>;
43 0 : static constexpr Options::String help = {
44 : "Initialization process where J is set to a simple Ansatz with a\n"
45 : " A/r + B/r^3 piece such that it is smooth with the Cauchy data at the \n"
46 : "worldtube"};
47 :
48 0 : WRAPPED_PUPable_decl_template(InverseCubic); // NOLINT
49 0 : explicit InverseCubic(CkMigrateMessage* /*unused*/) {}
50 :
51 0 : InverseCubic() = default;
52 :
53 0 : std::unique_ptr<InitializeJ> get_clone() const override;
54 :
55 0 : void operator()(
56 : gsl::not_null<Scalar<SpinWeighted<ComplexDataVector, 2>>*> j,
57 : gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_cauchy_coordinates,
58 : gsl::not_null<
59 : tnsr::i<DataVector, 2, ::Frame::Spherical<::Frame::Inertial>>*>
60 : angular_cauchy_coordinates,
61 : gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_inertial_coordinates,
62 : gsl::not_null<
63 : tnsr::i<DataVector, 2, ::Frame::Spherical<::Frame::Inertial>>*>
64 : angular_inertial_coordinates,
65 : const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_j,
66 : const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_dr_j,
67 : const Scalar<SpinWeighted<ComplexDataVector, 0>>& r,
68 : const Scalar<SpinWeighted<ComplexDataVector, 0>>& beta, size_t l_max,
69 : size_t number_of_radial_points,
70 : gsl::not_null<Parallel::NodeLock*> hdf5_lock) const override;
71 :
72 0 : void pup(PUP::er& /*p*/) override;
73 : };
74 :
75 : /*!
76 : * \brief Initialize \f$J\f$ on the first hypersurface from provided boundary
77 : * values of \f$J\f$, \f$R\f$, and \f$\partial_r J\f$.
78 : *
79 : * \details This initial data is chosen to take the function:
80 : *
81 : * \f[ J = \frac{A}{r} + \frac{B}{r^3},\f]
82 : *
83 : * where
84 : *
85 : * \f{align*}{
86 : * A &= R \left( \frac{3}{2} J|_{r = R} + \frac{1}{2} R \partial_r J|_{r =
87 : * R}\right) \notag\\
88 : * B &= - \frac{1}{2} R^3 (J|_{r = R} + R \partial_r J|_{r = R})
89 : * \f}
90 : */
91 : template <>
92 1 : struct InverseCubic<false> : InitializeJ<false> {
93 0 : using options = tmpl::list<>;
94 0 : static constexpr Options::String help = {
95 : "Initialization process where J is set to a simple Ansatz with a\n"
96 : " A/r + B/r^3 piece such that it is smooth with the Cauchy data at the \n"
97 : "worldtube"};
98 :
99 0 : WRAPPED_PUPable_decl_template(InverseCubic); // NOLINT
100 0 : explicit InverseCubic(CkMigrateMessage* /*unused*/) {}
101 :
102 0 : InverseCubic() = default;
103 :
104 0 : std::unique_ptr<InitializeJ> get_clone() const override;
105 :
106 0 : void operator()(
107 : gsl::not_null<Scalar<SpinWeighted<ComplexDataVector, 2>>*> j,
108 : gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_cauchy_coordinates,
109 : gsl::not_null<
110 : tnsr::i<DataVector, 2, ::Frame::Spherical<::Frame::Inertial>>*>
111 : angular_cauchy_coordinates,
112 : const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_j,
113 : const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_dr_j,
114 : const Scalar<SpinWeighted<ComplexDataVector, 0>>& r,
115 : const Scalar<SpinWeighted<ComplexDataVector, 0>>& beta, size_t l_max,
116 : size_t number_of_radial_points,
117 : gsl::not_null<Parallel::NodeLock*> hdf5_lock) const override;
118 :
119 0 : void pup(PUP::er& /*p*/) override;
120 : };
121 : } // namespace InitializeJ
122 : } // namespace Cce
|