Skip to content

Commit

Permalink
Rename RungeKutta3 to Rk3HesthavenSsp
Browse files Browse the repository at this point in the history
To distinguish it from the myriad other third-order RK methods out
there.
  • Loading branch information
wthrowe committed Jan 10, 2023
1 parent 9e720fd commit 494d796
Show file tree
Hide file tree
Showing 22 changed files with 63 additions and 64 deletions.
4 changes: 2 additions & 2 deletions src/Time/TimeSteppers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ spectre_target_sources(
ClassicalRungeKutta4.cpp
DormandPrince5.cpp
Heun2.cpp
Rk3HesthavenSsp.cpp
Rk3Owren.cpp
Rk4Owren.cpp
Rk5Owren.cpp
RungeKutta.cpp
RungeKutta3.cpp
)

spectre_target_headers(
Expand All @@ -25,10 +25,10 @@ spectre_target_headers(
Factory.hpp
Heun2.hpp
LtsTimeStepper.hpp
Rk3HesthavenSsp.hpp
Rk3Owren.hpp
Rk4Owren.hpp
Rk5Owren.hpp
RungeKutta.hpp
RungeKutta3.hpp
TimeStepper.hpp
)
6 changes: 3 additions & 3 deletions src/Time/TimeSteppers/Factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
#include "Time/TimeSteppers/ClassicalRungeKutta4.hpp"
#include "Time/TimeSteppers/DormandPrince5.hpp"
#include "Time/TimeSteppers/Heun2.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"
#include "Time/TimeSteppers/Rk3Owren.hpp"
#include "Time/TimeSteppers/Rk4Owren.hpp"
#include "Time/TimeSteppers/Rk5Owren.hpp"
#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Utilities/TMPL.hpp"

namespace TimeSteppers {
/// Typelist of available TimeSteppers
using time_steppers =
tmpl::list<TimeSteppers::AdamsBashforth, TimeSteppers::ClassicalRungeKutta4,
TimeSteppers::DormandPrince5, TimeSteppers::Heun2,
TimeSteppers::Rk3Owren, TimeSteppers::Rk4Owren,
TimeSteppers::Rk5Owren, TimeSteppers::RungeKutta3>;
TimeSteppers::Rk3HesthavenSsp, TimeSteppers::Rk3Owren,
TimeSteppers::Rk4Owren, TimeSteppers::Rk5Owren>;

/// Typelist of available LtsTimeSteppers
using lts_time_steppers = tmpl::list<TimeSteppers::AdamsBashforth>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Distributed under the MIT License.
// See LICENSE.txt for details.

#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"

#include <cmath>

namespace TimeSteppers {

size_t RungeKutta3::order() const { return 3; }
size_t Rk3HesthavenSsp::order() const { return 3; }

size_t RungeKutta3::error_estimate_order() const { return 2; }
size_t Rk3HesthavenSsp::error_estimate_order() const { return 2; }

double RungeKutta3::stable_step() const {
double Rk3HesthavenSsp::stable_step() const {
// This is the condition for y' = -k y to go to zero.
return 0.5 * (1. + cbrt(4. + sqrt(17.)) - 1. / cbrt(4. + sqrt(17.)));
}

const RungeKutta::ButcherTableau& RungeKutta3::butcher_tableau() const {
const RungeKutta::ButcherTableau& Rk3HesthavenSsp::butcher_tableau() const {
// See Hesthaven (5.32)
static const ButcherTableau tableau{
// Substep times
Expand All @@ -37,4 +37,4 @@ const RungeKutta::ButcherTableau& RungeKutta3::butcher_tableau() const {
}
} // namespace TimeSteppers

PUP::able::PUP_ID TimeSteppers::RungeKutta3::my_PUP_ID = 0; // NOLINT
PUP::able::PUP_ID TimeSteppers::Rk3HesthavenSsp::my_PUP_ID = 0; // NOLINT
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Distributed under the MIT License.
// See LICENSE.txt for details.

/// \file
/// Defines class RungeKutta3.

#pragma once

#include <cstddef>
Expand All @@ -22,40 +19,40 @@ namespace TimeSteppers {
/// 5.7.
///
/// The CFL factor/stable step size is 1.25637266330916.
class RungeKutta3 : public RungeKutta {
class Rk3HesthavenSsp : public RungeKutta {
public:
using options = tmpl::list<>;
static constexpr Options::String help = {
"A third-order strong stability-preserving Runge-Kutta time-stepper."};

RungeKutta3() = default;
RungeKutta3(const RungeKutta3&) = default;
RungeKutta3& operator=(const RungeKutta3&) = default;
RungeKutta3(RungeKutta3&&) = default;
RungeKutta3& operator=(RungeKutta3&&) = default;
~RungeKutta3() override = default;
Rk3HesthavenSsp() = default;
Rk3HesthavenSsp(const Rk3HesthavenSsp&) = default;
Rk3HesthavenSsp& operator=(const Rk3HesthavenSsp&) = default;
Rk3HesthavenSsp(Rk3HesthavenSsp&&) = default;
Rk3HesthavenSsp& operator=(Rk3HesthavenSsp&&) = default;
~Rk3HesthavenSsp() override = default;

size_t order() const override;

size_t error_estimate_order() const override;

double stable_step() const override;

WRAPPED_PUPable_decl_template(RungeKutta3); // NOLINT
WRAPPED_PUPable_decl_template(Rk3HesthavenSsp); // NOLINT

explicit RungeKutta3(CkMigrateMessage* /*unused*/) {}
explicit Rk3HesthavenSsp(CkMigrateMessage* /*unused*/) {}

private:
const ButcherTableau& butcher_tableau() const override;
};

inline bool constexpr operator==(const RungeKutta3& /*lhs*/,
const RungeKutta3& /*rhs*/) {
inline bool constexpr operator==(const Rk3HesthavenSsp& /*lhs*/,
const Rk3HesthavenSsp& /*rhs*/) {
return true;
}

inline bool constexpr operator!=(const RungeKutta3& /*lhs*/,
const RungeKutta3& /*rhs*/) {
inline bool constexpr operator!=(const Rk3HesthavenSsp& /*lhs*/,
const Rk3HesthavenSsp& /*rhs*/) {
return false;
}
} // namespace TimeSteppers
2 changes: 1 addition & 1 deletion tests/InputFiles/GrMhd/ValenciaDivClean/BlastWave.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ResourceInfo:
Evolution:
InitialTime: 0.0
InitialTimeStep: 0.01
TimeStepper: RungeKutta3
TimeStepper: Rk3HesthavenSsp

PhaseChangeAndTriggers:
- - Slabs:
Expand Down
2 changes: 1 addition & 1 deletion tests/InputFiles/NewtonianEuler/RiemannProblem1D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Evolution:
InitialTime: 0.0
InitialTimeStep: 0.0001
TimeStepper:
RungeKutta3
Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
2 changes: 1 addition & 1 deletion tests/InputFiles/NewtonianEuler/RiemannProblem2D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Evolution:
InitialTime: 0.0
InitialTimeStep: 0.0001
TimeStepper:
RungeKutta3
Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
2 changes: 1 addition & 1 deletion tests/InputFiles/NewtonianEuler/RiemannProblem3D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Evolution:
InitialTime: 0.0
InitialTimeStep: 0.0001
TimeStepper:
RungeKutta3
Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Evolution:
InitialTime: 0.0
InitialTimeStep: 0.01
TimeStepper:
RungeKutta3
Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Evolution:
InitialTime: 0.0
InitialTimeStep: 0.001
TimeStepper:
RungeKutta3
Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Evolution:
InitialTime: 0.0
InitialTimeStep: 0.001
TimeStepper:
RungeKutta3
Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
2 changes: 1 addition & 1 deletion tests/InputFiles/ScalarAdvection/Krivodonova1D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ResourceInfo:
Evolution:
InitialTime: 0.0
InitialTimeStep: 0.001
TimeStepper: RungeKutta3
TimeStepper: Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
2 changes: 1 addition & 1 deletion tests/InputFiles/ScalarAdvection/Kuzmin2D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ResourceInfo:
Evolution:
InitialTime: 0.0
InitialTimeStep: 0.001
TimeStepper: RungeKutta3
TimeStepper: Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
2 changes: 1 addition & 1 deletion tests/InputFiles/ScalarAdvection/Sinusoid1D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ResourceInfo:
Evolution:
InitialTime: 0.0
InitialTimeStep: 0.001
TimeStepper: RungeKutta3
TimeStepper: Rk3HesthavenSsp

PhaseChangeAndTriggers:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "Time/Time.hpp"
#include "Time/TimeStepId.hpp"
#include "Time/TimeSteppers/AdamsBashforth.hpp"
#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"
#include "Time/TimeSteppers/TimeStepper.hpp"
#include "Utilities/GetOutput.hpp"
#include "Utilities/Gsl.hpp"
Expand Down Expand Up @@ -446,7 +446,8 @@ void test(const bool time_runs_forward) {

// Missing dense output data
const auto check_missing_dense_data = [&](const bool data_needed) {
MockRuntimeSystem runner{{std::make_unique<TimeSteppers::RungeKutta3>()}};
MockRuntimeSystem runner{
{std::make_unique<TimeSteppers::Rk3HesthavenSsp>()}};
set_up_component(&runner, {{step_center, true, done_time, data_needed}});
{
auto& box =
Expand Down Expand Up @@ -661,7 +662,7 @@ struct PostprocessEvolved {
SPECTRE_TEST_CASE("Unit.Evolution.RunEventsAndDenseTriggers",
"[Unit][Evolution][Actions]") {
Parallel::register_classes_with_charm<TimeSteppers::AdamsBashforth,
TimeSteppers::RungeKutta3>();
TimeSteppers::Rk3HesthavenSsp>();
Parallel::register_factory_classes_with_charm<Metavariables<tmpl::list<>>>();

for (const auto time_runs_forward : {true, false}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "Time/Time.hpp"
#include "Time/TimeStepId.hpp"
#include "Time/TimeSteppers/AdamsBashforth.hpp"
#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"
#include "Time/TimeSteppers/TimeStepper.hpp"
#include "Utilities/ErrorHandling/Error.hpp"
#include "Utilities/Gsl.hpp"
Expand Down Expand Up @@ -157,7 +157,7 @@ std::unique_ptr<TimeStepper> make_time_stepper(
if (multistep_time_stepper) {
return std::make_unique<TimeSteppers::AdamsBashforth>(2);
} else {
return std::make_unique<TimeSteppers::RungeKutta3>();
return std::make_unique<TimeSteppers::Rk3HesthavenSsp>();
}
}

Expand Down Expand Up @@ -383,7 +383,7 @@ SPECTRE_TEST_CASE("Unit.Evolution.Subcell.Actions.TciAndSwitchToDg",
// 6. check if RDMP & TCI not triggered, switch to DG.
// 7. check if DidRollBack=True, stay in subcell.
Parallel::register_classes_with_charm<TimeSteppers::AdamsBashforth,
TimeSteppers::RungeKutta3>();
TimeSteppers::Rk3HesthavenSsp>();
test<1>();
test<2>();
test<3>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "Parallel/Phase.hpp"
#include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
#include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/KerrSchild.hpp"
#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"
#include "Time/TimeSteppers/TimeStepper.hpp"
#include "Utilities/FileSystem.hpp"
#include "Utilities/Gsl.hpp"
Expand Down Expand Up @@ -196,7 +196,7 @@ void test_gh_initialization() {
void test_analytic_initialization() {
using component = mock_analytic_worldtube_boundary<AnalyticMetavariables>;
const size_t l_max = 8;
Parallel::register_classes_with_charm<TimeSteppers::RungeKutta3>();
Parallel::register_classes_with_charm<TimeSteppers::Rk3HesthavenSsp>();
ActionTesting::MockRuntimeSystem<AnalyticMetavariables> runner{
{l_max, 100.0, 0.0}};

Expand All @@ -206,7 +206,7 @@ void test_analytic_initialization() {
AnalyticBoundaryDataManager{
12_st, 20.0, std::make_unique<Solutions::RotatingSchwarzschild>()},
static_cast<std::unique_ptr<TimeStepper>>(
std::make_unique<::TimeSteppers::RungeKutta3>()));
std::make_unique<::TimeSteppers::Rk3HesthavenSsp>()));
// this should run the initialization
for (size_t i = 0; i < 3; ++i) {
ActionTesting::next_action<component>(make_not_null(&runner), 0);
Expand Down Expand Up @@ -238,7 +238,7 @@ SPECTRE_TEST_CASE(
SPECTRE_TEST_CASE("Unit.Cce.Actions.InitializeWorldtubeBoundary.RtFail",
"[Utilities][Unit]") {
ERROR_TEST();
Parallel::register_classes_with_charm<TimeSteppers::RungeKutta3>();
Parallel::register_classes_with_charm<TimeSteppers::Rk3HesthavenSsp>();
using component = mock_analytic_worldtube_boundary<AnalyticMetavariables>;
const size_t l_max = 8;
ActionTesting::MockRuntimeSystem<AnalyticMetavariables> runner{
Expand All @@ -249,7 +249,7 @@ SPECTRE_TEST_CASE("Unit.Cce.Actions.InitializeWorldtubeBoundary.RtFail",
AnalyticBoundaryDataManager{
12_st, 20.0, std::make_unique<Solutions::RobinsonTrautman>()},
static_cast<std::unique_ptr<TimeStepper>>(
std::make_unique<::TimeSteppers::RungeKutta3>()));
std::make_unique<::TimeSteppers::Rk3HesthavenSsp>()));
// this should run the initialization
for (size_t i = 0; i < 3; ++i) {
ActionTesting::next_action<component>(make_not_null(&runner), 0);
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Evolution/Systems/Cce/Test_OptionTags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "NumericalAlgorithms/Interpolation/CubicSpanInterpolator.hpp"
#include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/KerrSchild.hpp"
#include "Time/Tags.hpp"
#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"
#include "Time/TimeSteppers/TimeStepper.hpp"
#include "Utilities/FileSystem.hpp"
#include "Utilities/Literals.hpp"
Expand Down Expand Up @@ -161,7 +161,7 @@ SPECTRE_TEST_CASE("Unit.Evolution.Systems.Cce.OptionTags", "[Unit][Cce]") {
TestHelpers::test_option_tag_factory_creation<
Cce::OptionTags::CceEvolutionPrefix<
::OptionTags::TimeStepper<TimeStepper>>,
TimeSteppers::RungeKutta3>("RungeKutta3:");
TimeSteppers::Rk3HesthavenSsp>("Rk3HesthavenSsp:");

const std::string filename = "OptionTagsTestCceR0100.h5";
if (file_system::check_if_file_exists(filename)) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Time/Actions/Test_ChangeSlabSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "Time/Tags.hpp"
#include "Time/Time.hpp"
#include "Time/TimeStepId.hpp"
#include "Time/TimeSteppers/RungeKutta3.hpp"
#include "Time/TimeSteppers/Rk3HesthavenSsp.hpp"
#include "Time/TimeSteppers/TimeStepper.hpp"
#include "Utilities/Gsl.hpp"
#include "Utilities/TMPL.hpp"
Expand Down Expand Up @@ -68,10 +68,10 @@ struct Component {
} // namespace

SPECTRE_TEST_CASE("Unit.Time.Actions.ChangeSlabSize", "[Unit][Time][Actions]") {
Parallel::register_classes_with_charm<TimeSteppers::RungeKutta3>();
Parallel::register_classes_with_charm<TimeSteppers::Rk3HesthavenSsp>();

ActionTesting::MockRuntimeSystem<Metavariables> runner{
{std::make_unique<TimeSteppers::RungeKutta3>()}};
{std::make_unique<TimeSteppers::Rk3HesthavenSsp>()}};

ActionTesting::emplace_component_and_initialize<Component>(&runner, 0, {});
ActionTesting::set_phase(make_not_null(&runner), Parallel::Phase::Testing);
Expand Down
Loading

0 comments on commit 494d796

Please sign in to comment.