From a6ec771f741d2ab7507fbe74ca86982917cf4e10 Mon Sep 17 00:00:00 2001 From: Samuel Jones Date: Tue, 27 May 2025 10:10:13 -0600 Subject: [PATCH 1/5] add rk34 low storage integrator --- CHANGELOG.md | 3 +- .../low_storage_integrator.cpp | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91254edc3bb36..29c48363d70fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## Current develop ### Added (new features/APIs/variables/...) - +- RK34 low storage 3rd order 4 stage SSP integrator with CFL <= 2 from Spiteri + & Ruuth 2002, SIAM Journal on Numerical Analysis, 40(2):469–491 ### Changed (changing behavior/API/variables/...) diff --git a/src/time_integration/low_storage_integrator.cpp b/src/time_integration/low_storage_integrator.cpp index 4d30e70fa97c6..68b22c36c6598 100644 --- a/src/time_integration/low_storage_integrator.cpp +++ b/src/time_integration/low_storage_integrator.cpp @@ -130,6 +130,40 @@ LowStorageIntegrator::LowStorageIntegrator(const std::string &name) gam0[2] = 2.0 / 3.0; gam1[2] = 1.0 / 3.0; c[2] = 0.5; + } else if (name_ == "rk34") { + // SSP 4-stage RK3 Spiteri & Ruuth 2002, SIAM Journal on Numerical + // Analysis, 40(2):469–491, CFL <= 2 + nstages = 4; + nbuffers = 2; + delta.resize(nstages); + beta.resize(nstages); + gam0.resize(nstages); + gam1.resize(nstages); + c.resize(nstages); + + delta[0] = 1.0; + beta[0] = 0.5; + gam0[0] = 0.0; + gam1[0] = 1.0; + c[0] = 0.0; + + delta[1] = 0.0; + beta[1] = 0.5; + gam0[1] = 1.0; + gam1[1] = 0.0; + c[1] = 1.0; + + delta[2] = 0.0; + beta[2] = 1./6.; + gam0[2] = 1.0/3.0; + gam1[2] = 2.0 / 3.0; + c[2] = 0.5; + + delta[3] = 0.0; + beta[3] = 0.5; + gam0[3] = 1.0; + gam1[3] = 0.0; + c[3] = 0.5; } else if (name_ == "rk4") { // Classic 5-stage SSPRK(5)4 in low-storage form // ceff = 0.377 From 92bc587dd94ca1337a7c543778316c6c4dca62a4 Mon Sep 17 00:00:00 2001 From: Samuel Jones Date: Tue, 27 May 2025 10:13:49 -0600 Subject: [PATCH 2/5] formatting --- src/time_integration/low_storage_integrator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/time_integration/low_storage_integrator.cpp b/src/time_integration/low_storage_integrator.cpp index 68b22c36c6598..09f71add79afc 100644 --- a/src/time_integration/low_storage_integrator.cpp +++ b/src/time_integration/low_storage_integrator.cpp @@ -154,8 +154,8 @@ LowStorageIntegrator::LowStorageIntegrator(const std::string &name) c[1] = 1.0; delta[2] = 0.0; - beta[2] = 1./6.; - gam0[2] = 1.0/3.0; + beta[2] = 1. / 6.; + gam0[2] = 1.0 / 3.0; gam1[2] = 2.0 / 3.0; c[2] = 0.5; From b4e3a1da682af4187eb8d154560f50815a1b2b75 Mon Sep 17 00:00:00 2001 From: Samuel Jones Date: Tue, 27 May 2025 10:17:06 -0600 Subject: [PATCH 3/5] copyright --- src/time_integration/low_storage_integrator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time_integration/low_storage_integrator.cpp b/src/time_integration/low_storage_integrator.cpp index 09f71add79afc..fc3306ccd9a6f 100644 --- a/src/time_integration/low_storage_integrator.cpp +++ b/src/time_integration/low_storage_integrator.cpp @@ -1,5 +1,5 @@ //======================================================================================== -// (C) (or copyright) 2020-2023. Triad National Security, LLC. All rights reserved. +// (C) (or copyright) 2020-2025. Triad National Security, LLC. All rights reserved. // // This program was produced under U.S. Government contract 89233218CNA000001 for Los // Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC From 2481bf01846b13967765a406df023b52baf3ab8a Mon Sep 17 00:00:00 2001 From: Samuel Jones Date: Tue, 16 Dec 2025 08:40:09 -0700 Subject: [PATCH 4/5] add unit test for rk34 integrator (4 stage, 3rd order) --- tst/unit/test_unit_integrators.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tst/unit/test_unit_integrators.cpp b/tst/unit/test_unit_integrators.cpp index 834526d455036..44674b30faa1b 100644 --- a/tst/unit/test_unit_integrators.cpp +++ b/tst/unit/test_unit_integrators.cpp @@ -189,6 +189,18 @@ TEST_CASE("Low storage integrator", "[StagedIntegrator]") { REQUIRE(std::abs(u[1] - ufinal[1]) <= 1e-2); } } + WHEN("We integrate with LowStorage rk34") { + // still accurate with large timestep + constexpr Real dt = 1e-2; + auto integrator = MakeIntegrator("rk34"); + State_t u; + GetInitialData(u); + Integrate(integrator, Step2SStar, tf, dt, u); + THEN("The final state doesn't differ too much from the true solution") { + REQUIRE(std::abs(u[0] - ufinal[0]) <= 1e-2); + REQUIRE(std::abs(u[1] - ufinal[1]) <= 1e-2); + } + } WHEN("We integrate with LowStorage rk4") { // still accurate with large timestep constexpr Real dt = 1e-2; From 000bff8350dda26bd6f2d2c79f96ea2af2c72333 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Tue, 16 Dec 2025 10:44:07 -0500 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 115c6b2d24c59..dd100eb8d3e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Current develop ### Added (new features/APIs/variables/...) -- [[PR XXXX]](https://github.com/parthenon-hpc-lab/parthenon/pull/XXXX) RK34 low storage 3rd order 4 stage SSP integrator with CFL <= 2 from Spiteri unit test added +- [[PR 1353]](https://github.com/parthenon-hpc-lab/parthenon/pull/1353) RK34 low storage 3rd order 4 stage SSP integrator with CFL <= 2 from Spiteri unit test added & Ruuth 2002, SIAM Journal on Numerical Analysis, 40(2):469–491 - [[PR 1337]](https://github.com/parthenon-hpc-lab/parthenon/pull/1337) Add task list based timing capabilities - [[PR 1331]](https://github.com/parthenon-hpc-lab/parthenon/pull/1331) Add control over whether to include/exclude an output on final signal