Skip to content

Commit

Permalink
Template worldtube helper
Browse files Browse the repository at this point in the history
  • Loading branch information
nikwit committed Nov 13, 2024
1 parent 7c4e6cf commit 7aebb48
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ void test_initial_position_velocity_tag() {
const double orbital_radius = 7.;
const double angular_vel = 0.1;
const auto domain_creator =
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object(
orbital_radius, 0.2, angular_vel);
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object<
false>(orbital_radius, 0.2, angular_vel);
const tnsr::I<double, 3> expected_pos{{orbital_radius, 0., 0.}};
const tnsr::I<double, 3> expected_vel{{0., angular_vel * orbital_radius, 0.}};
CHECK(Tags::InitialPositionAndVelocity::create_from_options(
Expand Down Expand Up @@ -192,8 +192,8 @@ void test_compute_face_coordinates_grid() {
void test_compute_face_coordinates() {
static constexpr size_t Dim = 3;
const auto domain_creator =
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object(
7., 0.2, pow(7, -1.5));
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object<
false>(7., 0.2, pow(7, -1.5));
const double initial_time = 0.;
auto domain = domain_creator->create_domain();
const auto excision_sphere = domain.excision_spheres().at("ExcisionSphereA");
Expand Down Expand Up @@ -321,8 +321,8 @@ void test_particle_position_velocity_compute() {
const double orbit_radius = 9.;
const double angular_velocity = 1. / (sqrt(orbit_radius) * orbit_radius);
const auto domain_creator =
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object(
orbit_radius, 0.2, angular_velocity);
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object<
false>(orbit_radius, 0.2, angular_velocity);
const double initial_time = 0.;
auto domain = domain_creator->create_domain();
const auto excision_sphere = domain.excision_spheres().at("ExcisionSphereA");
Expand Down Expand Up @@ -632,15 +632,15 @@ void test_puncture_field() {

void test_check_input_file() {
const auto bbh_correct =
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object(
7., 0.2, pow(7., -1.5));
TestHelpers::CurvedScalarWave::Worldtube::worldtube_binary_compact_object<
false>(7., 0.2, pow(7., -1.5));
const gr::Solutions::KerrSchild kerr_schild_correct(
1., make_array(0., 0., 0.), make_array(0., 0., 0.));
CHECK(Tags::CheckInputFile<3, gr::Solutions::KerrSchild>::create_from_options(
bbh_correct, "ExcisionSphereA", kerr_schild_correct));
{
const auto bbh_incorrect = TestHelpers::CurvedScalarWave::Worldtube::
worldtube_binary_compact_object(7., 0.2, 1.);
worldtube_binary_compact_object<false>(7., 0.2, 1.);
CHECK_THROWS_WITH(
(Tags::CheckInputFile<3, gr::Solutions::KerrSchild>::
create_from_options(bbh_incorrect, "ExcisionSphereA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "Helpers/Domain/BoundaryConditions/BoundaryCondition.hpp"

namespace TestHelpers::CurvedScalarWave::Worldtube {

template <bool EvolveOrbit>
std::unique_ptr<DomainCreator<3>> worldtube_binary_compact_object(
const double orbit_radius, const double worldtube_radius,
const double angular_velocity) {
Expand Down Expand Up @@ -70,21 +72,25 @@ std::unique_ptr<DomainCreator<3>> worldtube_binary_compact_object(
" InitialAngularVelocity: [0.0, 0.0," +
angular_velocity_stream.str() +
"]\n"
" TranslationMap:\n"
" InitialValues: [[0.0, 0.0, 0.0], [0.0, 0.0, 0.], [0.0, 0.0, "
"0.0]]\n"
" TranslationMap: None\n"
" ShapeMapA:\n"
" LMax: 8\n"
" LMax: 2\n"
" InitialValues: Spherical\n"
" SizeInitialValues: [0.0, 0.0, 0.0]\n"
" TransitionEndsAtCube: false\n"
" ShapeMapB:\n"
" LMax: 8\n"
" LMax: 2\n"
" InitialValues: Spherical\n"
" SizeInitialValues: [0.0, 0.0, 0.0]\n"
" TransitionEndsAtCube: false\n";
return ::TestHelpers::test_option_tag<::domain::OptionTags::DomainCreator<3>,
Metavariables>(
Metavariables<EvolveOrbit>>(
binary_compact_object_options);
}

template std::unique_ptr<DomainCreator<3>>
worldtube_binary_compact_object<true>(double, double, double);

template std::unique_ptr<DomainCreator<3>>
worldtube_binary_compact_object<false>(double, double, double);
} // namespace TestHelpers::CurvedScalarWave::Worldtube
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@
#include "Utilities/TMPL.hpp"

namespace TestHelpers::CurvedScalarWave::Worldtube {
template <bool EvolveOrbit>
struct Metavariables {
using system =
TestHelpers::domain::BoundaryConditions::SystemWithBoundaryConditions<3>;
struct factory_creation
: tt::ConformsTo<Options::protocols::FactoryCreation> {
// we set `UseWorldtube` to `false` here so the functions of time are valid
// which simplifies testing.
using factory_classes = tmpl::map<
tmpl::pair<DomainCreator<3>,
tmpl::list<::domain::creators::BinaryCompactObject<false>>>>;
using factory_classes = tmpl::map<tmpl::pair<
DomainCreator<3>,
tmpl::list<::domain::creators::BinaryCompactObject<EvolveOrbit>>>>;
};
};

// returns a binary compact object domain creator with the excision spheres
// corresponding to the circular worldtube setup: a central excision sphere
// (the central black hole) and a worldtube excision sphere in circular orbit
// around it with angular velocity R^{-3/2}, where R is the orbital radius.
template <bool EvolveOrbit>
std::unique_ptr<DomainCreator<3>> worldtube_binary_compact_object(
const double orbit_radius, const double worldtube_radius,
const double angular_velocity);
Expand Down

0 comments on commit 7aebb48

Please sign in to comment.