diff --git a/examples/tree_1d_dgsem/elixir_advection_PERK2.jl b/examples/tree_1d_dgsem/elixir_advection_PERK2.jl index dfc95e05907..2dc1c0b0464 100644 --- a/examples/tree_1d_dgsem/elixir_advection_PERK2.jl +++ b/examples/tree_1d_dgsem/elixir_advection_PERK2.jl @@ -63,4 +63,3 @@ sol = Trixi.solve(ode, ode_algorithm, # Print the timer summary summary_callback() -analysis_callback(sol) \ No newline at end of file diff --git a/src/callbacks_step/stepsize.jl b/src/callbacks_step/stepsize.jl index ef7ecc6e5fb..f54bda997b9 100644 --- a/src/callbacks_step/stepsize.jl +++ b/src/callbacks_step/stepsize.jl @@ -33,7 +33,7 @@ function Base.show(io::IO, ::MIME"text/plain", stepsize_callback = cb.affect! setup = [ - "CFL number" => stepsize_callback.cfl_number, + "CFL number" => stepsize_callback.cfl_number ] summary_box(io, "StepsizeCallback", setup) end @@ -64,7 +64,7 @@ end t = integrator.t u_ode = integrator.u semi = integrator.p - + # If the integrator is an optimized integrator, calculate cfl number instead of using the input cfl number if isa(integrator.alg, PERK2) || isa(integrator.alg, PERK3) cfl_number = calculate_cfl_number(u_ode, t, integrator.alg.dt_opt, semi) @@ -92,11 +92,13 @@ end function calculate_cfl_number(u_ode, t, dt_opt, semi::AbstractSemidiscretization) mesh, equations, solver, cache = mesh_equations_solver_cache(semi) u = wrap_array(u_ode, mesh, equations, solver, cache) - max_dt_variable = max_dt(u, t, mesh,have_constant_speed(equations), equations, solver, cache) + max_dt_variable = max_dt(u, t, mesh, have_constant_speed(equations), equations, + solver, cache) + # For debugging purpose, especially for PERK3 println("max_dt $max_dt_variable") cfl_number = dt_opt / max_dt(u, t, mesh, - have_constant_speed(equations), equations, - solver, cache) + have_constant_speed(equations), equations, + solver, cache) return cfl_number end 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 a603e7270bf..7049b4a6d70 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK2.jl @@ -138,8 +138,10 @@ mutable struct PERK2 <: PERKSingle newPERK2 = new(num_stages) newPERK2.a_matrix, newPERK2.c, newPERK2.dt_opt = compute_PERK2_butcher_tableau(num_stages, - eig_vals, tspan, - bS, c_end) + eig_vals, + tspan, + bS, + c_end) newPERK2.b1 = one(bS) - bS newPERK2.bS = bS @@ -153,8 +155,10 @@ mutable struct PERK2 <: PERKSingle newPERK2 = new(num_stages) newPERK2.a_matrix, newPERK2.c, newPERK2.dt_opt = compute_PERK2_butcher_tableau(num_stages, - eig_vals, tspan, - bS, c_end) + eig_vals, + tspan, + bS, + c_end) newPERK2.b1 = one(bS) - bS newPERK2.bS = bS @@ -288,7 +292,7 @@ function solve!(integrator::PERK2Integrator) end # Higher stages - for stage in 3:alg.num_stages + for stage in 3:(alg.num_stages) # Construct current state @threaded for i in eachindex(integrator.du) integrator.u_tmp[i] = integrator.u[i] + diff --git a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl index ea66d2ce356..cf9bc7d233d 100644 --- a/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl +++ b/src/time_integration/paired_explicit_runge_kutta/methods_PERK3.jl @@ -196,9 +196,10 @@ mutable struct PERK3 <: PERKSingle eig_vals = eigvals(jacobian_ad_forward(semi)) newPERK3 = new(num_stages) - newPERK3.a_matrix, newPERK3.c, newPERK3.dt_opt = compute_PERK3_Butcher_tableau(num_stages, tspan, - eig_vals, - c_s2) + newPERK3.a_matrix, newPERK3.c, newPERK3.dt_opt = compute_PERK3_Butcher_tableau(num_stages, + tspan, + eig_vals, + c_s2) return newPERK3 end @@ -208,9 +209,10 @@ mutable struct PERK3 <: PERKSingle c_s2 = 1.0) newPERK3 = new(num_stages) - newPERK3.a_matrix, newPERK3.c, newPERK3.dt_opt = compute_PERK3_Butcher_tableau(num_stages, tspan, - eig_vals, - c_s2) + newPERK3.a_matrix, newPERK3.c, newPERK3.dt_opt = compute_PERK3_Butcher_tableau(num_stages, + tspan, + eig_vals, + c_s2) return newPERK3 end end # struct PERK3