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 <pup.h>
8 :
9 : #include "DataStructures/ComplexDataVector.hpp"
10 : #include "DataStructures/DataVector.hpp"
11 : #include "DataStructures/Tensor/Tensor.hpp"
12 : #include "DataStructures/Variables.hpp"
13 : #include "DataStructures/VariablesTag.hpp"
14 : #include "Elliptic/Systems/SelfForce/Scalar/Tags.hpp"
15 : #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
16 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
17 : #include "Utilities/Gsl.hpp"
18 : #include "Utilities/MakeWithValue.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 : namespace ScalarSelfForce {
22 :
23 : /*!
24 : * \brief The first-order flux
25 : * $F^i=\{\partial_{r_\star}, \alpha \partial_{\cos\theta}\}\Psi_m$.
26 : */
27 1 : void fluxes(gsl::not_null<tnsr::I<ComplexDataVector, 2>*> flux,
28 : const Scalar<ComplexDataVector>& alpha,
29 : const tnsr::i<ComplexDataVector, 2>& field_gradient);
30 :
31 : /*!
32 : * \brief The first-order flux on an element face
33 : * $F^i=\{n_{r_\star}, \alpha n_{\cos\theta}\}\Psi_m$.
34 : */
35 1 : void fluxes_on_face(gsl::not_null<tnsr::I<ComplexDataVector, 2>*> flux,
36 : const Scalar<ComplexDataVector>& alpha,
37 : const tnsr::I<DataVector, 2>& face_normal_vector,
38 : const Scalar<ComplexDataVector>& field);
39 :
40 : /*!
41 : * \brief The source term $\beta \Psi_m + \gamma_i F^i$.
42 : */
43 1 : void add_sources(gsl::not_null<Scalar<ComplexDataVector>*> source,
44 : const Scalar<ComplexDataVector>& beta,
45 : const tnsr::i<ComplexDataVector, 2>& gamma,
46 : const Scalar<ComplexDataVector>& field,
47 : const tnsr::I<ComplexDataVector, 2>& flux);
48 :
49 : /// Fluxes $F^i$ for the scalar self-force system.
50 : /// \see ScalarSelfForce::FirstOrderSystem
51 1 : struct Fluxes {
52 0 : using argument_tags = tmpl::list<Tags::Alpha>;
53 0 : using volume_tags = tmpl::list<>;
54 0 : using const_global_cache_tags = tmpl::list<>;
55 0 : static constexpr bool is_trivial = false;
56 0 : static constexpr bool is_discontinuous = false;
57 0 : static void apply(gsl::not_null<tnsr::I<ComplexDataVector, 2>*> flux,
58 : const Scalar<ComplexDataVector>& alpha,
59 : const Scalar<ComplexDataVector>& /*field*/,
60 : const tnsr::i<ComplexDataVector, 2>& field_gradient);
61 0 : static void apply(gsl::not_null<tnsr::I<ComplexDataVector, 2>*> flux,
62 : const Scalar<ComplexDataVector>& alpha,
63 : const tnsr::i<DataVector, 2>& /*face_normal*/,
64 : const tnsr::I<DataVector, 2>& face_normal_vector,
65 : const Scalar<ComplexDataVector>& field);
66 : };
67 :
68 : /// Source terms for the scalar self-force system.
69 : /// \see ScalarSelfForce::FirstOrderSystem
70 1 : struct Sources {
71 0 : using argument_tags = tmpl::list<Tags::Beta, Tags::Gamma>;
72 0 : using const_global_cache_tags = tmpl::list<>;
73 0 : static void apply(gsl::not_null<Scalar<ComplexDataVector>*> scalar_equation,
74 : const Scalar<ComplexDataVector>& beta,
75 : const tnsr::i<ComplexDataVector, 2>& gamma,
76 : const Scalar<ComplexDataVector>& field,
77 : const tnsr::I<ComplexDataVector, 2>& flux);
78 : };
79 :
80 : /*!
81 : * \brief Adds or subtracts the singular field to/from the received data on
82 : * element boundaries.
83 : *
84 : * In the regularized region we solve for the regularized field
85 : * \begin{equation}
86 : * \Psi_m^R = \Psi_m - \Psi_m^P
87 : * \text{,}
88 : * \end{equation}
89 : * so we subtract the singular field on the regularized side and add it on the
90 : * other side of the boundary. We do the same for the received normal dot flux
91 : * $n_i F^i$, but with an extra minus sign because this quantity is defined with
92 : * the face normal from the perspective of the sending element (see
93 : * `elliptic::protocols::FirstOrderSystem`).
94 : */
95 1 : struct ModifyBoundaryData {
96 : private:
97 0 : static constexpr size_t Dim = 2;
98 0 : using singular_vars_on_mortars_tag =
99 : ::Tags::Variables<tmpl::list<Tags::SingularField,
100 : ::Tags::NormalDotFlux<Tags::SingularField>>>;
101 :
102 : public:
103 0 : using argument_tags =
104 : tmpl::list<Tags::FieldIsRegularized,
105 : ::Tags::Mortars<Tags::FieldIsRegularized, Dim>,
106 : ::Tags::Mortars<singular_vars_on_mortars_tag, Dim>>;
107 0 : static void apply(
108 : gsl::not_null<Scalar<ComplexDataVector>*> field,
109 : gsl::not_null<Scalar<ComplexDataVector>*> n_dot_flux,
110 : const DirectionalId<Dim>& mortar_id, bool field_is_regularized,
111 : const DirectionalIdMap<Dim, bool>& neighbors_field_is_regularized,
112 : const DirectionalIdMap<Dim, typename singular_vars_on_mortars_tag::type>&
113 : singular_vars_on_mortars);
114 : };
115 :
116 : } // namespace ScalarSelfForce
|