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 :
8 : #include "DataStructures/Tensor/TypeAliases.hpp"
9 : #include "Utilities/TMPL.hpp"
10 :
11 : /// \cond
12 : class DataVector;
13 :
14 : namespace gsl {
15 : template <class T>
16 : class not_null;
17 : } // namespace gsl
18 : /// \endcond
19 :
20 : namespace Ccz4 {
21 : /*!
22 : * \brief Indicates whether or not to evolve the shift in a system evolved using
23 : * first order CCZ4 \cite Dumbser2017okk
24 : *
25 : * \details In \cite Dumbser2017okk , evolving the shift corresponds to
26 : * \f$s = 1\f$ and not evolving it corresponds to \f$s = 0\f$
27 : */
28 0 : enum class EvolveShift : bool { False = false, True = true };
29 :
30 : /*!
31 : * \brief Indicates which slicing condition to use in a system evolved using
32 : * first order CCZ4 \cite Dumbser2017okk
33 : *
34 : * \details In \cite Dumbser2017okk , harmonic slicing corresponds to
35 : * \f$g(\alpha) = 1\f$ and 1 + log slicing corresponds to
36 : * \f$g(\alpha) = 2 / \alpha\f$ where \f$\alpha\f$ is the lapse.
37 : */
38 0 : enum class SlicingConditionType : char { Harmonic, Log };
39 :
40 : /*!
41 : * \brief Compute the RHS of the first order CCZ4 formulation of Einstein's
42 : * equations \cite Dumbser2017okk
43 : *
44 : * \details We define \f$\phi = (\det(\gamma_{ij}))^{-1/6}\f$ as the conformal
45 : * factor, \f$\alpha\f$ as the lapse, \f$\beta^i\f$ as the shift, \f$K_{ij}\f$
46 : * as the extrinsic curvature, and \f$Z_{a}\f$ as the Z4 constraint.
47 : *
48 : * The evolved variables are the conformal spatial metric
49 : * \f$\tilde{\gamma}_{ij} = \phi^2 \gamma_{ij}\f$, the natural log of the lapse
50 : * \f$\ln \alpha\f$, the shift \f$\beta^i\f$, the natural log of the conformal
51 : * factor \f$\ln \phi\f$, the trace-free part of the extrinsic curvature
52 : * \f$\tilde A_{ij} = \phi^2 \left(K_{ij} - \frac{1}{3} K \gamma_{ij}\right)\f$,
53 : * the trace of the extrinsic curvature \f$K = K_{ij} \gamma^{ij}\f$, the
54 : * projection of the Z4 four-vector along the normal direction
55 : * \f$\Theta = Z^0 \alpha\f$, \f$\hat{\Gamma}^{i}\f$ defined by
56 : * `Ccz4::Tags::GammaHat`, the free variable \f$b^i\f$ that controls the
57 : * evolution of the shift and its time derivative, the auxiliary variable
58 : * \f$A_i = \partial_i \ln(\alpha) = \frac{\partial_i \alpha}{\alpha}\f$, the
59 : * auxiliary variable \f$B_k{}^{i} = \partial_k \beta^i\f$, the auxiliary
60 : * variable \f$D_{kij} = \frac{1}{2} \partial_k \tilde{\gamma}_{ij}\f$, and the
61 : * auxiliary variable
62 : * \f$P_i = \partial_i \ln(\phi) = \frac{\partial_i \phi}{\phi}\f$.
63 : *
64 : * The evolution equations are equations 12a - 12m of \cite Dumbser2017okk .
65 : * Equations 13 - 27 define identities used in the evolution equations.
66 : *
67 : * This evolution uses two settings that can be toggled:
68 : * - `evolve_shift` governs whether or not the shift is evolved by setting
69 : * \f$s = 1\f$ or \f$s = 0\f$
70 : * - `slicing_condition_type` governs which slicing condition to use by setting
71 : * the value of \f$g(\alpha)\f$)
72 : */
73 : template <size_t Dim>
74 1 : struct TimeDerivative {
75 0 : static void apply(
76 : const gsl::not_null<tnsr::ii<DataVector, Dim>*>
77 : dt_conformal_spatial_metric,
78 : const gsl::not_null<Scalar<DataVector>*> dt_ln_lapse,
79 : const gsl::not_null<tnsr::I<DataVector, Dim>*> dt_shift,
80 : const gsl::not_null<Scalar<DataVector>*> dt_ln_conformal_factor,
81 : const gsl::not_null<tnsr::ii<DataVector, Dim>*> dt_a_tilde,
82 : const gsl::not_null<Scalar<DataVector>*> dt_trace_extrinsic_curvature,
83 : const gsl::not_null<Scalar<DataVector>*> dt_theta,
84 : const gsl::not_null<tnsr::I<DataVector, Dim>*> dt_gamma_hat,
85 : const gsl::not_null<tnsr::I<DataVector, Dim>*> dt_b,
86 : const gsl::not_null<tnsr::i<DataVector, Dim>*> dt_field_a,
87 : const gsl::not_null<tnsr::iJ<DataVector, Dim>*> dt_field_b,
88 : const gsl::not_null<tnsr::ijj<DataVector, Dim>*> dt_field_d,
89 : const gsl::not_null<tnsr::i<DataVector, Dim>*> dt_field_p,
90 : const gsl::not_null<Scalar<DataVector>*> conformal_factor_squared,
91 : const gsl::not_null<Scalar<DataVector>*> det_conformal_spatial_metric,
92 : const gsl::not_null<tnsr::II<DataVector, Dim>*>
93 : inv_conformal_spatial_metric,
94 : const gsl::not_null<tnsr::II<DataVector, Dim>*> inv_spatial_metric,
95 : const gsl::not_null<Scalar<DataVector>*> lapse,
96 : const gsl::not_null<Scalar<DataVector>*> slicing_condition,
97 : const gsl::not_null<Scalar<DataVector>*> d_slicing_condition,
98 : const gsl::not_null<tnsr::II<DataVector, Dim>*> inv_a_tilde,
99 : const gsl::not_null<tnsr::ij<DataVector, Dim>*> a_tilde_times_field_b,
100 : const gsl::not_null<tnsr::ii<DataVector, Dim>*>
101 : a_tilde_minus_one_third_conformal_metric_times_trace_a_tilde,
102 : const gsl::not_null<Scalar<DataVector>*> contracted_field_b,
103 : const gsl::not_null<tnsr::ijK<DataVector, Dim>*> symmetrized_d_field_b,
104 : const gsl::not_null<tnsr::i<DataVector, Dim>*>
105 : contracted_symmetrized_d_field_b,
106 : const gsl::not_null<tnsr::ijk<DataVector, Dim>*> field_b_times_field_d,
107 : const gsl::not_null<tnsr::i<DataVector, Dim>*> field_d_up_times_a_tilde,
108 : const gsl::not_null<tnsr::I<DataVector, Dim>*> contracted_field_d_up,
109 : const gsl::not_null<Scalar<DataVector>*> half_conformal_factor_squared,
110 : const gsl::not_null<tnsr::ij<DataVector, Dim>*>
111 : conformal_metric_times_field_b,
112 : const gsl::not_null<tnsr::ijk<DataVector, Dim>*>
113 : conformal_metric_times_symmetrized_d_field_b,
114 : const gsl::not_null<tnsr::ii<DataVector, Dim>*>
115 : conformal_metric_times_trace_a_tilde,
116 : const gsl::not_null<tnsr::i<DataVector, Dim>*>
117 : inv_conformal_metric_times_d_a_tilde,
118 : const gsl::not_null<tnsr::I<DataVector, Dim>*>
119 : gamma_hat_minus_contracted_conformal_christoffel,
120 : const gsl::not_null<tnsr::iJ<DataVector, Dim>*>
121 : d_gamma_hat_minus_contracted_conformal_christoffel,
122 : const gsl::not_null<tnsr::i<DataVector, Dim>*>
123 : contracted_christoffel_second_kind,
124 : const gsl::not_null<tnsr::ij<DataVector, Dim>*>
125 : contracted_d_conformal_christoffel_difference,
126 : const gsl::not_null<Scalar<DataVector>*> k_minus_2_theta_c,
127 : const gsl::not_null<Scalar<DataVector>*> k_minus_k0_minus_2_theta_c,
128 : const gsl::not_null<tnsr::ii<DataVector, Dim>*> lapse_times_a_tilde,
129 : const gsl::not_null<tnsr::ijj<DataVector, Dim>*> lapse_times_d_a_tilde,
130 : const gsl::not_null<tnsr::i<DataVector, Dim>*> lapse_times_field_a,
131 : const gsl::not_null<tnsr::ii<DataVector, Dim>*>
132 : lapse_times_conformal_spatial_metric,
133 : const gsl::not_null<Scalar<DataVector>*> lapse_times_slicing_condition,
134 : const gsl::not_null<Scalar<DataVector>*>
135 : lapse_times_ricci_scalar_plus_divergence_z4_constraint,
136 : const gsl::not_null<tnsr::I<DataVector, Dim>*>
137 : shift_times_deriv_gamma_hat,
138 : const gsl::not_null<tnsr::ii<DataVector, Dim>*>
139 : inv_tau_times_conformal_metric,
140 : const gsl::not_null<Scalar<DataVector>*> trace_a_tilde,
141 : const gsl::not_null<tnsr::iJJ<DataVector, Dim>*> field_d_up,
142 : const gsl::not_null<tnsr::Ijj<DataVector, Dim>*>
143 : conformal_christoffel_second_kind,
144 : const gsl::not_null<tnsr::iJkk<DataVector, Dim>*>
145 : d_conformal_christoffel_second_kind,
146 : const gsl::not_null<tnsr::Ijj<DataVector, Dim>*> christoffel_second_kind,
147 : const gsl::not_null<tnsr::ii<DataVector, Dim>*> spatial_ricci_tensor,
148 : const gsl::not_null<tnsr::ij<DataVector, Dim>*> grad_grad_lapse,
149 : const gsl::not_null<Scalar<DataVector>*> divergence_lapse,
150 : const gsl::not_null<tnsr::I<DataVector, Dim>*>
151 : contracted_conformal_christoffel_second_kind,
152 : const gsl::not_null<tnsr::iJ<DataVector, Dim>*>
153 : d_contracted_conformal_christoffel_second_kind,
154 : const gsl::not_null<tnsr::i<DataVector, Dim>*> spatial_z4_constraint,
155 : const gsl::not_null<tnsr::I<DataVector, Dim>*>
156 : upper_spatial_z4_constraint,
157 : const gsl::not_null<tnsr::ij<DataVector, Dim>*>
158 : grad_spatial_z4_constraint,
159 : const gsl::not_null<Scalar<DataVector>*>
160 : ricci_scalar_plus_divergence_z4_constraint,
161 : const double c, const double cleaning_speed,
162 : const Scalar<DataVector>& eta, const double f,
163 : const Scalar<DataVector>& k_0, const tnsr::i<DataVector, Dim>& d_k_0,
164 : const double kappa_1, const double kappa_2, const double kappa_3,
165 : const double mu, const double one_over_relaxation_time,
166 : const EvolveShift evolve_shift,
167 : const SlicingConditionType slicing_condition_type,
168 : const tnsr::ii<DataVector, Dim>& conformal_spatial_metric,
169 : const Scalar<DataVector>& ln_lapse, const tnsr::I<DataVector, Dim>& shift,
170 : const Scalar<DataVector>& ln_conformal_factor,
171 : const tnsr::ii<DataVector, Dim>& a_tilde,
172 : const Scalar<DataVector>& trace_extrinsic_curvature,
173 : const Scalar<DataVector>& theta,
174 : const tnsr::I<DataVector, Dim>& gamma_hat,
175 : const tnsr::I<DataVector, Dim>& b,
176 : const tnsr::i<DataVector, Dim>& field_a,
177 : const tnsr::iJ<DataVector, Dim>& field_b,
178 : const tnsr::ijj<DataVector, Dim>& field_d,
179 : const tnsr::i<DataVector, Dim>& field_p,
180 : const tnsr::ijj<DataVector, Dim>& d_a_tilde,
181 : const tnsr::i<DataVector, Dim>& d_trace_extrinsic_curvature,
182 : const tnsr::i<DataVector, Dim>& d_theta,
183 : const tnsr::iJ<DataVector, Dim>& d_gamma_hat,
184 : const tnsr::iJ<DataVector, Dim>& d_b,
185 : const tnsr::ij<DataVector, Dim>& d_field_a,
186 : const tnsr::ijK<DataVector, Dim>& d_field_b,
187 : const tnsr::ijkk<DataVector, Dim>& d_field_d,
188 : const tnsr::ij<DataVector, Dim>& d_field_p);
189 : };
190 : } // namespace Ccz4
|