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