Constraints.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 ///\file
5 /// Defines functions to calculate the generalized harmonic constraints
6 
7 #pragma once
8 
9 #include <cstddef>
10 
12 #include "DataStructures/DataBox/Tag.hpp"
13 #include "DataStructures/DataVector.hpp"
15 #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Tags.hpp"
16 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
18 #include "Utilities/ContainerHelpers.hpp"
19 #include "Utilities/TMPL.hpp"
20 
21 /// \cond
22 namespace gsl {
23 template <typename T>
24 class not_null;
25 } // namespace gsl
26 /// \endcond
27 
28 namespace GeneralizedHarmonic {
29 /// @{
30 /*!
31  * \brief Computes the generalized-harmonic 3-index constraint.
32  *
33  * \details Computes the generalized-harmonic 3-index constraint,
34  * \f$C_{iab} = \partial_i\psi_{ab} - \Phi_{iab},\f$ which is
35  * given by Eq. (26) of \cite Lindblom2005qh
36  */
37 template <size_t SpatialDim, typename Frame, typename DataType>
38 tnsr::iaa<DataType, SpatialDim, Frame> three_index_constraint(
39  const tnsr::iaa<DataType, SpatialDim, Frame>& d_spacetime_metric,
40  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
41 
42 template <size_t SpatialDim, typename Frame, typename DataType>
44  gsl::not_null<tnsr::iaa<DataType, SpatialDim, Frame>*> constraint,
45  const tnsr::iaa<DataType, SpatialDim, Frame>& d_spacetime_metric,
46  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
47 /// @}
48 
49 /// @{
50 /*!
51  * \brief Computes the generalized-harmonic gauge constraint.
52  *
53  * \details Computes the generalized-harmonic gauge constraint
54  * [Eq. (40) of \cite Lindblom2005qh],
55  * \f[
56  * C_a = H_a + g^{ij} \Phi_{ija} + t^b \Pi_{ba}
57  * - \frac{1}{2} g^i_a \psi^{bc} \Phi_{ibc}
58  * - \frac{1}{2} t_a \psi^{bc} \Pi_{bc},
59  * \f]
60  * where \f$H_a\f$ is the gauge function,
61  * \f$\psi_{ab}\f$ is the spacetime metric,
62  * \f$\Pi_{ab}=-t^c\partial_c \psi_{ab}\f$, and
63  * \f$\Phi_{iab} = \partial_i\psi_{ab}\f$; \f$t^a\f$ is the timelike unit
64  * normal vector to the spatial slice, \f$g^{ij}\f$ is the inverse spatial
65  * metric, and \f$g^b_c = \delta^b_c + t^b t_c\f$.
66  */
67 template <size_t SpatialDim, typename Frame, typename DataType>
68 tnsr::a<DataType, SpatialDim, Frame> gauge_constraint(
69  const tnsr::a<DataType, SpatialDim, Frame>& gauge_function,
70  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
71  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
72  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
73  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
74  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
75  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
76 
77 template <size_t SpatialDim, typename Frame, typename DataType>
78 void gauge_constraint(
79  gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> constraint,
80  const tnsr::a<DataType, SpatialDim, Frame>& gauge_function,
81  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
82  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
83  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
84  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
85  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
86  const tnsr::iaa<DataType, SpatialDim, Frame>& phi) noexcept;
87 /// @}
88 
89 /// @{
90 /*!
91  * \brief Computes the generalized-harmonic 2-index constraint.
92  *
93  * \details Computes the generalized-harmonic 2-index constraint
94  * [Eq. (44) of \cite Lindblom2005qh],
95  * \f{eqnarray}{
96  * C_{ia} &\equiv& g^{jk}\partial_j \Phi_{ika}
97  * - \frac{1}{2} g_a^j\psi^{cd}\partial_j \Phi_{icd}
98  * + t^b \partial_i \Pi_{ba}
99  * - \frac{1}{2} t_a \psi^{cd}\partial_i\Pi_{cd}
100  * \nonumber\\&&
101  * + \partial_i H_a
102  * + \frac{1}{2} g_a^j \Phi_{jcd} \Phi_{ief}
103  * \psi^{ce}\psi^{df}
104  * + \frac{1}{2} g^{jk} \Phi_{jcd} \Phi_{ike}
105  * \psi^{cd}t^e t_a
106  * \nonumber\\&&
107  * - g^{jk}g^{mn}\Phi_{jma}\Phi_{ikn}
108  * + \frac{1}{2} \Phi_{icd} \Pi_{be} t_a
109  * \left(\psi^{cb}\psi^{de}
110  * +\frac{1}{2}\psi^{be} t^c t^d\right)
111  * \nonumber\\&&
112  * - \Phi_{icd} \Pi_{ba} t^c \left(\psi^{bd}
113  * +\frac{1}{2} t^b t^d\right)
114  * + \frac{1}{2} \gamma_2 \left(t_a \psi^{cd}
115  * - 2 \delta^c_a t^d\right) C_{icd}.
116  * \f}
117  * where \f$H_a\f$ is the gauge function,
118  * \f$\psi_{ab}\f$ is the spacetime metric,
119  * \f$\Pi_{ab}=-t^c\partial_c \psi_{ab}\f$, and
120  * \f$\Phi_{iab} = \partial_i\psi_{ab}\f$; \f$t^a\f$ is the timelike unit
121  * normal vector to the spatial slice, \f$g^{ij}\f$ is the inverse spatial
122  * metric, and \f$g^b_c = \delta^b_c + t^b t_c\f$.
123  */
124 template <size_t SpatialDim, typename Frame, typename DataType>
125 tnsr::ia<DataType, SpatialDim, Frame> two_index_constraint(
126  const tnsr::ab<DataType, SpatialDim, Frame>& spacetime_d_gauge_function,
127  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
128  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
129  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
130  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
131  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
132  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
133  const tnsr::iaa<DataType, SpatialDim, Frame>& d_pi,
134  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi,
135  const Scalar<DataType>& gamma2,
136  const tnsr::iaa<DataType, SpatialDim, Frame>&
137  three_index_constraint) noexcept;
138 
139 template <size_t SpatialDim, typename Frame, typename DataType>
141  gsl::not_null<tnsr::ia<DataType, SpatialDim, Frame>*> constraint,
142  const tnsr::ab<DataType, SpatialDim, Frame>& spacetime_d_gauge_function,
143  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
144  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
145  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
146  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
147  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
148  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
149  const tnsr::iaa<DataType, SpatialDim, Frame>& d_pi,
150  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi,
151  const Scalar<DataType>& gamma2,
152  const tnsr::iaa<DataType, SpatialDim, Frame>&
153  three_index_constraint) noexcept;
154 /// @}
155 
156 /// @{
157 /*!
158  * \brief Computes the generalized-harmonic 4-index constraint.
159  *
160  * \details Computes the independent components of the generalized-harmonic
161  * 4-index constraint. The constraint itself is given by Eq. (45) of
162  * \cite Lindblom2005qh,
163  * \f{eqnarray}{
164  * C_{ijab} = 2 \partial_{[i}\Phi_{j]ab},
165  * \f}
166  * where \f$\Phi_{iab} = \partial_i\psi_{ab}\f$. Because the constraint is
167  * antisymmetric on the two spatial indices, here we compute and store
168  * only the independent components of \f$C_{ijab}\f$. Specifically, we
169  * compute
170  * \f{eqnarray}{
171  * D_{iab} \equiv \frac{1}{2} \epsilon_{i}{}^{jk} C_{jkab}
172  * = \epsilon_{i}{}^{jk} \partial_j \Phi_{kab},
173  * \f}
174  * where \f$\epsilon_{ijk}\f$ is the flat-space Levi-Civita symbol,
175  * which is raised and lowered with the Kronecker delta.
176  * In terms
177  * of \f$D_{iab}\f$, the full 4-index constraint is
178  * \f{eqnarray}{
179  * C_{jkab} = \epsilon^{i}{}_{jk} D_{iab}.
180  * \f}
181  */
182 template <size_t SpatialDim, typename Frame, typename DataType>
183 tnsr::iaa<DataType, SpatialDim, Frame> four_index_constraint(
184  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi) noexcept;
185 
186 template <size_t SpatialDim, typename Frame, typename DataType>
188  gsl::not_null<tnsr::iaa<DataType, SpatialDim, Frame>*> constraint,
189  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi) noexcept;
190 /// @}
191 
192 /// @{
193 /*!
194  * \brief Computes the generalized-harmonic F constraint.
195  *
196  * \details Computes the generalized-harmonic F constraint
197  * [Eq. (43) of \cite Lindblom2005qh],
198  * \f{eqnarray}{
199  * {\cal F}_a &\equiv&
200  * \frac{1}{2} g_a^i \psi^{bc}\partial_i \Pi_{bc}
201  * - g^{ij} \partial_i \Pi_{ja}
202  * - g^{ij} t^b \partial_i \Phi_{jba}
203  * + \frac{1}{2} t_a \psi^{bc} g^{ij} \partial_i \Phi_{jbc}
204  * \nonumber \\ &&
205  * + t_a g^{ij} \partial_i H_j
206  * + g_a^i \Phi_{ijb} g^{jk}\Phi_{kcd} \psi^{bd} t^c
207  * - \frac{1}{2} g_a^i \Phi_{ijb} g^{jk}
208  * \Phi_{kcd} \psi^{cd} t^b
209  * \nonumber \\ &&
210  * - g_a^i t^b \partial_i H_b
211  * + g^{ij} \Phi_{icd} \Phi_{jba} \psi^{bc} t^d
212  * - \frac{1}{2} t_a g^{ij} g^{mn} \Phi_{imc} \Phi_{njd}\psi^{cd}
213  * \nonumber \\ &&
214  * - \frac{1}{4} t_a g^{ij}\Phi_{icd}\Phi_{jbe}
215  * \psi^{cb}\psi^{de}
216  * + \frac{1}{4} t_a \Pi_{cd} \Pi_{be}
217  * \psi^{cb}\psi^{de}
218  * - g^{ij} H_i \Pi_{ja}
219  * \nonumber \\ &&
220  * - t^b g^{ij} \Pi_{b i} \Pi_{ja}
221  * - \frac{1}{4} g_a^i \Phi_{icd} t^c t^d \Pi_{be}
222  * \psi^{be}
223  * + \frac{1}{2} t_a \Pi_{cd} \Pi_{be}\psi^{ce}
224  * t^d t^b
225  * \nonumber \\ &&
226  * + g_a^i \Phi_{icd} \Pi_{be} t^c t^b \psi^{de}
227  * - g^{ij}\Phi_{iba} t^b \Pi_{je} t^e
228  * - \frac{1}{2} g^{ij}\Phi_{icd} t^c t^d \Pi_{ja}
229  * \nonumber \\ &&
230  * - g^{ij} H_i \Phi_{jba} t^b
231  * + g_{a}^i \Phi_{icd} H_b \psi^{bc} t^d
232  * +\gamma_2\bigl(g^{id}{\cal C}_{ida}
233  * -\frac{1}{2} g_a^i\psi^{cd}{\cal C}_{icd}\bigr)
234  * \nonumber \\ &&
235  * + \frac{1}{2} t_a \Pi_{cd}\psi^{cd} H_b t^b
236  * - t_a g^{ij} \Phi_{ijc} H_d \psi^{cd}
237  * +\frac{1}{2} t_a g^{ij} H_i \Phi_{jcd}\psi^{cd}
238  * \nonumber \\ &&
239  * - 16 \pi t^a T_{a b}
240  * \f}
241  * where \f$H_a\f$ is the gauge function,
242  * \f$\psi_{ab}\f$ is the spacetime metric,
243  * \f$\Pi_{ab}=-t^c\partial_c \psi_{ab}\f$, and
244  * \f$\Phi_{iab} = \partial_i\psi_{ab}\f$; \f$t^a\f$ is the timelike unit
245  * normal vector to the spatial slice, \f$g^{ij}\f$ is the inverse spatial
246  * metric, \f$g^b_c = \delta^b_c + t^b t_c\f$, and \f$T_{a b}\f$ is the
247  * stress-energy tensor if nonzero (if using the overload with no stress-energy
248  * tensor provided, the stress energy term is omitted).
249  *
250  * To justify the stress-energy contribution to the F constraint, note that
251  * the stress-energy tensor appears in the dynamics of the Generalized
252  * Harmonic system only through \f$\partial_t \Pi_{a b}\f$.
253  * That dependence arises from (using \f$\dots\f$ to indicate collections of
254  * terms that are known to be independent of the stress-energy tensor):
255  *
256  * \f[
257  * {\cal F}_a = \dots \alpha^{-1}(\partial_t {\cal C}_a),
258  * \f]
259  *
260  * where
261  *
262  * \f[
263  * {\cal C}_a = H_a + g^{i j} \Phi_{ij a} + t^b \Pi_{ba}
264  * - \frac{1}{2} g_a{}^i \psi^{bc} \Phi_{i b c}
265  * - \frac{1}{2} t_a \psi^{bc} \Pi_{b c}.
266  * \f].
267  *
268  * Therefore, the Stress-energy contribution can be calculated from the
269  * trace-reversed contribution appearing in
270  * `grmhd::GhValenciaDivClean::add_stress_energy_term_to_dt_pi` -- the
271  * trace reversal in that function and the trace-reversal that appears
272  * explicitly in \f${\cal C}_a\f$ cancel.
273  */
274 template <size_t SpatialDim, typename Frame, typename DataType>
275 tnsr::a<DataType, SpatialDim, Frame> f_constraint(
276  const tnsr::a<DataType, SpatialDim, Frame>& gauge_function,
277  const tnsr::ab<DataType, SpatialDim, Frame>& spacetime_d_gauge_function,
278  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
279  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
280  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
281  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
282  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
283  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
284  const tnsr::iaa<DataType, SpatialDim, Frame>& d_pi,
285  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi,
286  const Scalar<DataType>& gamma2,
287  const tnsr::iaa<DataType, SpatialDim, Frame>&
288  three_index_constraint) noexcept;
289 
290 template <size_t SpatialDim, typename Frame, typename DataType>
291 void f_constraint(
292  gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> constraint,
293  const tnsr::a<DataType, SpatialDim, Frame>& gauge_function,
294  const tnsr::ab<DataType, SpatialDim, Frame>& spacetime_d_gauge_function,
295  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
296  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
297  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
298  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
299  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
300  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
301  const tnsr::iaa<DataType, SpatialDim, Frame>& d_pi,
302  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi,
303  const Scalar<DataType>& gamma2,
304  const tnsr::iaa<DataType, SpatialDim, Frame>&
305  three_index_constraint) noexcept;
306 
307 template <size_t SpatialDim, typename Frame, typename DataType>
308 tnsr::a<DataType, SpatialDim, Frame> f_constraint(
309  const tnsr::a<DataType, SpatialDim, Frame>& gauge_function,
310  const tnsr::ab<DataType, SpatialDim, Frame>& spacetime_d_gauge_function,
311  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
312  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
313  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
314  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
315  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
316  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
317  const tnsr::iaa<DataType, SpatialDim, Frame>& d_pi,
318  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi,
319  const Scalar<DataType>& gamma2,
320  const tnsr::iaa<DataType, SpatialDim, Frame>& three_index_constraint,
321  const tnsr::aa<DataType, SpatialDim, Frame>&
322  trace_reversed_stress_energy) noexcept;
323 
324 template <size_t SpatialDim, typename Frame, typename DataType>
325 void f_constraint(
326  gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> constraint,
327  const tnsr::a<DataType, SpatialDim, Frame>& gauge_function,
328  const tnsr::ab<DataType, SpatialDim, Frame>& spacetime_d_gauge_function,
329  const tnsr::a<DataType, SpatialDim, Frame>& spacetime_normal_one_form,
330  const tnsr::A<DataType, SpatialDim, Frame>& spacetime_normal_vector,
331  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
332  const tnsr::AA<DataType, SpatialDim, Frame>& inverse_spacetime_metric,
333  const tnsr::aa<DataType, SpatialDim, Frame>& pi,
334  const tnsr::iaa<DataType, SpatialDim, Frame>& phi,
335  const tnsr::iaa<DataType, SpatialDim, Frame>& d_pi,
336  const tnsr::ijaa<DataType, SpatialDim, Frame>& d_phi,
337  const Scalar<DataType>& gamma2,
338  const tnsr::iaa<DataType, SpatialDim, Frame>& three_index_constraint,
339  const tnsr::aa<DataType, SpatialDim, Frame>&
340  trace_reversed_stress_energy) noexcept;
341 /// @}
342 
343 /// @{
344 /*!
345  * \brief Computes the generalized-harmonic (unnormalized) constraint energy.
346  *
347  * \details Computes the generalized-harmonic unnormalized constraint energy
348  * [Eq. (53) of \cite Lindblom2005qh with \f$m^{ab}=\delta^{ab}\f$ and with each
349  * term in the sum scaled by an arbitrary coefficient],
350  * \f{eqnarray}{
351  * E & = & K_1 C_a C_a + K_2\left(F_a F_a
352  + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
353  & + & K_3 C_{iab} C_{jab} g^{ij} + K_4 C_{ikab} C_{jlab}g^{ij} g^{kl}.
354  * \f}
355  * Here \f$C_a\f$ is the gauge constraint, \f$F_a\f$ is the f constraint,
356  * \f$C_{ia}\f$ is the two-index constraint, \f$C_{iab}\f$ is the
357  * three-index constraint, \f$C_{ikab}\f$ is the four-index constraint,
358  * \f$g^{ij}\f$ is the inverse spatial metric, and
359  * \f$K_1\f$, \f$K_2\f$, \f$K_3\f$, and \f$K_4\f$ are constant multipliers
360  * for each term that each default to a value of 1.0. Note that in this
361  * equation, spacetime indices \f$a,b\f$ are raised and lowered with
362  * the Kronecker delta.
363  *
364  * Also note that the argument `four_index_constraint` is a rank-3 tensor.
365  * This is because `GeneralizedHarmonic::four_index_constraint()` takes
366  * advantage of the antisymmetry of the four-index constraint's first two
367  * indices to only compute and return the independent
368  * components of \f$C_{ijab}\f$, which can be written as
369  * \f{eqnarray}{
370  * D_{iab} \equiv \frac{1}{2} \epsilon_{i}{}^{jk} C_{jkab},
371  * \f} where \f$\epsilon_{ijk}\f$ is the flat-space Levi-Civita tensor,
372  * whose inidces are raised and lowered with the Kronecker delta.
373  * The result is
374  * \f{eqnarray}{
375  * E & = & K_1 C_a C_a + K_2\left(F_a F_a
376  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
377  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
378  & + & 2 K_4 g D_{iab} D_{jab} g^{ij},
379  * \f} where \f$g\f$ is the determinant of the spatial metric.
380  *
381  * To derive this expression for the constraint energy implemented here,
382  * Eq.~(53) of \cite Lindblom2005qh is
383  * \f{eqnarray}{
384  * S_{AB} dc^A dc^B &=&
385  * m^{ab}\Bigl[d F_ad F_b
386  * +g^{ij}\bigl(d C_{ia}d C_{jb}
387  * +g^{kl}m^{cd}d C_{ikac}d C_{jlbd}\bigr)
388  * \nonumber\\
389  * & + & \Lambda^2\bigl(d C_ad C_b
390  * +g^{ij}m^{cd}d C_{iac}d C_{jbd}\bigr)
391  * \Bigr].
392  * \f} Replace \f$dc^A\rightarrow c^A\f$ to get
393  * \f{eqnarray}{
394  * E&=&
395  * m^{ab}\Bigl[ F_a F_b
396  * +g^{ij}\bigl( C_{ia} C_{jb}
397  * +g^{kl}m^{cd} C_{ikac} C_{jlbd}\bigr)
398  * \nonumber\\
399  * & + & \Lambda^2\bigl( C_a C_b
400  * +g^{ij}m^{cd} C_{iac} C_{jbd}\bigr)
401  * \Bigr]\nonumber\\
402  * &=&
403  * m^{ab} F_a F_b
404  * +m^{ab}g^{ij} C_{ia} C_{jb}
405  * +m^{ab}g^{ij} g^{kl}m^{cd} C_{ikac} C_{jlbd}
406  * \nonumber\\
407  * & + & m^{ab}\Lambda^2 C_a C_b
408  * +m^{ab}\Lambda^2 g^{ij}m^{cd} C_{iac} C_{jbd}.
409  * \f} Here \f$m^{ab}\f$ is an arbitrary positive-definite matrix, and
410  * \f$\Lambda\f$ is an arbitrary real scalar.
411  * Choose \f$m^{ab} = \delta^{ab}\f$ but allow an arbitrary coefficient to be
412  * placed in front of each term. Then, absorb \f$\Lambda^2\f$ into one of
413  * these coefficients, to get
414  * \f{eqnarray}{ E &=& K_
415  * F\delta^{ab} F_a F_b +K_2\delta^{ab}g^{ij} C_{ia} C_{jb}
416  +K_4\delta^{ab}g^{ij}
417  * g^{kl}\delta^{cd} C_{ikac} C_{jlbd}
418  * \nonumber\\
419  * & + & K_1\delta^{ab} C_a C_b
420  * +K_3\delta^{ab} g^{ij}\delta^{cd} C_{iac} C_{jbd}.
421  * \f}
422  * Adopting a Euclidean norm for the constraint space (i.e., choosing to raise
423  and
424  * lower spacetime indices with Kronecker deltas) gives
425  * \f{eqnarray}{ E &=& K_ F
426  * F_a F_a +K_2g^{ij} C_{ia} C_{ja} +K_4 g^{ij} g^{kl} C_{ikac} C_{jlac}
427  * \nonumber\\
428  * & + & K_1 C_a C_a
429  * +K_3g^{ij} C_{iac} C_{jac}.
430  * \f} The two-index constraint and f constraint can be viewed as the
431  * time and space components of a combined spacetime constraint. So next
432  * choose
433  * \f$K_ F=K_2\f$, giving \f{eqnarray}{ E&=& K_1 C_a C_a + K_2\left(F_a F_a
434  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
435  * & + & K_3 C_{iab} C_{jab} g^{ij}
436  * + K_4 C_{ikab} C_{jlab}g^{ij} g^{kl}.
437  * \f}
438  *
439  * Note that \f$C_{ikab}\f$ is antisymmetric on the first two indices. Next,
440  * replace the four-index constraint \f$C_{ijab}\f$ with \f$D_{iab}\f$, which
441  * contains the independent components of \f$C_{ijab}\f$. Specifically,
442  * \f{eqnarray}{
443  * D_{iab} \equiv \frac{1}{2} \epsilon_{i}{}^{jk} C_{jkab}.
444  * \f} The inverse relationship is
445  * \f{eqnarray}{
446  * C_{jkab} = \epsilon^{i}{}_{jk} D_{iab},
447  * \f} where \f$\epsilon_{ijk}\f$ is the flat-space Levi-Civita tensor, whose
448  * indices are raised and lowered with the Kronecker delta. Inserting this
449  relation
450  * to replace \f$C_{jkab}\f$ with \f$D_{iab}\f$ gives \f{eqnarray}{ E &=& K_1
451  C_a
452  * C_a + K_2\left(F_a F_a
453  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
454  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
455  * & + & K_4 D_{mab} D_{nab} \epsilon^{m}{}_{ik}
456  * \epsilon^{n}{}_{jl} g^{ij} g^{kl}. \f}
457  *
458  * There's a subtle point here: \f$g^{ij}\f$ is the inverse spatial metric,
459  which
460  * is not necessarily flat. But \f$\epsilon^{i}{}_{jk}\f$ is the flat space
461  * Levi-Civita tensor. In order to raise and lower indices of the Levi-Civita
462  * tensor with the inverse spatial metrics, put in the appropriate factors of
463  * \f$\sqrt{g}\f$, where \f$g\f$ is the metric determinant, to make the
464  * curved-space Levi-Civita tensor compatible with \f$g^{ij}\f$. Let
465  * \f$\varepsilon^{ijk}\f$ represent the curved space Levi-Civita tensor
466  compatible
467  * with \f$g^{ij}\f$: \f{eqnarray}{
468  * \varepsilon^{mik} = g^{-1/2} \epsilon^{mik}\\
469  * \varepsilon_{mik} = g^{1/2} \epsilon_{mik}.
470  * \f} Then we can write the constraint energy as
471  * \f{eqnarray}{
472  * E &=& K_1 C_a C_a + K_2\left(F_a F_a
473  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
474  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
475  * & + & K_4 D_{mab} D_{nab} g g^{-1/2}\epsilon^{m}{}_{ik}
476  * g^{-1/2}\epsilon^{n}{}_{jl} g^{ij} g^{kl}. \f} The factors of
477  * \f$g^{-1/2}\f$ make the Levi-Civita tensor compatible with \f$g^{ij}\f$.
478  * Swapping which summed indices are raised and which are lowered gives
479  * \f{eqnarray}{ E &=& K_1 C_a
480  C_a +
481  * K_2\left(F_a F_a
482  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
483  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
484  * & + & K_4 D_{mab} D_{nab} g g^{-1/2}\epsilon^{mik}
485  g^{-1/2}\epsilon^{njl}
486  * g_{ij} g_{kl}, \f} or \f{eqnarray}{ E &=& K_1 C_a C_a + K_2\left(F_a F_a
487  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
488  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
489  * & + & K_4 D_{mab} D_{nab} g \varepsilon^{mik} \varepsilon^{njl} g_{ij}
490  * g_{kl}, \f} or, reversing up and down repeated indices again,
491  * \f{eqnarray}{ E
492  * &=& K_1 C_a C_a + K_2\left(F_a F_a
493  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
494  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
495  * & + & K_4 D_{mab} D_{nab} g \varepsilon^{m}{}_{ik}
496  \varepsilon^{n}{}_{jl}
497  * g^{ij} g^{kl}. \f}
498  *
499  * The metric raises and lowers the indices of \f$\varepsilon^{ijk}\f$,
500  * so this can
501  * be written as \f{eqnarray}{ E &=& K_1 C_a C_a + K_2\left(F_a F_a
502  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
503  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
504  * & + & K_4 g D_{mab} D^{n}{}_{ab} \varepsilon^{mjl} \varepsilon_{njl}.
505  * \f}
506  *
507  * Now, in flat space (Eq. (1.23) of \cite ThorneBlandford2017),
508  * \f{eqnarray}{
509  * \epsilon^{mjl} \epsilon_{njl} = \delta^{mj}_{nj} = \delta^m_n \delta^j_j -
510  * \delta^m_j \delta^j_n = 2 \delta^m_n. \f} But this holds for curved space
511  * as well: multiply the left hand side by \f$1 = g^{1/2} g^{-1/2}\f$ to get
512  * \f{eqnarray}{
513  * g^{-1/2}\epsilon^{mjl} g^{1/2}\epsilon_{njl} = \varepsilon^{mjl}
514  * \varepsilon_{njl} = \delta^{mj}_{nj} = \delta^m_n \delta^j_j - \delta^m_j
515  * \delta^j_n = 2 \delta^m_n. \f} So the constraint energy is \f{eqnarray}{ E
516  &=&
517  * K_1 C_a C_a + K_2\left(F_a F_a
518  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
519  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
520  * & + & 2 K_4 D_{mab} D^{n}{}_{ab} \delta^m_n.
521  * \f}
522  * Simplifying gives the formula implemented here:
523  * \f{eqnarray}{
524  * E &=& K_1 C_a C_a + K_2\left(F_a F_a
525  * + C_{ia} C_{ja} g^{ij}\right)\nonumber\\
526  * & + & K_3 C_{iab} C_{jab} g^{ij}\nonumber\\
527  * & + & 2 K_4 g D_{iab} D_{jab} g^{ij}.
528  * \f}
529  */
530 template <size_t SpatialDim, typename Frame, typename DataType>
532  const tnsr::a<DataType, SpatialDim, Frame>& gauge_constraint,
533  const tnsr::a<DataType, SpatialDim, Frame>& f_constraint,
534  const tnsr::ia<DataType, SpatialDim, Frame>& two_index_constraint,
535  const tnsr::iaa<DataType, SpatialDim, Frame>& three_index_constraint,
536  const tnsr::iaa<DataType, SpatialDim, Frame>& four_index_constraint,
537  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
538  const Scalar<DataType>& spatial_metric_determinant,
539  double gauge_constraint_multiplier = 1.0,
540  double two_index_constraint_multiplier = 1.0,
541  double three_index_constraint_multiplier = 1.0,
542  double four_index_constraint_multiplier = 1.0) noexcept;
543 
544 template <size_t SpatialDim, typename Frame, typename DataType>
545 void constraint_energy(
546  gsl::not_null<Scalar<DataType>*> energy,
547  const tnsr::a<DataType, SpatialDim, Frame>& gauge_constraint,
548  const tnsr::a<DataType, SpatialDim, Frame>& f_constraint,
549  const tnsr::ia<DataType, SpatialDim, Frame>& two_index_constraint,
550  const tnsr::iaa<DataType, SpatialDim, Frame>& three_index_constraint,
551  const tnsr::iaa<DataType, SpatialDim, Frame>& four_index_constraint,
552  const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
553  const Scalar<DataType>& spatial_metric_determinant,
554  double gauge_constraint_multiplier = 1.0,
555  double two_index_constraint_multiplier = 1.0,
556  double three_index_constraint_multiplier = 1.0,
557  double four_index_constraint_multiplier = 1.0) noexcept;
558 /// @}
559 
560 namespace Tags {
561 /*!
562  * \brief Compute item to get the gauge constraint for the
563  * generalized harmonic evolution system.
564  *
565  * \details See `gauge_constraint()`. Can be retrieved using
566  * `GeneralizedHarmonic::Tags::GaugeConstraint`.
567  */
568 template <size_t SpatialDim, typename Frame>
569 struct GaugeConstraintCompute : GaugeConstraint<SpatialDim, Frame>,
571  using argument_tags = tmpl::list<
578 
579  using return_type = tnsr::a<DataVector, SpatialDim, Frame>;
580 
581  static constexpr auto function = static_cast<void (*)(
583  const tnsr::a<DataVector, SpatialDim, Frame>&,
584  const tnsr::a<DataVector, SpatialDim, Frame>&,
585  const tnsr::A<DataVector, SpatialDim, Frame>&,
586  const tnsr::II<DataVector, SpatialDim, Frame>&,
587  const tnsr::AA<DataVector, SpatialDim, Frame>&,
588  const tnsr::aa<DataVector, SpatialDim, Frame>&,
589  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
590  &gauge_constraint<SpatialDim, Frame, DataVector>);
591 
593 };
594 
595 /*!
596  * \brief Compute item to get the F-constraint for the
597  * generalized harmonic evolution system.
598  *
599  * \details See `f_constraint()`. Can be retrieved using
600  * `GeneralizedHarmonic::Tags::FConstraint`.
601  *
602  * \note If the system contains matter, you will need to use a system-specific
603  * version of this compute tag that passes the appropriate stress-energy tensor
604  * to the F-constraint calculation.
605  */
606 template <size_t SpatialDim, typename Frame>
607 struct FConstraintCompute : FConstraint<SpatialDim, Frame>, db::ComputeTag {
608  using argument_tags = tmpl::list<
615  ::Tags::deriv<Pi<SpatialDim, Frame>, tmpl::size_t<SpatialDim>, Frame>,
616  ::Tags::deriv<Phi<SpatialDim, Frame>, tmpl::size_t<SpatialDim>, Frame>,
619 
620  using return_type = tnsr::a<DataVector, SpatialDim, Frame>;
621 
622  static constexpr auto function = static_cast<void (*)(
624  const tnsr::a<DataVector, SpatialDim, Frame>&,
625  const tnsr::ab<DataVector, SpatialDim, Frame>&,
626  const tnsr::a<DataVector, SpatialDim, Frame>&,
627  const tnsr::A<DataVector, SpatialDim, Frame>&,
628  const tnsr::II<DataVector, SpatialDim, Frame>&,
629  const tnsr::AA<DataVector, SpatialDim, Frame>&,
630  const tnsr::aa<DataVector, SpatialDim, Frame>&,
631  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
632  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
633  const tnsr::ijaa<DataVector, SpatialDim, Frame>&,
634  const Scalar<DataVector>&,
635  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
636  &f_constraint<SpatialDim, Frame, DataVector>);
637 
639 };
640 
641 /*!
642  * \brief Compute item to get the two-index constraint for the
643  * generalized harmonic evolution system.
644  *
645  * \details See `two_index_constraint()`. Can be retrieved using
646  * `GeneralizedHarmonic::Tags::TwoIndexConstraint`.
647  */
648 template <size_t SpatialDim, typename Frame>
649 struct TwoIndexConstraintCompute : TwoIndexConstraint<SpatialDim, Frame>,
651  using argument_tags = tmpl::list<
658  ::Tags::deriv<Pi<SpatialDim, Frame>, tmpl::size_t<SpatialDim>, Frame>,
659  ::Tags::deriv<Phi<SpatialDim, Frame>, tmpl::size_t<SpatialDim>, Frame>,
662 
663  using return_type = tnsr::ia<DataVector, SpatialDim, Frame>;
664 
665  static constexpr auto function = static_cast<void (*)(
667  const tnsr::ab<DataVector, SpatialDim, Frame>&,
668  const tnsr::a<DataVector, SpatialDim, Frame>&,
669  const tnsr::A<DataVector, SpatialDim, Frame>&,
670  const tnsr::II<DataVector, SpatialDim, Frame>&,
671  const tnsr::AA<DataVector, SpatialDim, Frame>&,
672  const tnsr::aa<DataVector, SpatialDim, Frame>&,
673  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
674  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
675  const tnsr::ijaa<DataVector, SpatialDim, Frame>&,
676  const Scalar<DataVector>&,
677  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
678  &two_index_constraint<SpatialDim, Frame, DataVector>);
679 
681 };
682 
683 /*!
684  * \brief Compute item to get the three-index constraint for the
685  * generalized harmonic evolution system.
686  *
687  * \details See `three_index_constraint()`. Can be retrieved using
688  * `GeneralizedHarmonic::Tags::ThreeIndexConstraint`.
689  */
690 template <size_t SpatialDim, typename Frame>
693  using argument_tags =
694  tmpl::list<::Tags::deriv<gr::Tags::SpacetimeMetric<SpatialDim, Frame>,
695  tmpl::size_t<SpatialDim>, Frame>,
697 
698  using return_type = tnsr::iaa<DataVector, SpatialDim, Frame>;
699 
700  static constexpr auto function = static_cast<void (*)(
702  const tnsr::iaa<DataVector, SpatialDim, Frame>&,
703  const tnsr::iaa<DataVector, SpatialDim, Frame>&) noexcept>(
704  &three_index_constraint<SpatialDim, Frame, DataVector>);
705 
707 };
708 
709 /*!
710  * \brief Compute item to get the four-index constraint for the
711  * generalized harmonic evolution system.
712  *
713  * \details See `four_index_constraint()`. Can be retrieved using
714  * `GeneralizedHarmonic::Tags::FourIndexConstraint`.
715  */
716 template <size_t SpatialDim, typename Frame>
719  using argument_tags = tmpl::list<
720  ::Tags::deriv<Phi<SpatialDim, Frame>, tmpl::size_t<SpatialDim>, Frame>>;
721 
722  using return_type = tnsr::iaa<DataVector, SpatialDim, Frame>;
723 
724  static constexpr auto function = static_cast<void (*)(
726  const tnsr::ijaa<DataVector, SpatialDim, Frame>&) noexcept>(
727  &four_index_constraint<SpatialDim, Frame, DataVector>);
728 
730 };
731 
732 /*!
733  * \brief Compute item to get combined energy in all constraints for the
734  * generalized harmonic evolution system.
735  *
736  * \details See `constraint_energy()`. Can be retrieved using
737  * `GeneralizedHarmonic::Tags::ConstraintEnergy`.
738  */
739 template <size_t SpatialDim, typename Frame>
740 struct ConstraintEnergyCompute : ConstraintEnergy<SpatialDim, Frame>,
742  using argument_tags =
743  tmpl::list<GaugeConstraint<SpatialDim, Frame>,
750 
751  using return_type = Scalar<DataVector>;
752 
753  static constexpr auto function(
754  const gsl::not_null<Scalar<DataVector>*> energy,
755  const tnsr::a<DataVector, SpatialDim, Frame>& gauge_constraint,
756  const tnsr::a<DataVector, SpatialDim, Frame>& f_constraint,
757  const tnsr::ia<DataVector, SpatialDim, Frame>& two_index_constraint,
758  const tnsr::iaa<DataVector, SpatialDim, Frame>& three_index_constraint,
759  const tnsr::iaa<DataVector, SpatialDim, Frame>& four_index_constraint,
760  const tnsr::II<DataVector, SpatialDim, Frame>& inverse_spatial_metric,
761  const Scalar<DataVector>& spatial_metric_determinant) noexcept {
763  get(spatial_metric_determinant).size());
764  constraint_energy<SpatialDim, Frame, DataVector>(
766  three_index_constraint, four_index_constraint, inverse_spatial_metric,
767  spatial_metric_determinant);
768  }
769 
771 };
772 } // namespace Tags
773 } // namespace GeneralizedHarmonic
GeneralizedHarmonic::Tags::SpacetimeDerivGaugeH< SpatialDim, Frame >
db::ComputeTag
Mark a struct as a compute tag by inheriting from this.
Definition: Tag.hpp:157
GeneralizedHarmonic::Tags::GaugeConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:153
GeneralizedHarmonic::pi
void pi(gsl::not_null< tnsr::aa< DataType, SpatialDim, Frame > * > pi, const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the conjugate momentum of the spacetime metric .
GeneralizedHarmonic::three_index_constraint
tnsr::iaa< DataType, SpatialDim, Frame > three_index_constraint(const tnsr::iaa< DataType, SpatialDim, Frame > &d_spacetime_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the generalized-harmonic 3-index constraint.
GeneralizedHarmonic::Tags::FourIndexConstraintCompute
Compute item to get the four-index constraint for the generalized harmonic evolution system.
Definition: Constraints.hpp:717
GeneralizedHarmonic::four_index_constraint
tnsr::iaa< DataType, SpatialDim, Frame > four_index_constraint(const tnsr::ijaa< DataType, SpatialDim, Frame > &d_phi) noexcept
Computes the generalized-harmonic 4-index constraint.
gr::Tags::SpacetimeNormalVector
Definition: Tags.hpp:87
db::get
const auto & get(const DataBox< TagList > &box) noexcept
Retrieve the item with tag Tag from the DataBox.
Definition: DataBox.hpp:791
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Bjorhus.hpp:38
GeneralizedHarmonic::gauge_constraint
tnsr::a< DataType, SpatialDim, Frame > gauge_constraint(const tnsr::a< DataType, SpatialDim, Frame > &gauge_function, const tnsr::a< DataType, SpatialDim, Frame > &spacetime_normal_one_form, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the generalized-harmonic gauge constraint.
GeneralizedHarmonic::two_index_constraint
tnsr::ia< DataType, SpatialDim, Frame > two_index_constraint(const tnsr::ab< DataType, SpatialDim, Frame > &spacetime_d_gauge_function, const tnsr::a< DataType, SpatialDim, Frame > &spacetime_normal_one_form, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::iaa< DataType, SpatialDim, Frame > &d_pi, const tnsr::ijaa< DataType, SpatialDim, Frame > &d_phi, const Scalar< DataType > &gamma2, const tnsr::iaa< DataType, SpatialDim, Frame > &three_index_constraint) noexcept
Computes the generalized-harmonic 2-index constraint.
gr::Tags::DetSpatialMetric
Determinant of the spatial metric.
Definition: Tags.hpp:40
GeneralizedHarmonic::Tags::GaugeConstraintCompute
Compute item to get the gauge constraint for the generalized harmonic evolution system.
Definition: Constraints.hpp:569
GeneralizedHarmonic::f_constraint
tnsr::a< DataType, SpatialDim, Frame > f_constraint(const tnsr::a< DataType, SpatialDim, Frame > &gauge_function, const tnsr::ab< DataType, SpatialDim, Frame > &spacetime_d_gauge_function, const tnsr::a< DataType, SpatialDim, Frame > &spacetime_normal_one_form, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::iaa< DataType, SpatialDim, Frame > &d_pi, const tnsr::ijaa< DataType, SpatialDim, Frame > &d_phi, const Scalar< DataType > &gamma2, const tnsr::iaa< DataType, SpatialDim, Frame > &three_index_constraint) noexcept
Computes the generalized-harmonic F constraint.
cstddef
GeneralizedHarmonic::Tags::Pi< SpatialDim, Frame >
gr::Tags::InverseSpacetimeMetric
Definition: Tags.hpp:21
GeneralizedHarmonic::Tags::ConstraintEnergy
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:178
GeneralizedHarmonic::Tags::ThreeIndexConstraintCompute
Compute item to get the three-index constraint for the generalized harmonic evolution system.
Definition: Constraints.hpp:691
GeneralizedHarmonic::phi
void phi(gsl::not_null< tnsr::iaa< DataType, SpatialDim, Frame > * > phi, const Scalar< DataType > &lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes the auxiliary variable used by the generalized harmonic formulation of Einstein's equations...
GeneralizedHarmonic::Tags::FConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:158
GeneralizedHarmonic::Tags::GaugeH< SpatialDim, Frame >
gr::Tags::SpacetimeNormalOneForm
Definition: Tags.hpp:83
GeneralizedHarmonic::ConstraintDamping::Tags::ConstraintGamma2
Constraint dammping parameter for the generalized harmonic system (cf. ).
Definition: Tags.hpp:70
tnsr
Type aliases to construct common Tensors.
Definition: TypeAliases.hpp:31
GeneralizedHarmonic::Tags::Phi< SpatialDim, Frame >
GeneralizedHarmonic::Tags::FourIndexConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:173
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
GeneralizedHarmonic::Tags::FConstraintCompute
Compute item to get the F-constraint for the generalized harmonic evolution system.
Definition: Constraints.hpp:607
GeneralizedHarmonic::Tags::ThreeIndexConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:168
GeneralizedHarmonic::constraint_energy
Scalar< DataType > constraint_energy(const tnsr::a< DataType, SpatialDim, Frame > &gauge_constraint, const tnsr::a< DataType, SpatialDim, Frame > &f_constraint, const tnsr::ia< DataType, SpatialDim, Frame > &two_index_constraint, const tnsr::iaa< DataType, SpatialDim, Frame > &three_index_constraint, const tnsr::iaa< DataType, SpatialDim, Frame > &four_index_constraint, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const Scalar< DataType > &spatial_metric_determinant, double gauge_constraint_multiplier=1.0, double two_index_constraint_multiplier=1.0, double three_index_constraint_multiplier=1.0, double four_index_constraint_multiplier=1.0) noexcept
Computes the generalized-harmonic (unnormalized) constraint energy.
TypeAliases.hpp
Frame
Definition: IndexType.hpp:36
Tags::deriv
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:52
PartialDerivatives.hpp
GeneralizedHarmonic::Tags::TwoIndexConstraintCompute
Compute item to get the two-index constraint for the generalized harmonic evolution system.
Definition: Constraints.hpp:649
Prefixes.hpp
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
GeneralizedHarmonic::Tags::ConstraintEnergyCompute
Compute item to get combined energy in all constraints for the generalized harmonic evolution system.
Definition: Constraints.hpp:740
gr::inverse_spacetime_metric
void inverse_spacetime_metric(gsl::not_null< tnsr::AA< DataType, SpatialDim, Frame > * > inverse_spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute inverse spacetime metric from inverse spatial metric, lapse and shift.
TMPL.hpp
gr::spacetime_normal_vector
tnsr::A< DataType, SpatialDim, Frame > spacetime_normal_vector(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift) noexcept
Computes spacetime normal vector from lapse and shift.
GeneralizedHarmonic::Tags::TwoIndexConstraint
Tags corresponding to various constraints of the generalized harmonic system, and their diagnosticall...
Definition: Tags.hpp:163
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13
destructive_resize_components
void destructive_resize_components(const gsl::not_null< Container * > container, const size_t new_size, DestructiveResizeFunction destructive_resize=ContainerDestructiveResize{}) noexcept
Checks the size of each component of the container, and resizes if necessary.
Definition: ContainerHelpers.hpp:177