From bb359cd34db30fc0ffe2bc68d0f10cd927319763 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 08:50:50 +0100 Subject: [PATCH 01/39] remove restriction of DiffEqBase.jl (used as hotfix) --- .github/workflows/Downgrade.yml | 2 +- Project.toml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml index 78492151a67..85f4625d275 100644 --- a/.github/workflows/Downgrade.yml +++ b/.github/workflows/Downgrade.yml @@ -72,7 +72,7 @@ jobs: - uses: julia-actions/cache@v2 - uses: julia-actions/julia-downgrade-compat@v1 with: - skip: LinearAlgebra,Printf,SparseArrays,UUIDs,DiffEqBase,DelimitedFiles,Test,Downloads,Random + skip: LinearAlgebra,Printf,SparseArrays,UUIDs,DelimitedFiles,Test,Downloads,Random projects: ., test - uses: julia-actions/julia-buildpkg@v1 env: diff --git a/Project.toml b/Project.toml index 95d3c42d395..1fd17016bc6 100644 --- a/Project.toml +++ b/Project.toml @@ -9,7 +9,6 @@ CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949" @@ -69,7 +68,6 @@ ConstructionBase = "1.5" Convex = "0.16" DataStructures = "0.18.15" DelimitedFiles = "1" -DiffEqBase = "6 - 6.143" DiffEqCallbacks = "2.35" Downloads = "1.6" ECOS = "1.1.2" From 7ca0e1f82c2eebe2e1c6a77c114f0f0a0cd33415 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 09:02:19 +0100 Subject: [PATCH 02/39] ODE_DEFAULT_NORM moved --- test/test_mpi.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_mpi.jl b/test/test_mpi.jl index 001d9bff86e..66c5281089a 100644 --- a/test/test_mpi.jl +++ b/test/test_mpi.jl @@ -34,13 +34,13 @@ end # MPI t = 0.5 let u = 1.0 - @test ode_norm(u, t) ≈ OrdinaryDiffEq.ODE_DEFAULT_NORM(u, t) + @test ode_norm(u, t) ≈ OrdinaryDiffEq.DiffEqBase.ODE_DEFAULT_NORM(u, t) end let u = [1.0, -2.0] - @test ode_norm(u, t) ≈ OrdinaryDiffEq.ODE_DEFAULT_NORM(u, t) + @test ode_norm(u, t) ≈ OrdinaryDiffEq.DiffEqBase.ODE_DEFAULT_NORM(u, t) end let u = [SVector(1.0, -2.0), SVector(0.5, -0.1)] - @test ode_norm(u, t) ≈ OrdinaryDiffEq.ODE_DEFAULT_NORM(u, t) + @test ode_norm(u, t) ≈ OrdinaryDiffEq.DiffEqBase.ODE_DEFAULT_NORM(u, t) end end # MPI supporting functionality From 74a94433745965abb4c82b0510bc1c7f177eaaf2 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 09:26:26 +0100 Subject: [PATCH 03/39] use ADTypes --- examples/tree_1d_dgsem/elixir_advection_diffusion.jl | 4 ++-- examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl | 4 ++-- test/Project.toml | 2 ++ test/test_parabolic_1d.jl | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion.jl index 94d1da9132b..82c43dd6da8 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq +using OrdinaryDiffEq, ADTypes using Trixi ############################################################################### @@ -87,7 +87,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav # OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks time_int_tol = 1.0e-10 time_abs_tol = 1.0e-10 -sol = solve(ode, KenCarp4(autodiff = false), abstol = time_abs_tol, reltol = time_int_tol, +sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) # Print the timer summary diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl index 1aab3308fab..763187009dc 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl @@ -1,4 +1,4 @@ -using OrdinaryDiffEq +using OrdinaryDiffEq, ADTypes using Trixi ############################################################################### @@ -22,7 +22,7 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) ############################################################################### # run the simulation -sol = solve(ode, KenCarp4(autodiff = false), abstol = time_abs_tol, reltol = time_int_tol, +sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) # Print the timer summary diff --git a/test/Project.toml b/test/Project.toml index fb7eeb1a80c..9c5f639828b 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Convex = "f65535da-76fb-5f13-bab9-19810c17039a" @@ -21,6 +22,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] +ADTypes = "1.12" Aqua = "0.8" CairoMakie = "0.12, 0.13" Convex = "0.16" diff --git a/test/test_parabolic_1d.jl b/test/test_parabolic_1d.jl index 49cf359c51d..4b9b93121f8 100644 --- a/test/test_parabolic_1d.jl +++ b/test/test_parabolic_1d.jl @@ -60,7 +60,7 @@ end # Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, amr_callback) - sol = solve(ode, KenCarp4(autodiff = false), abstol = time_abs_tol, + sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) l2_error, linf_error = analysis_callback(sol) From b6b507dd117530ab4ff24aa03d39745e57d7e9a2 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 09:31:15 +0100 Subject: [PATCH 04/39] fix another depwarn --- examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl index df034af1bc9..56d2bc01491 100644 --- a/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl +++ b/examples/tree_3d_dgsem/elixir_lbm_taylor_green_vortex.jl @@ -73,5 +73,5 @@ callbacks = CallbackSet(summary_callback, sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback save_everystep = false, callback = callbacks, - save_start = false, alias_u0 = true); + save_start = false, alias = ODEAliasSpecifier(alias_u0 = true)); summary_callback() # print the timer summary From a719514a452f2ef053768add88693b5d7ad5d365 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 09:31:49 +0100 Subject: [PATCH 05/39] bump DiffEqCallbacks --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 1fd17016bc6..6bc4dae56ee 100644 --- a/Project.toml +++ b/Project.toml @@ -68,7 +68,7 @@ ConstructionBase = "1.5" Convex = "0.16" DataStructures = "0.18.15" DelimitedFiles = "1" -DiffEqCallbacks = "2.35" +DiffEqCallbacks = "2.35, 4" Downloads = "1.6" ECOS = "1.1.2" EllipsisNotation = "1.0" From 9b4763f042104fd773899e835464d5efd6579749 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 09:34:09 +0100 Subject: [PATCH 06/39] format --- examples/tree_1d_dgsem/elixir_advection_diffusion.jl | 3 ++- examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl | 3 ++- test/test_parabolic_1d.jl | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion.jl index 82c43dd6da8..95e94ca21f1 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion.jl @@ -87,7 +87,8 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, sav # OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks time_int_tol = 1.0e-10 time_abs_tol = 1.0e-10 -sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), abstol = time_abs_tol, reltol = time_int_tol, +sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), + abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) # Print the timer summary diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl index 763187009dc..b16963762fd 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl @@ -22,7 +22,8 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) ############################################################################### # run the simulation -sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), abstol = time_abs_tol, reltol = time_int_tol, +sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), + abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) # Print the timer summary diff --git a/test/test_parabolic_1d.jl b/test/test_parabolic_1d.jl index 4b9b93121f8..72e3b19a9c7 100644 --- a/test/test_parabolic_1d.jl +++ b/test/test_parabolic_1d.jl @@ -60,8 +60,8 @@ end # Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, amr_callback) - sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), abstol = time_abs_tol, - reltol = time_int_tol, + sol = solve(ode, KenCarp4(autodiff = AutoFiniteDiff()), + abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) l2_error, linf_error = analysis_callback(sol) @test l2_error ≈ [6.4878111416468355e-6] From 286e786d587b205578e481d937e41b616b3117e0 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 09:38:04 +0100 Subject: [PATCH 07/39] allow older version of ADTypes --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index 9c5f639828b..275bb8fb183 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -22,7 +22,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -ADTypes = "1.12" +ADTypes = "0.2, 1.12" Aqua = "0.8" CairoMakie = "0.12, 0.13" Convex = "0.16" From ac03d56262372b128c39d207adf9e5d6029d2cc5 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 10:02:42 +0100 Subject: [PATCH 08/39] Update test/Project.toml Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index 275bb8fb183..26bbad99907 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -22,7 +22,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -ADTypes = "0.2, 1.12" +ADTypes = "0.2.5, 1.12" Aqua = "0.8" CairoMakie = "0.12, 0.13" Convex = "0.16" From a750d7d742a5a12443e1c0b1e9dd40d7d2f80dbd Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 10:29:09 +0100 Subject: [PATCH 09/39] restrict to ADTypes v1 --- test/Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index 26bbad99907..bcff2f142af 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -22,7 +22,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -ADTypes = "0.2.5, 1.12" +ADTypes = "1" Aqua = "0.8" CairoMakie = "0.12, 0.13" Convex = "0.16" @@ -36,7 +36,7 @@ ForwardDiff = "0.10.24" LinearAlgebra = "1" MPI = "0.20.6" NLsolve = "4.5.1" -OrdinaryDiffEq = "6.66" +OrdinaryDiffEq = "6.75" Plots = "1.19" Printf = "1" Quadmath = "0.5.10" From bbb8cd4271aa7d7d61629290cf39de2c1fbd374d Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 10:32:33 +0100 Subject: [PATCH 10/39] bump ADTypes for NonlinearSolve.jl --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index bcff2f142af..d0c6f0135f2 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -22,7 +22,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -ADTypes = "1" +ADTypes = "1.1" Aqua = "0.8" CairoMakie = "0.12, 0.13" Convex = "0.16" From c4446acc22583a5ba63493d78e37b3938d2578b2 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 11:27:46 +0100 Subject: [PATCH 11/39] fix compat bounds for Downgrade action --- Project.toml | 10 +++++----- test/Project.toml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 6bc4dae56ee..5049fca387e 100644 --- a/Project.toml +++ b/Project.toml @@ -73,7 +73,7 @@ Downloads = "1.6" ECOS = "1.1.2" EllipsisNotation = "1.0" FillArrays = "1.9" -ForwardDiff = "0.10.24" +ForwardDiff = "0.10.36" HDF5 = "0.16.10, 0.17" LinearAlgebra = "1" LinearMaps = "2.7, 3.0" @@ -87,11 +87,11 @@ OffsetArrays = "1.13" P4est = "0.4.12" Polyester = "0.7.10" PrecompileTools = "1.2" -Preferences = "1.3" +Preferences = "1.4" Printf = "1" RecipesBase = "1.3.4" RecursiveArrayTools = "3.29" -Reexport = "1.0" +Reexport = "1.2" Requires = "1.1" SciMLBase = "2.67.0" SimpleUnPack = "1.1" @@ -100,12 +100,12 @@ StableRNGs = "1.0.2" StartUpDG = "1.1.5" Static = "0.8.7, 1" StaticArrayInterface = "1.4" -StaticArrays = "1.7" +StaticArrays = "1.9" StrideArrays = "0.1.26" StructArrays = "0.6.18" SummationByPartsOperators = "0.5.52" T8code = "0.7.4" -TimerOutputs = "0.5.7" +TimerOutputs = "0.5.23" Triangulate = "2.2" TriplotBase = "0.1" TriplotRecipes = "0.1" diff --git a/test/Project.toml b/test/Project.toml index d0c6f0135f2..f10379628d7 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -32,12 +32,12 @@ Downloads = "1" ECOS = "1.1.2" ExplicitImports = "1.0.1" FFMPEG = "0.4" -ForwardDiff = "0.10.24" +ForwardDiff = "0.10.36" LinearAlgebra = "1" MPI = "0.20.6" NLsolve = "4.5.1" OrdinaryDiffEq = "6.75" -Plots = "1.19" +Plots = "1.26" Printf = "1" Quadmath = "0.5.10" Random = "1" From c4f5279df9cfa4d8ba5dcfff8b847e6e64608016 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 12:05:24 +0100 Subject: [PATCH 12/39] fix Aqua.jl issue --- test/test_aqua.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_aqua.jl b/test/test_aqua.jl index 04c4a533d26..175c4113f23 100644 --- a/test/test_aqua.jl +++ b/test/test_aqua.jl @@ -13,7 +13,9 @@ include("test_trixi.jl") # exceptions necessary for adding a new method `StartUpDG.estimate_h` # in src/solvers/dgmulti/sbp.jl piracies = (treat_as_own = [Trixi.StartUpDG.RefElemData, - Trixi.StartUpDG.MeshData],)) + Trixi.StartUpDG.MeshData],), + # exception necessary because StableRNGs.jl is only used in an extension + stale_deps = (ignore = [StableRNGs])) @test isnothing(check_no_implicit_imports(Trixi, skip = (Core, Base, Trixi.P4est, Trixi.T8code, Trixi.EllipsisNotation))) From b4544731398c2a874a0e88cd5dd9b9f98f43695e Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:11:40 +0100 Subject: [PATCH 13/39] add DiffEqBase extension to fix callback issues with custom integrators --- Project.toml | 3 +++ ext/TrixiDiffEqBaseExt.jl | 11 +++++++++++ src/time_integration/methods_2N.jl | 8 ++++---- src/time_integration/methods_3Sstar.jl | 4 ++-- src/time_integration/methods_SSP.jl | 2 +- .../paired_explicit_runge_kutta.jl | 6 +++--- src/time_integration/time_integration.jl | 3 +++ 7 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 ext/TrixiDiffEqBaseExt.jl diff --git a/Project.toml b/Project.toml index 5049fca387e..c1c129d7985 100644 --- a/Project.toml +++ b/Project.toml @@ -52,11 +52,13 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [weakdeps] Convex = "f65535da-76fb-5f13-bab9-19810c17039a" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" [extensions] +TrixiDiffEqBaseExt = "DiffEqBase" TrixiConvexECOSExt = ["Convex", "ECOS"] TrixiMakieExt = "Makie" TrixiNLsolveExt = "NLsolve" @@ -68,6 +70,7 @@ ConstructionBase = "1.5" Convex = "0.16" DataStructures = "0.18.15" DelimitedFiles = "1" +DiffEqBase = "6.154" DiffEqCallbacks = "2.35, 4" Downloads = "1.6" ECOS = "1.1.2" diff --git a/ext/TrixiDiffEqBaseExt.jl b/ext/TrixiDiffEqBaseExt.jl new file mode 100644 index 00000000000..4737dc978b2 --- /dev/null +++ b/ext/TrixiDiffEqBaseExt.jl @@ -0,0 +1,11 @@ +# Package extension for DiffEqBase.jl interface for Trixi.jl +module TrixiDiffEqBaseExt + +using Trixi: AbstractTimeIntegrator +using DiffEqBase: DiffEqBase + +DiffEqBase.get_tstops(integrator::AbstractTimeIntegrator) = integrator.opts.tstops +DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) = get_tstops(integrator).valtree +DiffEqBase.get_tstops_max(integrator::AbstractTimeIntegrator) = maximum(get_tstops_array(integrator)) + +end # module TrixiDiffEqBaseExt diff --git a/src/time_integration/methods_2N.jl b/src/time_integration/methods_2N.jl index 71343b246fa..514b0bcfb99 100644 --- a/src/time_integration/methods_2N.jl +++ b/src/time_integration/methods_2N.jl @@ -14,7 +14,7 @@ abstract type SimpleAlgorithm2N end The following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of -- Carpenter, Kennedy (1994) +- Carpenter, Kennedy (1994) Fourth-order 2N-storage Runge-Kutta schemes (Solution 3) URL: https://ntrs.nasa.gov/citations/19940028444 File: https://ntrs.nasa.gov/api/citations/19940028444/downloads/19940028444.pdf @@ -53,7 +53,7 @@ end The following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of -- Carpenter, Kennedy (1994) +- Carpenter, Kennedy (1994) Third-order 2N-storage Runge-Kutta schemes with error control URL: https://ntrs.nasa.gov/citations/19940028444 File: https://ntrs.nasa.gov/api/citations/19940028444/downloads/19940028444.pdf @@ -91,7 +91,7 @@ end # https://diffeq.sciml.ai/v6.8/basics/integrator/#Handing-Integrators-1 # which are used in Trixi.jl. mutable struct SimpleIntegrator2N{RealT <: Real, uType, Params, Sol, F, Alg, - SimpleIntegrator2NOptions} + SimpleIntegrator2NOptions} <: AbstractTimeIntegrator u::uType # du::uType u_tmp::uType @@ -232,7 +232,7 @@ function set_proposed_dt!(integrator::SimpleIntegrator2N, dt) integrator.dt = dt end -# Required e.g. for `glm_speed_callback` +# Required e.g. for `glm_speed_callback` function get_proposed_dt(integrator::SimpleIntegrator2N) return integrator.dt end diff --git a/src/time_integration/methods_3Sstar.jl b/src/time_integration/methods_3Sstar.jl index 51501c6189e..dd02b40f40a 100644 --- a/src/time_integration/methods_3Sstar.jl +++ b/src/time_integration/methods_3Sstar.jl @@ -145,7 +145,7 @@ function SimpleIntegrator3SstarOptions(callback, tspan; maxiters = typemax(Int), end mutable struct SimpleIntegrator3Sstar{RealT <: Real, uType, Params, Sol, F, Alg, - SimpleIntegrator3SstarOptions} + SimpleIntegrator3SstarOptions} <: AbstractTimeIntegrator u::uType # du::uType u_tmp1::uType @@ -298,7 +298,7 @@ function set_proposed_dt!(integrator::SimpleIntegrator3Sstar, dt) integrator.dt = dt end -# Required e.g. for `glm_speed_callback` +# Required e.g. for `glm_speed_callback` function get_proposed_dt(integrator::SimpleIntegrator3Sstar) return integrator.dt end diff --git a/src/time_integration/methods_SSP.jl b/src/time_integration/methods_SSP.jl index 33d1f164138..ee01ae58589 100644 --- a/src/time_integration/methods_SSP.jl +++ b/src/time_integration/methods_SSP.jl @@ -78,7 +78,7 @@ end # https://diffeq.sciml.ai/v6.8/basics/integrator/#Handing-Integrators-1 # which are used in Trixi. mutable struct SimpleIntegratorSSP{RealT <: Real, uType, Params, Sol, F, Alg, - SimpleIntegratorSSPOptions} + SimpleIntegratorSSPOptions} <: AbstractTimeIntegrator u::uType du::uType r0::uType diff --git a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl index 87f067fc39d..ddf6827c010 100644 --- a/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl +++ b/src/time_integration/paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl @@ -8,7 +8,7 @@ # Define all of the functions necessary for polynomial optimizations include("polynomial_optimizer.jl") -# Abstract base type for both single/standalone and multi-level +# Abstract base type for both single/standalone and multi-level # PERK (Paired-Explicit Runge-Kutta) time integration schemes abstract type AbstractPairedExplicitRK end # Abstract base type for single/standalone PERK time integration schemes @@ -36,7 +36,7 @@ function PairedExplicitRKOptions(callback, tspan; maxiters = typemax(Int), kwarg tstops_internal) end -abstract type AbstractPairedExplicitRKIntegrator end +abstract type AbstractPairedExplicitRKIntegrator <: AbstractTimeIntegrator end abstract type AbstractPairedExplicitRKSingleIntegrator <: AbstractPairedExplicitRKIntegrator end @@ -176,7 +176,7 @@ end """ modify_dt_for_tstops!(integrator::PairedExplicitRK) - + Modify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54 diff --git a/src/time_integration/time_integration.jl b/src/time_integration/time_integration.jl index d19a1fcc37c..81145a090e1 100644 --- a/src/time_integration/time_integration.jl +++ b/src/time_integration/time_integration.jl @@ -13,6 +13,9 @@ struct TimeIntegratorSolution{tType, uType, P} prob::P end +# Abstract supertype of Trixi.jl\s own time integrators for dispatch +abstract type AbstractTimeIntegrator end + include("methods_2N.jl") include("methods_3Sstar.jl") include("methods_SSP.jl") From a76946a68739bd5223734389424ae4834fb9c79c Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:12:21 +0100 Subject: [PATCH 14/39] ignore several run folders --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b4f1cf6bb47..4c4206151e1 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ coverage_report/ .DS_Store -run -run/* +run*/ +run*/* LocalPreferences.toml From d79b2d39d1f9a001900b396c22e95a66da3b9772 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:13:14 +0100 Subject: [PATCH 15/39] sort alphabetically --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c1c129d7985..9c84aac7a7d 100644 --- a/Project.toml +++ b/Project.toml @@ -58,8 +58,8 @@ Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" [extensions] -TrixiDiffEqBaseExt = "DiffEqBase" TrixiConvexECOSExt = ["Convex", "ECOS"] +TrixiDiffEqBaseExt = "DiffEqBase" TrixiMakieExt = "Makie" TrixiNLsolveExt = "NLsolve" From a9a296444354d2aac347af660b00712077cc48c8 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:13:41 +0100 Subject: [PATCH 16/39] format --- ext/TrixiDiffEqBaseExt.jl | 8 ++++++-- src/time_integration/methods_3Sstar.jl | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/TrixiDiffEqBaseExt.jl b/ext/TrixiDiffEqBaseExt.jl index 4737dc978b2..556b4ca56b5 100644 --- a/ext/TrixiDiffEqBaseExt.jl +++ b/ext/TrixiDiffEqBaseExt.jl @@ -5,7 +5,11 @@ using Trixi: AbstractTimeIntegrator using DiffEqBase: DiffEqBase DiffEqBase.get_tstops(integrator::AbstractTimeIntegrator) = integrator.opts.tstops -DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) = get_tstops(integrator).valtree -DiffEqBase.get_tstops_max(integrator::AbstractTimeIntegrator) = maximum(get_tstops_array(integrator)) +function DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) + get_tstops(integrator).valtree +end +function DiffEqBase.get_tstops_max(integrator::AbstractTimeIntegrator) + maximum(get_tstops_array(integrator)) +end end # module TrixiDiffEqBaseExt diff --git a/src/time_integration/methods_3Sstar.jl b/src/time_integration/methods_3Sstar.jl index dd02b40f40a..30889d2aa17 100644 --- a/src/time_integration/methods_3Sstar.jl +++ b/src/time_integration/methods_3Sstar.jl @@ -145,7 +145,8 @@ function SimpleIntegrator3SstarOptions(callback, tspan; maxiters = typemax(Int), end mutable struct SimpleIntegrator3Sstar{RealT <: Real, uType, Params, Sol, F, Alg, - SimpleIntegrator3SstarOptions} <: AbstractTimeIntegrator + SimpleIntegrator3SstarOptions} <: + AbstractTimeIntegrator u::uType # du::uType u_tmp1::uType From 17f5abe69743cfa7bf93f21bbbf53fcc2fdfb1cd Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:15:25 +0100 Subject: [PATCH 17/39] import fix --- ext/TrixiDiffEqBaseExt.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/TrixiDiffEqBaseExt.jl b/ext/TrixiDiffEqBaseExt.jl index 556b4ca56b5..352ace13810 100644 --- a/ext/TrixiDiffEqBaseExt.jl +++ b/ext/TrixiDiffEqBaseExt.jl @@ -2,7 +2,7 @@ module TrixiDiffEqBaseExt using Trixi: AbstractTimeIntegrator -using DiffEqBase: DiffEqBase +using DiffEqBase: DiffEqBase, get_tstops, get_tstops_array, get_tstops_max DiffEqBase.get_tstops(integrator::AbstractTimeIntegrator) = integrator.opts.tstops function DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) From d74506f4be071699014cfa3c566c4772f28d8aa9 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:16:10 +0100 Subject: [PATCH 18/39] allow v3 of DiffEqCallbacks --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9c84aac7a7d..4e3b1870ae7 100644 --- a/Project.toml +++ b/Project.toml @@ -71,7 +71,7 @@ Convex = "0.16" DataStructures = "0.18.15" DelimitedFiles = "1" DiffEqBase = "6.154" -DiffEqCallbacks = "2.35, 4" +DiffEqCallbacks = "2.35, 3, 4" Downloads = "1.6" ECOS = "1.1.2" EllipsisNotation = "1.0" From 8805345eb3a309048fcba58a907fc941094fabfe Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:19:08 +0100 Subject: [PATCH 19/39] require Static.jl v1 for DiffEqBase.jl v6.154 (required for new DiffEqCallbacks stuff) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4e3b1870ae7..8a5dea5ffca 100644 --- a/Project.toml +++ b/Project.toml @@ -101,7 +101,7 @@ SimpleUnPack = "1.1" SparseArrays = "1" StableRNGs = "1.0.2" StartUpDG = "1.1.5" -Static = "0.8.7, 1" +Static = "1" StaticArrayInterface = "1.4" StaticArrays = "1.9" StrideArrays = "0.1.26" From dae8491c04796b7afe68e7e7f5917865e02d4804 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 12:30:59 +0100 Subject: [PATCH 20/39] require StaticArrayInterface 1.5.1 for Static.jl v1 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 8a5dea5ffca..670da067096 100644 --- a/Project.toml +++ b/Project.toml @@ -102,7 +102,7 @@ SparseArrays = "1" StableRNGs = "1.0.2" StartUpDG = "1.1.5" Static = "1" -StaticArrayInterface = "1.4" +StaticArrayInterface = "1.5.1" StaticArrays = "1.9" StrideArrays = "0.1.26" StructArrays = "0.6.18" From 2c11e003fb3e38d59483e20fa7096dd8d1efe25e Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 12:44:25 +0100 Subject: [PATCH 21/39] fix Aqua tests --- ext/TrixiDiffEqBaseExt.jl | 2 +- test/test_aqua.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/TrixiDiffEqBaseExt.jl b/ext/TrixiDiffEqBaseExt.jl index 352ace13810..b0b694b735d 100644 --- a/ext/TrixiDiffEqBaseExt.jl +++ b/ext/TrixiDiffEqBaseExt.jl @@ -2,7 +2,7 @@ module TrixiDiffEqBaseExt using Trixi: AbstractTimeIntegrator -using DiffEqBase: DiffEqBase, get_tstops, get_tstops_array, get_tstops_max +using DiffEqBase: DiffEqBase, get_tstops, get_tstops_array DiffEqBase.get_tstops(integrator::AbstractTimeIntegrator) = integrator.opts.tstops function DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) diff --git a/test/test_aqua.jl b/test/test_aqua.jl index 175c4113f23..9b3f2d67903 100644 --- a/test/test_aqua.jl +++ b/test/test_aqua.jl @@ -15,7 +15,7 @@ include("test_trixi.jl") piracies = (treat_as_own = [Trixi.StartUpDG.RefElemData, Trixi.StartUpDG.MeshData],), # exception necessary because StableRNGs.jl is only used in an extension - stale_deps = (ignore = [StableRNGs])) + stale_deps = (ignore = [:StableRNGs],)) @test isnothing(check_no_implicit_imports(Trixi, skip = (Core, Base, Trixi.P4est, Trixi.T8code, Trixi.EllipsisNotation))) From 599e1d43518e1e320e0a1cb13bd4c938beadf217 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:04:04 +0100 Subject: [PATCH 22/39] fix test values --- test/test_parabolic_1d.jl | 8 ++++---- test/test_tree_1d_fdsbp.jl | 24 ++++++++++++------------ test/test_tree_1d_hypdiff.jl | 9 ++++----- test/test_unstructured_2d.jl | 31 +++++++++++++++++-------------- 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/test/test_parabolic_1d.jl b/test/test_parabolic_1d.jl index 72e3b19a9c7..714095a0b81 100644 --- a/test/test_parabolic_1d.jl +++ b/test/test_parabolic_1d.jl @@ -16,8 +16,8 @@ isdir(outdir) && rm(outdir, recursive = true) @test_trixi_include(joinpath(examples_dir(), "tree_1d_dgsem", "elixir_advection_diffusion.jl"), initial_refinement_level=4, tspan=(0.0, 0.4), polydeg=3, - l2=[8.389498188525518e-06], - linf=[2.847421658558336e-05]) + l2=[8.40483031802723e-6], + linf=[2.8990878868540015e-5]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let @@ -64,8 +64,8 @@ end abstol = time_abs_tol, reltol = time_int_tol, save_everystep = false, callback = callbacks) l2_error, linf_error = analysis_callback(sol) - @test l2_error ≈ [6.4878111416468355e-6] - @test linf_error ≈ [3.258075790424364e-5] + @test l2_error ≈ [6.487940740394583e-6] + @test linf_error ≈ [3.262867898701227e-5] # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_tree_1d_fdsbp.jl b/test/test_tree_1d_fdsbp.jl index 71e77eeb389..5034ab2ca4a 100644 --- a/test/test_tree_1d_fdsbp.jl +++ b/test/test_tree_1d_fdsbp.jl @@ -116,14 +116,14 @@ end @trixi_testset "elixir_euler_convergence.jl with splitting_vanleer_haenel" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence.jl"), l2=[ - 3.413790589105506e-6, - 4.243957977156001e-6, - 8.667369423676437e-6 + 3.4137906030996366e-6, + 4.24395804622208e-6, + 8.667369559486434e-6 ], linf=[ - 1.4228079689537765e-5, - 1.3249887941046978e-5, - 3.201552933251861e-5 + 1.4228079725286946e-5, + 1.324988815953887e-5, + 3.20155297650615e-5 ], tspan=(0.0, 0.5), flux_splitting=splitting_vanleer_haenel) @@ -141,14 +141,14 @@ end @trixi_testset "elixir_euler_convergence.jl with VolumeIntegralStrongForm" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence.jl"), l2=[ - 8.6126767518378e-6, - 7.670897071480729e-6, - 1.4972772284191368e-5 + 8.612676636826464e-6, + 7.670896994006107e-6, + 1.4972772137651304e-5 ], linf=[ - 6.707982777909294e-5, - 3.487256699541419e-5, - 0.00010170331350556339 + 6.707982749043495e-5, + 3.48725672254524e-5, + 0.00010170331503767116 ], tspan=(0.0, 0.5), solver=DG(D_upw.central, nothing, SurfaceIntegralStrongForm(), diff --git a/test/test_tree_1d_hypdiff.jl b/test/test_tree_1d_hypdiff.jl index cd570c16708..2f253d30615 100644 --- a/test/test_tree_1d_hypdiff.jl +++ b/test/test_tree_1d_hypdiff.jl @@ -12,9 +12,8 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_1d_dgsem") @trixi_testset "elixir_hypdiff_nonperiodic.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_hypdiff_nonperiodic.jl"), - l2=[1.3655114954641076e-7, 1.0200345025539218e-6], - linf=[7.173286515893551e-7, 4.507116363683394e-6], - atol=2.5e-13) + l2=[1.3655114953278825e-7, 1.0200345026471077e-6], + linf=[7.173285075379177e-7, 4.507116828644797e-6]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let @@ -37,8 +36,8 @@ end t = sol.t[end] u_ode = sol.u[end] du_ode = similar(u_ode) - # Larger values for allowed allocations due to usage of custom - # integrator which are not *recorded* for the methods from + # Larger values for allowed allocations due to usage of custom + # integrator which are not *recorded* for the methods from # OrdinaryDiffEq.jl # Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877 @test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 10000 diff --git a/test/test_unstructured_2d.jl b/test/test_unstructured_2d.jl index cec7152f4fc..9653726f57d 100644 --- a/test/test_unstructured_2d.jl +++ b/test/test_unstructured_2d.jl @@ -17,12 +17,12 @@ isdir(outdir) && rm(outdir, recursive = true) @trixi_testset "elixir_euler_periodic.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_periodic.jl"), l2=[ - 0.0001099216141882387, 0.0001303795774982892, - 0.00013037957749794242, 0.0002993727892598759 + 0.00010992161458946449, 0.00013037957831794187, + 0.0001303795783182231, 0.00029937279106433015 ], linf=[ - 0.006407280810928562, 0.009836067015418948, - 0.009836067015398076, 0.021903519038095176 + 0.006407280909098478, 0.009836067162309448, + 0.009836067162292128, 0.021903519372712843 ]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) @@ -692,17 +692,20 @@ end @trixi_testset "FDSBP (upwind): elixir_euler_source_terms_upwind.jl with LF splitting" begin @test_trixi_include(joinpath(pkgdir(Trixi, "examples", "unstructured_2d_fdsbp"), "elixir_euler_source_terms_upwind.jl"), - l2=[3.8300267071890586e-5, - 5.295846741663533e-5, - 5.295846741663526e-5, - 0.00017564759295593478], - linf=[0.00018810716496542312, - 0.0003794187430412599, - 0.0003794187430412599, - 0.0009632958510650269], + l2=[ + 3.8300274213823844e-5, + 5.295847308063744e-5, + 5.295847308066259e-5, + 0.00017564760044077823 + ], + linf=[ + 0.0001881071653406785, + 0.00037941874324110003, + 0.0003794187432419882, + 0.0009632958467822306 + ], tspan=(0.0, 0.025), - flux_splitting=splitting_lax_friedrichs, - atol=1.0e-10) + flux_splitting=splitting_lax_friedrichs) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let From 3760a8ef740b2100a7ae7e0e0c16cc4977baf463 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:09:28 +0100 Subject: [PATCH 23/39] fix restart_file --- examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl b/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl index b16963762fd..a4c495e7f28 100644 --- a/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl +++ b/examples/tree_1d_dgsem/elixir_advection_diffusion_restart.jl @@ -10,7 +10,7 @@ trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file)) ############################################################################### # initialize the ODE -restart_file = "restart_000000018.h5" +restart_file = "restart_000000012.h5" restart_filename = joinpath("out", restart_file) tspan = (load_time(restart_filename), 2.0) From 19e1911915f464ac25559e5c046347ffbe47742e Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 13:12:50 +0100 Subject: [PATCH 24/39] require Octavian.jl v0.3.28 for Static.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 670da067096..39070e75367 100644 --- a/Project.toml +++ b/Project.toml @@ -85,7 +85,7 @@ MPI = "0.20.6" Makie = "0.21, 0.22" MuladdMacro = "0.2.2" NLsolve = "4.5.1" -Octavian = "0.3.21" +Octavian = "0.3.28" OffsetArrays = "1.13" P4est = "0.4.12" Polyester = "0.7.10" From f407ec1d6b33c6a6c205109db161fbac8b4ea05b Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:17:22 +0100 Subject: [PATCH 25/39] require LoopVectorization.jl v0.12.171 for Static.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 39070e75367..01cd969b70e 100644 --- a/Project.toml +++ b/Project.toml @@ -80,7 +80,7 @@ ForwardDiff = "0.10.36" HDF5 = "0.16.10, 0.17" LinearAlgebra = "1" LinearMaps = "2.7, 3.0" -LoopVectorization = "0.12.151" +LoopVectorization = "0.12.171" MPI = "0.20.6" Makie = "0.21, 0.22" MuladdMacro = "0.2.2" From da9648880fd8e7bb98c375a11227024cdd14fafc Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:19:21 +0100 Subject: [PATCH 26/39] require StrideArrays.jl v0.1.29 for Static.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 01cd969b70e..17c4a0579ec 100644 --- a/Project.toml +++ b/Project.toml @@ -104,7 +104,7 @@ StartUpDG = "1.1.5" Static = "1" StaticArrayInterface = "1.5.1" StaticArrays = "1.9" -StrideArrays = "0.1.26" +StrideArrays = "0.1.29" StructArrays = "0.6.18" SummationByPartsOperators = "0.5.52" T8code = "0.7.4" From d2f158778501ff30afecc8b0998c9559182e540c Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:21:04 +0100 Subject: [PATCH 27/39] require Polyester.jl v0.7.15 for Static.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 17c4a0579ec..3276485d4ae 100644 --- a/Project.toml +++ b/Project.toml @@ -88,7 +88,7 @@ NLsolve = "4.5.1" Octavian = "0.3.28" OffsetArrays = "1.13" P4est = "0.4.12" -Polyester = "0.7.10" +Polyester = "0.7.15" PrecompileTools = "1.2" Preferences = "1.4" Printf = "1" From 1f08a5cc7fb851d4f40944a2ec24642686dbb80c Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 13:20:37 +0100 Subject: [PATCH 28/39] fix typo --- src/time_integration/time_integration.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/time_integration/time_integration.jl b/src/time_integration/time_integration.jl index 81145a090e1..c810c00d8ce 100644 --- a/src/time_integration/time_integration.jl +++ b/src/time_integration/time_integration.jl @@ -13,7 +13,7 @@ struct TimeIntegratorSolution{tType, uType, P} prob::P end -# Abstract supertype of Trixi.jl\s own time integrators for dispatch +# Abstract supertype of Trixi.jl's own time integrators for dispatch abstract type AbstractTimeIntegrator end include("methods_2N.jl") From 7dba3cd3f6ec330b336ebadde603429d69703633 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 13:30:45 +0100 Subject: [PATCH 29/39] require OrdinaryDiffEq.jl v6.88 for FastBroadcast.jl version required by Static.jl v1 --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index f10379628d7..095ae3f5401 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -36,7 +36,7 @@ ForwardDiff = "0.10.36" LinearAlgebra = "1" MPI = "0.20.6" NLsolve = "4.5.1" -OrdinaryDiffEq = "6.75" +OrdinaryDiffEq = "6.88" Plots = "1.26" Printf = "1" Quadmath = "0.5.10" From 4c756670acf0a2f52e19a77d66618f400c13b4ac Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:37:03 +0100 Subject: [PATCH 30/39] require Polyester.jl v0.7.16 for OrdinaryDiffEqPRK.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3276485d4ae..ae9bb56718f 100644 --- a/Project.toml +++ b/Project.toml @@ -88,7 +88,7 @@ NLsolve = "4.5.1" Octavian = "0.3.28" OffsetArrays = "1.13" P4est = "0.4.12" -Polyester = "0.7.15" +Polyester = "0.7.16" PrecompileTools = "1.2" Preferences = "1.4" Printf = "1" From b844ee586cf2da62cd2aae8f7779e594d2f4b593 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:39:16 +0100 Subject: [PATCH 31/39] require MuladdMacro v0.2.4 for OrdinaryDiffEqPRK.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index ae9bb56718f..708d6e135d3 100644 --- a/Project.toml +++ b/Project.toml @@ -83,7 +83,7 @@ LinearMaps = "2.7, 3.0" LoopVectorization = "0.12.171" MPI = "0.20.6" Makie = "0.21, 0.22" -MuladdMacro = "0.2.2" +MuladdMacro = "0.2.4" NLsolve = "4.5.1" Octavian = "0.3.28" OffsetArrays = "1.13" From 832dd8dd560dedbac8a157f40d77b0bca18ec223 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:43:05 +0100 Subject: [PATCH 32/39] require Static.jl v1.1.1 for OrdinaryDiffEqHighOrderRK.jl --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 708d6e135d3..4600d26a9b4 100644 --- a/Project.toml +++ b/Project.toml @@ -101,7 +101,7 @@ SimpleUnPack = "1.1" SparseArrays = "1" StableRNGs = "1.0.2" StartUpDG = "1.1.5" -Static = "1" +Static = "1.1.1" StaticArrayInterface = "1.5.1" StaticArrays = "1.9" StrideArrays = "0.1.29" From 2fa1327aaa9a5e5772edb0fde92224045301a8b7 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 13:45:30 +0100 Subject: [PATCH 33/39] require ADTypes.jl v1.7.1 for OrdinaryDiffEqNonlinearSolve.jl --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index 095ae3f5401..1612dde3d26 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -22,7 +22,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -ADTypes = "1.1" +ADTypes = "1.7.1" Aqua = "0.8" CairoMakie = "0.12, 0.13" Convex = "0.16" From eb3d7789ff58b41fe8063f9ab1b6f6322d5d2839 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 14:23:31 +0100 Subject: [PATCH 34/39] fix documentation about PERK methods --- docs/src/time_integration.md | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/src/time_integration.md b/docs/src/time_integration.md index 3cdb7fa75ae..504db03b3c3 100644 --- a/docs/src/time_integration.md +++ b/docs/src/time_integration.md @@ -13,7 +13,7 @@ Some common options for `solve` from [OrdinaryDiffEq.jl](https://github.com/SciM are the following. Further documentation can be found in the [SciML docs](https://diffeq.sciml.ai/v6.8/basics/common_solver_opts/). - If you use a fixed time step method like `CarpenterKennedy2N54`, you need to pass - a time step as `dt=...`. If you use a [`StepsizeCallback`](@ref), the value passed + a time step as `dt=...`. If you use a [`StepsizeCallback`](@ref), the value passed as `dt=...` is irrelevant since it will be overwritten by the [`StepsizeCallback`](@ref). If you want to use an adaptive time step method such as `SSPRK43` or `RDPK3SpFSAL49` and still want to use CFL-based step size control via the [`StepsizeCallback`](@ref), @@ -25,12 +25,12 @@ are the following. Further documentation can be found in the - SSP methods and many low-storage methods from OrdinaryDiffEq.jl support `stage_limiter!`s and `step_limiter!`s, e.g., [`PositivityPreservingLimiterZhangShu`](@ref) and [`EntropyBoundedLimiter`](@ref) from Trixi.jl. -- If you start Julia with multiple threads and want to use them also in the time +- If you start Julia with multiple threads and want to use them also in the time integration method from OrdinaryDiffEq.jl, you need to pass the keyword argument - `thread=OrdinaryDiffEq.True()` to the algorithm, e.g., - `RDPK3SpFSAL49(thread=OrdinaryDiffEq.True())` or + `thread=OrdinaryDiffEq.True()` to the algorithm, e.g., + `RDPK3SpFSAL49(thread=OrdinaryDiffEq.True())` or `CarpenterKennedy2N54(thread=OrdinaryDiffEq.True(), williamson_condition=false)`. - For more information on using thread-based parallelism in Trixi.jl, please refer to + For more information on using thread-based parallelism in Trixi.jl, please refer to [Shared-memory parallelization with threads](@ref). - If you use error-based step size control (see also the section on [error-based adaptive step sizes](@ref adaptive_step_sizes)) together with MPI, you need to @@ -50,7 +50,7 @@ are the following. Further documentation can be found in the ### Stabilized Explicit Runge-Kutta Methods Optimized explicit schemes aim to maximize the timestep $\Delta t$ for a given simulation setup. -Formally, this boils down to an optimization problem of the form +Formally, this boils down to an optimization problem of the form ```math \underset{P_{p;S} \, \in \, \mathcal{P}_{p;S}}{\max} \Delta t \text{ such that } \big \vert P_{p;S}(\Delta t \lambda_m) \big \vert \leq 1, \quad m = 1 , \dots , M \tag{1} ``` @@ -79,12 +79,12 @@ Nevertheless, due to their optimized stability properties and low-storage nature #### Tutorial: Using `PairedExplicitRK2` -In this tutorial, we will demonstrate how you can use the second-order PERK time integrator. You need the packages `Convex.jl` and `ECOS.jl`, so be sure they are added to your environment. +In this tutorial, we will demonstrate how you can use the second-order PERK time integrator. You need the packages `Convex.jl`, `ECOS.jl`, and `NLsolve.jl`, so be sure they are added to your environment. First, you need to load the necessary packages: ```@example PERK-example-1 -using Convex, ECOS +using Convex, ECOS, NLsolve using OrdinaryDiffEq using Trixi ``` @@ -96,7 +96,7 @@ Then, define the ODE problem and the semidiscretization setup. For this example, cells_per_dimension = 100 coordinates_min = 0.0 coordinates_max = 1.0 -mesh = StructuredMesh(cells_per_dimension, +mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max) # Define the equation and initial condition @@ -109,8 +109,8 @@ initial_condition = initial_condition_convergence_test solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) # Define the semidiscretization -semi = SemidiscretizationHyperbolic(mesh, - equations, initial_condition, +semi = SemidiscretizationHyperbolic(mesh, + equations, initial_condition, solver) ``` @@ -125,14 +125,14 @@ analysis_callback = AnalysisCallback(semi, interval = 200) stepsize_callback = StepsizeCallback(cfl = 2.5) # Create a CallbackSet to collect all callbacks -callbacks = CallbackSet(summary_callback, - alive_callback, - analysis_callback, +callbacks = CallbackSet(summary_callback, + alive_callback, + analysis_callback, stepsize_callback) ``` -Now, we define the ODE problem by specifying the time span over which the ODE will be solved. -The `tspan` parameter is a tuple `(t_start, t_end)` that defines the start and end times for the simulation. +Now, we define the ODE problem by specifying the time span over which the ODE will be solved. +The `tspan` parameter is a tuple `(t_start, t_end)` that defines the start and end times for the simulation. The `semidiscretize` function is used to create the ODE problem from the simulation setup. ```@example PERK-example-1 @@ -145,10 +145,10 @@ ode = semidiscretize(semi, tspan) Next, we will construct the time integrator. In order to do this, you need the following components: - - Number of stages: The number of stages $S$ in the Runge-Kutta method. + - Number of stages: The number of stages $S$ in the Runge-Kutta method. In this example, we use `6` stages. - - Time span (`tspan`): A tuple `(t_start, t_end)` that defines the time span over which the ODE will be solved. - This defines the bounds for the bisection routine for the optimal timestep $\Delta t$ used in calculating the polynomial coefficients at optimization stage. + - Time span (`tspan`): A tuple `(t_start, t_end)` that defines the time span over which the ODE will be solved. + This defines the bounds for the bisection routine for the optimal timestep $\Delta t$ used in calculating the polynomial coefficients at optimization stage. This variable is already defined in step 5. - Semidiscretization (`semi`): The semidiscretization setup that includes the mesh, equations, initial condition, and solver. In this example, this variable is already defined in step 3. In the background, we compute from `semi` the Jacobian $J$ evaluated at the initial condition using [`jacobian_ad_forward`](https://trixi-framework.github.io/Trixi.jl/stable/reference-trixi/#Trixi.jacobian_ad_forward-Tuple{Trixi.AbstractSemidiscretization}). @@ -182,9 +182,9 @@ There are two additional constructors for the `PairedExplicitRK2` method besides In the previous tutorial the CFL number was set manually to $2.5$. To avoid the manual trial-and-error process behind this, instantiations of `AbstractPairedExplicitRK` methods can automatically compute the stable CFL number for a given simulation setup using the [`Trixi.calculate_cfl`](@ref) function. -When constructing the time integrator from a semidiscretization `semi`, +When constructing the time integrator from a semidiscretization `semi`, ```@example PERK-example-1 -# Construct third-order paired-explicit Runge-Kutta method with 8 stages for given simulation setup. +# Construct third-order paired-explicit Runge-Kutta method with 8 stages for given simulation setup. ode_algorithm = Trixi.PairedExplicitRK3(8, tspan, semi) ``` the maximum timestep `dt` is stored by the `ode_algorithm`. From b48479d328612eb881f45833f2713ab57d1347e7 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 14:34:56 +0100 Subject: [PATCH 35/39] fix some more test values and tolerances --- test/test_parabolic_1d.jl | 4 ++-- test/test_unstructured_2d.jl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_parabolic_1d.jl b/test/test_parabolic_1d.jl index 714095a0b81..ee645819fc0 100644 --- a/test/test_parabolic_1d.jl +++ b/test/test_parabolic_1d.jl @@ -31,8 +31,8 @@ end @trixi_testset "TreeMesh1D: elixir_advection_diffusion_restart.jl" begin @test_trixi_include(joinpath(examples_dir(), "tree_1d_dgsem", "elixir_advection_diffusion_restart.jl"), - l2=[1.0671615777620987e-5], - linf=[3.861509422325993e-5]) + l2=[1.0679933947301556e-5], + linf=[3.910500545667439e-5]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_unstructured_2d.jl b/test/test_unstructured_2d.jl index 9653726f57d..259eb39c545 100644 --- a/test/test_unstructured_2d.jl +++ b/test/test_unstructured_2d.jl @@ -705,7 +705,8 @@ end 0.0009632958467822306 ], tspan=(0.0, 0.025), - flux_splitting=splitting_lax_friedrichs) + flux_splitting=splitting_lax_friedrichs, + atol=2e-10) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let From d0b6f1f5620523b54205855845d98ee274c2297f Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 14:34:02 +0100 Subject: [PATCH 36/39] remove extras that are not required anymore since Julia v1.9 --- Project.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Project.toml b/Project.toml index 4600d26a9b4..154cb45a3a8 100644 --- a/Project.toml +++ b/Project.toml @@ -115,9 +115,3 @@ TriplotRecipes = "0.1" TrixiBase = "0.1.3" UUIDs = "1.6" julia = "1.10" - -[extras] -Convex = "f65535da-76fb-5f13-bab9-19810c17039a" -ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" -Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" -NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" From dd81e82e989255c9fccdc7ffb26e3d8be08de2ef Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 14:49:23 +0100 Subject: [PATCH 37/39] make DiffEqBase a regular dep instead of a weakdep Trixi.jl depends on DiffEqBase.jl already via DiffEqCallbacks.jl. Making DiffEqBase.jl a regular dep instead of a weakdep fixes a cyclic dependency issue with extensions. --- Project.toml | 3 +-- ext/TrixiDiffEqBaseExt.jl | 15 --------------- src/Trixi.jl | 1 + src/time_integration/time_integration.jl | 12 ++++++++++++ 4 files changed, 14 insertions(+), 17 deletions(-) delete mode 100644 ext/TrixiDiffEqBaseExt.jl diff --git a/Project.toml b/Project.toml index 154cb45a3a8..4690cdd6908 100644 --- a/Project.toml +++ b/Project.toml @@ -9,6 +9,7 @@ CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949" @@ -52,14 +53,12 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [weakdeps] Convex = "f65535da-76fb-5f13-bab9-19810c17039a" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" [extensions] TrixiConvexECOSExt = ["Convex", "ECOS"] -TrixiDiffEqBaseExt = "DiffEqBase" TrixiMakieExt = "Makie" TrixiNLsolveExt = "NLsolve" diff --git a/ext/TrixiDiffEqBaseExt.jl b/ext/TrixiDiffEqBaseExt.jl deleted file mode 100644 index b0b694b735d..00000000000 --- a/ext/TrixiDiffEqBaseExt.jl +++ /dev/null @@ -1,15 +0,0 @@ -# Package extension for DiffEqBase.jl interface for Trixi.jl -module TrixiDiffEqBaseExt - -using Trixi: AbstractTimeIntegrator -using DiffEqBase: DiffEqBase, get_tstops, get_tstops_array - -DiffEqBase.get_tstops(integrator::AbstractTimeIntegrator) = integrator.opts.tstops -function DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) - get_tstops(integrator).valtree -end -function DiffEqBase.get_tstops_max(integrator::AbstractTimeIntegrator) - maximum(get_tstops_array(integrator)) -end - -end # module TrixiDiffEqBaseExt diff --git a/src/Trixi.jl b/src/Trixi.jl index ffe759d0750..162954ef515 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -45,6 +45,7 @@ using DelimitedFiles: readdlm using Downloads: Downloads using CodeTracking: CodeTracking using ConstructionBase: ConstructionBase +using DiffEqBase: DiffEqBase, get_tstops, get_tstops_array using DiffEqCallbacks: PeriodicCallback, PeriodicCallbackAffect @reexport using EllipsisNotation # .. using FillArrays: Ones, Zeros diff --git a/src/time_integration/time_integration.jl b/src/time_integration/time_integration.jl index c810c00d8ce..0d37292c42b 100644 --- a/src/time_integration/time_integration.jl +++ b/src/time_integration/time_integration.jl @@ -16,8 +16,20 @@ end # Abstract supertype of Trixi.jl's own time integrators for dispatch abstract type AbstractTimeIntegrator end +# Interface required by DiffEqCallbacks.jl +function DiffEqBase.get_tstops(integrator::AbstractTimeIntegrator) + return integrator.opts.tstops +end +function DiffEqBase.get_tstops_array(integrator::AbstractTimeIntegrator) + return get_tstops(integrator).valtree +end +function DiffEqBase.get_tstops_max(integrator::AbstractTimeIntegrator) + return maximum(get_tstops_array(integrator)) +end + include("methods_2N.jl") include("methods_3Sstar.jl") include("methods_SSP.jl") include("paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl") + end # @muladd From 624c93235b1f5c5782218bea697c3fad29f08019 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Fri, 7 Feb 2025 14:53:17 +0100 Subject: [PATCH 38/39] format Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/time_integration/time_integration.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/time_integration/time_integration.jl b/src/time_integration/time_integration.jl index 0d37292c42b..609526da5aa 100644 --- a/src/time_integration/time_integration.jl +++ b/src/time_integration/time_integration.jl @@ -31,5 +31,4 @@ include("methods_2N.jl") include("methods_3Sstar.jl") include("methods_SSP.jl") include("paired_explicit_runge_kutta/paired_explicit_runge_kutta.jl") - end # @muladd From 4a682ffdf971a9c05095a6fd0025359be5ed13b7 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Fri, 7 Feb 2025 15:19:20 +0100 Subject: [PATCH 39/39] add NLsolve to docs/Project.toml --- docs/Project.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 5d63e239e0b..01bde4897e8 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -9,6 +9,7 @@ HOHQMesh = "e4f4c7b8-17cb-445a-93c5-f69190ed6c8c" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7" +NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -26,6 +27,7 @@ HOHQMesh = "0.1, 0.2" LaTeXStrings = "1.2" Literate = "2.9" Measurements = "2.5" +NLsolve = "4.5.1" OrdinaryDiffEq = "6.49.1" Plots = "1.9" Test = "1"