diff --git a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp index 03dea963b43e5..857ec07cc3d21 100644 --- a/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp +++ b/src/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp @@ -33,6 +33,7 @@ struct InitializeEvolvedVariables { using simple_tags = tmpl::list>; using return_tags = simple_tags; @@ -40,8 +41,9 @@ struct InitializeEvolvedVariables { using const_global_cache_tags = tmpl::list<>; using mutable_global_cache_tags = tmpl::list<>; using simple_tags_from_options = tmpl::list; - using argument_tags = tmpl::list<::Tags::TimeStepper, - Tags::InitialPositionAndVelocity>; + using argument_tags = + tmpl::list<::Tags::TimeStepper, + Tags::InitialPositionAndVelocity, ::Tags::Time>; static void apply( const gsl::not_null, Tags::EvolvedVelocity>>*> @@ -51,11 +53,15 @@ struct InitializeEvolvedVariables { ::Tags::dt>>>*> dt_evolved_vars, const gsl::not_null current_iteration, + const gsl::not_null expiration_time, const gsl::not_null<::Tags::HistoryEvolvedVariables::type*> time_stepper_history, const TimeStepper& time_stepper, - const std::array, 2>& initial_pos_and_vel) { + const std::array, 2>& initial_pos_and_vel, + const double initial_time) { *current_iteration = 0; + *expiration_time = initial_time + 1e-10; + const size_t starting_order = time_stepper.number_of_past_steps() == 0 ? time_stepper.order() : 1; *time_stepper_history = diff --git a/src/Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp b/src/Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp index deaa1452ca21d..6ecef17bdb8c9 100644 --- a/src/Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp +++ b/src/Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp @@ -355,6 +355,21 @@ struct CurrentIteration : db::SimpleTag { using type = size_t; }; +/*! + * \brief The current expiration time of the functions of time which are + * controlled by the worldtube singleton. + */ +struct ExpirationTime : db::SimpleTag { + using type = double; +}; + +/*! + * \brief The current worldtube radius held by the singleton. + */ +struct WorldtubeRadius : db::SimpleTag { + using type = double; +}; + /*! * \brief The initial position and velocity of the scalar charge in inertial * coordinates. diff --git a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp index be04765a73796..a8736cc446648 100644 --- a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp +++ b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/Test_InitializeEvolvedVariables.cpp @@ -7,6 +7,7 @@ #include "Evolution/Systems/CurvedScalarWave/Worldtube/SingletonActions/InitializeEvolvedVariables.hpp" #include "Framework/TestingFramework.hpp" #include "Time/Tags/HistoryEvolvedVariables.hpp" +#include "Time/Tags/Time.hpp" #include "Time/Tags/TimeStepper.hpp" #include "Time/TimeSteppers/AdamsBashforth.hpp" #include "Time/TimeSteppers/TimeStepper.hpp" @@ -21,19 +22,22 @@ SPECTRE_TEST_CASE( const tnsr::I initial_pos{{1., 2., 3.}}; const tnsr::I initial_vel{{4., 5., 6.}}; const size_t current_iteration = 77; + const double expiration_time = 1234.; + const double initial_time = 0.; auto box = db::create, ::Tags::ConcreteTimeStepper, - Tags::InitialPositionAndVelocity, Tags::CurrentIteration>, + Tags::InitialPositionAndVelocity, Tags::CurrentIteration, + Tags::ExpirationTime, ::Tags::Time>, time_stepper_ref_tags>( variables_tag::type{}, dt_variables_tag::type{}, TimeSteppers::History{}, static_cast>( std::make_unique(4)), std::array, 2>{{initial_pos, initial_vel}}, - current_iteration); + current_iteration, expiration_time, initial_time); db::mutate_apply( make_not_null(&box)); @@ -47,6 +51,7 @@ SPECTRE_TEST_CASE( CHECK(db::get<::Tags::HistoryEvolvedVariables>(box) == TimeSteppers::History(1)); CHECK(get(box) == 0); + CHECK(get(box) == initial_time + 1e-10); } } // namespace } // namespace CurvedScalarWave::Worldtube diff --git a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/Test_Tags.cpp b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/Test_Tags.cpp index 24ccde600cba8..ba4070775dc92 100644 --- a/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/Test_Tags.cpp +++ b/tests/Unit/Evolution/Systems/CurvedScalarWave/Worldtube/Test_Tags.cpp @@ -731,6 +731,10 @@ SPECTRE_TEST_CASE("Unit.Evolution.Systems.CurvedScalarWave.Worldtube.Tags", "Charge"); TestHelpers::db::test_simple_tag( "Mass"); + TestHelpers::db::test_simple_tag< + CurvedScalarWave::Worldtube::Tags::ExpirationTime>("ExpirationTime"); + TestHelpers::db::test_simple_tag< + CurvedScalarWave::Worldtube::Tags::WorldtubeRadius>("WorldtubeRadius"); TestHelpers::db::test_simple_tag< CurvedScalarWave::Worldtube::Tags::MaxIterations>("MaxIterations"); TestHelpers::db::test_simple_tag<