|
SpECTRE
2021.08.02
|
Classes, functions, macros, and instructions for developing tests. More...
Namespaces | |
| namespace | ActionTesting |
| Structures used for mocking the parallel components framework in order to test actions. | |
| namespace | pypp |
| Contains all functions for calling python from C++. | |
| namespace | TestHelpers::domain::BoundaryConditions |
| Helpers for boundary conditions. | |
| namespace | TestHelpers::elliptic |
| Helper functions to test elliptic first-order systems. | |
| namespace | TestHelpers::AnalyticData |
| Functions for testing analytic data. | |
| namespace | TestHelpers::VerifyGrSolution |
| Functions for testing GR analytic solutions. | |
| namespace | TestHelpers::AnalyticSolutions |
| Functions for testing analytic solutions. | |
| namespace | TestHelpers::gr |
| Make random GR variables which correct physical behavior, e.g. spatial metric will be positive definite. | |
| namespace | TestHelpers::hydro |
| Make random hydro variables which correct physical behavior, e.g. Lorentz factor will be greater or equal than one. | |
Classes | |
| class | ActionTesting::MockRuntimeSystem< Metavariables > |
| A class that mocks the infrastructure needed to run actions. It simulates message passing using the inbox infrastructure and handles most of the arguments to the apply method. This mocks the Charm++ runtime system as well as the layer built on top of it as part of SpECTRE. More... | |
| class | UniformCustomDistribution< T > |
A uniform distribution function object which redirects appropriately to either the std::uniform_int_distribution or the std::uniform_real_distribution. This also provides a convenience constructor which takes a 2-element array for the bounds for either floating point or int distributions. More... | |
| class | OrientationMapIterator< VolumeDim > |
| An iterator for looping through all possible orientations of the n-dim cube. More... | |
Macros | |
| #define | INVOKE_TEST_FUNCTION(FUNCTION_NAME, TUPLE_ARGS, ...) |
| Macro used to invoke a test function of multiple template arguments. More... | |
| #define | CHECK_FOR_DOUBLES_AND_DATAVECTORS(FUNCTION_NAME, ...) |
Macro used to test functions whose parameter can be a double or a DataVector. More... | |
| #define | CHECK_OP(a, op, b, c) |
| Check a op b == c and also the op= version. More... | |
| #define | MAKE_GENERATOR(...) |
MAKE_GENERATOR(NAME [, SEED]) declares a variable of name NAME containing a generator of type std::mt19937. More... | |
| #define | CHECK_VARIABLES_APPROX(a, b) |
| A wrapper around Catch's CHECK macro that checks approximate equality of each entry in each tag within a variables. More... | |
| #define | CHECK_VARIABLES_CUSTOM_APPROX(a, b, appx) |
Same as CHECK_VARIABLES_APPROX, but with a user-defined Approx. The third argument should be of type Approx. More... | |
| #define | SPECTRE_PARALLEL_REQUIRE(expr) |
| A similar to Catch's REQUIRE statement, but can be used in tests that spawn several chares with possibly complex interaction between the chares. More... | |
| #define | SPECTRE_PARALLEL_REQUIRE_FALSE(expr) |
| A similar to Catch's REQUIRE_FALSE statement, but can be used in tests that spawn several chares with possibly complex interaction between the chares. More... | |
| #define | CHECK_COMPLEX_APPROX(a, b) |
A wrapper around Catch's CHECK macro that checks approximate equality of the two entries in a std::complex. For efficiency, no function forwarding is performed, just a pair of CHECKs inline. More... | |
| #define | CHECK_COMPLEX_CUSTOM_APPROX(a, b, appx) |
Same as CHECK_COMPLEX_APPROX with user-defined Approx. The third argument should be of type Approx. More... | |
| #define | CHECK_ITERABLE_APPROX(a, b) |
| A wrapper around Catch's CHECK macro that checks approximate equality of entries in iterable containers. For maplike containers, keys are checked for strict equality and values are checked for approximate equality. More... | |
| #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. More... | |
| #define | ERROR_TEST() |
| Mark a test as checking a call to ERROR. More... | |
| #define | ASSERTION_TEST() |
| Mark a test to be checking an ASSERT. More... | |
| #define | OUTPUT_TEST() |
| Mark a test as checking the output with a regular expression. More... | |
Typedefs | |
| using | TestHelpers::VectorImpl::Bound = std::array< double, 2 > |
| Type alias to be more expressive with distribution bounds in vector tests which call the generic math test below. | |
Enumerations | |
| enum | TestHelpers::VectorImpl::TestKind { Normal , Strict , Inplace , GivenOrderOfArgumentsOnly } |
| the set of test types that may be used for the math operations More... | |
Functions | |
| template<typename T , typename Metavariables = NoSuchType> | |
| T | TestHelpers::test_creation (const std::string &construction_string) noexcept |
| Creates an instance of a given option-creatable type. More... | |
| template<typename OptionTag , typename Metavariables = NoSuchType> | |
| OptionTag::type | TestHelpers::test_option_tag (const std::string &construction_string) noexcept |
| Runs the option parser on a given tag. More... | |
| template<typename BaseClass , typename DerivedClass > | |
| std::unique_ptr< BaseClass > | TestHelpers::test_factory_creation (const std::string &construction_string) noexcept |
| Creates a class of a known derived type using a factory. More... | |
| template<typename T > | |
| T | serialize_and_deserialize (const T &t) |
Serializes and deserializes an object t of type T | |
| template<typename T > | |
| void | serialize_and_deserialize (const gsl::not_null< T * > result, const T &t) noexcept |
Serializes and deserializes an object t of type T | |
| template<typename T > | |
| void | test_serialization (const T &t) |
| Tests the serialization of comparable types. More... | |
| template<typename B , typename D , typename... Args> | |
| void | test_serialization_via_base (Args &&... args) |
| Test the serialization of a derived class via a base class pointer. More... | |
| template<typename T , typename U > | |
| void | check_cmp (const T &less, const U &greater) |
| Function to test comparison operators. Pass values with less < greater. | |
| template<typename Invocable , size_t VolumeDim> | |
| 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 domain of map with a sixth-order finite difference method. More... | |
| template<typename Exception , typename ThrowingFunctor > | |
| void | test_throw_exception (const ThrowingFunctor &func, const Exception &expected) |
Execute func and check that it throws an exception expected. More... | |
| template<size_t SpatialDim, typename Frame , typename DataType > | |
| tnsr::ii< DataType, SpatialDim, Frame > | TestHelpers::Schwarzschild::spatial_ricci (const tnsr::I< DataType, SpatialDim, Frame > &x, double mass) noexcept |
| Schwarzschild (Kerr-Schild) spatial ricci tensor. More... | |
| template<size_t SpatialDim, typename Frame , typename DataType > | |
| tnsr::ii< DataType, SpatialDim, Frame > | TestHelpers::Minkowski::extrinsic_curvature_sphere (const tnsr::I< DataType, SpatialDim, Frame > &x) noexcept |
| Extrinsic curvature of 2D sphere in 3D flat space. More... | |
| template<typename DataType > | |
| Scalar< DataType > | TestHelpers::Kerr::horizon_ricci_scalar (const Scalar< DataType > &horizon_radius, double mass, double dimensionless_spin_z) noexcept |
| Kerr (Kerr-Schild) horizon ricci scalar (spin on z axis) More... | |
| template<typename DataType > | |
| Scalar< DataType > | TestHelpers::Kerr::horizon_ricci_scalar (const Scalar< DataType > &horizon_radius_with_spin_on_z_axis, const YlmSpherepack &ylm_with_spin_on_z_axis, const YlmSpherepack &ylm, double mass, const std::array< double, 3 > &dimensionless_spin) noexcept |
| Kerr (Kerr-Schild) horizon ricci scalar (generic spin) More... | |
| template<typename DataType , size_t Dim, UpLo Ul, typename Fr = Frame::Inertial, Requires<(Ul==UpLo::Up)> = nullptr> | |
| tnsr::I< DataType, Dim, Fr > | make_random_vector_in_magnitude_range (const gsl::not_null< std::mt19937 * > nn_generator, const tnsr::ii< DataType, Dim, Fr > &metric, const double min_magnitude, const double max_magnitude) noexcept |
| Construct a spatial vector in a given magnitude range. More... | |
| template<typename DataType , size_t Dim, UpLo Ul, typename Fr = Frame::Inertial, typename T > | |
| Tensor< DataType, Symmetry< 1 >, index_list< SpatialIndex< Dim, Ul, Fr > > > | make_random_vector_in_magnitude_range_flat (const gsl::not_null< std::mt19937 * > nn_generator, const T &used_for_size, const double min_magnitude, const double max_magnitude) noexcept |
| Construct a spatial vector in a given magnitude range. More... | |
| template<typename T , typename UniformRandomBitGenerator , typename RandomNumberDistribution > | |
| void | fill_with_random_values (const gsl::not_null< T * > data, const gsl::not_null< UniformRandomBitGenerator * > generator, const gsl::not_null< RandomNumberDistribution * > distribution) noexcept |
| Fill an existing data structure with random values. | |
| template<typename T , typename UniformRandomBitGenerator , typename RandomNumberDistribution > | |
| T | make_with_random_values (const gsl::not_null< UniformRandomBitGenerator * > generator, const gsl::not_null< RandomNumberDistribution * > distribution) noexcept |
| Make a fixed-size data structure and fill with random values. More... | |
| template<typename DataType > | |
| tnsr::I< DataType, 1 > | random_unit_normal (gsl::not_null< std::mt19937 * > generator, const tnsr::ii< DataType, 1 > &spatial_metric) noexcept |
Make a random unit normal vector at each element of DataType. | |
| template<typename DataType > | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_0 (const DataType &data) noexcept |
| Test that evaluating a right hand side tensor expression containing a single rank 0 tensor correctly assigns the data to the evaluated left hand side tensor. More... | |
| template<typename DataType , typename TensorIndexTypeList , auto & TensorIndex> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_1_impl () noexcept |
| Test that evaluating a right hand side tensor expression containing a single rank 1 tensor correctly assigns the data to the evaluated left hand side tensor. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexType, UpLo Valence, auto & TensorIndex> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_1 () noexcept |
| Iterate testing of evaluating single rank 1 Tensors on multiple Frame types and dimensions. More... | |
| template<typename DataType , typename RhsSymmetry , typename RhsTensorIndexTypeList , auto & TensorIndexA, auto & TensorIndexB> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_2_impl () noexcept |
| Test that evaluating a right hand side tensor expression containing a single rank 2 tensor correctly assigns the data to the evaluated left hand side tensor. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexTypeA, template< size_t, UpLo, typename > class TensorIndexTypeB, UpLo ValenceA, UpLo ValenceB, auto & TensorIndexA, auto & TensorIndexB> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_2_no_symmetry () noexcept |
| Iterate testing of evaluating single rank 2 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexType, UpLo Valence, auto & TensorIndexA, auto & TensorIndexB> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_2_symmetric () noexcept |
| Iterate testing of evaluating single rank 2 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , typename RhsSymmetry , typename RhsTensorIndexTypeList , auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_3_impl () noexcept |
| Test that evaluating a right hand side tensor expression containing a single rank 3 tensor correctly assigns the data to the evaluated left hand side tensor. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexTypeA, template< size_t, UpLo, typename > class TensorIndexTypeB, template< size_t, UpLo, typename > class TensorIndexTypeC, UpLo ValenceA, UpLo ValenceB, UpLo ValenceC, auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_3_no_symmetry () noexcept |
| Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexTypeAB, template< size_t, UpLo, typename > class TensorIndexTypeC, UpLo ValenceAB, UpLo ValenceC, auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_3_ab_symmetry () noexcept |
| Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexTypeAC, template< size_t, UpLo, typename > class TensorIndexTypeB, UpLo ValenceAC, UpLo ValenceB, auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_3_ac_symmetry () noexcept |
| Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexTypeA, template< size_t, UpLo, typename > class TensorIndexTypeBC, UpLo ValenceA, UpLo ValenceBC, auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_3_bc_symmetry () noexcept |
| Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , template< size_t, UpLo, typename > class TensorIndexType, UpLo Valence, auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_3_abc_symmetry () noexcept |
| Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations. More... | |
| template<typename DataType , typename RhsSymmetry , typename RhsTensorIndexTypeList , auto & TensorIndexA, auto & TensorIndexB, auto & TensorIndexC, auto & TensorIndexD> | |
| void | TestHelpers::TensorExpressions::test_evaluate_rank_4 () noexcept |
| Test that evaluating a right hand side tensor expression containing a single rank 4 tensor correctly assigns the data to the evaluated left hand side tensor. More... | |
| void | TestHelpers::TensorExpressions::test_tensor_index_transformation_rank_0 () noexcept |
| Test that the transformation between two rank 0 tensors' generic indices and the subsequent transformed multi-index is correctly computed. More... | |
| template<typename TensorIndex > | |
| void | TestHelpers::TensorExpressions::test_tensor_index_transformation_rank_1 (const TensorIndex &) noexcept |
| Test that the transformation between two rank 1 tensors' generic indices and the subsequent transformed multi-indices are correctly computed. More... | |
| template<typename TensorIndexA , typename TensorIndexB > | |
| void | TestHelpers::TensorExpressions::test_tensor_index_transformation_rank_2 (const TensorIndexA &, const TensorIndexB &) noexcept |
| Test that the transformation between two rank 2 tensors' generic indices and the subsequent transformed multi-indices are correctly computed. More... | |
| template<typename TensorIndexA , typename TensorIndexB , typename TensorIndexC > | |
| void | TestHelpers::TensorExpressions::test_tensor_index_transformation_rank_3 (const TensorIndexA &, const TensorIndexB &, const TensorIndexC &) noexcept |
| Test that the transformation between two rank 3 tensors' generic indices and the subsequent transformed multi-indices are correctly computed. More... | |
| template<typename TensorIndexA , typename TensorIndexB , typename TensorIndexC , typename TensorIndexD > | |
| void | TestHelpers::TensorExpressions::test_tensor_index_transformation_rank_4 (const TensorIndexA &, const TensorIndexB &, const TensorIndexC &, const TensorIndexD &) noexcept |
| Test that the transformation between two rank 4 tensors' generic indices and the subsequent transformed multi-indices are correctly computed. More... | |
| template<typename VectorType , typename ValueType > | |
| void | TestHelpers::VectorImpl::vector_test_construct_and_assign (tt::get_fundamental_type_t< ValueType > low=tt::get_fundamental_type_t< ValueType >{-100.0}, tt::get_fundamental_type_t< ValueType > high=tt::get_fundamental_type_t< ValueType >{100.0}) noexcept |
test construction and assignment of a VectorType with a ValueType | |
| template<typename VectorType , typename ValueType > | |
| void | TestHelpers::VectorImpl::vector_test_serialize (tt::get_fundamental_type_t< ValueType > low=tt::get_fundamental_type_t< ValueType >{-100.0}, tt::get_fundamental_type_t< ValueType > high=tt::get_fundamental_type_t< ValueType >{ 100.0}) noexcept |
test the serialization of a VectorType constructed with a ValueType | |
| template<typename VectorType , typename ValueType > | |
| void | TestHelpers::VectorImpl::vector_test_ref (tt::get_fundamental_type_t< ValueType > low=tt::get_fundamental_type_t< ValueType >{-100.0}, tt::get_fundamental_type_t< ValueType > high=tt::get_fundamental_type_t< ValueType >{ 100.0}) noexcept |
test the construction and move of a reference VectorType constructed with a ValueType | |
| template<typename VectorType , typename ValueType = typename VectorType::ElementType> | |
| void | TestHelpers::VectorImpl::vector_ref_test_size_error (RefSizeErrorTestKind test_kind, tt::get_fundamental_type_t< ValueType > low=tt::get_fundamental_type_t< ValueType >{-100.0}, tt::get_fundamental_type_t< ValueType > high=tt::get_fundamental_type_t< ValueType >{100.0}) noexcept |
Test that assigning to a non-owning VectorType of the wrong size appropriately generates an error. More... | |
| template<typename VectorType , typename ValueType > | |
| void | TestHelpers::VectorImpl::vector_test_math_after_move (tt::get_fundamental_type_t< ValueType > low=tt::get_fundamental_type_t< ValueType >{-100.0}, tt::get_fundamental_type_t< ValueType > high=tt::get_fundamental_type_t< ValueType >{100.0}) noexcept |
tests a small sample of math functions after a move of a VectorType initialized with ValueType | |
| template<TestKind Test, typename VectorType0 , typename... VectorTypes, typename... FunctionsAndArgumentBounds> | |
| void | TestHelpers::VectorImpl::test_functions_with_vector_arguments (const std::tuple< FunctionsAndArgumentBounds... > &tuple_of_functions_and_argument_bounds) noexcept |
| General entry function for testing arbitrary math functions on vector types. More... | |
| template<typename Map > | |
| bool | are_maps_equal (const Map &map, const domain::CoordinateMapBase< Frame::Logical, Frame::Inertial, Map::dim > &map_base) noexcept |
Given a Map and a CoordinateMapBase, checks that the maps are equal by downcasting map_base and then comparing to map. Returns false if the downcast fails. | |
| template<typename SourceFrame , typename TargetFrame , size_t VolumeDim> | |
| void | check_if_maps_are_equal (const domain::CoordinateMapBase< SourceFrame, TargetFrame, VolumeDim > &map_one, const domain::CoordinateMapBase< SourceFrame, TargetFrame, VolumeDim > &map_two, const double time=std::numeric_limits< double >::quiet_NaN(), const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time={}) noexcept |
| Given two coordinate maps (but not their types), check that the maps are equal by evaluating them at a random set of points. | |
| template<typename Map > | |
| void | check_if_map_is_identity (const Map &map) noexcept |
| Given a coordinate map, check that this map is equal to the identity by evaluating the map at a random set of points. | |
| template<typename Map > | |
| void | test_frame_velocity (const Map &map, const std::array< double, Map::dim > &test_point, const double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) |
Given a Map map, checks that the frame velocity matches a sixth-order finite difference approximation. | |
| template<typename Map , typename... Args> | |
| void | test_coordinate_map_implementation (const Map &map) noexcept |
Checks that the CoordinateMap map functions as expected when used as the template parameter to the CoordinateMap type. | |
| template<typename Map , typename... Args> | |
| void | test_coordinate_map_argument_types (const Map &map, const std::array< double, Map::dim > &test_point, const Args &... args) |
Checks that the CoordinateMap map functions as expected when used with different argument types. | |
| template<typename Map > | |
| void | test_suite_for_map_on_unit_cube (const Map &map) noexcept |
Given a Map map, tests the map functions, including map inverse, jacobian, and inverse jacobian, for a series of points. These points are chosen in a dim-dimensonal cube of side 2 centered at the origin. The map is expected to be valid on the boundaries of the cube. | |
| template<typename Map > | |
| void | test_suite_for_map_on_sphere (const Map &map, const bool include_origin=true, const double radius_of_sphere=1.0) noexcept |
Given a Map map, tests the map functions, including map inverse, jacobian, and inverse jacobian, for a series of points. These points are chosen in a sphere of radius radius_of_sphere, and the map is expected to be valid on the boundary of that sphere as well as in its interior. The flag include_origin indicates whether to test the map at the origin. This test works only in 3 dimensions. | |
| template<typename Map > | |
| void | test_suite_for_map_on_cylinder (const Map &map, const double inner_radius, const double outer_radius) noexcept |
Given a Map map, tests the map functions, including map inverse, jacobian, and inverse jacobian, for a series of points. These points are chosen in a right cylinder with cylindrical radius 1 and z-axis extending from -1 to +1. The map is expected to be valid on the boundary of that cylinder as well as in its interior. This test works only in 3 dimensions. | |
| std::array< OrientationMap< 3 >, 6 > | all_wedge_directions () noexcept |
| Wedge OrientationMap in each of the six directions used in the Shell and Sphere domain creators. | |
| template<typename System , typename BoundaryCorrection , size_t FaceDim, typename... VolumeTags, typename... RangeTags> | |
| void | TestHelpers::evolution::dg::test_boundary_correction_conservation (const gsl::not_null< std::mt19937 * > generator, const BoundaryCorrection &correction, const Mesh< FaceDim > &face_mesh, const tuples::TaggedTuple< VolumeTags... > &volume_data, const tuples::TaggedTuple< Tags::Range< RangeTags >... > &ranges, const ZeroOnSmoothSolution zero_on_smooth_solution=ZeroOnSmoothSolution::Yes, const double eps=1.0e-12) |
| Checks that the boundary correction is conservative and that for smooth solutions the strong-form correction is zero. More... | |
| template<typename System , typename ConversionClassList = tmpl::list<>, typename BoundaryCorrection , size_t FaceDim, typename... VolumeTags, typename... RangeTags> | |
| void | TestHelpers::evolution::dg::test_boundary_correction_with_python (const gsl::not_null< std::mt19937 * > generator, const std::string &python_module, const std::array< std::string, tmpl::size< typename BoundaryCorrection::dg_package_field_tags >::value > &python_dg_package_data_functions, const std::array< std::string, tmpl::size< typename System::variables_tag::tags_list >::value > &python_dg_boundary_terms_functions, const BoundaryCorrection &correction, const Mesh< FaceDim > &face_mesh, const tuples::TaggedTuple< VolumeTags... > &volume_data, const tuples::TaggedTuple< Tags::Range< RangeTags >... > &ranges, const double epsilon=1.0e-12) |
Tests that the dg_package_data and dg_boundary_terms functions agree with the python implementation. More... | |
| template<typename System , typename SolutionType , size_t Dim = System::volume_dim, typename... Maps, typename PackageFluxesArgs > | |
| void | FirstOrderEllipticSolutionsTestHelpers::verify_smooth_solution (const SolutionType &solution, const domain::CoordinateMap< Frame::Logical, Frame::Inertial, Maps... > &coord_map, const double tolerance_offset, const double tolerance_scaling, PackageFluxesArgs &&package_fluxes_args) |
| template<typename System , typename SolutionType , size_t Dim = System::volume_dim, typename... Maps> | |
| void | FirstOrderEllipticSolutionsTestHelpers::verify_solution_with_power_law_convergence (const SolutionType &solution, const domain::CoordinateMap< Frame::Logical, Frame::Inertial, Maps... > &coord_map, const double tolerance_offset, const double tolerance_pow) |
| template<typename Solution > | |
| void | verify_grmhd_solution (const Solution &solution, const Block< 3 > &block, const Mesh< 3 > &mesh, const double error_tolerance, const double time, const double delta_time) noexcept |
Determines if the given solution is a solution of the GRMHD equations. More... | |
| template<typename ReturnType , typename T , typename UniformRandomBitGenerator , typename RandomNumberDistribution > | |
| ReturnType | make_with_random_values (const gsl::not_null< UniformRandomBitGenerator * > generator, const gsl::not_null< RandomNumberDistribution * > distribution, const T &used_for_size) noexcept |
| Make a data structure and fill it with random values. More... | |
| template<typename ReturnType , typename T , typename UniformRandomBitGenerator , typename RandomNumberDistribution > | |
| ReturnType | make_with_random_values (const gsl::not_null< UniformRandomBitGenerator * > generator, RandomNumberDistribution distribution, const T &used_for_size) noexcept |
| Make a data structure and fill it with random values. More... | |
| template<typename Map > | |
| void | test_jacobian (const Map &map, const std::array< double, Map::dim > &test_point) noexcept |
Given a Map map, checks that the jacobian gives expected results when compared to the numerical derivative in each direction. | |
| template<typename Map > | |
| void | test_jacobian (const Map &map, const std::array< double, Map::dim > &test_point, const double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) noexcept |
Given a Map map, checks that the jacobian gives expected results when compared to the numerical derivative in each direction. | |
| template<typename Map > | |
| void | test_inv_jacobian (const Map &map, const std::array< double, Map::dim > &test_point) noexcept |
Given a Map map, checks that the inverse jacobian and jacobian multiply together to produce the identity matrix. | |
| template<typename Map > | |
| void | test_inv_jacobian (const Map &map, const std::array< double, Map::dim > &test_point, const double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) |
Given a Map map, checks that the inverse jacobian and jacobian multiply together to produce the identity matrix. | |
| template<typename Map , typename T > | |
| void | test_inverse_map (const Map &map, const std::array< T, Map::dim > &test_point) noexcept |
Given a Map map, checks that the inverse map gives expected results. | |
| template<typename Map , typename T > | |
| void | test_inverse_map (const Map &map, const std::array< T, Map::dim > &test_point, const double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) noexcept |
Given a Map map, checks that the inverse map gives expected results. | |
| template<class DampingFunctionType , class T , class... MemberArgs> | |
| void | TestHelpers::GeneralizedHarmonic::ConstraintDamping::check (std::unique_ptr< DampingFunctionType > in_gh_damping_function, const std::string &python_function_prefix, const T &used_for_size, const std::array< std::pair< double, double >, 1 > &random_value_bounds, const std::vector< std::string > &function_of_time_names, const MemberArgs &... member_args) noexcept |
| Test a DampingFunction by comparing to python functions. More... | |
| template<class DampingFunctionType , class T , class... MemberArgs> | |
| void | TestHelpers::GeneralizedHarmonic::ConstraintDamping::check (DampingFunctionType in_gh_damping_function, const std::string &python_function_prefix, const T &used_for_size, const std::array< std::pair< double, double >, 1 > &random_value_bounds, const std::vector< std::string > &function_of_time_names, const MemberArgs &... member_args) noexcept |
| Test a DampingFunction by comparing to python functions. More... | |
| template<typename System , typename SolutionType , typename... Maps, typename... FluxesArgs, typename... SourcesArgs> | |
| void | FirstOrderEllipticSolutionsTestHelpers::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<>{}) |
Test that the solution numerically solves the System on the given grid for the given tolerance. | |
| template<typename System , typename SolutionType , typename... Maps> | |
| void | FirstOrderEllipticSolutionsTestHelpers::verify_solution (const SolutionType &solution, const Mesh< System::volume_dim > &mesh, const domain::CoordinateMap< Frame::Logical, Frame::Inertial, Maps... > coord_map, const double tolerance) |
Test that the solution numerically solves the System on the given grid for the given tolerance. | |
| template<class EosType , class T , class... MemberArgs> | |
| void | TestHelpers::EquationsOfState::check (std::unique_ptr< EosType > in_eos, const std::string &python_function_prefix, const T &used_for_size, const MemberArgs &... member_args) noexcept |
| Test an equation of state by comparing to python functions. More... | |
| template<class EosType , class T , class... MemberArgs> | |
| void | TestHelpers::EquationsOfState::check (EosType in_eos, const std::string &python_function_prefix, const T &used_for_size, const MemberArgs &... member_args) noexcept |
| Test an equation of state by comparing to python functions. More... | |
| template<class MathFunctionType , class T , class... MemberArgs> | |
| void | TestHelpers::MathFunctions::check (std::unique_ptr< MathFunctionType > in_math_function, const std::string &python_function_prefix, const T &used_for_size, const std::array< std::pair< double, double >, 1 > random_value_bounds, const MemberArgs &... member_args) noexcept |
| Test a MathFunction by comparing to python functions. More... | |
| template<class MathFunctionType , class T , class... MemberArgs> | |
| void | TestHelpers::MathFunctions::check (MathFunctionType in_math_function, const std::string &python_function_prefix, const T &used_for_size, const std::array< std::pair< double, double >, 1 > random_value_bounds, const MemberArgs &... member_args) noexcept |
| Test a MathFunction by comparing to python functions. More... | |
Classes, functions, macros, and instructions for developing tests.
SpECTRE uses the testing framework Catch. Catch supports a variety of different styles of tests including BDD and fixture tests. The file cmake/SpectreAddCatchTests.cmake parses the source files and adds the found tests to ctest with the correct properties specified by tags and attributes.
To run the tests, type ctest in the build directory. You can specify a regex to match the test name using ctest -R Unit.Blah, or run all tests with a certain tag using ctest -L tag.
To compare two floating-point numbers that may differ by round-off, use the helper object approx. This is an instance of Catch's comparison class Approx in which the relative tolerance for comparisons is set to roughly \(10^{-14}\) (i.e. std::numeric_limits<double>::epsilon()*100). When possible, we recommend using approx for fuzzy comparisons as follows:
For checks that need more control over the precision (e.g. an algorithm in which round-off errors accumulate to a higher level), we recommend using the approx helper with a one-time tolerance adjustment. A comment should explain the reason for the adjustment:
For tests in which the same precision adjustment is re-used many times, a new helper object can be created from Catch's Approx with a custom precision:
Note: We provide the approx object because Catch's Approx defaults to a very loose tolerance (std::numeric_limits<float>::epsilon()*100, or roughly \(10^{-5}\) relative error), and so is poorly-suited to checking many numerical algorithms that rely on double-precision accuracy. By providing a tighter tolerance with approx, we avoid having to redefine the tolerance in every test.
Attributes allow you to modify properties of the test. Attributes are specified as follows:
Available attributes are:
| Attribute | Description |
|---|---|
| TimeOut | override the default timeout and set the timeout to N seconds. This should be set very sparingly since unit tests are designed to be short. If your test is too long you should consider testing smaller portions of the code if possible, or writing an integration test instead. |
| OutputRegex | When testing failure modes the exact error message must be tested, not just that the test failed. Since the string passed is a regular expression you must escape any regex tokens. For example, to match some (word) and you must specify the string some \(word\) and. If your error message contains a newline, you can match it using the dot operator ., which matches any character. |
Several tests fail intentionally at the executable level to test error handling like ASSERT statements in the code. CTest is aware of which should fail and passes them. If you want to debug an individual test in a debugger you need to run a single test using the RunTests executable (in dg-charm-build/bin/RunTests) you must specify the name of the test as the first argument. For example, if you want to run just the "Unit.Gradient" test you can run ./bin/RunTests Unit.Gradient. If you are using a debugger launch the debugger, for example if you're using LLDB then run lldb ./bin/RunTests and then to run the executable inside the debugger use run Unit.Gradient inside the debugger.
SpECTRE uses the testing framework Catch. Catch supports a variety of different styles of tests including BDD and fixture tests. The file cmake/SpectreAddCatchTests.cmake parses the source files and adds the found tests to ctest with the correct properties specified by tags and attributes.
To run the tests, type ctest in the build directory. You can specify a regex to match the test name using ctest -R Unit.Blah, or run all tests with a certain tag using ctest -L tag.
To compare two floating-point numbers that may differ by round-off, use the helper object approx. This is an instance of Catch's comparison class Approx in which the relative tolerance for comparisons is set to roughly \(10^{-14}\) (i.e. std::numeric_limits<double>::epsilon()*100). When possible, we recommend using approx for fuzzy comparisons as follows:
For checks that need more control over the precision (e.g. an algorithm in which round-off errors accumulate to a higher level), we recommend using the approx helper with a one-time tolerance adjustment. A comment should explain the reason for the adjustment:
For tests in which the same precision adjustment is re-used many times, a new helper object can be created from Catch's Approx with a custom precision:
Note: We provide the approx object because Catch's Approx defaults to a very loose tolerance (std::numeric_limits<float>::epsilon()*100, or roughly \(10^{-5}\) relative error), and so is poorly-suited to checking many numerical algorithms that rely on double-precision accuracy. By providing a tighter tolerance with approx, we avoid having to redefine the tolerance in every test.
Attributes allow you to modify properties of the test. Attributes are specified as follows:
Available attributes are:
| Attribute | Description |
|---|---|
| TimeOut | override the default timeout and set the timeout to N seconds. This should be set very sparingly since unit tests are designed to be short. If your test is too long you should consider testing smaller portions of the code if possible, or writing an integration test instead. |
| OutputRegex | When testing failure modes the exact error message must be tested, not just that the test failed. Since the string passed is a regular expression you must escape any regex tokens. For example, to match some (word) and you must specify the string some \(word\) and. If your error message contains a newline, you can match it using the dot operator ., which matches any character. |
Several tests fail intentionally at the executable level to test error handling like ASSERT statements in the code. CTest is aware of which should fail and passes them. If you want to debug an individual test in a debugger you need to run a single test using the RunTests executable (in dg-charm-build/bin/RunTests) you must specify the name of the test as the first argument. For example, if you want to run just the "Unit.Gradient" test you can run ./bin/RunTests Unit.Gradient. If you are using a debugger launch the debugger, for example if you're using LLDB then run lldb ./bin/RunTests and then to run the executable inside the debugger use run Unit.Gradient inside the debugger.
| #define ASSERTION_TEST | ( | ) |
Mark a test to be checking an ASSERT.
Testing error handling is just as important as testing functionality. Tests that are supposed to exit with an error must be annotated with the attribute
Note that the regex only needs to be a sub-expression of the error message, that is, there are implicit wildcards before and after the string.
In order to test ASSERT's properly the test must also fail for release builds. This is done by adding this macro at the beginning for the test.
| #define CHECK_COMPLEX_APPROX | ( | a, | |
| b | |||
| ) |
A wrapper around Catch's CHECK macro that checks approximate equality of the two entries in a std::complex. For efficiency, no function forwarding is performed, just a pair of CHECKs inline.
| #define CHECK_COMPLEX_CUSTOM_APPROX | ( | a, | |
| b, | |||
| appx | |||
| ) |
Same as CHECK_COMPLEX_APPROX with user-defined Approx. The third argument should be of type Approx.
| #define CHECK_FOR_DOUBLES_AND_DATAVECTORS | ( | FUNCTION_NAME, | |
| ... | |||
| ) |
Macro used to test functions whose parameter can be a double or a DataVector.
In testing multiple instances of a function template using random values, it often proves useful to write a wrapper around pypp::check_with_random_values. This way, one can easily loop over several values of one or multiple template parameters (e.g. when testing a function templated in the number of spacetime dimensions.) The template parameters of the wrapper will then correspond to the template parameters of the function, which will be used by pypp::check_with_random_values to invoke and test each instance. Each of these wrappers will generally need only one parameter, namely a variable used_for_size passed to pypp::check_with_random_values that can be a double, a DataVector, or both (provided that the function being tested is templated in the type of used_for_size.) Since this is applied in multiple test files, all of these files will share the same way to generate the required calls to the wrapper.
This macro, along with
allow to generate calls to multiple instances of a test function template in the same way as done by INVOKE_TEST_FUNCTION(FUNCTION_NAME, ARGS_TUPLE, ...) (to which these macros call), except that the tuple of arguments is not passed, as these macros will assume that a double d and/or a DataVector dv will be previously defined. Although any ds and dvs will work, one can (and it is recommended to) generate signaling NaN values for d and dv. This can be done by invoking one of the three provided macros: GENERATE_UNINIATILIZED_DOUBLE, GENERATE_UNINITIALIZED_DATAVECTOR, or GENERATE_UNINITIALIZED_DOUBLE_AND_DATAVECTOR. For example,
will generate a test case for 1, 2 and 3 dimensions:
Analogously, the wrapper
can be invoked by writing
which will generate
Note that it is not necessary to pass values for DataType, as they are deduced from used_for_size.
| #define CHECK_ITERABLE_APPROX | ( | a, | |
| b | |||
| ) |
A wrapper around Catch's CHECK macro that checks approximate equality of entries in iterable containers. For maplike containers, keys are checked for strict equality and values are checked for approximate equality.
| #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.
| #define CHECK_OP | ( | a, | |
| op, | |||
| b, | |||
| c | |||
| ) |
Check a op b == c and also the op= version.
| #define CHECK_VARIABLES_APPROX | ( | a, | |
| b | |||
| ) |
A wrapper around Catch's CHECK macro that checks approximate equality of each entry in each tag within a variables.
| #define CHECK_VARIABLES_CUSTOM_APPROX | ( | a, | |
| b, | |||
| appx | |||
| ) |
Same as CHECK_VARIABLES_APPROX, but with a user-defined Approx. The third argument should be of type Approx.
| #define ERROR_TEST | ( | ) |
Mark a test as checking a call to ERROR.
In order to properly handle aborting with Catch versions newer than 1.6.1 we must install a signal handler after Catch does, which means inside the SPECTRE_TEST_CASE itself. The ERROR_TEST() macro should be the first line in the SPECTRE_TEST_CASE.
| #define INVOKE_TEST_FUNCTION | ( | FUNCTION_NAME, | |
| TUPLE_ARGS, | |||
| ... | |||
| ) |
Macro used to invoke a test function of multiple template arguments.
This macro allows to generate calls to multiple instances of a test function template, all of which will receive the same parameters. The first argument to this macro is the name of the function. The second argument is a macro-tuple containing the parameters passed to each instance, e.g. (x, y). The remaining arguments are macro-tuples of the values for each template parameter one wants to loop over, e.g. (1, 2, 3), (Frame::Inertial, Frame::Grid). For example, a function template
can be invoked by writing
which will generate
| #define MAKE_GENERATOR | ( | ... | ) |
MAKE_GENERATOR(NAME [, SEED]) declares a variable of name NAME containing a generator of type std::mt19937.
As the generator is made, INFO is called to make sure failed tests provide seed information. SEED is chosen randomly if not supplied, otherwise it must be a constant expression.
| #define OUTPUT_TEST | ( | ) |
Mark a test as checking the output with a regular expression.
The OUTPUT_TEST() macro should be the first line in the SPECTRE_TEST_CASE. Catch requires at least one CHECK in each test to pass, so we add one in case nothing but the output is checked.
| #define SPECTRE_PARALLEL_REQUIRE | ( | expr | ) |
A similar to Catch's REQUIRE statement, but can be used in tests that spawn several chares with possibly complex interaction between the chares.
| #define SPECTRE_PARALLEL_REQUIRE_FALSE | ( | expr | ) |
A similar to Catch's REQUIRE_FALSE statement, but can be used in tests that spawn several chares with possibly complex interaction between the chares.
the set of test types that may be used for the math operations
Three types of test are provided:
Normal is used to indicate those tests which should be performed over all combinations of the supplied vector type(s) and their value types. This is useful for e.g. +.Strict is used to indicate those tests which should be performed over only sets of the vector type and compared to the same operation of the set of its value type. This is useful for e.g. atan2, which cannot take a DataVector and a double as arguments.Inplace is used to indicate those tests which should be performed maintaining the type of the left-hand side of the operator and not including it in the combinations. Inplace operators such as += have a more restrictive condition on the type of the left hand side than do simply +. (e.g. double + complex<double> compiles, but double += complex<double> does not)GivenOrderOfArgumentsOnly is used to indicate that the arguments given should not be taken in any combination apart from the given combination. This should be used for highly restrictive operations which are only supported for certain type combinations.
|
noexcept |
Test a DampingFunction by comparing to python functions.
The python functions must be added to TestFunctions.py in tests/Unit/Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Python. Each python function for a corresponding DampingFunction should begin with a prefix python_function_prefix. The prefix for each class of DampingFunction is arbitrary, but should generally be descriptive (e.g. 'gaussian_plus_constant') of the DampingFunction.
The input parameter function_of_time_name is the name of the FunctionOfTime that will be included in the FunctionsOfTime passed to the DampingFunction's call operator. For time-dependent DampingFunctions, this parameter must be consistent with the FunctionOfTime name that the call operator of in_gh_damping_function expects. For time-independent DampingFunctions, function_of_time_name will be ignored.
If a DampingFunction class has member variables set by its constructor, then these member variables must be passed in as the last arguments to the check function`. Each python function must take these same arguments as the trailing arguments.
|
noexcept |
Test an equation of state by comparing to python functions.
The python functions must be added to tests/Unit/PointwiseFunctions/Hydro/EquationsOfState/TestFunctions.py. The prefix for each class of equation of state is arbitrary, but should generally be something like "polytropic" for polytropic fluids.
The python_function_prefix argument passed to check must be PREFIX. If an EoS class has member variables (these must be doubles currently) that are used to compute the quantities, such as the polytropic constant and polytropic exponent for a fluid, then they must be passed in as the last arguments to the check function`. Each python function must take these same arguments as the trailing arguments.
|
noexcept |
Test a MathFunction by comparing to python functions.
The python functions must be added to tests/Unit/PointwiseFunctions/MathFunctions/Python/TestFunctions.py. The prefix for each class of MathFunction is arbitrary, but should generally be descriptive (e.g. 'gaussian', 'sinusoid', 'pow_x') of the MathFunction.
The python_function_prefix argument passed to check must be PREFIX. If a MathFunction class has member variables set by its constructor, then these member variables must be passed in as the last arguments to the check function`. Each python function must take these same arguments as the trailing arguments.
|
noexcept |
Test a DampingFunction by comparing to python functions.
The python functions must be added to TestFunctions.py in tests/Unit/Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Python. Each python function for a corresponding DampingFunction should begin with a prefix python_function_prefix. The prefix for each class of DampingFunction is arbitrary, but should generally be descriptive (e.g. 'gaussian_plus_constant') of the DampingFunction.
The input parameter function_of_time_name is the name of the FunctionOfTime that will be included in the FunctionsOfTime passed to the DampingFunction's call operator. For time-dependent DampingFunctions, this parameter must be consistent with the FunctionOfTime name that the call operator of in_gh_damping_function expects. For time-independent DampingFunctions, function_of_time_name will be ignored.
If a DampingFunction class has member variables set by its constructor, then these member variables must be passed in as the last arguments to the check function`. Each python function must take these same arguments as the trailing arguments.
|
noexcept |
Test an equation of state by comparing to python functions.
The python functions must be added to tests/Unit/PointwiseFunctions/Hydro/EquationsOfState/TestFunctions.py. The prefix for each class of equation of state is arbitrary, but should generally be something like "polytropic" for polytropic fluids.
The python_function_prefix argument passed to check must be PREFIX. If an EoS class has member variables (these must be doubles currently) that are used to compute the quantities, such as the polytropic constant and polytropic exponent for a fluid, then they must be passed in as the last arguments to the check function`. Each python function must take these same arguments as the trailing arguments.
|
noexcept |
Test a MathFunction by comparing to python functions.
The python functions must be added to tests/Unit/PointwiseFunctions/MathFunctions/Python/TestFunctions.py. The prefix for each class of MathFunction is arbitrary, but should generally be descriptive (e.g. 'gaussian', 'sinusoid', 'pow_x') of the MathFunction.
The python_function_prefix argument passed to check must be PREFIX. If a MathFunction class has member variables set by its constructor, then these member variables must be passed in as the last arguments to the check function`. Each python function must take these same arguments as the trailing arguments.
|
noexcept |
Extrinsic curvature of 2D sphere in 3D flat space.
Computes \(K_{ij} = \frac{1}{r}\left(\delta_{ij} - \frac{x_i x_j}{r}\right),\) where \(r = x_i x_j \delta^{ij}\) and \(x_i\) is the position vector in Cartesian coordinates.
|
noexcept |
Kerr (Kerr-Schild) horizon ricci scalar (spin on z axis)
Computes the 2-dimensional Ricci scalar \(R\) on the horizon of a Kerr-Schild black hole with spin in the z direction in terms of mass mass and dimensionless spin dimensionless_spin_z.
|
noexcept |
Kerr (Kerr-Schild) horizon ricci scalar (generic spin)
Computes the 2-dimensional Ricci scalar \(R\) on the horizon of a Kerr-Schild black hole with generic spin in terms of mass mass and dimensionless spin dimensionless_spin.
|
noexcept |
Construct a spatial vector in a given magnitude range.
The magnitude is computed with respect to the given metric, where the metric is assumed to have positive signature.
|
noexcept |
Construct a spatial vector in a given magnitude range.
The magnitude is computed with respect to the flat space Euclidian metric.
|
noexcept |
Make a fixed-size data structure and fill with random values.
Given a template argument type T, create an object of the same type, fills it with random values, and returns the result. Acts as a convenience function to avoid users needing to put in constructors with signaling_NaN()s or max()s themselves when making with random values. Used as make_with_random_values<Type>(make_not_null(&gen),make_not_null(&dist))
|
noexcept |
Make a data structure and fill it with random values.
Given an object of type T, create an object of type ReturnType whose elements are initialized to random values using the given random number generator and random number distribution.
Requires: the type ReturnType to be creatable using make_with_value<ReturnType>(T)
|
noexcept |
Make a data structure and fill it with random values.
Given an object of type T, create an object of type ReturnType whose elements are initialized to random values using the given random number generator and random number distribution.
Requires: the type ReturnType to be creatable using make_with_value<ReturnType>(T)
|
noexcept |
Calculates the derivative of an Invocable at a point x - represented by an array of doubles - in the domain of map with a sixth-order finite difference method.
Intended for use with CoordinateMaps taking the domain {xi,eta,zeta} to the range {x,y,z}. This function calculates the derivative along the direction given by direction with a step size of h.
Requires: direction be between 0 and VolumeDim
|
noexcept |
Schwarzschild (Kerr-Schild) spatial ricci tensor.
Computes \(R_{ij} = M \frac{r^2(4M+r)\delta_{ij}-(8M+3r)x_i x_j} {r^4(2M+r^2)},\) where \(r = x_i x_j \delta^{ij}\), \(x_i\) is the position vector in Cartesian coordinates, and M is the mass.
| void TestHelpers::evolution::dg::test_boundary_correction_conservation | ( | const gsl::not_null< std::mt19937 * > | generator, |
| const BoundaryCorrection & | correction, | ||
| const Mesh< FaceDim > & | face_mesh, | ||
| const tuples::TaggedTuple< VolumeTags... > & | volume_data, | ||
| const tuples::TaggedTuple< Tags::Range< RangeTags >... > & | ranges, | ||
| const ZeroOnSmoothSolution | zero_on_smooth_solution = ZeroOnSmoothSolution::Yes, |
||
| const double | eps = 1.0e-12 |
||
| ) |
Checks that the boundary correction is conservative and that for smooth solutions the strong-form correction is zero.
By default, each input tensor for dg_package_data is randomly generated from the interval [-1,1) (except the metric, which for systems with a metric is generated to be close to flat space). The argument ranges is a TaggedTuple of TestHelpers::evolution::dg::Tags::Range<tag> that enables the caller to pick a custom interval for generating the input tag. This is useful, for example, for tensors that need positive values. Each tag in ranges must be an argument of dg_package_data.
| void TestHelpers::evolution::dg::test_boundary_correction_with_python | ( | const gsl::not_null< std::mt19937 * > | generator, |
| const std::string & | python_module, | ||
| const std::array< std::string, tmpl::size< typename BoundaryCorrection::dg_package_field_tags >::value > & | python_dg_package_data_functions, | ||
| const std::array< std::string, tmpl::size< typename System::variables_tag::tags_list >::value > & | python_dg_boundary_terms_functions, | ||
| const BoundaryCorrection & | correction, | ||
| const Mesh< FaceDim > & | face_mesh, | ||
| const tuples::TaggedTuple< VolumeTags... > & | volume_data, | ||
| const tuples::TaggedTuple< Tags::Range< RangeTags >... > & | ranges, | ||
| const double | epsilon = 1.0e-12 |
||
| ) |
Tests that the dg_package_data and dg_boundary_terms functions agree with the python implementation.
The variables are filled with random numbers between zero and one before being passed to the implementations. If in the future we need support for negative numbers we can add the ability to specify a single range for all random numbers or each individually.
Please note the following:
pypp::SetupLocalPythonEnvironment must be created before the test_boundary_correction_with_python can be called.dg_formulation is passed as a bool use_strong_form to the python functions since we don't want to rely on python bindings for the enum.ConversionClassList template parameter, which is then passed to pypp::call(). This allows you to, e.g., convert an equation of state into an array locally in a test file.dg_package_field_tagsSystem::variables_tagdg_package_data function, excluding the gsl::not_null arguments.dg_boundary_terms function, excluding the gsl::not_null arguments.dg_package_data is randomly generated from the interval [-1,1) (except the metric, which for systems with a metric is generated to be close to flat space). The argument ranges is a TaggedTuple of TestHelpers::evolution::dg::Tags::Range<tag> that enables the caller to pick a custom interval for generating the input tag. This is useful, for example, for tensors that need positive values. Each tag in ranges must be an argument of dg_package_data.
|
noexcept |
Creates an instance of a given option-creatable type.
This is a wrapper around Options::Parser constructing a single, specified type T from the supplied string. If necessary, metavariables can be supplied as the second template argument.
A class can be explicitly created through a factory by passing std::unique_ptr<BaseClass> as the type. This will require metavariables to be passed. For testing basic factory creation, the simpler TestHelpers::test_factory_creation() can be used instead.
|
noexcept |
Test that evaluating a right hand side tensor expression containing a single rank 0 tensor correctly assigns the data to the evaluated left hand side tensor.
| data | the data being stored in the Tensors |
|
noexcept |
Iterate testing of evaluating single rank 1 Tensors on multiple Frame types and dimensions.
| DataType | the type of data being stored in the Tensors |
| TensorIndexType | the Tensors' TensorIndexType |
| Valence | the valence of the Tensors' index |
| TensorIndex | the TensorIndex used in the the TensorExpression, e.g. ti_a |
|
noexcept |
Test that evaluating a right hand side tensor expression containing a single rank 1 tensor correctly assigns the data to the evaluated left hand side tensor.
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeList | the Tensors' typelist containing their TensorIndexType |
| TensorIndex | the TensorIndex used in the the TensorExpression, e.g. ti_a |
|
noexcept |
Test that evaluating a right hand side tensor expression containing a single rank 2 tensor correctly assigns the data to the evaluated left hand side tensor.
TensorIndexA and TensorIndexB can be any type of TensorIndex and are not necessarily ti_a and ti_b. The "A" and "B" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used and TensorIndexB is the second index used.
If we consider the RHS tensor's generic indices to be (a, b), then this test checks that the data in the evaluated LHS tensor is correct according to the index orders of the LHS and RHS. The two possible cases that are checked are when the LHS tensor is evaluated with index order (a, b) and when it is evaluated with the index order (b, a).
| DataType | the type of data being stored in the Tensors |
| RhsSymmetry | the Symmetry of the RHS Tensor |
| RhsTensorIndexTypeList | the RHS Tensor's typelist of TensorIndexTypes |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
|
noexcept |
Iterate testing of evaluating single rank 2 Tensors on multiple Frame types and dimension combinations.
We test nonsymmetric indices and symmetric indices across two functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_2_no_symmetry)test_evaluate_rank_2_symmetric)TensorIndexA and TensorIndexB can be any type of TensorIndex and are not necessarily ti_a and ti_b. The "A" and "B" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used and TensorIndexB is the second index used.
Note: test_evaluate_rank_2_symmetric has fewer template parameters due to the two indices having a shared TensorIndexType and and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
|
noexcept |
Iterate testing of evaluating single rank 2 Tensors on multiple Frame types and dimension combinations.
We test nonsymmetric indices and symmetric indices across two functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_2_no_symmetry)test_evaluate_rank_2_symmetric)TensorIndexA and TensorIndexB can be any type of TensorIndex and are not necessarily ti_a and ti_b. The "A" and "B" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used and TensorIndexB is the second index used.
Note: test_evaluate_rank_2_symmetric has fewer template parameters due to the two indices having a shared TensorIndexType and and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
|
noexcept |
Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations.
We test various different symmetries across several functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_3_no_symmetry)test_evaluate_rank_3_ab_symmetry)test_evaluate_rank_3_ac_symmetry)test_evaluate_rank_3_bc_symmetry)test_evaluate_rank_3_abc_symmetry)TensorIndexA, TensorIndexB, and TensorIndexC can be any type of TensorIndex and are not necessarily ti_a, ti_b, and ti_c. The "A", "B", and "C" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, and TensorIndexC is the third index used.
Note: the functions dealing with symmetric indices have fewer template parameters due to the indices having a shared TensorIndexType and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| TensorIndexTypeC | the TensorIndexType of the third index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| ValenceC | the valence of the third index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
|
noexcept |
Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations.
We test various different symmetries across several functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_3_no_symmetry)test_evaluate_rank_3_ab_symmetry)test_evaluate_rank_3_ac_symmetry)test_evaluate_rank_3_bc_symmetry)test_evaluate_rank_3_abc_symmetry)TensorIndexA, TensorIndexB, and TensorIndexC can be any type of TensorIndex and are not necessarily ti_a, ti_b, and ti_c. The "A", "B", and "C" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, and TensorIndexC is the third index used.
Note: the functions dealing with symmetric indices have fewer template parameters due to the indices having a shared TensorIndexType and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| TensorIndexTypeC | the TensorIndexType of the third index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| ValenceC | the valence of the third index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
|
noexcept |
Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations.
We test various different symmetries across several functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_3_no_symmetry)test_evaluate_rank_3_ab_symmetry)test_evaluate_rank_3_ac_symmetry)test_evaluate_rank_3_bc_symmetry)test_evaluate_rank_3_abc_symmetry)TensorIndexA, TensorIndexB, and TensorIndexC can be any type of TensorIndex and are not necessarily ti_a, ti_b, and ti_c. The "A", "B", and "C" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, and TensorIndexC is the third index used.
Note: the functions dealing with symmetric indices have fewer template parameters due to the indices having a shared TensorIndexType and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| TensorIndexTypeC | the TensorIndexType of the third index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| ValenceC | the valence of the third index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
|
noexcept |
Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations.
We test various different symmetries across several functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_3_no_symmetry)test_evaluate_rank_3_ab_symmetry)test_evaluate_rank_3_ac_symmetry)test_evaluate_rank_3_bc_symmetry)test_evaluate_rank_3_abc_symmetry)TensorIndexA, TensorIndexB, and TensorIndexC can be any type of TensorIndex and are not necessarily ti_a, ti_b, and ti_c. The "A", "B", and "C" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, and TensorIndexC is the third index used.
Note: the functions dealing with symmetric indices have fewer template parameters due to the indices having a shared TensorIndexType and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| TensorIndexTypeC | the TensorIndexType of the third index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| ValenceC | the valence of the third index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
|
noexcept |
Test that evaluating a right hand side tensor expression containing a single rank 3 tensor correctly assigns the data to the evaluated left hand side tensor.
TensorIndexA, TensorIndexB, and TensorIndexC can be any type of TensorIndex and are not necessarily ti_a, ti_b, and ti_c. The "A", "B", and "C" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, and TensorIndexC is the third index used.
If we consider the RHS tensor's generic indices to be (a, b, c), then this test checks that the data in the evaluated LHS tensor is correct according to the index orders of the LHS and RHS. The possible cases that are checked are when the LHS tensor is evaluated with index orders: (a, b, c), (a, c, b), (b, a, c), (b, c, a), (c, a, b), and (c, b, a).
| DataType | the type of data being stored in the Tensors |
| RhsSymmetry | the Symmetry of the RHS Tensor |
| RhsTensorIndexTypeList | the RHS Tensor's typelist of TensorIndexTypes |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
|
noexcept |
Iterate testing of evaluating single rank 3 Tensors on multiple Frame types and dimension combinations.
We test various different symmetries across several functions to ensure that the code works correctly with symmetries. This function tests one of the following symmetries:
test_evaluate_rank_3_no_symmetry)test_evaluate_rank_3_ab_symmetry)test_evaluate_rank_3_ac_symmetry)test_evaluate_rank_3_bc_symmetry)test_evaluate_rank_3_abc_symmetry)TensorIndexA, TensorIndexB, and TensorIndexC can be any type of TensorIndex and are not necessarily ti_a, ti_b, and ti_c. The "A", "B", and "C" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, and TensorIndexC is the third index used.
Note: the functions dealing with symmetric indices have fewer template parameters due to the indices having a shared TensorIndexType and valence
| DataType | the type of data being stored in the Tensors |
| TensorIndexTypeA | the TensorIndexType of the first index of the RHS Tensor |
| TensorIndexTypeB | the TensorIndexType of the second index of the RHS Tensor |
| TensorIndexTypeC | the TensorIndexType of the third index of the RHS Tensor |
| ValenceA | the valence of the first index used on the RHS of the TensorExpression |
| ValenceB | the valence of the second index used on the RHS of the TensorExpression |
| ValenceC | the valence of the third index used on the RHS of the TensorExpression |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
|
noexcept |
Test that evaluating a right hand side tensor expression containing a single rank 4 tensor correctly assigns the data to the evaluated left hand side tensor.
TensorIndexA, TensorIndexB, TensorIndexC, and TensorIndexD can be any type of TensorIndex and are not necessarily ti_a, ti_b, ti_c, and ti_d. The "A", "B", "C", and "D" suffixes just denote the ordering of the generic indices of the RHS tensor expression. In the RHS tensor expression, it means TensorIndexA is the first index used, TensorIndexB is the second index used, TensorIndexC is the third index used, and TensorIndexD is the fourth index used.
If we consider the RHS tensor's generic indices to be (a, b, c, d), then this test checks that the data in the evaluated LHS tensor is correct according to the index orders of the LHS and RHS. The possible cases that are checked are when the LHS tensor is evaluated with index orders of all 24 permutations of (a, b, c, d), e.g. (a, b, d, c), (a, c, b, d), ...
| DataType | the type of data being stored in the Tensors |
| RhsSymmetry | the Symmetry of the RHS Tensor |
| RhsTensorIndexTypeList | the RHS Tensor's typelist of TensorIndexTypes |
| TensorIndexA | the first TensorIndex used on the RHS of the TensorExpression, e.g. ti_a |
| TensorIndexB | the second TensorIndex used on the RHS of the TensorExpression, e.g. ti_B |
| TensorIndexC | the third TensorIndex used on the RHS of the TensorExpression, e.g. ti_c |
| TensorIndexD | the fourth TensorIndex used on the RHS of the TensorExpression, e.g. ti_D |
|
noexcept |
Creates a class of a known derived type using a factory.
This is a shorthand for creating a DerivedClass through a BaseClass factory, saving the caller from having to explicitly write metavariables with the appropriate factory_classes alias. The name of the type should be supplied as the first line of the passed string, just as for normal use of a factory.
If multiple factory creatable types must be handled or if metavariables must be passed for some other reason, then the more general TestHelpers::test_creation() must be used instead.
|
noexcept |
General entry function for testing arbitrary math functions on vector types.
This utility tests all combinations of the operator on the type arguments, and all combinations of reference or constant reference wrappers on all arguments. In certain test cases (see below), it also tests using the vector type's value_types in the operators as well (e.g. DataVector + double). This is very useful for quickly generating a lot of tests, but the number of tests scales exponentially in the number of arguments. Therefore, functions with many arguments can be time-consuming to run. 4-or-more-argument functions should be used only if completely necessary and with caution. Any number of vector types may be specified, and tests are run on all unique combinations of the provided. For instance, if only one type is provided, the tests will be run only on combinations of that single type and its value_type.
| tuple_of_functions_and_argument_bounds | A tuple of tuples, in which the inner tuple contains first a function object followed by a tuple of 2-element arrays equal to the number of arguments, which represent the bounds for the random generation of the respective arguments. This system is provided for robust testing of operators like /, where the left-hand side has a different valid set of values than the right-hand-side. |
| Test | from the TestKind enum, determines whether the tests will be:
|
| VectorType0 | The first vector type for which combinations are tested. The first is accepted as a separate template argument for appropriately handling Inplace tests. |
| VectorTypes | The remaining types for which combinations are tested. Any number of types may be passed in, and the test will check the appropriate combinations of the vector types and (depending on the Test) the respective value_types. |
|
noexcept |
Runs the option parser on a given tag.
Runs the option parser with the supplied input on a given tag. The tag name and any groups are handled by this function and should not be supplied in the argument string. If necessary, metavariables can be supplied as the second template argument.
| void test_serialization | ( | const T & | t | ) |
Tests the serialization of comparable types.
| void test_serialization_via_base | ( | Args &&... | args | ) |
Test the serialization of a derived class via a base class pointer.
| B | the base class |
| D | the derived class |
| Args | deduced from args |
| args | arguments passed to a constructor of the derived class |
|
noexcept |
Test that the transformation between two rank 0 tensors' generic indices and the subsequent transformed multi-index is correctly computed.
The functions tested are:
|
noexcept |
Test that the transformation between two rank 1 tensors' generic indices and the subsequent transformed multi-indices are correctly computed.
The functions tested are:
| TensorIndex | the first generic tensor index, e.g. type of ti_a |
|
noexcept |
Test that the transformation between two rank 2 tensors' generic indices and the subsequent transformed multi-indices are correctly computed.
The functions tested are:
If we consider the first tensor's generic indices to be (a, b), the possible orderings of the second tensor's generic indices are: (a, b) and (b, a). For each of these cases, this test checks that for each multi-index with the first generic index ordering, the equivalent multi-index with the second ordering is correctly computed.
| TensorIndexA | the first generic tensor index, e.g. type of ti_a |
| TensorIndexB | the second generic tensor index, e.g. type of ti_B |
|
noexcept |
Test that the transformation between two rank 3 tensors' generic indices and the subsequent transformed multi-indices are correctly computed.
The functions tested are:
If we consider the first tensor's generic indices to be (a, b, c), the possible orderings of the second tensor's generic indices are: (a, b, c), (a, c, b), (b, a, c), (b, c, a), (c, a, b), and (c, b, a). For each of these cases, this test checks that for each multi-index with the first generic index ordering, the equivalent multi-index with the second ordering is correctly computed.
| TensorIndexA | the first generic tensor index, e.g. type of ti_a |
| TensorIndexB | the second generic tensor index, e.g. type of ti_B |
| TensorIndexC | the third generic tensor index, e.g. type of ti_c |
|
noexcept |
Test that the transformation between two rank 4 tensors' generic indices and the subsequent transformed multi-indices are correctly computed.
The functions tested are:
If we consider the first tensor's generic indices to be (a, b, c, d), there are 24 permutations that are possible orderings of the second tensor's generic indices, such as: (a, b, c, d), (a, b, d, c), (a, c, b, d), etc. For each of these cases, this test checks that for each multi-index with the first generic index ordering, the equivalent multi-index with the second ordering is correctly computed.
| TensorIndexA | the first generic tensor index, e.g. type of ti_a |
| TensorIndexB | the second generic tensor index, e.g. type of ti_B |
| TensorIndexC | the third generic tensor index, e.g. type of ti_c |
| TensorIndexD | the fourth generic tensor index, e.g. type of ti_D |
| void test_throw_exception | ( | const ThrowingFunctor & | func, |
| const Exception & | expected | ||
| ) |
Execute func and check that it throws an exception expected.
.what() strings of the thrown and expected exceptions are compared for a partial match only: the expected.what() string must be contained in (or equal to) the .what() string of the thrown exception.
|
noexcept |
Test that assigning to a non-owning VectorType of the wrong size appropriately generates an error.
a calling function should be an ASSERTION_TEST() and check for the string "Must copy into same size". Three types of tests are provided and one must be provided as the first function argument:
RefSizeErrorTestKind::Copy: Checks that copy-assigning to a non-owning VectorType from a VectorType with the wrong size generates an error.RefSizeErrorTestKind::ExpressionAssign: Checks that assigning to a non-owning VectorType from an expression with alias ResultType of VectorType with the wrong size generates an errorRefSizeErrorTestKind::Move: Checks that move-assigning to a non-owning VectorType from a VectorType with the wrong size generates an error.
|
noexcept |
Determines if the given solution is a solution of the GRMHD equations.
Uses numerical derivatives to compute the solution, on the given mesh of the root Element of the given block at the given time using a sixth-order derivative in time for the given delta_time. The maximum residual of the GRMHD equations must be zero within error_tolerance
| void FirstOrderEllipticSolutionsTestHelpers::verify_smooth_solution | ( | const SolutionType & | solution, |
| const domain::CoordinateMap< Frame::Logical, Frame::Inertial, Maps... > & | coord_map, | ||
| const double | tolerance_offset, | ||
| const double | tolerance_scaling, | ||
| PackageFluxesArgs && | package_fluxes_args | ||
| ) |
Test that the solution numerically solves the System on the given grid and that the discretization error decreases as expected for a smooth function.
We expect exponential convergence for a smooth solution, so the tolerance is computed as
\begin{equation} C_1 \exp{\left(-C_2 * N_\mathrm{points}\right)} \end{equation}
where \(C_1\) is the tolerance_offset, \(C_2\) is the tolerance_scaling and \(N_\mathrm{points}\) is the number of grid points per dimension.
| void FirstOrderEllipticSolutionsTestHelpers::verify_solution_with_power_law_convergence | ( | const SolutionType & | solution, |
| const domain::CoordinateMap< Frame::Logical, Frame::Inertial, Maps... > & | coord_map, | ||
| const double | tolerance_offset, | ||
| const double | tolerance_pow | ||
| ) |
Test that the solution numerically solves the System on the given grid and that the discretization error decreases as a power law.
The tolerance is computed as
\begin{equation} C \left(N_\mathrm{points}\right)^{-p} \end{equation}
where \(C\) is the tolerance_offset, \(p\) is the tolerance_pow and \(N_\mathrm{points}\) is the number of grid points per dimension.