diff --git a/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.cpp b/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.cpp index 6c62f353b016..23f2e2c3dbc1 100644 --- a/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.cpp +++ b/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.cpp @@ -224,57 +224,6 @@ void implement_apply_dirichlet( } } -template -void implement_apply_neumann( - const gsl::not_null*> n_dot_conformal_factor_gradient, - const gsl::not_null*> - n_dot_lapse_times_conformal_factor_gradient, - const gsl::not_null*> - n_dot_longitudinal_shift_excess, - const std::array>, 2>& - /*superposed_objects*/, - const tnsr::I& /*x*/, - const tnsr::i& /*face_normal*/) { - /* - using analytic_tags = tmpl::list< - ::Tags::deriv, - tmpl::size_t<3>, Frame::Inertial>, - ::Tags::deriv, - tmpl::size_t<3>, Frame::Inertial>, - ::Tags::deriv, - tmpl::size_t<3>, Frame::Inertial>>; - - const auto solution_vars = - variables_from_tagged_tuple((*solution)->variables(x, analytic_tags{})); - const auto& deriv_conformal_factor_minus_one = - get<::Tags::deriv, - tmpl::size_t<3>, Frame::Inertial>>(solution_vars); - const auto& deriv_lapse_times_conformal_factor_minus_one = get< - ::Tags::deriv, - tmpl::size_t<3>, Frame::Inertial>>(solution_vars); - const auto& deriv_shift_excess = - get<::Tags::deriv, - tmpl::size_t<3>, Frame::Inertial>>(solution_vars); - */ - get(*n_dot_conformal_factor_gradient) = 0.; - get(*n_dot_lapse_times_conformal_factor_gradient) = 0.; - std::fill(n_dot_longitudinal_shift_excess->begin(), - n_dot_longitudinal_shift_excess->end(), 0.); - /* - for (size_t i = 0; i < 3; ++i) { - get(*n_dot_conformal_factor_gradient) += - face_normal.get(i) * deriv_conformal_factor_minus_one.get(i); - get(*n_dot_lapse_times_conformal_factor_gradient) += - face_normal.get(i) * - deriv_lapse_times_conformal_factor_minus_one.get(i); - for (size_t j = 0; j < 3; ++j) { - n_dot_longitudinal_shift_excess->get(i) += - face_normal.get(j) * deriv_shift_excess.get(i, j); - } - } - */ -} - } // namespace template @@ -283,28 +232,21 @@ void SuperposedBoostedBinary::apply( const gsl::not_null*> lapse_times_conformal_factor_minus_one, const gsl::not_null*> shift_excess, - const gsl::not_null*> n_dot_conformal_factor_gradient, + const gsl::not_null< + Scalar*> /*n_dot_conformal_factor_gradient*/, const gsl::not_null*> - n_dot_lapse_times_conformal_factor_gradient, + /*n_dot_lapse_times_conformal_factor_gradient*/, const gsl::not_null*> - n_dot_longitudinal_shift_excess, + /*n_dot_longitudinal_shift_excess*/, const tnsr::i& /*deriv_conformal_factor_correction1*/, const tnsr::i& /*deriv_lapse_times_conformal_factor_correction1*/, const tnsr::iJ& /*deriv_shift_excess_correction1*/, - const tnsr::I& x, - const tnsr::i& face_normal) const { - if (boundary_ == elliptic::BoundaryConditionType::Dirichlet) { - implement_apply_dirichlet( - conformal_factor_minus_one, lapse_times_conformal_factor_minus_one, - shift_excess, superposed_objects_, xcoords_, masses_, momentum_left_, - momentum_right_, y_offset_, z_offset_, x); - } else if (boundary_ == elliptic::BoundaryConditionType::Neumann) { - implement_apply_neumann( - n_dot_conformal_factor_gradient, - n_dot_lapse_times_conformal_factor_gradient, - n_dot_longitudinal_shift_excess, superposed_objects_, x, face_normal); - } + const tnsr::I& x) const { + implement_apply_dirichlet( + conformal_factor_minus_one, lapse_times_conformal_factor_minus_one, + shift_excess, superposed_objects_, xcoords_, masses_, momentum_left_, + momentum_right_, y_offset_, z_offset_, x); } template @@ -315,28 +257,20 @@ void SuperposedBoostedBinary:: lapse_times_conformal_factor_correction, const gsl::not_null*> shift_excess_correction, const gsl::not_null*> - n_dot_conformal_factor_gradient_correction, + /*n_dot_conformal_factor_gradient_correction*/, const gsl::not_null*> - n_dot_lapse_times_conformal_factor_gradient_correction, + /*n_dot_lapse_times_conformal_factor_gradient_correction*/, const gsl::not_null*> - n_dot_longitudinal_shift_excess_correction, + /*n_dot_longitudinal_shift_excess_correction*/, const tnsr::i& /*deriv_conformal_factor_correction*/, const tnsr::i& /*deriv_lapse_times_conformal_factor_correction*/, - const tnsr::iJ& /*deriv_shift_excess_correction*/, - const tnsr::I& /*x*/, - const tnsr::i& /*face_normal*/) const { - if (boundary_ == elliptic::BoundaryConditionType::Dirichlet) { - get(*conformal_factor_correction) = 0.; - get(*lapse_times_conformal_factor_correction) = 0.; - std::fill(shift_excess_correction->begin(), shift_excess_correction->end(), - 0.); - } else if (boundary_ == elliptic::BoundaryConditionType::Neumann) { - get(*n_dot_conformal_factor_gradient_correction) = 0.; - get(*n_dot_lapse_times_conformal_factor_gradient_correction) = 0.; - std::fill(n_dot_longitudinal_shift_excess_correction->begin(), - n_dot_longitudinal_shift_excess_correction->end(), 0.); - } + const tnsr::iJ& /*deriv_shift_excess_correction*/) + const { + get(*conformal_factor_correction) = 0.; + get(*lapse_times_conformal_factor_correction) = 0.; + std::fill(shift_excess_correction->begin(), shift_excess_correction->end(), + 0.); } template diff --git a/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.hpp b/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.hpp index 4f36e8935f50..72f8216593fc 100644 --- a/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.hpp +++ b/src/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.hpp @@ -36,9 +36,7 @@ namespace Xcts::BoundaryConditions { * * This takes two isolated objects and after applying a boost to each of them, * superposes them. The superposed system is then imposed on the boundary, with - * Dirichlet or Neumann boundary conditions. - * - * \warning The Neumann boundary conditions is not yet implemented. + * Dirichlet boundary conditions. * */ @@ -85,16 +83,11 @@ class SuperposedBoostedBinary "The object placed on the positive x-axis."; using type = std::unique_ptr; }; - struct BoundaryCondition { - static constexpr Options::String help = "Boundary Condition Type."; - using type = elliptic::BoundaryConditionType; - }; using options = tmpl::list; + CenterOfMassOffset, ObjectLeft, ObjectRight>; static constexpr Options::String help = - "Impose flat spacetime at this boundary."; + "Impose supperposed boosted binary system on the boundary."; SuperposedBoostedBinary() = default; SuperposedBoostedBinary(const SuperposedBoostedBinary&) = delete; @@ -125,8 +118,7 @@ class SuperposedBoostedBinary ? std::make_optional( deserialize>( serialize(superposed_objects_[1].value()).data())) - : std::nullopt, - boundary_); + : std::nullopt); } SuperposedBoostedBinary( @@ -136,7 +128,6 @@ class SuperposedBoostedBinary const std::array center_of_mass_offset, std::optional> object_left, std::optional> object_right, - elliptic::BoundaryConditionType boundary, const Options::Context& context = {}) : xcoords_(xcoords), masses_(masses), @@ -144,8 +135,7 @@ class SuperposedBoostedBinary momentum_right_(momentum_right), y_offset_(center_of_mass_offset[0]), z_offset_(center_of_mass_offset[1]), - superposed_objects_({std::move(object_left), std::move(object_right)}), - boundary_(boundary) { + superposed_objects_({std::move(object_left), std::move(object_right)}) { if (masses_[0] <= 0. || masses_[1] <= 0.) { PARSE_ERROR(context, "The masses must be positive."); } @@ -157,16 +147,17 @@ class SuperposedBoostedBinary std::vector boundary_condition_types() const override { return {// Conformal factor - boundary_, + elliptic::BoundaryConditionType::Dirichlet, // Lapse times conformal factor - boundary_, + elliptic::BoundaryConditionType::Dirichlet, // Shift - boundary_, boundary_, boundary_}; + elliptic::BoundaryConditionType::Dirichlet, + elliptic::BoundaryConditionType::Dirichlet, + elliptic::BoundaryConditionType::Dirichlet}; } using argument_tags = - tmpl::flatten, - domain::Tags::FaceNormal<3, Frame::Inertial>>>; + tmpl::flatten>>; using volume_tags = tmpl::list<>; void apply( @@ -181,12 +172,9 @@ class SuperposedBoostedBinary const tnsr::i& deriv_lapse_times_conformal_factor_correction, const tnsr::iJ& deriv_shift_excess_correction, - const tnsr::I& x, - const tnsr::i& face_normal) const; + const tnsr::I& x) const; - using argument_tags_linearized = - tmpl::flatten, - domain::Tags::FaceNormal<3, Frame::Inertial>>>; + using argument_tags_linearized = tmpl::list<>; using volume_tags_linearized = tmpl::list<>; void apply_linearized( @@ -203,9 +191,7 @@ class SuperposedBoostedBinary const tnsr::i& deriv_conformal_factor_correction, const tnsr::i& deriv_lapse_times_conformal_factor_correction, - const tnsr::iJ& deriv_shift_excess_correction, - const tnsr::I& x, - const tnsr::i& face_normal) const; + const tnsr::iJ& deriv_shift_excess_correction) const; // NOLINTNEXTLINE(google-runtime-references) void pup(PUP::er& p) override { @@ -217,7 +203,6 @@ class SuperposedBoostedBinary p | momentum_left_; p | momentum_right_; p | superposed_objects_; - p | boundary_; } private: @@ -229,7 +214,6 @@ class SuperposedBoostedBinary double z_offset_{}; std::array>, 2> superposed_objects_{}; - elliptic::BoundaryConditionType boundary_{}; }; template diff --git a/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.py b/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.py index 0a3934f55150..7ecb5ebb0e85 100644 --- a/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.py +++ b/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/SuperposedBoostedBinary.py @@ -159,15 +159,3 @@ def shift_excess(x): shift_right = shift(boosted_spacetime_metric_right) return shift_left + shift_right - - -def n_dot_conformal_factor_gradient(x, face_normal): - return 0.0 - - -def n_dot_lapse_times_conformal_factor_gradient(x, face_normal): - return 0.0 - - -def n_dot_longitudinal_shift_excess(x, face_normal): - return np.zeros(3) diff --git a/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/Test_SuperposedBoostedBinary.cpp b/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/Test_SuperposedBoostedBinary.cpp index f015aa77b237..8295b875fce0 100644 --- a/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/Test_SuperposedBoostedBinary.cpp +++ b/tests/Unit/Elliptic/Systems/Xcts/BoundaryConditions/Test_SuperposedBoostedBinary.cpp @@ -65,8 +65,7 @@ struct FactoryMetavars { }; template -void test_suite(const elliptic::BoundaryConditionType& boundary, - const std::string& options_string) { +void test_suite(const std::string& options_string) { INFO("Test factory-creation"); using IsolatedObjectBase = elliptic::analytic_data::AnalyticSolution; using IsolatedObjectClasses = tmpl::list; @@ -83,15 +82,9 @@ void test_suite(const elliptic::BoundaryConditionType& boundary, IsolatedObjectBase, IsolatedObjectClasses>&>(*serialized); { INFO("Properties"); - if (boundary == elliptic::BoundaryConditionType::Dirichlet) { - CHECK(boundary_condition.boundary_condition_types() == - std::vector{ - 5, elliptic::BoundaryConditionType::Dirichlet}); - } else if (boundary == elliptic::BoundaryConditionType::Neumann) { - CHECK(boundary_condition.boundary_condition_types() == - std::vector{ - 5, elliptic::BoundaryConditionType::Neumann}); - } + CHECK(boundary_condition.boundary_condition_types() == + std::vector{ + 5, elliptic::BoundaryConditionType::Dirichlet}); } { MAKE_GENERATOR(gen); @@ -131,29 +124,6 @@ void test_suite(const elliptic::BoundaryConditionType& boundary, num_points, std::numeric_limits::signaling_NaN()}; const tnsr::iJ deriv_shift_excess{ num_points, std::numeric_limits::signaling_NaN()}; - /* - if constexpr (Linearized == false) { - boundary_condition.apply( - make_not_null(&conformal_factor_minus_one), - make_not_null(&lapse_times_conformal_factor_minus_one), - make_not_null(&shift_excess), - make_not_null(&n_dot_conformal_factor_gradient), - make_not_null(&n_dot_lapse_times_conformal_factor_gradient), - make_not_null(&n_dot_longitudinal_shift_excess), - deriv_conformal_factor, deriv_lapse_times_conformal_factor, - deriv_shift_excess, x, face_normal); - } else if constexpr (Linearized == true) { - boundary_condition.apply_linearized( - make_not_null(&conformal_factor_minus_one), - make_not_null(&lapse_times_conformal_factor_minus_one), - make_not_null(&shift_excess), - make_not_null(&n_dot_conformal_factor_gradient), - make_not_null(&n_dot_lapse_times_conformal_factor_gradient), - make_not_null(&n_dot_longitudinal_shift_excess), - deriv_conformal_factor, deriv_lapse_times_conformal_factor, - deriv_shift_excess, x, face_normal); - } - */ elliptic::apply_boundary_condition< Linearized, void, @@ -168,51 +138,22 @@ void test_suite(const elliptic::BoundaryConditionType& boundary, make_not_null(&n_dot_longitudinal_shift_excess), deriv_conformal_factor, deriv_lapse_times_conformal_factor, deriv_shift_excess); - if (boundary == elliptic::BoundaryConditionType::Dirichlet) { - const auto expected_conformal_factor_minus_one = - pypp::call>(py_module, - "conformal_factor_minus_one", x); - const auto expected_lapse_times_conformal_factor_minus_one = - pypp::call>( - py_module, "lapse_times_conformal_factor_minus_one", x); - const auto expected_shift_excess = - pypp::call>(py_module, "shift_excess", x); + const auto expected_conformal_factor_minus_one = + pypp::call>(py_module, "conformal_factor_minus_one", + x); + const auto expected_lapse_times_conformal_factor_minus_one = + pypp::call>( + py_module, "lapse_times_conformal_factor_minus_one", x); + const auto expected_shift_excess = + pypp::call>(py_module, "shift_excess", x); - CHECK_ITERABLE_APPROX(get(conformal_factor_minus_one), - get(expected_conformal_factor_minus_one)); - CHECK_ITERABLE_APPROX( - get(lapse_times_conformal_factor_minus_one), - get(expected_lapse_times_conformal_factor_minus_one)); - CHECK_ITERABLE_APPROX(get<0>(shift_excess), - get<0>(expected_shift_excess)); - CHECK_ITERABLE_APPROX(get<1>(shift_excess), - get<1>(expected_shift_excess)); - CHECK_ITERABLE_APPROX(get<2>(shift_excess), - get<2>(expected_shift_excess)); - } else if (boundary == elliptic::BoundaryConditionType::Neumann) { - const auto expected_n_dot_conformal_factor_gradient = - pypp::call>( - py_module, "n_dot_conformal_factor_gradient", x, face_normal); - const auto expected_n_dot_lapse_times_conformal_factor_gradient = - pypp::call>( - py_module, "n_dot_lapse_times_conformal_factor_gradient", x, - face_normal); - const auto expected_n_dot_longitudinal_shift_excess = - pypp::call>( - py_module, "n_dot_longitudinal_shift_excess", x, face_normal); - - CHECK_ITERABLE_APPROX(get(n_dot_conformal_factor_gradient), - get(expected_n_dot_conformal_factor_gradient)); - CHECK_ITERABLE_APPROX( - get(n_dot_lapse_times_conformal_factor_gradient), - get(expected_n_dot_lapse_times_conformal_factor_gradient)); - CHECK_ITERABLE_APPROX(get<0>(n_dot_longitudinal_shift_excess), - get<0>(expected_n_dot_longitudinal_shift_excess)); - CHECK_ITERABLE_APPROX(get<1>(n_dot_longitudinal_shift_excess), - get<1>(expected_n_dot_longitudinal_shift_excess)); - CHECK_ITERABLE_APPROX(get<2>(n_dot_longitudinal_shift_excess), - get<2>(expected_n_dot_longitudinal_shift_excess)); - } + CHECK_ITERABLE_APPROX(get(conformal_factor_minus_one), + get(expected_conformal_factor_minus_one)); + CHECK_ITERABLE_APPROX(get(lapse_times_conformal_factor_minus_one), + get(expected_lapse_times_conformal_factor_minus_one)); + CHECK_ITERABLE_APPROX(get<0>(shift_excess), get<0>(expected_shift_excess)); + CHECK_ITERABLE_APPROX(get<1>(shift_excess), get<1>(expected_shift_excess)); + CHECK_ITERABLE_APPROX(get<2>(shift_excess), get<2>(expected_shift_excess)); } } } // namespace @@ -220,38 +161,21 @@ void test_suite(const elliptic::BoundaryConditionType& boundary, SPECTRE_TEST_CASE("Unit.Xcts.BoundaryConditions.SuperposedBoostedBinary", "[Unit][Elliptic]") { const pypp::SetupLocalPythonEnvironment local_python_env(""); - test_suite(elliptic::BoundaryConditionType::Dirichlet, - "SuperposedBoostedBinary:\n" - " XCoords: [-5., 6.]\n" - " Masses: [1.1, 0.43]\n" - " MomentumLeft: [0.01, 0.01, 0.01]\n" - " MomentumRight: [-0.01, -0.01, -0.01]\n" - " CenterOfMassOffset: [0.02, 0.01]\n" - " ObjectLeft:\n" - " Schwarzschild:\n" - " Mass: 1.1\n" - " Coordinates: Isotropic\n" - " ObjectRight:\n" - " Schwarzschild:\n" - " Mass: 0.43\n" - " Coordinates: Isotropic\n" - " BoundaryCondition: Dirichlet"); - test_suite(elliptic::BoundaryConditionType::Neumann, - "SuperposedBoostedBinary:\n" - " XCoords: [-5., 6.]\n" - " Masses: [1.1, 0.43]\n" - " MomentumLeft: [0.01, 0.01, 0.01]\n" - " MomentumRight: [-0.01, -0.01, -0.01]\n" - " CenterOfMassOffset: [0.02, 0.01]\n" - " ObjectLeft:\n" - " Schwarzschild:\n" - " Mass: 1.1\n" - " Coordinates: Isotropic\n" - " ObjectRight:\n" - " Schwarzschild:\n" - " Mass: 0.43\n" - " Coordinates: Isotropic\n" - " BoundaryCondition: Neumann"); + test_suite( + "SuperposedBoostedBinary:\n" + " XCoords: [-5., 6.]\n" + " Masses: [1.1, 0.43]\n" + " MomentumLeft: [0.01, 0.01, 0.01]\n" + " MomentumRight: [-0.01, -0.01, -0.01]\n" + " CenterOfMassOffset: [0.02, 0.01]\n" + " ObjectLeft:\n" + " Schwarzschild:\n" + " Mass: 1.1\n" + " Coordinates: Isotropic\n" + " ObjectRight:\n" + " Schwarzschild:\n" + " Mass: 0.43\n" + " Coordinates: Isotropic"); } } // namespace Xcts::BoundaryConditions