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/DataBox/PrefixHelpers.hpp"
9 : #include "DataStructures/DataBox/Prefixes.hpp"
10 : #include "DataStructures/DataVector.hpp"
11 : #include "DataStructures/TaggedContainers.hpp"
12 : #include "DataStructures/Tensor/Tensor.hpp"
13 : #include "Evolution/DiscontinuousGalerkin/TimeDerivativeDecisions.hpp"
14 : #include "Evolution/Systems/CurvedScalarWave/System.hpp"
15 : #include "Evolution/Systems/CurvedScalarWave/TimeDerivative.hpp"
16 : #include "Evolution/Systems/GeneralizedHarmonic/System.hpp"
17 : #include "Evolution/Systems/GeneralizedHarmonic/TimeDerivative.hpp"
18 : #include "Evolution/Systems/ScalarTensor/Tags.hpp"
19 : #include "PointwiseFunctions/AnalyticData/GhScalarTensor/Factory.hpp"
20 : #include "PointwiseFunctions/ScalarTensor/ScalarSource.hpp"
21 : #include "PointwiseFunctions/ScalarTensor/StressEnergy.hpp"
22 : #include "Time/Tags/Time.hpp"
23 : #include "Utilities/Gsl.hpp"
24 : #include "Utilities/TMPL.hpp"
25 :
26 : namespace ScalarTensor {
27 : /*!
28 : * \brief Compute the RHS terms of the evolution equations for the scalar tensor
29 : * system.
30 : *
31 : * \details The bulk of the computations in this class dispatch to
32 : * `GeneralizedHarmonic::TimeDerivative` and
33 : * `CurvedScalarWave::TimeDerivative` as a 'product system' -- each
34 : * independently operating on its own subset of the supplied variable
35 : * collections.
36 : * The additional steps taken are to compute the trace-reversed stress energy
37 : * tensor associated with the scalar part of the system and add its contribution
38 : * to the \f$\partial_t \Pi_{a b}\f$ variable in the Generalized Harmonic
39 : * system, as well as adding any scalar sources to the variable \f$\partial_t
40 : * \Pi\f$.
41 : *
42 : * \warning Backreaction of the scalar field onto the metric is currently
43 : * disabled and the system is evolved in the test-field (or decoupling)
44 : * approximation.
45 : */
46 1 : struct TimeDerivative {
47 0 : static constexpr size_t dim = 3;
48 0 : static constexpr bool backreaction_is_enabled = false;
49 0 : using gh_dt_tags =
50 : db::wrap_tags_in<::Tags::dt,
51 : typename gh::System<dim>::variables_tag::tags_list>;
52 0 : using scalar_dt_tags = db::wrap_tags_in<
53 : ::Tags::dt,
54 : typename CurvedScalarWave::System<dim>::variables_tag::tags_list>;
55 0 : using dt_tags = tmpl::append<gh_dt_tags, scalar_dt_tags>;
56 0 : using gh_temp_tags = typename gh::TimeDerivative<
57 : gh::ScalarTensor::AnalyticData::all_analytic_data, dim>::temporary_tags;
58 0 : using gh_gradient_tags = typename gh::System<dim>::gradients_tags;
59 0 : using gh_arg_tags = typename gh::TimeDerivative<
60 : gh::ScalarTensor::AnalyticData::all_analytic_data, dim>::argument_tags;
61 0 : using scalar_temp_tags =
62 : typename CurvedScalarWave::TimeDerivative<dim>::temporary_tags;
63 0 : using scalar_extra_temp_tags =
64 : tmpl::list<ScalarTensor::Tags::TraceReversedStressEnergy<
65 : DataVector, dim, ::Frame::Inertial>>;
66 0 : using scalar_gradient_tags =
67 : typename CurvedScalarWave::System<dim>::gradients_tags;
68 0 : using gradient_tags = tmpl::append<gh_gradient_tags, scalar_gradient_tags>;
69 0 : using scalar_arg_tags =
70 : typename CurvedScalarWave::TimeDerivative<dim>::argument_tags;
71 0 : using temporary_tags = tmpl::remove_duplicates<
72 : tmpl::append<gh_temp_tags, scalar_temp_tags, scalar_extra_temp_tags>>;
73 0 : using argument_tags =
74 : tmpl::append<gh_arg_tags, scalar_arg_tags,
75 : tmpl::list<ScalarTensor::Tags::ScalarSource>>;
76 :
77 0 : static evolution::dg::TimeDerivativeDecisions<3> apply(
78 : // GH dt variables
79 : gsl::not_null<tnsr::aa<DataVector, dim>*> dt_spacetime_metric,
80 : gsl::not_null<tnsr::aa<DataVector, dim>*> dt_pi,
81 : gsl::not_null<tnsr::iaa<DataVector, dim>*> dt_phi,
82 : // Scalar dt variables
83 : gsl::not_null<Scalar<DataVector>*> dt_psi_scalar,
84 : gsl::not_null<Scalar<DataVector>*> dt_pi_scalar,
85 : gsl::not_null<tnsr::i<DataVector, dim, Frame::Inertial>*> dt_phi_scalar,
86 :
87 : // GH temporal variables
88 : gsl::not_null<Scalar<DataVector>*> temp_gamma1,
89 : gsl::not_null<Scalar<DataVector>*> temp_gamma2,
90 : gsl::not_null<tnsr::a<DataVector, dim>*> temp_gauge_function,
91 : gsl::not_null<tnsr::ab<DataVector, dim>*>
92 : temp_spacetime_deriv_gauge_function,
93 : gsl::not_null<Scalar<DataVector>*> gamma1gamma2,
94 : gsl::not_null<Scalar<DataVector>*> half_half_pi_two_normals,
95 : gsl::not_null<Scalar<DataVector>*> normal_dot_gauge_constraint,
96 : gsl::not_null<Scalar<DataVector>*> gamma1_plus_1,
97 : gsl::not_null<tnsr::a<DataVector, dim>*> pi_one_normal,
98 : gsl::not_null<tnsr::a<DataVector, dim>*> gauge_constraint,
99 : gsl::not_null<tnsr::i<DataVector, dim>*> half_phi_two_normals,
100 : gsl::not_null<tnsr::aa<DataVector, dim>*>
101 : shift_dot_three_index_constraint,
102 : gsl::not_null<tnsr::aa<DataVector, dim>*>
103 : mesh_velocity_dot_three_index_constraint,
104 : gsl::not_null<tnsr::ia<DataVector, dim>*> phi_one_normal,
105 : gsl::not_null<tnsr::aB<DataVector, dim>*> pi_2_up,
106 : gsl::not_null<tnsr::iaa<DataVector, dim>*> three_index_constraint,
107 : gsl::not_null<tnsr::Iaa<DataVector, dim>*> phi_1_up,
108 : gsl::not_null<tnsr::iaB<DataVector, dim>*> phi_3_up,
109 : gsl::not_null<tnsr::abC<DataVector, dim>*> christoffel_first_kind_3_up,
110 : gsl::not_null<Scalar<DataVector>*> lapse,
111 : gsl::not_null<tnsr::I<DataVector, dim>*> shift,
112 : gsl::not_null<tnsr::II<DataVector, dim>*> inverse_spatial_metric,
113 : gsl::not_null<Scalar<DataVector>*> det_spatial_metric,
114 : gsl::not_null<Scalar<DataVector>*> sqrt_det_spatial_metric,
115 : gsl::not_null<tnsr::AA<DataVector, dim>*> inverse_spacetime_metric,
116 : gsl::not_null<tnsr::abb<DataVector, dim>*> christoffel_first_kind,
117 : gsl::not_null<tnsr::Abb<DataVector, dim>*> christoffel_second_kind,
118 : gsl::not_null<tnsr::a<DataVector, dim>*> trace_christoffel,
119 : gsl::not_null<tnsr::A<DataVector, dim>*> normal_spacetime_vector,
120 :
121 : // Scalar temporal variables
122 : gsl::not_null<Scalar<DataVector>*> result_gamma1_scalar,
123 : gsl::not_null<Scalar<DataVector>*> result_gamma2_scalar,
124 :
125 : // Extra temporal tags
126 : gsl::not_null<tnsr::aa<DataVector, dim>*> stress_energy,
127 :
128 : // GH spatial derivatives
129 : const tnsr::iaa<DataVector, dim>& d_spacetime_metric,
130 : const tnsr::iaa<DataVector, dim>& d_pi,
131 : const tnsr::ijaa<DataVector, dim>& d_phi,
132 :
133 : // scalar spatial derivatives
134 : const tnsr::i<DataVector, dim>& d_psi_scalar,
135 : const tnsr::i<DataVector, dim>& d_pi_scalar,
136 : const tnsr::ij<DataVector, dim>& d_phi_scalar,
137 :
138 : // GH argument variables
139 : const tnsr::aa<DataVector, dim>& spacetime_metric,
140 : const tnsr::aa<DataVector, dim>& pi,
141 : const tnsr::iaa<DataVector, dim>& phi, const Scalar<DataVector>& gamma0,
142 : const Scalar<DataVector>& gamma1, const Scalar<DataVector>& gamma2,
143 : const gh::gauges::GaugeCondition& gauge_condition, const Mesh<dim>& mesh,
144 : double time,
145 : const tnsr::I<DataVector, dim, Frame::Inertial>& inertial_coords,
146 : const InverseJacobian<DataVector, dim, Frame::ElementLogical,
147 : Frame::Inertial>& inverse_jacobian,
148 : const std::optional<tnsr::I<DataVector, dim, Frame::Inertial>>&
149 : mesh_velocity,
150 :
151 : // Scalar argument variables
152 : const Scalar<DataVector>& pi_scalar,
153 : const tnsr::i<DataVector, dim>& phi_scalar,
154 : const Scalar<DataVector>& lapse_scalar,
155 : const tnsr::I<DataVector, dim>& shift_scalar,
156 : const tnsr::i<DataVector, dim>& deriv_lapse,
157 : const tnsr::iJ<DataVector, dim>& deriv_shift,
158 : const tnsr::II<DataVector, dim>& upper_spatial_metric,
159 : const tnsr::I<DataVector, dim>& trace_spatial_christoffel,
160 : const Scalar<DataVector>& trace_extrinsic_curvature,
161 : const Scalar<DataVector>& gamma1_scalar,
162 : const Scalar<DataVector>& gamma2_scalar,
163 :
164 : const Scalar<DataVector>& scalar_source);
165 : };
166 : } // namespace ScalarTensor
|