VerifyGrSolution.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
7 
8 #include <array>
9 #include <cstddef>
10 
12 #include "DataStructures/DataBox/Prefixes.hpp" // IWYU pragma: keep
13 #include "DataStructures/DataVector.hpp" // IWYU pragma: keep
19 #include "Domain/CoordinateMaps/CoordinateMap.tpp"
21 #include "Domain/CoordinateMaps/ProductMaps.tpp"
23 #include "Domain/Mesh.hpp"
26 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
27 #include "Evolution/TypeTraits.hpp" // IWYU pragma: keep
29 #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.tpp"
32 #include "PointwiseFunctions/GeneralRelativity/ExtrinsicCurvature.hpp"
33 #include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/GaugeSource.hpp"
34 #include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/Phi.hpp"
35 #include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/Pi.hpp"
36 #include "PointwiseFunctions/GeneralRelativity/IndexManipulation.hpp"
37 #include "PointwiseFunctions/GeneralRelativity/InverseSpacetimeMetric.hpp"
38 #include "PointwiseFunctions/GeneralRelativity/SpacetimeMetric.hpp"
39 #include "PointwiseFunctions/GeneralRelativity/SpacetimeNormalOneForm.hpp"
40 #include "PointwiseFunctions/GeneralRelativity/SpacetimeNormalVector.hpp"
41 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
43 #include "Utilities/Gsl.hpp"
46 #include "Utilities/TMPL.hpp"
47 #include "Utilities/TypeTraits.hpp"
48 
49 /// \cond
50 // IWYU pragma: no_forward_declare Tensor
51 // IWYU pragma: no_forward_declare Tags::deriv
52 /// \endcond
53 
54 namespace TestHelpers {
55 /// \ingroup TestingFrameworkGroup
56 /// Functions for testing GR analytic solutions
57 namespace VerifyGrSolution {
58 
59 /// Determines if the given `solution` is a time-independent solution
60 /// of the Einstein equations. Uses numerical derivatives to compute
61 /// the solution, on a grid extending from `lower_bound` to `upper_bound`
62 /// with `grid_size_each_dimension` points in each dimension.
63 /// The right-hand side of the Einstein equations must be zero within
64 /// `error_tolerance`
65 template <typename Solution>
67  const Solution& solution, const size_t grid_size_each_dimension,
68  const std::array<double, 3>& lower_bound,
69  const std::array<double, 3>& upper_bound,
70  const double error_tolerance) noexcept {
71  static_assert(evolution::is_analytic_solution_v<Solution>,
72  "Solution was not derived from AnalyticSolution");
73  // Shorter names for tags.
74  using SpacetimeMetric = gr::Tags::SpacetimeMetric<3, Frame::Inertial>;
78  using VariablesTags = tmpl::list<SpacetimeMetric, Pi, Phi, GaugeH>;
79 
80  // Set up grid
81  const size_t data_size = pow<3>(grid_size_each_dimension);
82  Mesh<3> mesh{grid_size_each_dimension, Spectral::Basis::Legendre,
83  Spectral::Quadrature::GaussLobatto};
84 
85  using Affine = domain::CoordinateMaps::Affine;
86  using Affine3D =
88  const auto coord_map =
89  domain::make_coordinate_map<Frame::Logical, Frame::Inertial>(Affine3D{
90  Affine{-1., 1., lower_bound[0], upper_bound[0]},
91  Affine{-1., 1., lower_bound[1], upper_bound[1]},
92  Affine{-1., 1., lower_bound[2], upper_bound[2]},
93  });
94 
95  // Set up coordinates
96  const auto x_logical = logical_coordinates(mesh);
97  const auto x = coord_map(x_logical);
98  const double t = 1.3; // Arbitrary time for time-independent solution.
99 
100  // Evaluate analytic solution
101  const auto vars =
102  solution.variables(x, t, typename Solution::template tags<DataVector>{});
103  const auto& lapse = get<gr::Tags::Lapse<>>(vars);
104  const auto& dt_lapse = get<Tags::dt<gr::Tags::Lapse<>>>(vars);
105  const auto& d_lapse =
106  get<typename Solution::template DerivLapse<DataVector>>(vars);
107  const auto& shift = get<gr::Tags::Shift<3>>(vars);
108  const auto& d_shift =
109  get<typename Solution::template DerivShift<DataVector>>(vars);
110  const auto& dt_shift = get<Tags::dt<gr::Tags::Shift<3>>>(vars);
111  const auto& g = get<gr::Tags::SpatialMetric<3>>(vars);
112  const auto& dt_g = get<Tags::dt<gr::Tags::SpatialMetric<3>>>(vars);
113  const auto& d_g =
114  get<typename Solution::template DerivSpatialMetric<DataVector>>(vars);
115 
116  // Check those quantities that should vanish identically.
117  CHECK(get(dt_lapse) == make_with_value<DataVector>(x, 0.));
118  CHECK(dt_shift ==
119  make_with_value<cpp20::remove_cvref_t<decltype(dt_shift)>>(x, 0.));
120  CHECK(dt_g == make_with_value<cpp20::remove_cvref_t<decltype(dt_g)>>(x, 0.));
121 
122  // Need upper spatial metric for many things below.
123  const auto upper_spatial_metric = determinant_and_inverse(g).second;
124 
125  // Compute generalized harmonic quantities. Put them in a Variables
126  // so that we can take numerical derivatives of them.
127  // Also put gauge_function into this list since we need a numerical
128  // derivative of it too.
129  Variables<VariablesTags> gh_vars(data_size);
130  auto& psi = get<SpacetimeMetric>(gh_vars);
131  auto& pi = get<Pi>(gh_vars);
132  auto& phi = get<Phi>(gh_vars);
133  auto& gauge_function = get<GaugeH>(gh_vars);
134  psi = gr::spacetime_metric(lapse, shift, g);
135  phi = GeneralizedHarmonic::phi(lapse, d_lapse, shift, d_shift, g, d_g);
136  pi = GeneralizedHarmonic::pi(lapse, dt_lapse, shift, dt_shift, g, dt_g, phi);
137 
138  // Compute gauge_function compatible with d/dt(lapse) and d/dt(shift).
139  gauge_function = GeneralizedHarmonic::gauge_source(
140  lapse, dt_lapse, d_lapse, shift, dt_shift, d_shift, g,
141  trace(gr::extrinsic_curvature(lapse, shift, d_shift, g, dt_g, d_g),
142  upper_spatial_metric),
144  upper_spatial_metric));
145 
146  // Compute numerical derivatives of psi,pi,phi,H.
147  // Normally one should not take numerical derivatives of H for
148  // plugging into the RHS of the generalized harmonic equations, but
149  // here this is just a test.
150  const auto gh_derivs =
151  partial_derivatives<VariablesTags, VariablesTags, 3, Frame::Inertial>(
152  gh_vars, mesh, coord_map.inv_jacobian(x_logical));
153  const auto& d_psi =
154  get<Tags::deriv<SpacetimeMetric, tmpl::size_t<3>, Frame::Inertial>>(
155  gh_derivs);
156  const auto& d_pi =
157  get<Tags::deriv<Pi, tmpl::size_t<3>, Frame::Inertial>>(gh_derivs);
158  const auto& d_phi =
159  get<Tags::deriv<Phi, tmpl::size_t<3>, Frame::Inertial>>(gh_derivs);
160  const auto& d_H =
161  get<Tags::deriv<GaugeH, tmpl::size_t<3>, Frame::Inertial>>(gh_derivs);
162 
163  Approx numerical_approx =
164  Approx::custom().epsilon(error_tolerance).scale(1.0);
165 
166  // Test 3-index constraint
167  CHECK_ITERABLE_CUSTOM_APPROX(d_psi, phi, numerical_approx);
168 
169  // Compute spacetime deriv of H.
170  // Assume time derivative of H is zero, for time-independent solution
171  auto d4_H = make_with_value<tnsr::ab<DataVector, 3>>(x, 0.0);
172  for (size_t a = 0; a < 4; ++a) {
173  for (size_t i = 0; i < 3; ++i) {
174  d4_H.get(i + 1, a) = d_H.get(i, a);
175  }
176  }
177 
178  // Compute analytic derivatives of psi, for use in computing
179  // christoffel symbols.
180  auto d4_psi = make_with_value<tnsr::abb<DataVector, 3>>(x, 0.0);
181  for (size_t b = 0; b < 4; ++b) {
182  for (size_t c = b; c < 4; ++c) { // symmetry
183  d4_psi.get(0, b, c) = -get(lapse) * pi.get(b, c);
184  for (size_t k = 0; k < 3; ++k) {
185  d4_psi.get(0, b, c) += shift.get(k) * phi.get(k, b, c);
186  d4_psi.get(k + 1, b, c) = phi.get(k, b, c);
187  }
188  }
189  }
190 
191  // Compute derived spacetime quantities
192  const auto upper_psi =
193  gr::inverse_spacetime_metric(lapse, shift, upper_spatial_metric);
195  const auto christoffel_second_kind =
197  const auto trace_christoffel_first_kind =
199  const auto normal_one_form =
200  gr::spacetime_normal_one_form<3, Frame::Inertial>(lapse);
201  const auto normal_vector = gr::spacetime_normal_vector(lapse, shift);
202 
203  // Test ADM evolution equation gives zero
204  auto dt_g_adm = make_with_value<tnsr::ii<DataVector, 3>>(x, 0.0);
205  {
206  auto ex_curv = gr::extrinsic_curvature(lapse, shift, d_shift, g, dt_g, d_g);
207  for (size_t i = 0; i < 3; ++i) {
208  for (size_t j = i; j < 3; ++j) { // Symmetry
209  dt_g_adm.get(i, j) -= 2.0 * get(lapse) * ex_curv.get(i, j);
210  for (size_t k = 0; k < 3; ++k) {
211  dt_g_adm.get(i, j) += shift.get(k) * d_g.get(k, i, j) +
212  g.get(k, i) * d_shift.get(j, k) +
213  g.get(k, j) * d_shift.get(i, k);
214  }
215  }
216  }
217  CHECK_ITERABLE_APPROX(dt_g_adm,
218  make_with_value<decltype(dt_g_adm)>(x, 0.0));
219  }
220 
221  // Test 1-index constraint
223  gauge_function, normal_one_form, normal_vector, upper_spatial_metric,
224  upper_psi, pi, phi);
225  CHECK_ITERABLE_CUSTOM_APPROX(C_1, make_with_value<decltype(C_1)>(x, 0.0),
226  numerical_approx);
227 
228  // Constraint-damping parameters: Set to arbitrary values.
229  // gamma = 0 (for all gammas) and gamma1 = -1 are special because,
230  // they zero out various terms in the equations, so don't choose those.
231  const auto gamma0 = make_with_value<Scalar<DataVector>>(x, 1.0);
232  const auto gamma1 = make_with_value<Scalar<DataVector>>(x, 1.0);
233  const auto gamma2 = make_with_value<Scalar<DataVector>>(x, 1.0);
234 
235  // Compute RHS of generalized harmonic Einstein equations.
236  auto dt_psi =
237  make_with_value<tnsr::aa<DataVector, 3, Frame::Inertial>>(x, 0.0);
238  auto dt_pi =
239  make_with_value<tnsr::aa<DataVector, 3, Frame::Inertial>>(x, 0.0);
240  auto dt_phi =
241  make_with_value<tnsr::iaa<DataVector, 3, Frame::Inertial>>(x, 0.0);
243  make_not_null(&dt_psi), make_not_null(&dt_pi), make_not_null(&dt_phi),
244  psi, pi, phi, d_psi, d_pi, d_phi, gamma0, gamma1, gamma2, gauge_function,
245  d4_H);
246 
247  // Make sure the RHS is zero.
249  dt_psi, make_with_value<decltype(dt_psi)>(x, 0.0), numerical_approx);
250  CHECK_ITERABLE_CUSTOM_APPROX(dt_pi, make_with_value<decltype(dt_pi)>(x, 0.0),
251  numerical_approx);
253  dt_phi, make_with_value<decltype(dt_phi)>(x, 0.0), numerical_approx);
254 }
255 
256 namespace detail {
257 template <typename Tag>
259 
260 template <typename Tag, typename Solution>
261 db::const_item_type<Tag> time_derivative(const Solution& solution,
262  const tnsr::I<double, 3>& x,
263  const double time,
264  const double dt) noexcept {
265  db::const_item_type<Tag> result{};
266  for (auto it = result.begin(); it != result.end(); ++it) {
267  const auto index = result.get_tensor_index(it);
268  *it = numerical_derivative(
269  [&index, &solution, &x](const std::array<double, 1>& t_array) noexcept {
270  return std::array<double, 1>{
271  {get<Tag>(solution.variables(x, t_array[0], tmpl::list<Tag>{}))
272  .get(index)}};
273  },
274  std::array<double, 1>{{time}}, 0, dt)[0];
275  }
276  return result;
277 }
278 
279 template <typename Tag, typename Solution>
280 db::const_item_type<deriv<Tag>> space_derivative(const Solution& solution,
281  const tnsr::I<double, 3>& x,
282  const double time,
283  const double dx) noexcept {
285  for (auto it = result.begin(); it != result.end(); ++it) {
286  const auto index = result.get_tensor_index(it);
287  *it = numerical_derivative(
288  [&index, &solution, &time,
289  &x](const std::array<double, 1>& offset) noexcept {
290  auto position = x;
291  position.get(index[0]) += offset[0];
292  return std::array<double, 1>{
293  {get<Tag>(solution.variables(position, time, tmpl::list<Tag>{}))
294  .get(all_but_specified_element_of(index, 0))}};
295  },
296  std::array<double, 1>{{0.0}}, 0, dx)[0];
297  }
298  return result;
299 }
300 } // namespace detail
301 
302 /// Check the consistency of dependent quantities returned by a
303 /// solution. This includes checking pointwise relations such as
304 /// consistency of the metric and inverse and comparing returned and
305 /// numerical derivatives.
306 template <typename Solution>
307 void verify_consistency(const Solution& solution, const double time,
308  const tnsr::I<double, 3>& position,
309  const double derivative_delta,
310  const double derivative_tolerance) noexcept {
311  using Lapse = gr::Tags::Lapse<double>;
314  using SqrtDetSpatialMetric = gr::Tags::SqrtDetSpatialMetric<double>;
315  using InverseSpatialMetric =
317  using ExtrinsicCurvature =
319  using tags =
320  tmpl::list<SpatialMetric, SqrtDetSpatialMetric, InverseSpatialMetric,
321  ExtrinsicCurvature, Lapse, Shift, detail::deriv<Shift>,
324 
325  auto derivative_approx = approx.epsilon(derivative_tolerance);
326 
327  const auto vars = solution.variables(position, time, tags{});
328 
329  const auto numerical_metric_det_and_inverse =
330  determinant_and_inverse(get<SpatialMetric>(vars));
331  CHECK_ITERABLE_APPROX(get(get<SqrtDetSpatialMetric>(vars)),
332  sqrt(get(numerical_metric_det_and_inverse.first)));
333  CHECK_ITERABLE_APPROX(get<InverseSpatialMetric>(vars),
334  numerical_metric_det_and_inverse.second);
335 
337  get<ExtrinsicCurvature>(vars),
339  get<Lapse>(vars), get<Shift>(vars), get<detail::deriv<Shift>>(vars),
340  get<SpatialMetric>(vars), get<Tags::dt<SpatialMetric>>(vars),
342 
344  detail::time_derivative<Lapse>(
345  solution, position, time, derivative_delta),
346  derivative_approx);
348  detail::time_derivative<Shift>(
349  solution, position, time, derivative_delta),
350  derivative_approx);
352  detail::time_derivative<SpatialMetric>(
353  solution, position, time, derivative_delta),
354  derivative_approx);
355 
357  detail::space_derivative<Lapse>(
358  solution, position, time, derivative_delta),
359  derivative_approx);
361  detail::space_derivative<Shift>(
362  solution, position, time, derivative_delta),
363  derivative_approx);
365  detail::space_derivative<SpatialMetric>(
366  solution, position, time, derivative_delta),
367  derivative_approx);
368 }
369 } // namespace VerifyGrSolution
370 } // namespace TestHelpers
domain::CoordinateMaps::ProductOf3Maps
Product of three one-dimensional CoordinateMaps.
Definition: ProductMaps.hpp:86
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 .
all_but_specified_element_of
std::array< T, Dim - 1 > all_but_specified_element_of(const std::array< T, Dim > &a, const size_t element_to_remove) noexcept
Construct an array from an existing array omitting one element.
Definition: StdArrayHelpers.hpp:98
gr::christoffel_first_kind
void christoffel_first_kind(gsl::not_null< tnsr::abb< DataType, SpatialDim, Frame, Index > * > christoffel, const tnsr::abb< DataType, SpatialDim, Frame, Index > &d_metric) noexcept
Computes Christoffel symbol of the first kind from derivative of metric.
DataBoxTag.hpp
trace
void trace(gsl::not_null< Scalar< DataType > * > trace, const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index0, Index0 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &metric) noexcept
Computes trace of a rank-2 symmetric tensor.
Frame::Inertial
Definition: IndexType.hpp:44
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
ProductMaps.hpp
get
constexpr Tag::type & get(Variables< TagList > &v) noexcept
Return Tag::type pointing into the contiguous array.
Definition: Variables.hpp:689
TestingFramework.hpp
DeterminantAndInverse.hpp
raise_or_lower_first_index
void raise_or_lower_first_index(gsl::not_null< Tensor< DataType, Symmetry< 2, 1, 1 >, index_list< change_index_up_lo< Index0 >, Index1, Index1 >> * > result, const Tensor< DataType, Symmetry< 2, 1, 1 >, index_list< Index0, Index1, Index1 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &metric) noexcept
Raises or lowers the first index of a rank 3 tensor which is symmetric in the last two indices.
CHECK_ITERABLE_CUSTOM_APPROX
#define CHECK_ITERABLE_CUSTOM_APPROX(a, b, appx)
Same as CHECK_ITERABLE_APPROX with user-defined Approx. The third argument should be of type Approx.
Definition: TestingFramework.hpp:151
CoordinateMap.hpp
CHECK_ITERABLE_APPROX
#define CHECK_ITERABLE_APPROX(a, b)
A wrapper around Catch's CHECK macro that checks approximate equality of entries in iterable containe...
Definition: TestingFramework.hpp:139
GeneralizedHarmonic::ComputeDuDt
Compute the RHS of the Generalized Harmonic formulation of Einstein's equations.
Definition: Equations.hpp:101
Spectral.hpp
domain::CoordinateMaps::Affine
Affine map from .
Definition: Affine.hpp:37
TestHelpers.hpp
numerical_derivative
std::result_of_t< const Invocable &(const std::array< double, VolumeDim > &)> numerical_derivative(const Invocable &function, const std::array< double, VolumeDim > &x, const size_t direction, const double delta) noexcept
Calculates the derivative of an Invocable at a point x - represented by an array of doubles - in the ...
Definition: TestHelpers.hpp:286
gr::lapse
Scalar< DataType > lapse(const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute lapse from shift and spacetime metric.
Affine.hpp
determinant_and_inverse
void determinant_and_inverse(const gsl::not_null< Scalar< T > * > det, const gsl::not_null< Tensor< T, Symm, tmpl::list< change_index_up_lo< Index1 >, change_index_up_lo< Index0 >>> * > inv, const Tensor< T, Symm, tmpl::list< Index0, Index1 >> &tensor) noexcept
Computes the determinant and inverse of a rank-2 Tensor.
Definition: DeterminantAndInverse.hpp:371
make_with_value
std::remove_const_t< R > make_with_value(const T &input, const ValueType &value) noexcept
Given an object of type T, create an object of type R whose elements are initialized to value.
Definition: MakeWithValue.hpp:43
cstddef
TestHelpers::VerifyGrSolution::verify_time_independent_einstein_solution
void verify_time_independent_einstein_solution(const Solution &solution, const size_t grid_size_each_dimension, const std::array< double, 3 > &lower_bound, const std::array< double, 3 > &upper_bound, const double error_tolerance) noexcept
Determines if the given solution is a time-independent solution of the Einstein equations....
Definition: VerifyGrSolution.hpp:66
GeneralizedHarmonic::gauge_source
void gauge_source(gsl::not_null< tnsr::a< DataType, SpatialDim, Frame > * > gauge_source_h, const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const Scalar< DataType > &trace_extrinsic_curvature, const tnsr::i< DataType, SpatialDim, Frame > &trace_christoffel_last_indices) noexcept
Computes generalized harmonic gauge source function.
MakeWithValue.hpp
array
LogicalCoordinates.hpp
GeneralizedHarmonic::Tags::Pi
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:29
ConstantExpressions.hpp
gr::Tags::SpacetimeMetric
Definition: Tags.hpp:17
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::GaugeH
Gauge source function for the generalized harmonic system.
Definition: Tags.hpp:63
gr::Tags::Shift
Definition: Tags.hpp:48
std::decay_t
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.
Definition: Constraints.cpp:957
Variables.hpp
Constraints.hpp
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:50
gr::shift
tnsr::I< DataType, SpatialDim, Frame > shift(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute shift from spacetime metric and inverse spatial metric.
GeneralizedHarmonic::Tags::Phi
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:40
Tags::dt
Prefix indicating a time derivative.
Definition: Prefixes.hpp:32
logical_coordinates
void logical_coordinates(gsl::not_null< tnsr::I< DataVector, VolumeDim, Frame::Logical > * > logical_coords, const Mesh< VolumeDim > &mesh) noexcept
Compute the logical coordinates in an Element.
Gsl.hpp
StdArrayHelpers.hpp
gr::spacetime_metric
void spacetime_metric(gsl::not_null< tnsr::aa< DataType, Dim, Frame > * > spacetime_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, Dim, Frame > &shift, const tnsr::ii< DataType, Dim, Frame > &spatial_metric) noexcept
Computes the spacetime metric from the spatial metric, lapse, and shift.
Tensor.hpp
TestHelpers::VerifyGrSolution::verify_consistency
void verify_consistency(const Solution &solution, const double time, const tnsr::I< double, 3 > &position, const double derivative_delta, const double derivative_tolerance) noexcept
Check the consistency of dependent quantities returned by a solution. This includes checking pointwis...
Definition: VerifyGrSolution.hpp:307
Tags::deriv
Prefix indicating spatial derivatives.
Definition: PartialDerivatives.hpp:54
std::time
T time(T... args)
trace_last_indices
void trace_last_indices(gsl::not_null< Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> * > trace_of_tensor, const Tensor< DataType, Symmetry< 2, 1, 1 >, index_list< Index0, Index1, Index1 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index1 >, change_index_up_lo< Index1 >>> &metric) noexcept
Computes trace of a rank 3 tensor, which is symmetric in its last two indices, tracing the symmetric ...
make_not_null
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion,...
Definition: Gsl.hpp:880
gr::Tags::ExtrinsicCurvature
Definition: Tags.hpp:110
gr::extrinsic_curvature
tnsr::ii< DataType, SpatialDim, Frame > extrinsic_curvature(const Scalar< DataType > &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::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes extrinsic curvature from metric and derivatives.
Mesh.hpp
Christoffel.hpp
Prefixes.hpp
Equations.hpp
gr::Tags::Lapse
Definition: Tags.hpp:52
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.
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
gr::Tags::SqrtDetSpatialMetric
Definition: Tags.hpp:44