diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl index ad385e6df2..b897ea71a7 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl @@ -135,6 +135,8 @@ optimized for a certain simulation setup (PDE, IC & BC, Riemann Solver, DG Solve - Brian Vermeire (2019). Paired explicit Runge-Kutta schemes for stiff systems of equations [DOI: 10.1016/j.jcp.2019.05.014](https://doi.org/10.1016/j.jcp.2019.05.014) + +Note: To use this integrator, the user must import the `Convex` and `ECOS` packages. """ mutable struct PairedExplicitRK2 <: AbstractPairedExplicitRKSingle const num_stages::Int @@ -149,7 +151,7 @@ end # struct PairedExplicitRK2 # Constructor that reads the coefficients from a file function PairedExplicitRK2(num_stages, base_path_monomial_coeffs::AbstractString, - dt_opt, + dt_opt = nothing, bS = 1.0, cS = 0.5) # If the user has the monomial coefficients, they also must have the optimal time step a_matrix, c = compute_PairedExplicitRK2_butcher_tableau(num_stages, @@ -246,6 +248,10 @@ function calculate_cfl(ode_algorithm::AbstractPairedExplicitRKSingle, ode) semi = ode.p dt_opt = ode_algorithm.dt_opt + if isnothing(dt_opt) + error("The optimal time step `dt_opt` must be provided.") + end + mesh, equations, solver, cache = mesh_equations_solver_cache(semi) u = wrap_array(u_ode, mesh, equations, solver, cache) diff --git a/test/test_unit.jl b/test/test_unit.jl index 5831122ffe..70e2e2ed10 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -1671,7 +1671,7 @@ end Trixi.download("https://gist.githubusercontent.com/DanielDoehring/8db0808b6f80e59420c8632c0d8e2901/raw/39aacf3c737cd642636dd78592dbdfe4cb9499af/MonCoeffsS6p2.txt", joinpath(path_coeff_file, "gamma_6.txt")) - ode_algorithm = Trixi.PairedExplicitRK2(6, path_coeff_file, 42) # dummy optimal time step (dt_opt plays no role in determining `a_matrix`) + ode_algorithm = Trixi.PairedExplicitRK2(6, path_coeff_file) @test isapprox(ode_algorithm.a_matrix, [0.12405417889682908 0.07594582110317093