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