VerifySolution.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
8 #include "Domain/CoordinateMaps/CoordinateMap.tpp"
10 #include "Domain/CoordinateMaps/ProductMaps.tpp"
11 #include "Elliptic/Systems/Xcts/FirstOrderSystem.hpp"
12 #include "Elliptic/Systems/Xcts/Geometry.hpp"
13 #include "Framework/CheckWithRandomValues.hpp"
15 #include "Helpers/PointwiseFunctions/AnalyticSolutions/FirstOrderEllipticSolutionsTestHelpers.hpp"
17
18 namespace TestHelpers::Xcts::Solutions {
19
20 namespace detail {
21 template <::Xcts::Equations EnabledEquations,
22  ::Xcts::Geometry ConformalGeometry, int ConformalMatterScale,
23  typename Solution>
24 void verify_solution_impl(const Solution& solution,
25  const std::array<double, 3>& center,
27  const double tolerance) {
28  CAPTURE(EnabledEquations);
29  CAPTURE(ConformalGeometry);
30  using system = ::Xcts::FirstOrderSystem<EnabledEquations, ConformalGeometry,
31  ConformalMatterScale>;
32  const Mesh<3> mesh{12, Spectral::Basis::Legendre,
34  using AffineMap = domain::CoordinateMaps::Affine;
35  using AffineMap3D =
38  coord_map{
42  FirstOrderEllipticSolutionsTestHelpers::verify_solution<system>(
43  solution, mesh, coord_map, tolerance);
44 }
45 } // namespace detail
46
47 /*!
48  * \brief Verify the solution solves the XCTS equations numerically.
49  *
50  * \tparam ConformalGeometry Specify Xcts::Geometry::FlatCartesian to test
51  * both the flat _and_ the curved system, or Xcts::Geometry::Curved to only
52  * test the curved system (for solutions on a curved conformal background).
53  * \tparam Solution The analytic solution to test (inferred)
54  * \param solution The analytic solution to test
55  * \param center offset for the \p inner_radius and the \p outer_radius
56  * \param inner_radius Lower-left corner of a cube on which to test
57  * \param outer_radius Upper-right corner of a cube on which to test
58  * \param tolerance Requested tolerance
59  */
60 template <::Xcts::Geometry ConformalGeometry, int ConformalMatterScale,
61  typename Solution>
62 void verify_solution(const Solution& solution,
63  const std::array<double, 3>& center,
65  const double tolerance) {
66  if constexpr (ConformalGeometry == ::Xcts::Geometry::FlatCartesian) {
68  detail::verify_solution_impl,
73  (ConformalMatterScale));
74  } else {
76  detail::verify_solution_impl,
80  (::Xcts::Geometry::Curved), (ConformalMatterScale));
81  }
82 }
83
84 } // namespace TestHelpers::Xcts::Solutions
Xcts::FirstOrderSystem
The Extended Conformal Thin Sandwich (XCTS) decomposition of the Einstein constraint equations,...
Definition: FirstOrderSystem.hpp:142
INVOKE_TEST_FUNCTION
#define INVOKE_TEST_FUNCTION(FUNCTION_NAME, TUPLE_ARGS,...)
Macro used to invoke a test function of multiple template arguments.
Definition: CheckWithRandomValues.hpp:794
Xcts::Equations::HamiltonianAndLapse
@ HamiltonianAndLapse
Both the Hamiltonian constraint and the lapse equation, solved for and .
domain::CoordinateMaps::ProductOf3Maps
Product of three one-dimensional CoordinateMaps.
Definition: ProductMaps.hpp:90
ProductMaps.hpp
std::system
T system(T... args)
TestingFramework.hpp
evolution::dg::subcell::fd::mesh
Mesh< Dim > mesh(const Mesh< Dim > &dg_mesh) noexcept
Computes the cell-centered finite-difference mesh from the DG mesh, using grid points per dimension,...
CoordinateMap.hpp
domain::CoordinateMaps::Affine
Affine map from .
Definition: Affine.hpp:37
Xcts::Geometry::Curved
@ Curved
The conformal geometry is either curved or employs curved coordinates, so non-vanishing Christoffel s...
Affine.hpp
Xcts::Equations::HamiltonianLapseAndShift
@ HamiltonianLapseAndShift
The full XCTS equations, solved for , and .
FirstOrderEllipticSolutionsTestHelpers::verify_solution
void verify_solution(const SolutionType &solution, const Mesh< System::volume_dim > &mesh, const domain::CoordinateMap< Frame::Logical, Frame::Inertial, Maps... > coord_map, const double tolerance, const std::tuple< FluxesArgs... > &fluxes_args, const std::tuple< SourcesArgs... > &sources_args=std::tuple<>{})
Definition: FirstOrderEllipticSolutionsTestHelpers.hpp:141
std::array< double, 3 >
Xcts::Equations
Equations
Indicates a subset of the XCTS equations.
Definition: FluxesAndSources.hpp:24
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:49
Xcts::Geometry::FlatCartesian
@ FlatCartesian
Euclidean (flat) manifold with Cartesian coordinates, i.e. the conformal metric has components in th...
Xcts::Geometry
Geometry
Types of conformal geometries for the XCTS equations.
Definition: Geometry.hpp:8
Xcts::Equations::Hamiltonian
@ Hamiltonian
Only the Hamiltonian constraint, solved for .
Mesh.hpp
domain::CoordinateMap
A coordinate map or composition of coordinate maps.
Definition: CoordinateMap.hpp:240