From 02a7f7c9e3d615c32e79fdf9c43aa93ddac57d9d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 12 Aug 2024 18:35:18 -0400 Subject: [PATCH 01/55] Remove the InteractiveUtils dependency by reimplementing subtypes This cuts out a decent loading dependency --- .../src/OrdinaryDiffEqDifferentiation.jl | 3 +- .../src/derivative_utils.jl | 2 +- .../src/utils.jl | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 lib/OrdinaryDiffEqDifferentiation/src/utils.jl diff --git a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl index cffbf869cb..9551a6b856 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl @@ -16,8 +16,6 @@ using DiffEqBase import LinearAlgebra import LinearAlgebra: Diagonal, I, UniformScaling, diagind, mul!, lmul!, axpby!, opnorm import SparseArrays: SparseMatrixCSC, AbstractSparseMatrix, nonzeros - -import InteractiveUtils import ArrayInterface import StaticArrayInterface @@ -53,6 +51,7 @@ else struct OrdinaryDiffEqTag end end +include("utils.jl") include("alg_utils.jl") include("linsolve_utils.jl") include("derivative_utils.jl") diff --git a/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl b/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl index ee2a9d4fd4..43c039d26c 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl @@ -922,7 +922,7 @@ function LinearSolve.init_cacheval( assumptions::OperatorAssumptions) end -for alg in InteractiveUtils.subtypes(LinearSolve.AbstractFactorization) +for alg in subtypes(LinearSolve.AbstractFactorization) @eval function LinearSolve.init_cacheval(alg::$alg, A::WOperator, b, u, Pl, Pr, maxiters::Int, abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions) diff --git a/lib/OrdinaryDiffEqDifferentiation/src/utils.jl b/lib/OrdinaryDiffEqDifferentiation/src/utils.jl new file mode 100644 index 0000000000..e2b9d3fd6f --- /dev/null +++ b/lib/OrdinaryDiffEqDifferentiation/src/utils.jl @@ -0,0 +1,31 @@ +# Reimplementation of InteractiveUtils.subtypes +# Used to remove the direct dependency + +subtypes(x::Type) = _subtypes_in!(Base.loaded_modules_array(), x) +function _subtypes_in!(mods::Array, x::Type) + xt = Base.unwrap_unionall(x) + if !isabstracttype(x) || !isa(xt, DataType) + # Fast path + return Type[] + end + sts = Vector{Any}() + while !isempty(mods) + m = pop!(mods) + xt = xt::DataType + for s in names(m, all = true) + if isdefined(m, s) && !Base.isdeprecated(m, s) + t = getfield(m, s) + dt = isa(t, UnionAll) ? Base.unwrap_unionall(t) : t + if isa(dt, DataType) + if dt.name.name === s && dt.name.module == m && supertype(dt).name == xt.name + ti = typeintersect(t, x) + ti != Base.Bottom && push!(sts, ti) + end + elseif isa(t, Module) && nameof(t) === s && parentmodule(t) === m && t !== m + t === Base || push!(mods, t) # exclude Base, since it also parented by Main + end + end + end + end + return permute!(sts, sortperm(map(string, sts))) +end \ No newline at end of file From 669b3f2b5f7f05534452511ae779459b0cd0db2d Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 13 Aug 2024 08:27:36 -0400 Subject: [PATCH 02/55] add tstops API --- lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl | 4 +++- .../src/integrators/integrator_interface.jl | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl b/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl index 4dcf9873ef..6cbb4ec20a 100644 --- a/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl +++ b/lib/OrdinaryDiffEqCore/src/OrdinaryDiffEqCore.jl @@ -51,7 +51,9 @@ import DiffEqBase: resize!, deleteat!, addat!, full_cache, user_cache, u_cache, add_tstop!, has_tstop, first_tstop, pop_tstop!, add_saveat!, set_reltol!, set_abstol!, postamble!, last_step_failed, - isautodifferentiable + isautodifferentiable, + get_tstops, get_tstops_array, get_tstops_max + using DiffEqBase: check_error!, @def, _vec, _reshape diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl index 4ffdf20c7e..1168ab4a81 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl @@ -452,3 +452,7 @@ function DiffEqBase.set_u!(integrator::ODEIntegrator, u) end DiffEqBase.has_stats(i::ODEIntegrator) = true + +DiffEqBase.get_tstops(integ::ODEIntegrator) = integ.opts.tstops +DiffEqBase.get_tstops_array(integ::ODEIntegrator) = get_tstops(integ).valtree +DiffEqBase.get_tstops_max(integ::ODEIntegrator) = maximum(get_tstops_array(integ)) From 8a1af1e9e830d8b012a3e4c0c4ceb9e4184f8953 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 15 Aug 2024 01:35:26 -0400 Subject: [PATCH 03/55] Autocompat Using: ```julia function autocompat(ctx=Pkg.Types.Context(); io=nothing) io = something(io, ctx.io) updated_deps = String[] for dep_list in (ctx.env.project.deps, ctx.env.project.weakdeps, ctx.env.project.extras), (dep, uuid) in dep_list compat_str = Pkg.Operations.get_compat_str(ctx.env.project, dep) isnothing(compat_str) || continue if uuid in ctx.env.manifest v = ctx.env.manifest[uuid].version v === nothing && (v = "<0.0.1, 1") else try pkg_versions = Pkg.Versions.VersionSpec([Pkg.Operations.get_all_registered_versions( ctx, uuid)...]) if isempty(pkg_versions) @warn "No versions of $(dep) are registered. Possibly a Standard Library package." v = "<0.0.1, 1" else latest_version = Pkg.Operations.get_latest_compatible_version( ctx, uuid, pkg_versions) v = latest_version end catch err @error "Encountered Error $(err) while processing $(dep). Skipping." continue end end Pkg.Operations.set_compat(ctx.env.project, dep, string(v)) || Pkg.Types.pkgerror("invalid compat version specifier \"$(string(v))\"") push!(updated_deps, dep) end if isempty(updated_deps) Pkg.printpkgstyle(io, :Info, "no misssing compat entries found. No changes made."; color=Base.info_color()) elseif length(updated_deps) == 1 Pkg.printpkgstyle(io, :Info, "new entry set for $(only(updated_deps)) based on its current version"; color=Base.info_color()) else Pkg.printpkgstyle(io, :Info, "new entries set for $(join(updated_deps, ", ", " and ")) based on their current versions"; color=Base.info_color()) end Pkg.Types.write_env(ctx.env) return Pkg.Operations.print_compat(ctx; io) end for x in readdir("/Users/chrisrackauckas/.julia/dev/OrdinaryDiffEq/lib") Pkg.activate("/Users/chrisrackauckas/.julia/dev/OrdinaryDiffEq/lib/$x") autocompat() end ``` --- .../Project.toml | 23 ++++++-- lib/OrdinaryDiffEqBDF/Project.toml | 50 ++++++++++++----- lib/OrdinaryDiffEqCore/Project.toml | 4 ++ lib/OrdinaryDiffEqDefault/Project.toml | 28 +++++++--- .../Project.toml | 5 ++ lib/OrdinaryDiffEqExplicitRK/Project.toml | 9 +++- lib/OrdinaryDiffEqExponentialRK/Project.toml | 39 ++++++++++---- lib/OrdinaryDiffEqExtrapolation/Project.toml | 21 ++++++-- lib/OrdinaryDiffEqFIRK/Project.toml | 32 ++++++++--- lib/OrdinaryDiffEqFeagin/Project.toml | 22 +++++--- lib/OrdinaryDiffEqFunctionMap/Project.toml | 22 ++++++-- lib/OrdinaryDiffEqHighOrderRK/Project.toml | 22 ++++++-- lib/OrdinaryDiffEqIMEXMultistep/Project.toml | 12 ++++- lib/OrdinaryDiffEqLinear/Project.toml | 29 +++++++--- lib/OrdinaryDiffEqLowOrderRK/Project.toml | 28 +++++++--- lib/OrdinaryDiffEqLowStorageRK/Project.toml | 29 +++++++--- lib/OrdinaryDiffEqNonlinearSolve/Project.toml | 33 ++++++++++-- lib/OrdinaryDiffEqNordsieck/Project.toml | 23 ++++++-- lib/OrdinaryDiffEqPDIRK/Project.toml | 25 ++++++--- lib/OrdinaryDiffEqPRK/Project.toml | 18 +++++-- lib/OrdinaryDiffEqQPRK/Project.toml | 22 ++++++-- lib/OrdinaryDiffEqRKN/Project.toml | 16 +++++- lib/OrdinaryDiffEqRosenbrock/Project.toml | 53 +++++++++++++------ lib/OrdinaryDiffEqSDIRK/Project.toml | 30 ++++++++--- lib/OrdinaryDiffEqSSPRK/Project.toml | 27 ++++++++-- lib/OrdinaryDiffEqStabilizedIRK/Project.toml | 20 +++++-- lib/OrdinaryDiffEqStabilizedRK/Project.toml | 19 +++++-- lib/OrdinaryDiffEqSymplecticRK/Project.toml | 37 +++++++++---- lib/OrdinaryDiffEqTsit5/Project.toml | 29 +++++++--- lib/OrdinaryDiffEqVerner/Project.toml | 36 +++++++++---- 30 files changed, 589 insertions(+), 174 deletions(-) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml b/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml index a97175c232..bf8227cebc 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml @@ -4,27 +4,42 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] +ADTypes = "1.7.1" +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqLowOrderRK = "<0.0.1, 1" +Polyester = "0.7.16" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" [targets] test = ["DiffEqDevTools", "ODEProblemLibrary", "Random", "SafeTestsets", "Test", "DiffEqBase"] diff --git a/lib/OrdinaryDiffEqBDF/Project.toml b/lib/OrdinaryDiffEqBDF/Project.toml index 6073f25b88..554298b9fd 100644 --- a/lib/OrdinaryDiffEqBDF/Project.toml +++ b/lib/OrdinaryDiffEqBDF/Project.toml @@ -4,34 +4,56 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf" -TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" -PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -Preferences = "21216c6a-2e73-6563-6e65-726566657250" +TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" + +[compat] +ArrayInterface = "7.15.0" +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +ForwardDiff = "0.10.36" +LinearAlgebra = "<0.0.1, 1" +MacroTools = "0.5.13" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +OrdinaryDiffEqSDIRK = "<0.0.1, 1" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" +TruncatedStacktraces = "1.4.0" +julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" - -[compat] -julia = "1.10" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["DiffEqDevTools", "ForwardDiff", "Random", "SafeTestsets", "Test", "ODEProblemLibrary", "StaticArrays"] diff --git a/lib/OrdinaryDiffEqCore/Project.toml b/lib/OrdinaryDiffEqCore/Project.toml index 145d364e85..8be36cf535 100644 --- a/lib/OrdinaryDiffEqCore/Project.toml +++ b/lib/OrdinaryDiffEqCore/Project.toml @@ -40,6 +40,7 @@ Adapt = "3.0, 4" ArrayInterface = "7" DataStructures = "0.18" DiffEqBase = "6.147" +DiffEqDevTools = "2.44.4" DocStringExtensions = "0.9" EnumX = "1" FastBroadcast = "0.2, 0.3" @@ -54,8 +55,10 @@ MuladdMacro = "0.2.1" Polyester = "0.7" PrecompileTools = "1" Preferences = "1.3" +Random = "<0.0.1, 1" RecursiveArrayTools = "2.36, 3" Reexport = "1.0" +SafeTestsets = "0.1.0" SciMLBase = "2.27.1" SciMLOperators = "0.3" SciMLStructures = "1" @@ -63,6 +66,7 @@ SimpleUnPack = "1" Static = "0.8, 1" StaticArrayInterface = "1.2" StaticArraysCore = "1.0" +Test = "<0.0.1, 1" TruncatedStacktraces = "1.2" julia = "1.10" diff --git a/lib/OrdinaryDiffEqDefault/Project.toml b/lib/OrdinaryDiffEqDefault/Project.toml index ab7944b465..bbcf79a48a 100644 --- a/lib/OrdinaryDiffEqDefault/Project.toml +++ b/lib/OrdinaryDiffEqDefault/Project.toml @@ -4,18 +4,37 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce" OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Preferences = "21216c6a-2e73-6563-6e65-726566657250" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" + +[compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +EnumX = "1.0.4" +LinearAlgebra = "<0.0.1, 1" +LinearSolve = "2.32.0" +OrdinaryDiffEqBDF = "<0.0.1, 1" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqRosenbrock = "<0.0.1, 1" +OrdinaryDiffEqTsit5 = "<0.0.1, 1" +OrdinaryDiffEqVerner = "<0.0.1, 1" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Test = "<0.0.1, 1" +julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" @@ -23,8 +42,5 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[compat] -julia = "1.10" - [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test"] diff --git a/lib/OrdinaryDiffEqDifferentiation/Project.toml b/lib/OrdinaryDiffEqDifferentiation/Project.toml index 44a759e22e..45728b4d86 100644 --- a/lib/OrdinaryDiffEqDifferentiation/Project.toml +++ b/lib/OrdinaryDiffEqDifferentiation/Project.toml @@ -25,6 +25,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" ADTypes = "1" ArrayInterface = "7" DiffEqBase = "6" +DiffEqDevTools = "2.44.4" FastBroadcast = "0.3" FiniteDiff = "2" ForwardDiff = "0.10" @@ -32,11 +33,15 @@ FunctionWrappersWrappers = "0.1" InteractiveUtils = "1.10" LinearAlgebra = "1.10" LinearSolve = "2" +OrdinaryDiffEqCore = "<0.0.1, 1" +Random = "<0.0.1, 1" +SafeTestsets = "0.1.0" SciMLBase = "2" SparseArrays = "1" SparseDiffTools = "2" StaticArrayInterface = "1" StaticArrays = "1" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqExplicitRK/Project.toml b/lib/OrdinaryDiffEqExplicitRK/Project.toml index 62a93710e7..0f3a77a9f1 100644 --- a/lib/OrdinaryDiffEqExplicitRK/Project.toml +++ b/lib/OrdinaryDiffEqExplicitRK/Project.toml @@ -10,17 +10,22 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" [compat] DiffEqBase = "6" +DiffEqDevTools = "2.44.4" FastBroadcast = "0.3" +LinearAlgebra = "1.10" MuladdMacro = "0.2" OrdinaryDiffEqCore = "1" +Random = "<0.0.1, 1" RecursiveArrayTools = "3" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Test = "<0.0.1, 1" TruncatedStacktraces = "1" -LinearAlgebra = "1.10" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqExponentialRK/Project.toml b/lib/OrdinaryDiffEqExponentialRK/Project.toml index 0b5eda4639..c3dadcf16a 100644 --- a/lib/OrdinaryDiffEqExponentialRK/Project.toml +++ b/lib/OrdinaryDiffEqExponentialRK/Project.toml @@ -4,30 +4,49 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +ExponentialUtilities = "d4d017d3-3776-5f7e-afef-a10c40355c18" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -ExponentialUtilities = "d4d017d3-3776-5f7e-afef-a10c40355c18" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" -OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf" +OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +ExponentialUtilities = "1.26.1" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +LinearSolve = "2.32.0" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqSDIRK = "<0.0.1, 1" +OrdinaryDiffEqTsit5 = "<0.0.1, 1" +OrdinaryDiffEqVerner = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +SciMLBase = "2.48.1" +SparseArrays = "<0.0.1, 1" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" +OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "OrdinaryDiffEqTsit5", "LinearSolve", "SparseArrays"] diff --git a/lib/OrdinaryDiffEqExtrapolation/Project.toml b/lib/OrdinaryDiffEqExtrapolation/Project.toml index 87c090e7a1..96da66f8ba 100644 --- a/lib/OrdinaryDiffEqExtrapolation/Project.toml +++ b/lib/OrdinaryDiffEqExtrapolation/Project.toml @@ -4,25 +4,38 @@ authors = ["Chris Rackauckas ", "Yingbo Ma "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +LinearSolve = "2.32.0" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +SciMLOperators = "0.3.9" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqFeagin/Project.toml b/lib/OrdinaryDiffEqFeagin/Project.toml index 352c557ed5..a2dd1f3423 100644 --- a/lib/OrdinaryDiffEqFeagin/Project.toml +++ b/lib/OrdinaryDiffEqFeagin/Project.toml @@ -10,17 +10,23 @@ MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] - DiffEqBase = "6" - FastBroadcast = "0.3" - MuladdMacro = "0.2" - OrdinaryDiffEqCore = "1" - Polyester = "0.7" - RecursiveArrayTools = "3" - Static = "1" +DiffEqBase = "6" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3" +MuladdMacro = "0.2" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "1" +Polyester = "0.7" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqFunctionMap/Project.toml b/lib/OrdinaryDiffEqFunctionMap/Project.toml index afedfedee3..6a4bf4bfcc 100644 --- a/lib/OrdinaryDiffEqFunctionMap/Project.toml +++ b/lib/OrdinaryDiffEqFunctionMap/Project.toml @@ -4,16 +4,28 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +SciMLBase = "2.48.1" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqHighOrderRK/Project.toml b/lib/OrdinaryDiffEqHighOrderRK/Project.toml index 31139b6ff8..be9ca6047f 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqHighOrderRK/Project.toml @@ -4,20 +4,32 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/lib/OrdinaryDiffEqIMEXMultistep/Project.toml b/lib/OrdinaryDiffEqIMEXMultistep/Project.toml index 68cd5ba7ba..7ae0574146 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/Project.toml +++ b/lib/OrdinaryDiffEqIMEXMultistep/Project.toml @@ -4,14 +4,24 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +Random = "<0.0.1, 1" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqLinear/Project.toml b/lib/OrdinaryDiffEqLinear/Project.toml index 4e8a891525..c96fcad0fd 100644 --- a/lib/OrdinaryDiffEqLinear/Project.toml +++ b/lib/OrdinaryDiffEqLinear/Project.toml @@ -4,18 +4,33 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" -SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" ExponentialUtilities = "d4d017d3-3776-5f7e-afef-a10c40355c18" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" +OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +ExponentialUtilities = "1.26.1" +LinearAlgebra = "<0.0.1, 1" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqRosenbrock = "<0.0.1, 1" +OrdinaryDiffEqTsit5 = "<0.0.1, 1" +OrdinaryDiffEqVerner = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +SciMLBase = "2.48.1" +SciMLOperators = "0.3.9" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqLowOrderRK/Project.toml b/lib/OrdinaryDiffEqLowOrderRK/Project.toml index 50381f0129..abe5cd293e 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqLowOrderRK/Project.toml @@ -4,25 +4,39 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +SciMLBase = "2.48.1" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqLowStorageRK/Project.toml b/lib/OrdinaryDiffEqLowStorageRK/Project.toml index 69a660c478..f4d3444218 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/Project.toml +++ b/lib/OrdinaryDiffEqLowStorageRK/Project.toml @@ -4,28 +4,45 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -Preferences = "21216c6a-2e73-6563-6e65-726566657250" [compat] +Adapt = "4.0.4" +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +Polyester = "0.7.16" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml index 0dcde5e487..983362d14a 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml +++ b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml @@ -5,26 +5,49 @@ version = "1.0.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" -SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a" +ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226" SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] +ADTypes = "1.7.1" +ArrayInterface = "7.15.0" +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +FastClosures = "0.3.2" +ForwardDiff = "0.10.36" +LinearAlgebra = "<0.0.1, 1" +LinearSolve = "2.32.0" +MuladdMacro = "0.2.4" +NonlinearSolve = "3.14.0" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +PreallocationTools = "0.4.23" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +SafeTestsets = "0.1.0" +SciMLBase = "2.48.1" +SciMLOperators = "0.3.9" +SciMLStructures = "1.4.2" +SimpleNonlinearSolve = "1.12.0" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqNordsieck/Project.toml b/lib/OrdinaryDiffEqNordsieck/Project.toml index c7cf281571..b5d6e1e924 100644 --- a/lib/OrdinaryDiffEqNordsieck/Project.toml +++ b/lib/OrdinaryDiffEqNordsieck/Project.toml @@ -4,26 +4,41 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqTsit5 = "<0.0.1, 1" +Polyester = "0.7.16" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqPDIRK/Project.toml b/lib/OrdinaryDiffEqPDIRK/Project.toml index d04fd6e123..934fdf6e95 100644 --- a/lib/OrdinaryDiffEqPDIRK/Project.toml +++ b/lib/OrdinaryDiffEqPDIRK/Project.toml @@ -4,17 +4,30 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" -Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" +Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +Polyester = "0.7.16" +Random = "<0.0.1, 1" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqPRK/Project.toml b/lib/OrdinaryDiffEqPRK/Project.toml index be11209f92..558f4ba96c 100644 --- a/lib/OrdinaryDiffEqPRK/Project.toml +++ b/lib/OrdinaryDiffEqPRK/Project.toml @@ -4,14 +4,24 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +Polyester = "0.7.16" +Random = "<0.0.1, 1" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Test = "<0.0.1, 1" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqQPRK/Project.toml b/lib/OrdinaryDiffEqQPRK/Project.toml index a62a778703..d846f141d3 100644 --- a/lib/OrdinaryDiffEqQPRK/Project.toml +++ b/lib/OrdinaryDiffEqQPRK/Project.toml @@ -4,23 +4,35 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqRKN/Project.toml b/lib/OrdinaryDiffEqRKN/Project.toml index 3f8cd8a90d..35904fa591 100644 --- a/lib/OrdinaryDiffEqRKN/Project.toml +++ b/lib/OrdinaryDiffEqRKN/Project.toml @@ -4,23 +4,35 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +Polyester = "0.7.16" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Statistics = "1.11.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "Statistics"] diff --git a/lib/OrdinaryDiffEqRosenbrock/Project.toml b/lib/OrdinaryDiffEqRosenbrock/Project.toml index bc07b9e356..a6beaa8c5e 100644 --- a/lib/OrdinaryDiffEqRosenbrock/Project.toml +++ b/lib/OrdinaryDiffEqRosenbrock/Project.toml @@ -4,37 +4,60 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" -Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" -MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" +MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" +Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Preferences = "21216c6a-2e73-6563-6e65-726566657250" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" [compat] +ADTypes = "1.7.1" +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +FiniteDiff = "2.24.0" +ForwardDiff = "0.10.36" +LinearAlgebra = "<0.0.1, 1" +LinearSolve = "2.32.0" +MacroTools = "0.5.13" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +Polyester = "0.7.16" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" -Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "LinearAlgebra", "LinearSolve", "ForwardDiff", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqSDIRK/Project.toml b/lib/OrdinaryDiffEqSDIRK/Project.toml index 1258235f8f..2634167fc5 100644 --- a/lib/OrdinaryDiffEqSDIRK/Project.toml +++ b/lib/OrdinaryDiffEqSDIRK/Project.toml @@ -4,20 +4,36 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" -TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MacroTools = "0.5.13" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +SciMLBase = "2.48.1" +Test = "<0.0.1, 1" +TruncatedStacktraces = "1.4.0" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqSSPRK/Project.toml b/lib/OrdinaryDiffEqSSPRK/Project.toml index e1809f4e59..716273ee14 100644 --- a/lib/OrdinaryDiffEqSSPRK/Project.toml +++ b/lib/OrdinaryDiffEqSSPRK/Project.toml @@ -4,28 +4,45 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" -PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -Preferences = "21216c6a-2e73-6563-6e65-726566657250" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqLowStorageRK = "<0.0.1, 1" +Polyester = "0.7.16" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" +OrdinaryDiffEqLowStorageRK = "b0944070-b475-4768-8dec-fb6eb410534d" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" -OrdinaryDiffEqLowStorageRK = "b0944070-b475-4768-8dec-fb6eb410534d" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "ODEProblemLibrary", "OrdinaryDiffEqLowStorageRK"] diff --git a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml index b883fe232d..4c7db7ca66 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml @@ -4,25 +4,39 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b" +OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqDifferentiation = "<0.0.1, 1" +OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "LinearAlgebra"] diff --git a/lib/OrdinaryDiffEqStabilizedRK/Project.toml b/lib/OrdinaryDiffEqStabilizedRK/Project.toml index 31afc480d4..d8de539f80 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedRK/Project.toml @@ -4,24 +4,37 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +ODEProblemLibrary = "0.1.8" +OrdinaryDiffEqCore = "<0.0.1, 1" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +StaticArrays = "1.9.7" +Test = "<0.0.1, 1" julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "LinearAlgebra", "ODEProblemLibrary"] diff --git a/lib/OrdinaryDiffEqSymplecticRK/Project.toml b/lib/OrdinaryDiffEqSymplecticRK/Project.toml index 25f6621ec5..79a947a99f 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/Project.toml +++ b/lib/OrdinaryDiffEqSymplecticRK/Project.toml @@ -4,26 +4,41 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" + +[compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqRKN = "<0.0.1, 1" +OrdinaryDiffEqTsit5 = "<0.0.1, 1" +Polyester = "0.7.16" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Statistics = "1.11.1" +Test = "<0.0.1, 1" +julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +OrdinaryDiffEqRKN = "af6ede74-add8-4cfd-b1df-9a4dbb109d7a" +OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" -LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a" -OrdinaryDiffEqRKN = "af6ede74-add8-4cfd-b1df-9a4dbb109d7a" - -[compat] -julia = "1.10" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test", "Statistics", "LinearAlgebra", "OrdinaryDiffEqTsit5", "OrdinaryDiffEqRKN"] diff --git a/lib/OrdinaryDiffEqTsit5/Project.toml b/lib/OrdinaryDiffEqTsit5/Project.toml index 772053b8ee..7f03587a92 100644 --- a/lib/OrdinaryDiffEqTsit5/Project.toml +++ b/lib/OrdinaryDiffEqTsit5/Project.toml @@ -4,19 +4,34 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Preferences = "21216c6a-2e73-6563-6e65-726566657250" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" +TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" [compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" +TruncatedStacktraces = "1.4.0" julia = "1.10" [extras] diff --git a/lib/OrdinaryDiffEqVerner/Project.toml b/lib/OrdinaryDiffEqVerner/Project.toml index 984460ac9c..4055334d39 100644 --- a/lib/OrdinaryDiffEqVerner/Project.toml +++ b/lib/OrdinaryDiffEqVerner/Project.toml @@ -4,18 +4,37 @@ authors = ["ParamThakkar123 "] version = "1.0.0" [deps] +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" -OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" -TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" -RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" +OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" +Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" Preferences = "21216c6a-2e73-6563-6e65-726566657250" +RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" +TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" + +[compat] +DiffEqBase = "6.152.2" +DiffEqDevTools = "2.44.4" +FastBroadcast = "0.3.5" +LinearAlgebra = "<0.0.1, 1" +MuladdMacro = "0.2.4" +OrdinaryDiffEqCore = "<0.0.1, 1" +Polyester = "0.7.16" +PrecompileTools = "1.2.1" +Preferences = "1.4.3" +Random = "<0.0.1, 1" +RecursiveArrayTools = "3.27.0" +Reexport = "1.2.2" +SafeTestsets = "0.1.0" +Static = "1.1.1" +Test = "<0.0.1, 1" +TruncatedStacktraces = "1.4.0" +julia = "1.10" [extras] DiffEqDevTools = "f3b72e0c-5b89-59e1-b016-84e28bfd966d" @@ -23,8 +42,5 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -[compat] -julia = "1.10" - [targets] test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test"] From a3d10672e82f543024b0945d34667e8bf7987230 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 06:28:50 -0400 Subject: [PATCH 04/55] Split and inactivate increment functions --- lib/OrdinaryDiffEqCore/Project.toml | 6 ++ .../ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl | 14 ++++ .../src/integrators/integrator_interface.jl | 6 +- .../src/integrators/integrator_utils.jl | 78 +++++++++++-------- 4 files changed, 69 insertions(+), 35 deletions(-) create mode 100644 lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl diff --git a/lib/OrdinaryDiffEqCore/Project.toml b/lib/OrdinaryDiffEqCore/Project.toml index 8be36cf535..da7cb6e978 100644 --- a/lib/OrdinaryDiffEqCore/Project.toml +++ b/lib/OrdinaryDiffEqCore/Project.toml @@ -34,6 +34,12 @@ StaticArrayInterface = "0d7ed370-da01-4f52-bd93-41d350b8b718" StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" +[weakdeps] +EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" + +[extensions] +OrdinaryDiffEqCoreEnzymeCore = "EnzymeCore" + [compat] ADTypes = "0.2, 1" Adapt = "3.0, 4" diff --git a/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl b/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl new file mode 100644 index 0000000000..c3e1ba3b94 --- /dev/null +++ b/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl @@ -0,0 +1,14 @@ +module OrdinaryDiffEqCoreEnzymeCoreExt +import OrdinaryDiffEqCore, EnzymeCore + +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf_from_initdt!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.fixed_t_for_floatingpoint_error!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_accept!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_reject!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf_perform_step!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf_fsal!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.check_error!), args...) = true +Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.log_step!), args...) = true + +end \ No newline at end of file diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl index 4d97950267..f9d5d3d02a 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl @@ -419,7 +419,11 @@ function DiffEqBase.auto_dt_reset!(integrator::ODEIntegrator) integrator.opts.internalnorm, integrator.sol.prob, integrator) integrator.dtpropose = integrator.dt - integrator.stats.nf += 2 + increment_nf_from_initdt!(integrator.stats) +end + +function increment_nf_from_initdt!(stats) + stats.nf += 2 end function DiffEqBase.set_t!(integrator::ODEIntegrator, t::Real) diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl index bf8b029ec9..3d3549e745 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl @@ -231,57 +231,32 @@ function _loopfooter!(integrator) (integrator.opts.force_dtmin && abs(integrator.dt) <= timedepentdtmin(integrator)) if integrator.accept_step # Accept - integrator.stats.naccept += 1 + increment_accept!(integrator.stats) integrator.last_stepfail = false dtnew = DiffEqBase.value(step_accept_controller!(integrator, integrator.alg, q)) * oneunit(integrator.dt) integrator.tprev = integrator.t - integrator.t = if has_tstop(integrator) - tstop = integrator.tdir * first_tstop(integrator) - if abs(ttmp - tstop) < - 100eps(float(max(integrator.t, tstop) / oneunit(integrator.t))) * - oneunit(integrator.t) - tstop - else - ttmp - end - else - ttmp - end + integrator.t = fixed_t_for_floatingpoint_error!(integrator, ttmp) calc_dt_propose!(integrator, dtnew) handle_callbacks!(integrator) else # Reject - integrator.stats.nreject += 1 + increment_reject!(integrator.stats) end elseif !integrator.opts.adaptive #Not adaptive - integrator.stats.naccept += 1 + increment_accept!(integrator.stats) integrator.tprev = integrator.t - integrator.t = if has_tstop(integrator) - tstop = integrator.tdir * first_tstop(integrator) - if abs(ttmp - tstop) < - 100eps(float(integrator.t / oneunit(integrator.t))) * oneunit(integrator.t) - tstop - else - ttmp - end - else - ttmp - end + integrator.t = fixed_t_for_floatingpoint_error!(integrator, ttmp) integrator.last_stepfail = false integrator.accept_step = true integrator.dtpropose = integrator.dt handle_callbacks!(integrator) end if integrator.opts.progress && integrator.iter % integrator.opts.progress_steps == 0 - t1, t2 = integrator.sol.prob.tspan - @logmsg(LogLevel(-1), - integrator.opts.progress_name, - _id=integrator.opts.progress_id, - message=integrator.opts.progress_message(integrator.dt, integrator.u, - integrator.p, integrator.t), - progress=(integrator.t - t1) / (t2 - t1)) + log_step!(integrator.opts.progress_name, integrator.opts.progress_id, + integrator.opts.progress_message, integrator.dt, integrator.u, + integrator.p, integrator.t, integrator.sol.prob.tspan) end # Take value because if t is dual then maxeig can be dual @@ -295,6 +270,37 @@ function _loopfooter!(integrator) nothing end +function increment_accept!(stats) + stats.naccept += 1 +end + +function increment_reject!(stats) + stats.nreject += 1 +end + +function log_step!(progress_name, progress_id, progress_message, dt, u, p, t, tspan) + t1, t2 = tspan + @logmsg(LogLevel(-1),progress_name, + _id=progress_id, + message=progress_message(dt, u, p, t), + progress=(t - t1) / (t2 - t1)) +end + +function fixed_t_for_floatingpoint_error!(integrator, ttmp) + if has_tstop(integrator) + tstop = integrator.tdir * first_tstop(integrator) + if abs(ttmp - tstop) < + 100eps(float(max(integrator.t, tstop) / oneunit(integrator.t))) * + oneunit(integrator.t) + tstop + else + ttmp + end + else + ttmp + end +end + # Use a generated function to call apply_callback! in a type-stable way @generated function apply_ith_callback!(integrator, time, upcrossing, event_idx, cb_idx, @@ -471,7 +477,7 @@ handle_callback_modifiers!(integrator::ODEIntegrator) = nothing function reset_fsal!(integrator) # Under these conditions, these algorithms are not FSAL anymore - integrator.stats.nf += 1 + increment_nf_fsal!(integrator.stats) # Ignore DAEs but they already re-ran initialization # Mass matrix DAEs do need to reset FSAL if available @@ -491,6 +497,10 @@ function reset_fsal!(integrator) # integrator.reeval_fsal = false end +function increment_nf_fsal!(stats) + stats.nf += 1 +end + function nlsolve_f(f, alg::OrdinaryDiffEqAlgorithm) f isa SplitFunction && issplit(alg) ? f.f1 : f end From 3dee72083a7cc2daaae8f5078310dda03dc8335a Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 06:36:55 -0400 Subject: [PATCH 05/55] Handle all nf increments --- .../adams_bashforth_moulton_perform_step.jl | 122 +++++++------- lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl | 56 +++---- lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl | 6 +- .../ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl | 2 - .../src/integrators/integrator_interface.jl | 6 +- .../src/integrators/integrator_utils.jl | 6 +- .../src/derivative_wrappers.jl | 8 +- .../src/linsolve_utils.jl | 2 +- .../src/explicit_rk_perform_step.jl | 12 +- .../src/exponential_rk_perform_step.jl | 152 ++++++++--------- .../src/extrapolation_perform_step.jl | 100 +++++------ .../src/firk_perform_step.jl | 40 ++--- .../src/feagin_rk_perform_step.jl | 36 ++-- .../src/fixed_timestep_perform_step.jl | 6 +- .../src/high_order_rk_perform_step.jl | 66 ++++---- .../src/imex_multistep_perform_step.jl | 24 +-- .../src/linear_perform_step.jl | 82 ++++----- .../src/fixed_timestep_perform_step.jl | 52 +++--- .../src/low_order_rk_perform_step.jl | 158 +++++++++--------- .../src/split_perform_step.jl | 8 +- .../src/low_storage_rk_perform_step.jl | 122 +++++++------- .../src/functional.jl | 4 +- .../src/newton.jl | 4 +- .../src/nordsieck_perform_step.jl | 12 +- .../src/nordsieck_utils.jl | 4 +- .../src/qprk_perform_step.jl | 12 +- lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl | 82 ++++----- .../src/generic_rosenbrock.jl | 12 +- .../src/rosenbrock_perform_step.jl | 128 +++++++------- .../src/kencarp_kvaerno_perform_step.jl | 10 +- .../src/sdirk_perform_step.jl | 28 ++-- .../src/ssprk_perform_step.jl | 130 +++++++------- .../src/irkc_perform_step.jl | 12 +- .../src/irkc_utils.jl | 8 +- .../src/rkc_perform_step.jl | 92 +++++----- .../src/rkc_utils.jl | 8 +- .../src/symplectic_perform_step.jl | 60 +++---- .../src/tsit_perform_step.jl | 8 +- .../src/verner_rk_perform_step.jl | 36 ++-- 39 files changed, 855 insertions(+), 861 deletions(-) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl index a000e9f714..d5fa5a27f1 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl @@ -6,7 +6,7 @@ function initialize!(integrator, ABM43ConstantCache, ABM54ConstantCache}) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -31,7 +31,7 @@ function initialize!(integrator, integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::AB3ConstantCache, repeat_step = false) @@ -46,7 +46,7 @@ end cache.step += 1 ttmp = t + (2 / 3) * dt ralk2 = f(uprev + (2 / 3) * dt * k1, p, ttmp) #Ralston Method - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = uprev + (dt / 4) * (k1 + 3 * ralk2) if cnt == 1 k3 = k1 @@ -61,7 +61,7 @@ end cache.k2 = k2 cache.k3 = k3 integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -80,7 +80,7 @@ end ttmp = t + (2 / 3) * dt @.. broadcast=false tmp=uprev + (2 / 3) * dt * k1 f(ralk2, tmp, p, ttmp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uprev + (dt / 4) * (k1 + 3 * ralk2) #Ralston Method if cnt == 1 cache.k3 .= k1 @@ -93,7 +93,7 @@ end cache.k2 .= k1 end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ABM32ConstantCache, repeat_step = false) @@ -108,7 +108,7 @@ end cache.step += 1 ttmp = t + (2 / 3) * dt ralk2 = f(uprev + (2 / 3) * dt * k1, p, ttmp) #Ralston Method - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = uprev + (dt / 4) * (k1 + 3 * ralk2) k2 = k1 else @@ -121,7 +121,7 @@ end cache.k2 = k2 cache.k3 = k3 integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -140,7 +140,7 @@ end ttmp = t + (2 / 3) * dt @.. broadcast=false tmp=uprev + (2 / 3) * dt * k1 f(ralk2, tmp, p, ttmp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uprev + (dt / 4) * (k1 + 3 * ralk2) #Ralston Method cache.k2 .= k1 else @@ -157,7 +157,7 @@ end cache.k2 .= k1 end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::AB4ConstantCache, repeat_step = false) @@ -175,7 +175,7 @@ end k2 = f(uprev + halfdt * k1, p, ttmp) k3 = f(uprev + halfdt * k2, p, ttmp) k4 = f(uprev + dt * k3, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) u = uprev + (dt / 6) * (2 * (k2 + k3) + (k1 + k4)) #RK4 if cnt == 1 cache.k4 = k1 @@ -191,7 +191,7 @@ end cache.k2 = k1 end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -215,7 +215,7 @@ end f(t3, tmp, p, ttmp) @.. broadcast=false tmp=uprev + dt * t3 f(t4, tmp, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) @.. broadcast=false u=uprev + (dt / 6) * (2 * (t2 + t3) + (k1 + t4)) #RK4 if cnt == 1 cache.k4 .= k1 @@ -231,7 +231,7 @@ end cache.k2 .= k1 end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ABM43ConstantCache, repeat_step = false) @@ -249,7 +249,7 @@ end k2 = f(uprev + halfdt * k1, p, ttmp) k3 = f(uprev + halfdt * k2, p, ttmp) k4 = f(uprev + dt * k3, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) u = uprev + (dt / 6) * (2 * (k2 + k3) + (k1 + k4)) #RK4 if cnt == 1 cache.k3 = k1 @@ -265,7 +265,7 @@ end cache.k2 = k1 end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -289,7 +289,7 @@ end f(t3, tmp, p, ttmp) @.. broadcast=false tmp=uprev + dt * t3 f(t4, tmp, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) @.. broadcast=false u=uprev + (dt / 6) * (2 * (t2 + t3) + (k1 + t4)) #RK4 if cnt == 1 cache.k3 .= k1 @@ -310,7 +310,7 @@ end cache.k2 .= k1 end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::AB5ConstantCache, repeat_step = false) @@ -328,7 +328,7 @@ end k2 = f(uprev + halfdt * k1, p, ttmp) k3 = f(uprev + halfdt * k2, p, ttmp) k4 = f(uprev + dt * k3, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) u = uprev + (dt / 6) * (2 * (k2 + k3) + (k1 + k4)) #RK4 if cnt == 1 cache.k5 = k1 @@ -347,7 +347,7 @@ end cache.k2 = k1 end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -371,7 +371,7 @@ end f(t3, tmp, p, ttmp) @.. broadcast=false tmp=uprev + dt * t3 f(t4, tmp, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uprev + (dt / 6) * (2 * (t2 + t3) + (k1 + t4)) #RK4 if cnt == 1 cache.k5 .= k1 @@ -392,7 +392,7 @@ end cache.k2 .= k1 end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ABM54ConstantCache, repeat_step = false) @@ -410,7 +410,7 @@ end k2 = f(uprev + halfdt * k1, p, ttmp) k3 = f(uprev + halfdt * k2, p, ttmp) k4 = f(uprev + dt * k3, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) u = uprev + (dt / 6) * (2 * (k2 + k3) + (k1 + k4)) #RK4 if cnt == 1 cache.k4 = k1 @@ -429,7 +429,7 @@ end cache.k2 = k1 end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -454,7 +454,7 @@ end @.. broadcast=false tmp=uprev + dt * t3 f(t4, tmp, p, t + dt) @.. broadcast=false u=uprev + (dt / 6) * (2 * (t2 + t3) + (k1 + t4)) #RK4 - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if cnt == 1 cache.k4 .= k1 elseif cnt == 2 @@ -480,7 +480,7 @@ end cache.k2 .= k1 end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # Variable Step Size Multistep Methods @@ -541,7 +541,7 @@ end end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -558,7 +558,7 @@ function initialize!(integrator, cache::VCAB3Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCAB3Cache, repeat_step = false) @@ -607,14 +607,14 @@ end end end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end cache.ϕstar_nm1, cache.ϕstar_n = ϕstar_n, ϕstar_nm1 end function initialize!(integrator, cache::VCAB4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -675,7 +675,7 @@ end end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -692,7 +692,7 @@ function initialize!(integrator, cache::VCAB4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCAB4Cache, repeat_step = false) @@ -747,7 +747,7 @@ end end end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end cache.ϕstar_nm1, cache.ϕstar_n = ϕstar_n, ϕstar_nm1 end @@ -756,7 +756,7 @@ end function initialize!(integrator, cache::VCAB5ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -824,7 +824,7 @@ end end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -841,7 +841,7 @@ function initialize!(integrator, cache::VCAB5Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCAB5Cache, repeat_step = false) @@ -903,7 +903,7 @@ end end end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end cache.ϕstar_nm1, cache.ϕstar_n = ϕstar_n, ϕstar_nm1 end @@ -912,7 +912,7 @@ end function initialize!(integrator, cache::VCABM3ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -953,7 +953,7 @@ end u += g[i] * ϕstar_n[i] end du_np1 = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, du_np1, k + 1) u += g[end - 1] * ϕ_np1[end - 1] if integrator.opts.adaptive @@ -971,7 +971,7 @@ end end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -988,7 +988,7 @@ function initialize!(integrator, cache::VCABM3Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCABM3Cache, repeat_step = false) @@ -1024,7 +1024,7 @@ end @.. broadcast=false u+=g[i] * ϕstar_n[i] end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, k4, k + 1) @.. broadcast=false u+=g[end - 1] * ϕ_np1[end - 1] if integrator.opts.adaptive @@ -1041,7 +1041,7 @@ end end end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end cache.ϕstar_nm1, cache.ϕstar_n = ϕstar_n, ϕstar_nm1 end @@ -1050,7 +1050,7 @@ end function initialize!(integrator, cache::VCABM4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -1097,7 +1097,7 @@ end u += g[i] * ϕstar_n[i] end du_np1 = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, du_np1, k + 1) u += g[end - 1] * ϕ_np1[end - 1] if integrator.opts.adaptive @@ -1115,7 +1115,7 @@ end end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1132,7 +1132,7 @@ function initialize!(integrator, cache::VCABM4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCABM4Cache, repeat_step = false) @@ -1174,7 +1174,7 @@ end @.. broadcast=false u+=g[i] * ϕstar_n[i] end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, k4, k + 1) @.. broadcast=false u+=g[end - 1] * ϕ_np1[end - 1] if integrator.opts.adaptive @@ -1191,7 +1191,7 @@ end end end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end cache.ϕstar_nm1, cache.ϕstar_n = ϕstar_n, ϕstar_nm1 end @@ -1200,7 +1200,7 @@ end function initialize!(integrator, cache::VCABM5ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -1254,7 +1254,7 @@ end u += g[i] * ϕstar_n[i] end du_np1 = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, du_np1, k + 1) u += g[end - 1] * ϕ_np1[end - 1] if integrator.opts.adaptive @@ -1272,7 +1272,7 @@ end end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1289,7 +1289,7 @@ function initialize!(integrator, cache::VCABM5Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCABM5Cache, repeat_step = false) @@ -1339,7 +1339,7 @@ end @.. broadcast=false u=muladd(g[3], ϕstar_n[3], u) @.. broadcast=false u=muladd(g[4], ϕstar_n[4], u) f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, k4, 6) @.. broadcast=false u=muladd(g[6 - 1], ϕ_np1[6 - 1], u) if integrator.opts.adaptive @@ -1361,7 +1361,7 @@ end cache.ϕstar_nm1[3] .= ϕstar_n[3] cache.ϕstar_nm1[4] .= ϕstar_n[4] f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end cache.ϕstar_nm1, cache.ϕstar_n = ϕstar_n, ϕstar_nm1 return nothing @@ -1372,7 +1372,7 @@ end function initialize!(integrator, cache::VCABMConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -1401,7 +1401,7 @@ end u = muladd(g[i], ϕstar_n[i], u) end du_np1 = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, du_np1, k + 1) u = muladd(g[k], ϕ_np1[k], u) if integrator.opts.adaptive @@ -1418,7 +1418,7 @@ end return nothing end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if step <= 4 || order < 3 cache.order = min(order + 1, 3) else @@ -1466,7 +1466,7 @@ function initialize!(integrator, cache::VCABMCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::VCABMCache, repeat_step = false) @@ -1489,7 +1489,7 @@ end @.. broadcast=false u=muladd(g[i], ϕstar_n[i], u) end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) ϕ_np1!(cache, k4, k + 1) @.. broadcast=false u=muladd(g[k], ϕ_np1[k], u) if integrator.opts.adaptive @@ -1505,7 +1505,7 @@ end return nothing end f(k4, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if step <= 4 || order < 3 cache.order = min(order + 1, 3) else diff --git a/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl b/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl index 82adbd82ef..a040c6076d 100644 --- a/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl +++ b/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::ABDF2ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -60,7 +60,7 @@ end nlsolvefail(nlsolver) && return integrator.fsallast = f(uₙ, p, t + dtₙ) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive tmp = integrator.fsallast - (1 + dtₙ / dtₙ₋₁) * integrator.fsalfirst + @@ -92,7 +92,7 @@ function initialize!(integrator, cache::ABDF2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ABDF2Cache, repeat_step = false) @@ -151,7 +151,7 @@ end step_limiter!(uₙ, integrator, p, t + dtₙ) f(integrator.fsallast, uₙ, p, t + dtₙ) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive btilde0 = (dtₙ₋₁ + dtₙ) * 1 // 6 btilde1 = 1 + dtₙ / dtₙ₋₁ @@ -182,7 +182,7 @@ function initialize!(integrator, cache::SBDFConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) cache.du₁ = f1(uprev, p, t) cache.du₂ = f2(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsalfirst = cache.du₁ + cache.du₂ @@ -243,7 +243,7 @@ function perform_step!(integrator, cache::SBDFConstantCache, repeat_step = false cache.k₁ = du₂) cache.du₁ = f1(u, p, t + dt) cache.du₂ = f2(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsallast = cache.du₁ + cache.du₂ integrator.k[1] = integrator.fsalfirst @@ -262,7 +262,7 @@ function initialize!(integrator, cache::SBDFCache) integrator.k[2] = integrator.fsallast f1(cache.du₁, uprev, p, t) f2(cache.du₂, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 @.. broadcast=false integrator.fsalfirst=cache.du₁ + cache.du₂ end @@ -317,7 +317,7 @@ function perform_step!(integrator, cache::SBDFCache, repeat_step = false) cache.k₁ .= du₂) f1(du₁, u, p, t + dt) f2(du₂, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 @.. broadcast=false integrator.fsallast=du₁ + du₂ end @@ -328,7 +328,7 @@ function initialize!(integrator, cache::QNDF1ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -403,7 +403,7 @@ function perform_step!(integrator, cache::QNDF1ConstantCache, repeat_step = fals cache.dtₙ₋₁ = dt cache.uprev2 = uprev integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -418,7 +418,7 @@ function initialize!(integrator, cache::QNDF1Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::QNDF1Cache, repeat_step = false) @@ -492,7 +492,7 @@ function perform_step!(integrator, cache::QNDF1Cache, repeat_step = false) cache.uprev2 .= uprev cache.dtₙ₋₁ = dt f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return end @@ -500,7 +500,7 @@ function initialize!(integrator, cache::QNDF2ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -599,7 +599,7 @@ function perform_step!(integrator, cache::QNDF2ConstantCache, repeat_step = fals cache.dtₙ₋₂ = dtₙ₋₁ cache.dtₙ₋₁ = dt integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -614,7 +614,7 @@ function initialize!(integrator, cache::QNDF2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::QNDF2Cache, repeat_step = false) @@ -712,7 +712,7 @@ function perform_step!(integrator, cache::QNDF2Cache, repeat_step = false) cache.dtₙ₋₂ = dtₙ₋₁ cache.dtₙ₋₁ = dt f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return end @@ -720,7 +720,7 @@ function initialize!(integrator, cache::QNDFConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -823,7 +823,7 @@ function perform_step!(integrator, cache::QNDFConstantCache{max_order}, cache.prevorder = k if integrator.opts.dense integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end integrator.k[1] = integrator.fsalfirst @@ -839,7 +839,7 @@ function initialize!(integrator, cache::QNDFCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::QNDFCache{max_order}, @@ -947,7 +947,7 @@ function perform_step!(integrator, cache::QNDFCache{max_order}, cache.prevorder = k if integrator.opts.dense f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end return nothing @@ -958,7 +958,7 @@ function initialize!(integrator, cache::MEBDF2ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1002,7 +1002,7 @@ end ### finalize integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1016,7 +1016,7 @@ function initialize!(integrator, cache::MEBDF2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::MEBDF2Cache, repeat_step = false) @@ -1058,14 +1058,14 @@ end ### finalize f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::FBDFConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1210,7 +1210,7 @@ function perform_step!(integrator, cache::FBDFConstantCache{max_order}, end integrator.fsallast = f(u, p, tdt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1224,7 +1224,7 @@ function initialize!(integrator, cache::FBDFCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::FBDFCache{max_order}, @@ -1337,5 +1337,5 @@ function perform_step!(integrator, cache::FBDFCache{max_order}, end f(integrator.fsallast, u, p, tdt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end diff --git a/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl b/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl index a89ddc0001..2be69e8277 100644 --- a/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl +++ b/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl @@ -200,7 +200,7 @@ end @.. broadcast=false du=(nlsolver.α * z + nlsolver.tmp) * inv(nlsolver.γ * dt) @.. broadcast=false integrator.fsallast=du - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive btilde0 = (dtₙ₋₁ + dtₙ) * 1 // 6 btilde1 = 1 + ρ @@ -227,7 +227,7 @@ function initialize!(integrator, cache::DFBDFConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.du, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst @@ -358,7 +358,7 @@ function initialize!(integrator, cache::DFBDFCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast #integrator.f(integrator.fsalfirst, integrator.du, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - #integrator.stats.nf += 1 + #OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::DFBDFCache{max_order}, diff --git a/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl b/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl index c3e1ba3b94..c43dd98c3e 100644 --- a/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl +++ b/lib/OrdinaryDiffEqCore/ext/OrdinaryDiffEqCoreEnzymeCoreExt.jl @@ -2,12 +2,10 @@ module OrdinaryDiffEqCoreEnzymeCoreExt import OrdinaryDiffEqCore, EnzymeCore Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf!), args...) = true -Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf_from_initdt!), args...) = true Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.fixed_t_for_floatingpoint_error!), args...) = true Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_accept!), args...) = true Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_reject!), args...) = true Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf_perform_step!), args...) = true -Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.increment_nf_fsal!), args...) = true Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.check_error!), args...) = true Enzyme.EnzymeCore.EnzymeRules.inactive(::typeof(OrdinaryDiffEqCore.log_step!), args...) = true diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl index f9d5d3d02a..99592d1069 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl @@ -419,11 +419,11 @@ function DiffEqBase.auto_dt_reset!(integrator::ODEIntegrator) integrator.opts.internalnorm, integrator.sol.prob, integrator) integrator.dtpropose = integrator.dt - increment_nf_from_initdt!(integrator.stats) + increment_nf!(integrator.stats, 2) end -function increment_nf_from_initdt!(stats) - stats.nf += 2 +function increment_nf!(stats, amt = 1) + stats.nf += amt end function DiffEqBase.set_t!(integrator::ODEIntegrator, t::Real) diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl index 3d3549e745..3024f40827 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_utils.jl @@ -477,7 +477,7 @@ handle_callback_modifiers!(integrator::ODEIntegrator) = nothing function reset_fsal!(integrator) # Under these conditions, these algorithms are not FSAL anymore - increment_nf_fsal!(integrator.stats) + increment_nf!(integrator.stats, 1) # Ignore DAEs but they already re-ran initialization # Mass matrix DAEs do need to reset FSAL if available @@ -497,10 +497,6 @@ function reset_fsal!(integrator) # integrator.reeval_fsal = false end -function increment_nf_fsal!(stats) - stats.nf += 1 -end - function nlsolve_f(f, alg::OrdinaryDiffEqAlgorithm) f isa SplitFunction && issplit(alg) ? f.f1 : f end diff --git a/lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl b/lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl index b5948646cf..5104b94e86 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl @@ -101,7 +101,7 @@ function derivative!(df::AbstractArray{<:Number}, f, end df .= first.(ForwardDiff.partials.(grad_config)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) elseif alg_autodiff(alg) isa AutoFiniteDiff FiniteDiff.finite_difference_gradient!(df, f, x, grad_config, dir = diffdir(integrator)) @@ -125,7 +125,7 @@ function derivative(f, x::Union{Number, AbstractArray{<:Number}}, tmp = length(x) # We calculate derivative for all elements in gradient alg = unwrap_alg(integrator, true) if alg_autodiff(alg) isa AutoForwardDiff - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.iter == 1 try d = ForwardDiff.derivative(f, x) @@ -239,13 +239,13 @@ function jacobian!(J::AbstractMatrix{<:Number}, f, x::AbstractArray{<:Number}, else forwarddiff_color_jacobian!(J, f, x, jac_config) end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) elseif alg_autodiff(alg) isa AutoFiniteDiff isforward = alg_difftype(alg) === Val{:forward} if isforward forwardcache = get_tmp_cache(integrator, alg, unwrap_cache(integrator, true))[2] f(forwardcache, x) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = jacobian_finitediff_forward!(J, f, x, jac_config, forwardcache, integrator) else # not forward difference diff --git a/lib/OrdinaryDiffEqDifferentiation/src/linsolve_utils.jl b/lib/OrdinaryDiffEqDifferentiation/src/linsolve_utils.jl index f2f77162fd..aa48161e1b 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/linsolve_utils.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/linsolve_utils.jl @@ -35,7 +35,7 @@ function dolinsolve(integrator, linsolve; A = nothing, linu = nothing, b = nothi if alg_autodiff(_alg) isa AutoForwardDiff integrator.stats.nf += linres.iters elseif alg_autodiff(_alg) isa AutoFiniteDiff - integrator.stats.nf += 2 * linres.iters + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) * linres.iters else error("$alg_autodiff not yet supported in dolinsolve function") end diff --git a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl index 08ddee112a..a2133263b5 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::ExplicitRKConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -27,7 +27,7 @@ end utilde = utilde + A[j, i] * kk[j] end kk[i] = f(uprev + dt * utilde, p, t + c[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #Calc Last @@ -37,7 +37,7 @@ end end u_beforefinal = uprev + dt * utilde_last kk[end] = f(u_beforefinal, p, t + c[end] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = kk[end] # Uses fsallast as temp even if not fsal # Accumulate Result @@ -65,7 +65,7 @@ end if !isfsal(alg.tableau) integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end integrator.k[1] = integrator.fsalfirst @@ -81,7 +81,7 @@ function initialize!(integrator, cache::ExplicitRKCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @generated function accumulate_explicit_stages!(out, A, uprev, kk, dt, ::Val{s}, @@ -235,6 +235,6 @@ end if !isfsal(alg.tableau) f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl index 74b56b5df8..12abd86a98 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl @@ -13,7 +13,7 @@ end function initialize!(integrator, cache::ExpRKConstantCache) # Pre-start fsal integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) # Initialize interpolation derivatives @@ -26,7 +26,7 @@ function initialize!(integrator, cache::ExpRKCache) # Pre-start fsal integrator.fsalfirst = zero(cache.rtmp) integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) # Initialize interpolation derivatives @@ -47,7 +47,7 @@ function perform_step!(integrator, cache::LawsonEulerConstantCache, repeat_step if isa(f, SplitFunction) integrator.stats.nf2 += 1 else - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd v = uprev + dt * nl if alg.krylov @@ -60,7 +60,7 @@ function perform_step!(integrator, cache::LawsonEulerConstantCache, repeat_step # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -76,7 +76,7 @@ function perform_step!(integrator, cache::LawsonEulerCache, repeat_step = false) if isa(f, SplitFunction) integrator.stats.nf2 += 1 else - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd @.. broadcast=false tmp=uprev + dt * G if alg.krylov @@ -90,7 +90,7 @@ function perform_step!(integrator, cache::LawsonEulerCache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -110,7 +110,7 @@ function perform_step!(integrator, cache::NorsettEulerConstantCache, repeat_step # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -136,7 +136,7 @@ function perform_step!(integrator, cache::NorsettEulerCache, repeat_step = false # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -154,7 +154,7 @@ function perform_step!(integrator, cache::ETDRK2ConstantCache, repeat_step = fal if isa(f, SplitFunction) integrator.stats.nf2 += 1 else - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end w2 = phiv(dt, A, F2, 2; m = min(alg.m, size(A, 1)), opnorm = integrator.opts.internalopnorm, iop = alg.iop) @@ -173,7 +173,7 @@ function perform_step!(integrator, cache::ETDRK2ConstantCache, repeat_step = fal # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -199,7 +199,7 @@ function perform_step!(integrator, cache::ETDRK2Cache, repeat_step = false) if isa(f, SplitFunction) integrator.stats.nf2 += 1 else - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end F2 .+= mul!(rtmp, A, uprev) arnoldi!(Ks, A, F2; m = min(alg.m, size(A, 1)), @@ -230,7 +230,7 @@ function perform_step!(integrator, cache::ETDRK2Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -257,7 +257,7 @@ function perform_step!(integrator, cache::ETDRK3ConstantCache, repeat_step = fal if isa(f, SplitFunction) integrator.stats.nf2 += 2 else - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) end # Krylov on F3 (third column) w3 = phiv(dt, A, F3, 3; kwargs...) @@ -283,7 +283,7 @@ function perform_step!(integrator, cache::ETDRK3ConstantCache, repeat_step = fal # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -319,7 +319,7 @@ function perform_step!(integrator, cache::ETDRK3Cache, repeat_step = false) if isa(f, SplitFunction) integrator.stats.nf2 += 2 else - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) end # Krylov for F3 (third column) arnoldi!(Ks, A, F3; kwargs...) @@ -353,7 +353,7 @@ function perform_step!(integrator, cache::ETDRK3Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -390,7 +390,7 @@ function perform_step!(integrator, cache::ETDRK4ConstantCache, repeat_step = fal if isa(f, SplitFunction) integrator.stats.nf2 += 3 else - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end # Krylov on F4 (fourth column) w4 = phiv(dt, A, F4, 3; kwargs...) @@ -417,7 +417,7 @@ function perform_step!(integrator, cache::ETDRK4ConstantCache, repeat_step = fal # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -467,7 +467,7 @@ function perform_step!(integrator, cache::ETDRK4Cache, repeat_step = false) if isa(f, SplitFunction) integrator.stats.nf2 += 3 else - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end # Krylov for F4 (fourth column) arnoldi!(Ks, A, F4; kwargs...) @@ -507,7 +507,7 @@ function perform_step!(integrator, cache::ETDRK4Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -554,7 +554,7 @@ function perform_step!(integrator, cache::HochOst4ConstantCache, repeat_step = f if isa(f, SplitFunction) integrator.stats.nf2 += 4 else - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) end # Krylov on F5 (fifth column) w5 = phiv(dt, A, F5, 3; kwargs...) @@ -584,7 +584,7 @@ function perform_step!(integrator, cache::HochOst4ConstantCache, repeat_step = f # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -649,7 +649,7 @@ function perform_step!(integrator, cache::HochOst4Cache, repeat_step = false) if isa(f, SplitFunction) integrator.stats.nf2 += 4 else - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) end # Krylov on F5 (fifth column) arnoldi!(Ks, A, F5; kwargs...) @@ -703,7 +703,7 @@ function perform_step!(integrator, cache::HochOst4Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -729,7 +729,7 @@ function perform_step!(integrator, cache::Exp4ConstantCache, repeat_step = false w4 = K1 * [-7 / 300, 97 / 150, -37 / 300] u4 = uprev + dt * w4 d4 = f(u4, p, t + dt) - f0 - dt * (J * w4) # TODO: what should be the time? - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Krylov for the first remainder d4 B2 = [zero(d4) d4] K2 = phiv_timestep(ts, J, B2; kwargs...) @@ -739,7 +739,7 @@ function perform_step!(integrator, cache::Exp4ConstantCache, repeat_step = false w7 = K1 * [59 / 300, -7 / 75, 269 / 300] + K2 * [2 / 3, 2 / 3, 2 / 3] u7 = uprev + dt * w7 d7 = f(u7, p, t + dt) - f0 - dt * (J * w7) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Krylov for the second remainder d7 B3 = [zero(d7) d7] k7 = phiv_timestep(ts[1], J, B3; kwargs...) @@ -749,7 +749,7 @@ function perform_step!(integrator, cache::Exp4ConstantCache, repeat_step = false # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -777,7 +777,7 @@ function perform_step!(integrator, cache::Exp4Cache, repeat_step = false) @muladd @.. broadcast=false tmp=uprev + dt * rtmp # tmp is now u4 mul!(rtmp2, J, rtmp) f(rtmp, tmp, p, t + dt) # TODO: what should be the time? - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @muladd @.. broadcast=false @view(B[:, 2])=rtmp - f0 - dt * rtmp2 # B[:,2] is now d4 # Partially update entities that use k1, k2, k3 mul!(rtmp, K, [59 / 300, -7 / 75, 269 / 300]) # rtmp is now w7 @@ -792,7 +792,7 @@ function perform_step!(integrator, cache::Exp4Cache, repeat_step = false) @muladd @.. broadcast=false tmp=uprev + dt * rtmp # tmp is now u7 mul!(rtmp2, J, rtmp) f(rtmp, tmp, p, t + dt) # TODO: what should be the time? - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @muladd @.. broadcast=false @view(B[:, 2])=rtmp - f0 - dt * rtmp2 # B[:,2] is now d7 # Partially update entities that use k4, k5, k6 mul!(rtmp, K, [1.0, -4 / 3, 1.0]) @@ -805,7 +805,7 @@ function perform_step!(integrator, cache::Exp4Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -825,7 +825,7 @@ function perform_step!(integrator, cache::EPIRK4s3AConstantCache, repeat_step = U3 = uprev + K[:, 2] R2 = f(U2, p, t + dt / 2) - f0 - J * K[:, 1] # remainder of U2 R3 = f(U3, p, t + 2dt / 3) - f0 - J * K[:, 2] # remainder of U3 - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) # Update u (horizontally) B = zeros(eltype(f0), length(f0), 5) @@ -836,7 +836,7 @@ function perform_step!(integrator, cache::EPIRK4s3AConstantCache, repeat_step = # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -870,7 +870,7 @@ function perform_step!(integrator, cache::EPIRK4s3ACache, repeat_step = false) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R3 B[:, 4] .-= (13.5 / dt^2) * rtmp B[:, 5] .+= (81 / dt^3) * rtmp - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) # Update u du = @view(K[:, 1]) @@ -879,7 +879,7 @@ function perform_step!(integrator, cache::EPIRK4s3ACache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -901,7 +901,7 @@ function perform_step!(integrator, cache::EPIRK4s3BConstantCache, repeat_step = U3 = uprev + K[:, 2] R2 = f(U2, p, t + dt / 2) - f0 - J * K[:, 1] # remainder of U2 R3 = f(U3, p, t + 3dt / 4) - f0 - J * K[:, 2] # remainder of U3 - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) # Update u (horizontally) B = zeros(eltype(f0), length(f0), 5) @@ -912,7 +912,7 @@ function perform_step!(integrator, cache::EPIRK4s3BConstantCache, repeat_step = # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -949,7 +949,7 @@ function perform_step!(integrator, cache::EPIRK4s3BCache, repeat_step = false) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R3 B[:, 4] .-= (16 / dt^2) * rtmp B[:, 5] .+= (144 / dt^3) * rtmp - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) # Update u fill!(@view(B[:, 3]), zero(eltype(B))) @@ -960,7 +960,7 @@ function perform_step!(integrator, cache::EPIRK4s3BCache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -981,7 +981,7 @@ function perform_step!(integrator, cache::EPIRK5s3ConstantCache, repeat_step = f k = phiv_timestep(48dt / 55, J, B; kwargs...) U2 = uprev + k R2 = f(U2, p, t + 48dt / 55) - f0 - J * k # remainder of U2 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Compute U3 horizontally B[:, 2] = (53 / 5) * f0 @@ -990,7 +990,7 @@ function perform_step!(integrator, cache::EPIRK5s3ConstantCache, repeat_step = f k = phiv_timestep(4dt / 9, J, B; kwargs...) U3 = uprev + k R3 = f(U3, p, t + 4dt / 9) - f0 - J * k # remainder of U3 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Update u (horizontally) B = fill(zero(eltype(f0)), length(f0), 5) @@ -1001,7 +1001,7 @@ function perform_step!(integrator, cache::EPIRK5s3ConstantCache, repeat_step = f # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1027,7 +1027,7 @@ function perform_step!(integrator, cache::EPIRK5s3Cache, repeat_step = false) @.. broadcast=false tmp=uprev + k # tmp is now U2 f(rtmp, tmp, p, t + 48dt / 55) mul!(rtmp2, J, k) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R2 # Compute U3 horizontally @@ -1044,7 +1044,7 @@ function perform_step!(integrator, cache::EPIRK5s3Cache, repeat_step = false) @.. broadcast=false tmp=uprev + k # tmp is now U3 f(rtmp, tmp, p, t + 4dt / 9) mul!(rtmp2, J, k) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R3 B[:, 4] .+= (2187 / (106 * dt^2)) .* rtmp B[:, 5] .-= (2187 / (106 * dt^3)) .* rtmp @@ -1055,7 +1055,7 @@ function perform_step!(integrator, cache::EPIRK5s3Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -1074,7 +1074,7 @@ function perform_step!(integrator, cache::EXPRB53s3ConstantCache, repeat_step = K = phiv_timestep([dt / 2, 9dt / 10], J, B; kwargs...) U2 = uprev + K[:, 1] R2 = f(U2, p, t + dt / 2) - f0 - J * K[:, 1] # remainder of U2 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) U3 = uprev + K[:, 2] # partially # Compute the second group for U3 @@ -1082,7 +1082,7 @@ function perform_step!(integrator, cache::EXPRB53s3ConstantCache, repeat_step = K = phiv_timestep([dt / 2, 9dt / 10], J, B; kwargs...) U3 .+= 216 / (25 * dt^2) .* K[:, 1] + 8 / dt^2 .* K[:, 2] R3 = f(U3, p, t + 9dt / 10) - f0 - J * (U3 - uprev) # remainder of U3 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Compute the third group for u B = fill(zero(eltype(f0)), length(f0), 5) @@ -1093,7 +1093,7 @@ function perform_step!(integrator, cache::EXPRB53s3ConstantCache, repeat_step = # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1117,7 +1117,7 @@ function perform_step!(integrator, cache::EXPRB53s3Cache, repeat_step = false) @.. broadcast=false tmp=uprev + @view(K[:, 1]) # tmp is now U2 f(rtmp, tmp, p, t + dt / 2) mul!(rtmp2, J, @view(K[:, 1])) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R2 @.. broadcast=false tmp=uprev + @view(K[:, 2]) # tmp is now U3 (partially) @@ -1132,7 +1132,7 @@ function perform_step!(integrator, cache::EXPRB53s3Cache, repeat_step = false) ## U3 and R3 @views tmp .+= 216 / (25 * dt^2) .* K[:, 1] + 8 / dt^2 .* K[:, 2] # tmp is now U3 f(rtmp, tmp, p, t + 9dt / 10) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp .-= uprev mul!(rtmp2, J, tmp) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R3 @@ -1147,7 +1147,7 @@ function perform_step!(integrator, cache::EXPRB53s3Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -1177,7 +1177,7 @@ function perform_step!(integrator, cache::EPIRK5P1ConstantCache, repeat_step = f ## U1 and R1 U1 = uprev + K1[:, 1] R1 = f(U1, p, t + g11) - f0 - J * K1[:, 1] # remainder of U1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Compute the second column (R1) B = [zero(R1) R1] @@ -1185,7 +1185,7 @@ function perform_step!(integrator, cache::EPIRK5P1ConstantCache, repeat_step = f ## U2 and R2 U2 = uprev + K1[:, 2] + a22 * k2 R2 = f(U2, p, t + g21) - f0 - J * (U2 - uprev) # remainder of U2 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Compute the third column (dR = R2 - 2R1) B = fill(zero(eltype(f0)), length(f0), 4) @@ -1196,7 +1196,7 @@ function perform_step!(integrator, cache::EPIRK5P1ConstantCache, repeat_step = f # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1230,7 +1230,7 @@ function perform_step!(integrator, cache::EPIRK5P1Cache, repeat_step = false) @.. broadcast=false tmp=uprev + @view(K[:, 1]) # tmp is now U1 f(rtmp, tmp, p, t + g11) mul!(rtmp2, J, @view(K[:, 1])) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R1 @.. broadcast=false tmp=uprev + @view(K[:, 2]) # partially update U2 (stored tmp) @.. broadcast=false u=uprev + @view(K[:, 3]) # partially update u @@ -1243,7 +1243,7 @@ function perform_step!(integrator, cache::EPIRK5P1Cache, repeat_step = false) ## U2 and R2 axpy!(a22, k, tmp) # tmp is now U2 f(rtmp, tmp, p, t + g21) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp .-= uprev mul!(rtmp2, J, tmp) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R2 @@ -1257,7 +1257,7 @@ function perform_step!(integrator, cache::EPIRK5P1Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -1289,7 +1289,7 @@ function perform_step!(integrator, cache::EPIRK5P2ConstantCache, repeat_step = f ## U1 and R1 U1 = uprev + K1[:, 1] R1 = f(U1, p, t + g11) - f0 - J * K1[:, 1] # remainder of U1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Compute the second column (R1) B = [zero(R1) zero(R1) R1] @@ -1297,7 +1297,7 @@ function perform_step!(integrator, cache::EPIRK5P2ConstantCache, repeat_step = f ## U2 and R2 U2 = uprev + K1[:, 2] + a22 * k2 R2 = f(U2, p, t + g21) - f0 - J * (U2 - uprev) # remainder of U2 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Compute the third column (dR = R2 - 2R1) dR = R2 - 2R1 @@ -1308,7 +1308,7 @@ function perform_step!(integrator, cache::EPIRK5P2ConstantCache, repeat_step = f # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1344,7 +1344,7 @@ function perform_step!(integrator, cache::EPIRK5P2Cache, repeat_step = false) @.. broadcast=false tmp=uprev + @view(K[:, 1]) # tmp is now U1 f(rtmp, tmp, p, t + g11) mul!(rtmp2, J, @view(K[:, 1])) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R1 @.. broadcast=false tmp=uprev + @view(K[:, 2]) # partially update U2 (stored in tmp) @.. broadcast=false u=uprev + @view(K[:, 3]) # partially update u @@ -1358,7 +1358,7 @@ function perform_step!(integrator, cache::EPIRK5P2Cache, repeat_step = false) ## U2 and R2 axpy!(a22, k, tmp) # tmp is now U2 f(rtmp, tmp, p, t + g21) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp .-= uprev mul!(rtmp2, J, tmp) @.. broadcast=false rtmp=rtmp - f0 - rtmp2 # rtmp is now R2 @@ -1374,7 +1374,7 @@ function perform_step!(integrator, cache::EPIRK5P2Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -1390,7 +1390,7 @@ function perform_step!(integrator, cache::Exprb32ConstantCache, repeat_step = fa opnorm = integrator.opts.internalopnorm, iop = alg.iop) U2 = uprev + dt * w1[:, 2] F2 = _compute_nl(f, U2, p, t + dt, A) + A * uprev - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) w2 = phiv(dt, A, F2, 3; m = min(alg.m, size(A, 1)), opnorm = integrator.opts.internalopnorm, iop = alg.iop) u = uprev + dt * (w1[:, 2] - 2w1[:, 4] + 2w2[:, 4]) @@ -1404,7 +1404,7 @@ function perform_step!(integrator, cache::Exprb32ConstantCache, repeat_step = fa # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1427,7 +1427,7 @@ function perform_step!(integrator, cache::Exprb32Cache, repeat_step = false) # Krylov for F2 @muladd @.. broadcast=false tmp=uprev + dt * @view(w1[:, 2]) _compute_nl!(F2, f, tmp, p, t + dt, J, rtmp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) F2 .+= mul!(rtmp, J, uprev) arnoldi!( Ks, J, F2; m = min(alg.m, size(J, 1)), opnorm = integrator.opts.internalopnorm, @@ -1448,7 +1448,7 @@ function perform_step!(integrator, cache::Exprb32Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -1467,12 +1467,12 @@ function perform_step!(integrator, cache::Exprb43ConstantCache, repeat_step = fa w1 = phiv(dt, Ks, 4) U2 = uprev + dt / 2 * w1_half[:, 2] F2 = _compute_nl(f, U2, p, t + dt / 2, A) + Au - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Krylov on F2 (second column) w2 = phiv(dt, A, F2, 4; kwargs...) U3 = uprev + dt * w2[:, 2] F3 = _compute_nl(f, U3, p, t + dt, A) + Au - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Krylov on F3 (third column) w3 = phiv(dt, A, F3, 4; kwargs...) u = uprev + @@ -1488,7 +1488,7 @@ function perform_step!(integrator, cache::Exprb43ConstantCache, repeat_step = fa # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1514,14 +1514,14 @@ function perform_step!(integrator, cache::Exprb43Cache, repeat_step = false) @muladd @.. broadcast=false @views tmp = uprev + halfdt * w1_half[:, 2] # tmp is U2 _compute_nl!(F2, f, tmp, p, t + halfdt, J, rtmp) F2 .+= Au - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Krylov for F2 arnoldi!(Ks, J, F2; kwargs...) phiv!(w2, dt, Ks, 4; cache = phiv_cache) @muladd @.. broadcast=false @views tmp = uprev + dt * w2[:, 2] # tmp is U3 _compute_nl!(F3, f, tmp, p, t + dt, J, rtmp) F3 .+= Au - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Krylov for F3 (third column) arnoldi!(Ks, J, F3; kwargs...) phiv!(w3, dt, Ks, 4; cache = phiv_cache) @@ -1539,7 +1539,7 @@ function perform_step!(integrator, cache::Exprb43Cache, repeat_step = false) # Update integrator state f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -1552,7 +1552,7 @@ function initialize!(integrator, cache::ETD2ConstantCache) # Pre-start fsal lin = integrator.f.f1(integrator.uprev, integrator.p, integrator.t) nl = integrator.f.f2(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 nlprev = zero(nl) # to be computed in the first iteration via ETD1 integrator.fsalfirst = ETD2Fsal(lin, nl, nlprev) @@ -1581,7 +1581,7 @@ function perform_step!(integrator, cache::ETD2ConstantCache, repeat_step = false nlprev = nl lin = f.f1(u, p, t + dt) nl = f.f2(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.k[2] = lin + nl integrator.fsallast.lin = lin @@ -1599,7 +1599,7 @@ function initialize!(integrator, cache::ETD2Cache) @unpack lin, nl = integrator.fsalfirst integrator.f.f1(lin, integrator.uprev, integrator.p, integrator.t) integrator.f.f2(nl, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # Avoid undefined entries if k is an array of arrays @@ -1630,7 +1630,7 @@ function perform_step!(integrator, cache::ETD2Cache, repeat_step = false) fsallast.nlprev .= nl f.f1(fsallast.lin, u, p, t + dt) f.f2(fsallast.nl, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 @.. broadcast=false integrator.k[2]=fsallast.lin + fsallast.nl end diff --git a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl index 48fec8c66d..8e4f3554a6 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl @@ -7,7 +7,7 @@ function initialize!(integrator, cache::AitkenNevilleCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) cache.step_no = 1 alg = unwrap_alg(integrator, false) @@ -28,11 +28,11 @@ function perform_step!(integrator, cache::AitkenNevilleCache, repeat_step = fals # Solve using Euler method @muladd @.. broadcast=false u=uprev + dt_temp * fsalfirst f(k, u, p, t + dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) for j in 2:(2^(i - 1)) @muladd @.. broadcast=false u=u + dt_temp * k f(k, u, p, t + j * dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @.. broadcast=false T[i, 1]=u end @@ -65,7 +65,7 @@ function perform_step!(integrator, cache::AitkenNevilleCache, repeat_step = fals end end end - integrator.stats.nf += 2^max_order - 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2)^max_order - 1 end # Richardson extrapolation @@ -121,14 +121,14 @@ function perform_step!(integrator, cache::AitkenNevilleCache, repeat_step = fals @.. broadcast=false u=T[cache.cur_order, cache.cur_order] cache.step_no = cache.step_no + 1 f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::AitkenNevilleConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -153,12 +153,12 @@ function perform_step!(integrator, cache::AitkenNevilleConstantCache, repeat_ste # Solve using Euler method with dt_temp = dt/n_{i} @muladd u = @.. broadcast=false uprev+dt_temp * integrator.fsalfirst k = f(u, p, t + dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) for j in 2:(2^(i - 1)) @muladd u = @.. broadcast=false u+dt_temp * k k = f(u, p, t + j * dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end T[i, 1] = u end @@ -185,7 +185,7 @@ function perform_step!(integrator, cache::AitkenNevilleConstantCache, repeat_ste end end - integrator.stats.nf += 2^max_order - 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2)^max_order - 1 end # Richardson extrapolation @@ -243,7 +243,7 @@ function perform_step!(integrator, cache::AitkenNevilleConstantCache, repeat_ste integrator.u = T[cache.cur_order, cache.cur_order] k = f(integrator.u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -258,7 +258,7 @@ function initialize!(integrator, cache::ImplicitEulerExtrapolationCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) cache.step_no = 1 #alg = unwrap_alg(integrator, true) @@ -332,7 +332,7 @@ function perform_step!(integrator, cache::ImplicitEulerExtrapolationCache, @.. broadcast=false diff1[1]=u_tmps[1] - u_tmps2[1] f(k_tmps[1], u_tmps[1], p, t + j * dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @.. broadcast=false T[index, 1]=u_tmps[1] @@ -478,7 +478,7 @@ function perform_step!(integrator, cache::ImplicitEulerExtrapolationCache, @.. broadcast=false k_tmps[1]=-k_tmps[1] @.. broadcast=false u_tmps[1]=u_tmps[1] + k_tmps[1] f(k_tmps[1], u_tmps[1], p, t + j * dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @.. broadcast=false T[n_curr + 1, 1]=u_tmps[1] @@ -511,7 +511,7 @@ function perform_step!(integrator, cache::ImplicitEulerExtrapolationCache, cache.step_no = cache.step_no + 1 f(integrator.fsallast, integrator.u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ImplicitEulerExtrapolationConstantCache) @@ -574,7 +574,7 @@ function perform_step!(integrator, cache::ImplicitEulerExtrapolationConstantCach end diff1 = u_tmp - u_tmp2 k_copy = f(u_tmp, p, t + j * dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end T[index, 1] = u_tmp @@ -681,7 +681,7 @@ function perform_step!(integrator, cache::ImplicitEulerExtrapolationConstantCach integrator.stats.nsolve += 1 u_tmp = u_tmp + k k_copy = f(u_tmp, p, t + j * dt_temp) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end T[n_curr + 1, 1] = u_tmp @@ -714,7 +714,7 @@ function perform_step!(integrator, cache::ImplicitEulerExtrapolationConstantCach # Use extrapolated value of u integrator.u = T[n_curr + 1, n_curr + 1] k_temp = f(integrator.u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k_temp integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -771,7 +771,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointDeuflhardCache, @.. broadcast=false u_temp1=u_temp2 + dt_int * fsalfirst # Euler starting step for j in 2:j_int f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false T[i + 1]=u_temp2 + 2 * dt_int * k # Explicit Midpoint rule @.. broadcast=false u_temp2=u_temp1 @.. broadcast=false u_temp1=T[i + 1] @@ -891,7 +891,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointDeuflhardCache, @.. broadcast=false u_temp1=u_temp2 + dt_int * fsalfirst # Euler starting step for j in 2:j_int f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false T[n_curr + 1]=u_temp2 + 2 * dt_int * k @.. broadcast=false u_temp2=u_temp1 @.. broadcast=false u_temp1=T[n_curr + 1] @@ -935,7 +935,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointDeuflhardCache, end f(cache.k, integrator.u, p, t + dt) # Update FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ExtrapolationMidpointDeuflhardConstantCache) @@ -992,7 +992,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointDeuflhardConstant u_temp1 = u_temp2 + dt_int * integrator.fsalfirst # Euler starting step for j in 2:j_int T[i + 1] = u_temp2 + 2 * dt_int * f(u_temp1, p, t + (j - 1) * dt_int) # Explicit Midpoint rule - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp2 = u_temp1 u_temp1 = T[i + 1] end @@ -1094,7 +1094,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointDeuflhardConstant for j in 2:j_int T[n_curr + 1] = u_temp2 + 2 * dt_int * f(u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp2 = u_temp1 u_temp1 = T[n_curr + 1] end @@ -1203,7 +1203,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationCache, @.. broadcast=false diff1[1]=u_temp1 - u_temp2 for j in 2:j_int f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false linsolve_tmps[1]=dt_int * k - (u_temp1 - u_temp2) linsolve = cache.linsolve[1] @@ -1481,7 +1481,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationCache, @.. broadcast=false u_temp1=u_temp2 + k # Euler starting step for j in 2:j_int f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false linsolve_tmps[1]=dt_int * k - (u_temp1 - u_temp2) linsolve = cache.linsolve[1] @@ -1534,7 +1534,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationCache, end f(cache.k, integrator.u, p, t + dt) # Update FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ImplicitDeuflhardExtrapolationConstantCache) @@ -1599,7 +1599,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationConstant -_vec(dt_int * f(u_temp1, p, t + (j - 1) * dt_int) - (u_temp1 - u_temp2)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp2 = u_temp1 u_temp1 = T[i + 1] if (i <= 1) @@ -1647,7 +1647,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationConstant t + (j - 1) * dt_int) - (u_temp3 - u_temp4)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp4 = u_temp3 u_temp3 = T[index + 1] if (index <= 1) @@ -1693,7 +1693,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationConstant t + (j - 1) * dt_int) - (u_temp3 - u_temp4)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp4 = u_temp3 u_temp3 = T[index + 1] if (index <= 1) @@ -1765,7 +1765,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationConstant f(u_temp1, p, t + (j - 1) * dt_int) - (u_temp1 - u_temp2)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp2 = u_temp1 u_temp1 = T[n_curr + 1] end @@ -1801,7 +1801,7 @@ function perform_step!(integrator, cache::ImplicitDeuflhardExtrapolationConstant integrator.fsallast = f(u, p, t + dt) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ExtrapolationMidpointHairerWannerCache) @@ -1857,7 +1857,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointHairerWannerCache @.. broadcast=false u_temp1=u_temp2 + dt_int * fsalfirst # Euler starting step for j in 2:j_int f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false T[i + 1]=u_temp2 + 2 * dt_int * k # Explicit Midpoint rule @.. broadcast=false u_temp2=u_temp1 @.. broadcast=false u_temp1=T[i + 1] @@ -1979,7 +1979,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointHairerWannerCache @.. broadcast=false u_temp1=u_temp2 + dt_int * fsalfirst # Euler starting step for j in 2:j_int f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false T[n_curr + 1]=u_temp2 + 2 * dt_int * k @.. broadcast=false u_temp2=u_temp1 @.. broadcast=false u_temp1=T[n_curr + 1] @@ -2023,7 +2023,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointHairerWannerCache end f(cache.k, integrator.u, p, t + dt) # Update FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ExtrapolationMidpointHairerWannerConstantCache) @@ -2082,7 +2082,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointHairerWannerConst u_temp1 = u_temp2 + dt_int * integrator.fsalfirst # Euler starting step for j in 2:j_int T[i + 1] = u_temp2 + 2 * dt_int * f(u_temp1, p, t + (j - 1) * dt_int) # Explicit Midpoint rule - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp2 = u_temp1 u_temp1 = T[i + 1] end @@ -2183,7 +2183,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointHairerWannerConst for j in 2:j_int T[n_curr + 1] = u_temp2 + 2 * dt_int * f(u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u_temp2 = u_temp1 u_temp1 = T[n_curr + 1] end @@ -2219,7 +2219,7 @@ function perform_step!(integrator, cache::ExtrapolationMidpointHairerWannerConst integrator.fsallast = f(u, p, t + dt) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ImplicitHairerWannerExtrapolationConstantCache) @@ -2287,7 +2287,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationConst -_vec(dt_int * f(u_temp1, p, t + (j - 1) * dt_int) - (u_temp1 - u_temp2)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[i + 1] = 0.5(T[i + 1] + u_temp2) end @@ -2339,7 +2339,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationConst t + (j - 1) * dt_int) - (u_temp3 - u_temp4)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[index + 1] = 0.5(T[index + 1] + u_temp4) end @@ -2387,7 +2387,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationConst t + (j - 1) * dt_int) - (u_temp3 - u_temp4)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[index + 1] = 0.5(T[index + 1] + u_temp4) end @@ -2464,7 +2464,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationConst f(u_temp1, p, t + (j - 1) * dt_int) - (u_temp1 - u_temp2)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[n_curr + 1] = 0.5(T[n_curr + 1] + u_temp2) end @@ -2577,7 +2577,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationCache @.. broadcast=false diff1[1]=u_temp1 - u_temp2 for j in 2:(j_int + 1) f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false linsolve_tmps[1]=dt_int * k - (u_temp1 - u_temp2) linsolve = cache.linsolve[1] @@ -2862,7 +2862,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationCache @.. broadcast=false u_temp1=u_temp2 + k # Euler starting step for j in 2:(j_int + 1) f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false linsolve_tmps[1]=dt_int * k - (u_temp1 - u_temp2) linsolve = cache.linsolve[1] @@ -2924,7 +2924,7 @@ function perform_step!(integrator, cache::ImplicitHairerWannerExtrapolationCache end f(cache.k, integrator.u, p, t + dt) # Update FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::ImplicitEulerBarycentricExtrapolationConstantCache) @@ -2992,7 +2992,7 @@ function perform_step!(integrator, _reshape( W \ -_vec(dt_int * f(u_temp1, p, t + (j - 1) * dt_int)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[i + 1] = 0.25(T[i + 1] + 2 * u_temp1 + u_temp2) end @@ -3042,7 +3042,7 @@ function perform_step!(integrator, -_vec(dt_int * f(u_temp3, p, t + (j - 1) * dt_int)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[index + 1] = 0.25(T[index + 1] + 2 * u_temp3 + u_temp4) end @@ -3088,7 +3088,7 @@ function perform_step!(integrator, -_vec(dt_int * f(u_temp3, p, t + (j - 1) * dt_int)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[index + 1] = 0.25(T[index + 1] + 2 * u_temp3 + u_temp4) end @@ -3163,7 +3163,7 @@ function perform_step!(integrator, -_vec(dt_int * f(u_temp1, p, t + (j - 1) * dt_int)), axes(uprev)) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if (j == j_int + 1) T[n_curr + 1] = 0.25(T[n_curr + 1] + 2 * u_temp1 + u_temp2) end @@ -3278,7 +3278,7 @@ function perform_step!(integrator, cache::ImplicitEulerBarycentricExtrapolationC @.. broadcast=false diff1[1]=u_temp1 - u_temp2 for j in 2:(j_int + 1) f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false linsolve_tmps[1]=dt_int * k linsolve = cache.linsolve[1] @@ -3578,7 +3578,7 @@ function perform_step!(integrator, cache::ImplicitEulerBarycentricExtrapolationC @.. broadcast=false u_temp1=u_temp2 + k # Euler starting step for j in 2:(j_int + 1) f(k, cache.u_temp1, p, t + (j - 1) * dt_int) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false linsolve_tmps[1]=dt_int * k linsolve = cache.linsolve[1] @@ -3635,5 +3635,5 @@ function perform_step!(integrator, cache::ImplicitEulerBarycentricExtrapolationC end f(cache.k, integrator.u, p, t + dt) # Update FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end diff --git a/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl b/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl index b60e9b0e38..4c55660956 100644 --- a/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl +++ b/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl @@ -42,7 +42,7 @@ function initialize!(integrator, cache::RadauIIA5ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -55,7 +55,7 @@ function initialize!(integrator, cache::RadauIIA9ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -72,7 +72,7 @@ function initialize!(integrator, cache::RadauIIA3Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) nothing end @@ -84,7 +84,7 @@ function initialize!(integrator, cache::RadauIIA5Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @unpack abstol, reltol = integrator.opts if reltol isa Number @@ -106,7 +106,7 @@ function initialize!(integrator, cache::RadauIIA9Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @unpack abstol, reltol = integrator.opts if reltol isa Number @@ -160,7 +160,7 @@ end # evaluate function ff1 = f(uprev + z1, p, t + c1 * dt) ff2 = f(uprev + z2, p, t + c2 * dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) fw1 = @. TI11 * ff1 + TI12 * ff2 fw2 = @. TI21 * ff1 + TI22 * ff2 @@ -280,7 +280,7 @@ end f(fsallast, tmp, p, t + c1 * dt) @. tmp = uprev + z2 f(k2, tmp, p, t + c2 * dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) @. fw1 = TI11 * fsallast + TI12 * k2 @. fw2 = TI21 * fsallast + TI22 * k2 @@ -371,7 +371,7 @@ end integrator.EEst = internalnorm(atmp, t) end f(fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return end @@ -437,7 +437,7 @@ end ff1 = f(uprev + z1, p, t + c1 * dt) ff2 = f(uprev + z2, p, t + c2 * dt) ff3 = f(uprev + z3, p, t + dt) # c3 = 1 - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) fw1 = @.. broadcast=false TI11*ff1+TI12*ff2+TI13*ff3 fw2 = @.. broadcast=false TI21*ff1+TI22*ff2+TI23*ff3 @@ -522,7 +522,7 @@ end if !(integrator.EEst < oneunit(integrator.EEst)) && integrator.iter == 1 || integrator.u_modified f0 = f(uprev .+ utilde, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) utilde = @.. broadcast=false f0+tmp alg.smooth_est && (utilde = LU1 \ utilde; integrator.stats.nsolve += 1) atmp = calculate_residuals(utilde, uprev, u, atol, rtol, internalnorm, t) @@ -541,7 +541,7 @@ end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -619,7 +619,7 @@ end f(k2, tmp, p, t + c2 * dt) @.. broadcast=false tmp=uprev + z3 f(k3, tmp, p, t + dt) # c3 = 1 - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) @.. broadcast=false fw1=TI11 * fsallast + TI12 * k2 + TI13 * k3 @.. broadcast=false fw2=TI21 * fsallast + TI22 * k2 + TI23 * k3 @@ -755,7 +755,7 @@ end integrator.u_modified @.. broadcast=false utilde=uprev + utilde f(fsallast, utilde, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false ubuff=fsallast + tmp if alg.smooth_est @@ -780,7 +780,7 @@ end end end f(fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return end @@ -878,7 +878,7 @@ end ff3 = f(uprev + z3, p, t + c3 * dt) ff4 = f(uprev + z4, p, t + c4 * dt) ff5 = f(uprev + z5, p, t + dt) # c5 = 1 - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) fw1 = @.. broadcast=false TI11*ff1+TI12*ff2+TI13*ff3+TI14*ff4+TI15*ff5 fw2 = @.. broadcast=false TI21*ff1+TI22*ff2+TI23*ff3+TI24*ff4+TI25*ff5 @@ -982,7 +982,7 @@ end if !(integrator.EEst < oneunit(integrator.EEst)) && integrator.iter == 1 || integrator.u_modified f0 = f(uprev .+ utilde, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) utilde = @.. broadcast=false f0+tmp alg.smooth_est && (utilde = LU1 \ utilde; integrator.stats.nsolve += 1) atmp = calculate_residuals(utilde, uprev, u, atol, rtol, internalnorm, t) @@ -1007,7 +1007,7 @@ end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1120,7 +1120,7 @@ end f(k4, tmp, p, t + c4 * dt) @.. broadcast=false tmp=uprev + z5 f(k5, tmp, p, t + dt) # c5 = 1 - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) @.. broadcast=false fw1=TI11 * fsallast + TI12 * k2 + TI13 * k3 + TI14 * k4 + TI15 * k5 @@ -1304,7 +1304,7 @@ end integrator.u_modified @.. broadcast=false utilde=uprev + utilde f(fsallast, utilde, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false ubuff=fsallast + tmp if alg.smooth_est @@ -1336,6 +1336,6 @@ end end f(fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return end diff --git a/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl b/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl index 73dd68e2cf..01f352fd39 100644 --- a/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::Feagin10ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -66,7 +66,7 @@ end a1612 * k13 + a1613 * k14 + a1614 * k15 + a1615 * k16), p, t + c16 * dt) - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) u = uprev + dt * (b1 * k1 + b2 * k2 + b3 * k3 + b5 * k5 + b7 * k7 + b9 * k9 + b10 * k10 + b11 * k11 + @@ -78,7 +78,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end k = f(u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -93,7 +93,7 @@ function initialize!(integrator, cache::Feagin10Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #= @@ -256,7 +256,7 @@ end b13 * k13[i] + b14 * k14[i] + b15 * k15[i] + b16 * k16[i] + b17 * k17[i]) end - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) step_limiter!(u, integrator, p, t + dt) @@ -269,12 +269,12 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(integrator.fsallast, u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::Feagin12ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -396,7 +396,7 @@ end (a2421 * k22 + a2422 * k23 + a2423 * k24)), p, t + c24 * dt) - integrator.stats.nf += 24 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 24) u = uprev + dt * ((b1 * k1 + b2 * k2 + b3 * k3 + b5 * k5) + (b7 * k7 + b8 * k8 + b10 * k10 + b11 * k11) + @@ -404,7 +404,7 @@ end (b17 * k17 + b18 * k18 + b19 * k19 + b20 * k20) + (b21 * k21 + b22 * k22 + b23 * k23) + (b24 * k24 + b25 * k25)) k = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k if integrator.opts.adaptive utilde = @.. broadcast=false dt*(k2-k24)*adaptiveConst @@ -425,7 +425,7 @@ function initialize!(integrator, cache::Feagin12Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #= @@ -672,7 +672,7 @@ end (b21 * k21[i] + b22 * k22[i] + b23 * k23[i]) + (b24 * k24[i] + b25 * k25[i])) end - integrator.stats.nf += 24 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 24) step_limiter!(u, integrator, p, t + dt) @@ -685,12 +685,12 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::Feagin14ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -886,7 +886,7 @@ end a3429 * k30 + a3430 * k31 + a3431 * k32 + a3432 * k33 + a3433 * k34), p, t + c34 * dt) - integrator.stats.nf += 34 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 34) u = uprev + dt * (b1 * k1 + b2 * k2 + b3 * k3 + b5 * k5 + b7 * k7 + b8 * k8 + b10 * k10 + b11 * k11 + @@ -901,7 +901,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end k = f(u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -916,7 +916,7 @@ function initialize!(integrator, cache::Feagin14Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #= @@ -1280,7 +1280,7 @@ end b31 * k31[i] + b32 * k32[i] + b33 * k33[i] + b34 * k34[i] + b35 * k35[i]) end - integrator.stats.nf += 35 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 35) step_limiter!(u, integrator, p, t + dt) @@ -1293,5 +1293,5 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(integrator.fsallast, u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end diff --git a/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl b/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl index 3da3118eab..d1734e99f1 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/fixed_timestep_perform_step.jl @@ -16,7 +16,7 @@ function perform_step!(integrator, cache::FunctionMapCache, repeat_step = false) else f(u, uprev, p, t + dt) end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end @@ -28,11 +28,11 @@ function perform_step!(integrator, cache::FunctionMapConstantCache, repeat_step integrator.f.f === DiffEqBase.DISCRETE_OUTOFPLACE_DEFAULT) if FunctionMap_scale_by_time(alg) tmp = f(uprev, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @muladd integrator.u = @.. broadcast=false uprev+dt * tmp else integrator.u = f(uprev, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end end diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl index fe66e071f1..8027c7a1eb 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::TanYam7ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -36,7 +36,7 @@ end a108 * k8), p, t + dt) - integrator.stats.nf += 9 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 9) u = uprev + dt * (b1 * k1 + b4 * k4 + b5 * k5 + b6 * k6 + b7 * k7 + b8 * k8 + b9 * k9) if integrator.opts.adaptive utilde = dt * @@ -47,7 +47,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end integrator.fsallast = f(u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -61,7 +61,7 @@ function initialize!(integrator, cache::TanYam7Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::TanYam7Cache, repeat_step = false) @@ -118,7 +118,7 @@ end b9 * k9) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (btilde1 * k1 + btilde4 * k4 + btilde5 * k5 + @@ -131,7 +131,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return nothing end @@ -183,7 +183,7 @@ end @tight_loop_macros for i in uidx @inbounds u[i] = uprev[i] + dt*(b1*k1[i]+b4*k4[i]+b5*k5[i]+b6*k6[i]+b7*k7[i]+b8*k8[i]+b9*k9[i]) end - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) if integrator.opts.adaptive @tight_loop_macros for i in uidx @inbounds utilde[i] = dt*(btilde1*k1[i]+btilde4*k4[i]+btilde5*k5[i]+btilde6*k6[i]+btilde7*k7[i]+btilde8*k8[i]+btilde9*k9[i]+btilde10*k10[i]) @@ -192,13 +192,13 @@ end integrator.EEst = integrator.opts.internalnorm(atmp,t) end f(k, u, p, t+dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end =# function initialize!(integrator, cache::TsitPap8ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -288,7 +288,7 @@ end a1309 * k9 + a1310 * k10), p, t + dt) - integrator.stats.nf += 12 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 12) u = uprev + dt * (b1 * k1 + b6 * k6 + b7 * k7 + b8 * k8 + b9 * k9 + b10 * k10 + b11 * k11 + b12 * k12) @@ -301,7 +301,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -315,7 +315,7 @@ function initialize!(integrator, cache::TsitPap8Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::TsitPap8Cache, repeat_step = false) @@ -394,7 +394,7 @@ end b11 * k11 + b12 * k12) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 13 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 13) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (btilde1 * k1 + btilde6 * k6 + btilde7 * k7 + @@ -408,7 +408,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return nothing end @@ -472,7 +472,7 @@ end @tight_loop_macros for i in uidx @inbounds u[i] = uprev[i] + dt*(b1*k1[i]+b6*k6[i]+b7*k7[i]+b8*k8[i]+b9*k9[i]+b10*k10[i]+b11*k11[i]+b12*k12[i]) end - integrator.stats.nf += 13 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 13) if integrator.opts.adaptive @tight_loop_macros for i in uidx @inbounds utilde[i] = dt*(btilde1*k1[i] + btilde6*k6[i] + btilde7*k7[i] + btilde8*k8[i] + btilde9*k9[i] + btilde10*k10[i] + btilde11*k11[i] + btilde12*k12[i] + btilde13*k13[i]) @@ -481,7 +481,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp,t) end f(k, u, p, t+dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end =# @@ -489,7 +489,7 @@ function initialize!(integrator, cache::DP8ConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -539,7 +539,7 @@ end a1209 * k9 + a1210 * k10 + a1211 * k11), p, t + dt) - integrator.stats.nf += 11 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 11) kupdate = b1 * k1 + b6 * k6 + b7 * k7 + b8 * k8 + b9 * k9 + b10 * k10 + b11 * k11 + b12 * k12 u = uprev + dt * kupdate @@ -563,7 +563,7 @@ end end end k13 = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k13 if integrator.opts.calck @unpack c14, c15, c16, a1401, a1407, a1408, a1409, a1410, a1411, a1412, a1413, a1501, a1506, a1507, a1508, a1511, a1512, a1513, a1514, a1601, a1606, a1607, a1608, a1609, a1613, a1614, a1615 = cache @@ -586,7 +586,7 @@ end a1613 * k13 + a1614 * k14 + a1615 * k15), p, t + c16 * dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) udiff = kupdate integrator.k[1] = udiff bspl = k1 - udiff @@ -623,7 +623,7 @@ function initialize!(integrator, cache::DP8Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k13 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::DP8Cache, repeat_step = false) @@ -694,7 +694,7 @@ end @.. broadcast=false thread=thread u=uprev + dt * kupdate stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 12 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 12) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (k1 * er1 + k6 * er6 + k7 * er7 + @@ -721,7 +721,7 @@ end end end f(k13, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.calck @unpack c14, c15, c16, a1401, a1407, a1408, a1409, a1410, a1411, a1412, a1413, a1501, a1506, a1507, a1508, a1511, a1512, a1513, a1514, a1601, a1606, a1607, a1608, a1609, a1613, a1614, a1615 = cache.tab @unpack d401, d406, d407, d408, d409, d410, d411, d412, d413, d414, d415, d416, d501, d506, d507, d508, d509, d510, d511, d512, d513, d514, d515, d516, d601, d606, d607, d608, d609, d610, d611, d612, d613, d614, d615, d616, d701, d706, d707, d708, d709, d710, d711, d712, d713, d714, d715, d716 = cache.tab @@ -743,7 +743,7 @@ end a1609 * k9 + a1613 * k13 + a1614 * k14 + a1615 * k15) f(k16, tmp, p, t + c16 * dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) @.. broadcast=false thread=thread udiff=kupdate @.. broadcast=false thread=thread bspl=k1 - udiff @.. broadcast=false thread=thread integrator.k[3]=udiff - k13 - bspl @@ -834,7 +834,7 @@ end @inbounds kupdate[i] = b1*k1[i]+b6*k6[i]+b7*k7[i]+b8*k8[i]+b9*k9[i]+b10*k10[i]+b11*k11[i]+b12*k12[i] @inbounds u[i] = uprev[i] + dt*kupdate[i] end - integrator.stats.nf += 12 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 12) if integrator.opts.adaptive @tight_loop_macros for i in uidx @inbounds utilde[i] = dt*(k1[i]*er1 + k6[i]*er6 + k7[i]*er7 + k8[i]*er8 + k9[i]*er9 + k10[i]*er10 + k11[i]*er11 + k12[i]*er12) @@ -854,7 +854,7 @@ end end end f(k13, u, p, t+dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.calck @unpack c14,c15,c16,a1401,a1407,a1408,a1409,a1410,a1411,a1412,a1413,a1501,a1506,a1507,a1508,a1511,a1512,a1513,a1514,a1601,a1606,a1607,a1608,a1609,a1613,a1614,a1615 = cache.tab @unpack d401,d406,d407,d408,d409,d410,d411,d412,d413,d414,d415,d416,d501,d506,d507,d508,d509,d510,d511,d512,d513,d514,d515,d516,d601,d606,d607,d608,d609,d610,d611,d612,d613,d614,d615,d616,d701,d706,d707,d708,d709,d710,d711,d712,d713,d714,d715,d716 = cache.tab @@ -870,7 +870,7 @@ end @inbounds tmp[i] = uprev[i]+dt*(a1601*k1[i]+a1606*k6[i]+a1607*k7[i]+a1608*k8[i]+a1609*k9[i]+a1613*k13[i]+a1614*k14[i]+a1615*k15[i]) end f(k16, tmp, p, t + c16*dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) @tight_loop_macros for i in uidx @inbounds udiff[i]= kupdate[i] @inbounds bspl[i] = k1[i] - udiff[i] @@ -886,7 +886,7 @@ end function initialize!(integrator, cache::PFRK87ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -986,7 +986,7 @@ end α1309 * k9 + α1310 * k10 + α1311 * k11), p, t + c13 * dt) - integrator.stats.nf += 12 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 12) u = uprev + dt * (β1 * k1 + β6 * k6 + β7 * k7 + β8 * k8 + β9 * k9 + β10 * k10 + β11 * k11 + β12 * k12 + β13 * k13) @@ -999,7 +999,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -1013,7 +1013,7 @@ function initialize!(integrator, cache::PFRK87Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::PFRK87Cache, repeat_step = false) @@ -1135,7 +1135,7 @@ end β11 * k11 + β12 * k12 + β13 * k13) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 13 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 13) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (β1tilde * k1 + β6tilde * k6 + β7tilde * k7 + @@ -1148,6 +1148,6 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return nothing end diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl index 0e71c5be16..eb3e820509 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl @@ -5,7 +5,7 @@ function initialize!(integrator, cache::CNAB2ConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f.f1(integrator.uprev, integrator.p, integrator.t) + integrator.f.f2(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # Avoid undefined entries if k is an array of arrays @@ -21,7 +21,7 @@ function perform_step!(integrator, cache::CNAB2ConstantCache, repeat_step = fals f1 = integrator.f.f1 f2 = integrator.f.f2 du₁ = f1(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) k1 = integrator.fsalfirst - du₁ # Explicit part if cnt == 1 @@ -47,7 +47,7 @@ function perform_step!(integrator, cache::CNAB2ConstantCache, repeat_step = fals cache.k2 = k1 integrator.fsallast = f1(u, p, t + dt) + f2(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -62,7 +62,7 @@ function initialize!(integrator, cache::CNAB2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::CNAB2Cache, repeat_step = false) @@ -73,7 +73,7 @@ function perform_step!(integrator, cache::CNAB2Cache, repeat_step = false) cnt = integrator.iter f1(du₁, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false k1=integrator.fsalfirst - du₁ # Explicit part if cnt == 1 @@ -96,7 +96,7 @@ function perform_step!(integrator, cache::CNAB2Cache, repeat_step = false) cache.k2 .= k1 f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # CNLF2 @@ -106,7 +106,7 @@ function initialize!(integrator, cache::CNLF2ConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f.f1(integrator.uprev, integrator.p, integrator.t) + integrator.f.f2(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # Avoid undefined entries if k is an array of arrays @@ -122,7 +122,7 @@ function perform_step!(integrator, cache::CNLF2ConstantCache, repeat_step = fals f1 = integrator.f.f1 f2 = integrator.f.f2 du₁ = f1(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Explicit part if cnt == 1 tmp = uprev + dt * (integrator.fsalfirst - du₁) @@ -150,7 +150,7 @@ function perform_step!(integrator, cache::CNLF2ConstantCache, repeat_step = fals cache.uprev2 = uprev cache.k2 = du₁ integrator.fsallast = f1(u, p, t + dt) + f2(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -165,7 +165,7 @@ function initialize!(integrator, cache::CNLF2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::CNLF2Cache, repeat_step = false) @@ -176,7 +176,7 @@ function perform_step!(integrator, cache::CNLF2Cache, repeat_step = false) cnt = integrator.iter f1(du₁, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Explicit part if cnt == 1 @.. broadcast=false tmp=uprev + dt * (integrator.fsalfirst - du₁) @@ -201,5 +201,5 @@ function perform_step!(integrator, cache::CNLF2Cache, repeat_step = false) cache.uprev2 .= uprev cache.k2 .= du₁ f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end diff --git a/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl b/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl index fed2fa658f..98fa7e400e 100644 --- a/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl +++ b/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl @@ -6,7 +6,7 @@ function initialize!(integrator, cache::MagnusMidpointCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusMidpointCache, repeat_step = false) @@ -28,7 +28,7 @@ function perform_step!(integrator, cache::MagnusMidpointCache, repeat_step = fal end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::LieRK4Cache) integrator.kshortsize = 2 @@ -38,7 +38,7 @@ function initialize!(integrator, cache::LieRK4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::LieRK4Cache, repeat_step = false) @@ -80,7 +80,7 @@ function perform_step!(integrator, cache::LieRK4Cache, repeat_step = false) end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::RKMK4Cache) @@ -91,7 +91,7 @@ function initialize!(integrator, cache::RKMK4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::RKMK4Cache, repeat_step = false) @@ -124,7 +124,7 @@ function perform_step!(integrator, cache::RKMK4Cache, repeat_step = false) end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::RKMK2Cache) @@ -135,7 +135,7 @@ function initialize!(integrator, cache::RKMK2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::RKMK2Cache, repeat_step = false) @@ -158,7 +158,7 @@ function perform_step!(integrator, cache::RKMK2Cache, repeat_step = false) end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::CG3Cache) @@ -169,7 +169,7 @@ function initialize!(integrator, cache::CG3Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::CG3Cache, repeat_step = false) @@ -194,7 +194,7 @@ function perform_step!(integrator, cache::CG3Cache, repeat_step = false) uprev integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::CG2Cache) @@ -205,7 +205,7 @@ function initialize!(integrator, cache::CG2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::CG2Cache, repeat_step = false) @@ -223,7 +223,7 @@ function perform_step!(integrator, cache::CG2Cache, repeat_step = false) (exponential!((1 / 2) * k2, exp_method, exp_cache))) * uprev integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::CG4aCache) @@ -234,7 +234,7 @@ function initialize!(integrator, cache::CG4aCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::CG4aCache, repeat_step = false) @@ -271,7 +271,7 @@ function perform_step!(integrator, cache::CG4aCache, repeat_step = false) exponential!(dt * (0.1370831520630755) * A, exp_method, exp_cache)) * uprev integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusAdapt4Cache) @@ -282,7 +282,7 @@ function initialize!(integrator, cache::MagnusAdapt4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusAdapt4Cache, repeat_step = false) @@ -334,7 +334,7 @@ function perform_step!(integrator, cache::MagnusAdapt4Cache, repeat_step = false u .= exponential!(v4, exp_method, exp_cache) * uprev integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive utilde = u - exponential!(y6, exp_method, exp_cache) * uprev calculate_residuals!(atmp, utilde, uprev, u, integrator.opts.abstol, @@ -351,7 +351,7 @@ function initialize!(integrator, cache::MagnusNC8Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusNC8Cache, repeat_step = false) @@ -416,7 +416,7 @@ function perform_step!(integrator, cache::MagnusNC8Cache, repeat_step = false) u .= exponential!(Ω1 + Ω2 + Ω3_4_5_6, exp_method, exp_cache) * uprev end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusGL4Cache) @@ -427,7 +427,7 @@ function initialize!(integrator, cache::MagnusGL4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusGL4Cache, repeat_step = false) @@ -452,7 +452,7 @@ function perform_step!(integrator, cache::MagnusGL4Cache, repeat_step = false) u .= exponential!(Ω, exp_method, exp_cache) * uprev end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusGL8Cache) @@ -463,7 +463,7 @@ function initialize!(integrator, cache::MagnusGL8Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusGL8Cache, repeat_step = false) @@ -520,7 +520,7 @@ function perform_step!(integrator, cache::MagnusGL8Cache, repeat_step = false) u .= exponential!(Ω1 + Ω2 + Ω3_4_5_6, exp_method, exp_cache) * uprev end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusNC6Cache) @@ -531,7 +531,7 @@ function initialize!(integrator, cache::MagnusNC6Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusNC6Cache, repeat_step = false) @@ -568,7 +568,7 @@ function perform_step!(integrator, cache::MagnusNC6Cache, repeat_step = false) u .= exponential!(Ω1 + Ω2 + Ω3_4, exp_method, exp_cache) * uprev end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusGL6Cache) @@ -579,7 +579,7 @@ function initialize!(integrator, cache::MagnusGL6Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusGL6Cache, repeat_step = false) @@ -612,7 +612,7 @@ function perform_step!(integrator, cache::MagnusGL6Cache, repeat_step = false) u .= exponential!(Ω1 + Ω2 + Ω3_4, exp_method, exp_cache) * uprev end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusGauss4Cache) @@ -623,7 +623,7 @@ function initialize!(integrator, cache::MagnusGauss4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusGauss4Cache, repeat_step = false) @@ -650,7 +650,7 @@ function perform_step!(integrator, cache::MagnusGauss4Cache, repeat_step = false exp_cache) * uprev end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::LieEulerCache) @@ -661,7 +661,7 @@ function initialize!(integrator, cache::LieEulerCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::LieEulerCache, repeat_step = false) @@ -682,7 +682,7 @@ function perform_step!(integrator, cache::LieEulerCache, repeat_step = false) end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MagnusLeapfrogCache) @@ -693,7 +693,7 @@ function initialize!(integrator, cache::MagnusLeapfrogCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MagnusLeapfrogCache, repeat_step = false, @@ -716,7 +716,7 @@ function perform_step!(integrator, cache::MagnusLeapfrogCache, repeat_step = fal end integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) iter += 1 else L = integrator.f.f @@ -730,14 +730,14 @@ function perform_step!(integrator, cache::MagnusLeapfrogCache, repeat_step = fal end uprev = u integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end function initialize!(integrator, cache::LinearExponentialConstantCache) # Pre-start fsal integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) # Initialize interpolation derivatives @@ -766,7 +766,7 @@ function perform_step!(integrator, cache::LinearExponentialConstantCache, # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -776,7 +776,7 @@ function initialize!(integrator, cache::LinearExponentialCache) # Pre-start fsal integrator.fsalfirst = zero(cache.rtmp) integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) # Initialize interpolation derivatives @@ -811,7 +811,7 @@ function perform_step!(integrator, cache::LinearExponentialCache, repeat_step = # Update integrator state u .= tmp f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # integrator.k is automatically set due to aliasing end @@ -822,7 +822,7 @@ cay(A) = inv(I - 1 / 2 * A) * (I + 1 / 2 * A) function initialize!(integrator, cache::CayleyEulerConstantCache) # Pre-start fsal integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) # Initialize interpolation derivatives @@ -849,7 +849,7 @@ function perform_step!(integrator, cache::CayleyEulerConstantCache, repeat_step # Update integrator state integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -863,7 +863,7 @@ function initialize!(integrator, cache::CayleyEulerCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::CayleyEulerCache, repeat_step = false) @@ -886,5 +886,5 @@ function perform_step!(integrator, cache::CayleyEulerCache, repeat_step = false) # Update integrator state integrator.f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl index 8639a951ee..e3f510e405 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::EulerConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -14,7 +14,7 @@ function perform_step!(integrator, cache::EulerConstantCache, repeat_step = fals @unpack t, dt, uprev, f, p = integrator @muladd u = @.. broadcast=false uprev+dt * integrator.fsalfirst k = f(u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -30,21 +30,21 @@ function initialize!(integrator, cache::EulerCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::EulerCache, repeat_step = false) @unpack t, dt, uprev, u, f, p = integrator @muladd @.. broadcast=false u=uprev + dt * integrator.fsalfirst f(integrator.fsallast, u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::Union{HeunConstantCache, RalstonConstantCache}) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -69,7 +69,7 @@ end tmp = @.. broadcast=false uprev+a₁ * fsalfirst k2 = f(tmp, p, t + a₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if cache isa HeunConstantCache u = @.. broadcast=false uprev+a₂ * (fsalfirst + k2) @@ -89,7 +89,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end k = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = k integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -105,7 +105,7 @@ function initialize!(integrator, cache::Union{HeunCache, RalstonCache}) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::Union{HeunCache, RalstonCache}, @@ -126,7 +126,7 @@ end @.. broadcast=false thread=thread tmp=uprev + a₁ * fsalfirst stage_limiter!(tmp, integrator, p, t + a₁) f(k, tmp, p, t + a₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if cache isa HeunCache @.. broadcast=false thread=thread u=uprev + a₂ * (fsalfirst + k) @@ -151,12 +151,12 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(integrator.fsallast, u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::MidpointConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -172,10 +172,10 @@ end halfdt = dt / 2 tmp = @.. broadcast=false uprev+halfdt * integrator.fsalfirst k = f(tmp, p, t + halfdt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = @.. broadcast=false uprev+dt * k integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive utilde = @.. broadcast=false dt*(integrator.fsalfirst - k) atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -196,7 +196,7 @@ function initialize!(integrator, cache::MidpointCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::MidpointCache, repeat_step = false) @@ -206,7 +206,7 @@ end @.. broadcast=false thread=thread tmp=uprev + halfdt * fsalfirst stage_limiter!(k, tmp, p, t + halfdt) f(k, tmp, p, t + halfdt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread u=uprev + dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) @@ -218,12 +218,12 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::RK4ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -243,7 +243,7 @@ end k₄ = f(uprev + dt * k₃, p, t + dt) u = uprev + (dt / 6) * (2 * (k₂ + k₃) + (k₁ + k₄)) integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) if integrator.opts.adaptive # Shampine Solving ODEs and DDEs with Residual Control Estimate k₅ = integrator.fsallast @@ -277,7 +277,7 @@ end integrator.opts.internalnorm, t), t) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.EEst = convert(typeof(one(t)), 2.1342) * max(e1, e2) end integrator.k[1] = integrator.fsalfirst @@ -294,7 +294,7 @@ function initialize!(integrator, cache::RK4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # pre-start FSAL - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::RK4Cache, repeat_step = false) @@ -316,7 +316,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) if integrator.opts.adaptive # Shampine Solving ODEs and DDEs with Residual Control Estimate k₅ = k @@ -362,7 +362,7 @@ end thread) e2 = integrator.opts.internalnorm(atmp, t) integrator.EEst = convert(typeof(one(t)), 2.1342) * max(e1, e2) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) end end @@ -370,7 +370,7 @@ function initialize!(integrator, cache::Anas5ConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -405,7 +405,7 @@ end u = uprev + dt * (b1 * k1 + b3 * k3 + b4 * k4 + b5 * k5 + b6 * k6) k7 = f(u, p, t + dt) integrator.fsallast = k7 - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.k[1] = k1 integrator.k[2] = k2 integrator.k[3] = k3 @@ -429,7 +429,7 @@ function initialize!(integrator, cache::Anas5Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k7 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::Anas5Cache, repeat_step = false) @@ -483,5 +483,5 @@ end stage_limiter!(tmp, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k7, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) end diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl index d3423f3d24..c9f662ce04 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::BS3ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -21,7 +21,7 @@ end u = uprev + dt * (a41 * k1 + a42 * k2 + a43 * k3) k4 = f(u, p, t + dt) integrator.fsallast = k4 - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if integrator.opts.adaptive utilde = dt * (btilde1 * k1 + btilde2 * k2 + btilde3 * k3 + btilde4 * k4) atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -41,7 +41,7 @@ function initialize!(integrator, cache::BS3Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::BS3Cache, repeat_step = false) @@ -62,7 +62,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k4, u, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (btilde1 * k1 + btilde2 * k2 + btilde3 * k3 + btilde4 * k4) @@ -77,7 +77,7 @@ function initialize!(integrator, cache::OwrenZen3ConstantCache) integrator.kshortsize = 4 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -100,7 +100,7 @@ end u = uprev + dt * (a41 * k1 + a42 * k2 + a43 * k3) k4 = f(u, p, t + dt) integrator.fsallast = k4 - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if integrator.opts.adaptive utilde = dt * (btilde1 * k1 + btilde2 * k2 + btilde3 * k3) atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -124,7 +124,7 @@ function initialize!(integrator, cache::OwrenZen3Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k4 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::OwrenZen3Cache, repeat_step = false) @@ -142,7 +142,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k4, u, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (btilde1 * k1 + btilde2 * k2 + btilde3 * k3) @@ -157,7 +157,7 @@ function initialize!(integrator, cache::OwrenZen4ConstantCache) integrator.kshortsize = 6 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -181,7 +181,7 @@ end u = uprev + dt * (a61 * k1 + a63 * k3 + a64 * k4 + a65 * k5) k6 = f(u, p, t + dt) integrator.fsallast = k6 - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) if integrator.opts.adaptive utilde = dt * (btilde1 * k1 + btilde3 * k3 + btilde4 * k4 + btilde5 * k5) atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -209,7 +209,7 @@ function initialize!(integrator, cache::OwrenZen4Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k6 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::OwrenZen4Cache, repeat_step = false) @@ -235,7 +235,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k6, u, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (btilde1 * k1 + btilde3 * k3 + btilde4 * k4 + @@ -275,7 +275,7 @@ end @inbounds u[i] = uprev[i]+dt*(a61*k1[i]+a63*k3[i]+a64*k4[i]+a65*k5[i]) end f(k6, u, p, t+dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) if integrator.opts.adaptive @tight_loop_macros for i in uidx @inbounds utilde[i] = dt*(btilde1*k1[i] + btilde3*k3[i] + btilde4*k4[i] + btilde5*k5[i]) @@ -290,7 +290,7 @@ function initialize!(integrator, cache::OwrenZen5ConstantCache) integrator.kshortsize = 8 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -318,7 +318,7 @@ end u = uprev + dt * (a81 * k1 + a83 * k3 + a84 * k4 + a85 * k5 + a86 * k6 + a87 * k7) k8 = f(u, p, t + dt) integrator.fsallast = k8 - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) if integrator.opts.adaptive utilde = dt * (btilde1 * k1 + btilde3 * k3 + btilde4 * k4 + btilde5 * k5 + btilde6 * k6 + @@ -352,7 +352,7 @@ function initialize!(integrator, cache::OwrenZen5Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k8 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::OwrenZen5Cache, repeat_step = false) @@ -391,7 +391,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k8, u, p, t + dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (btilde1 * k1 + btilde3 * k3 + btilde4 * k4 + @@ -440,7 +440,7 @@ end @inbounds u[i] = uprev[i]+dt*(a81*k1[i]+a83*k3[i]+a84*k4[i]+a85*k5[i]+a86*k6[i]+a87*k7[i]) end f(k8, u, p, t+dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) if integrator.opts.adaptive @tight_loop_macros for i in uidx @inbounds utilde[i] = dt*(btilde1*k1[i] + btilde3*k3[i] + btilde4*k4[i] + btilde5*k5[i] + btilde6*k6[i] + btilde7*k7[i]) @@ -456,7 +456,7 @@ function initialize!(integrator, cache::BS5ConstantCache) alg.lazy ? (integrator.kshortsize = 8) : (integrator.kshortsize = 11) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -486,11 +486,11 @@ end t + c5 * dt) k7 = f(uprev + dt * (a71 * k1 + a72 * k2 + a73 * k3 + a74 * k4 + a75 * k5 + a76 * k6), p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) u = uprev + dt * (a81 * k1 + a83 * k3 + a84 * k4 + a85 * k5 + a86 * k6 + a87 * k7) integrator.fsallast = f(u, p, t + dt) k8 = integrator.fsallast - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive uhat = dt * (bhat1 * k1 + bhat3 * k3 + bhat4 * k4 + bhat5 * k5 + bhat6 * k6) utilde = dt * @@ -538,7 +538,7 @@ end (a111 * k[1] + a112 * k[2] + a113 * k[3] + a114 * k[4] + a115 * k[5] + a116 * k[6] + a117 * k[7] + a118 * k[8] + a119 * k[9] + a1110 * k[10]), p, t + c8 * dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end end @@ -564,7 +564,7 @@ function initialize!(integrator, cache::BS5Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k8 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::BS5Cache, repeat_step = false) @@ -603,7 +603,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k8, u, p, t + dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (bhat1 * k1 + bhat3 * k3 + bhat4 * k4 + @@ -651,7 +651,7 @@ end a118 * k[8] + a119 * k[9] + a1110 * k[10]) f(k[11], tmp, p, t + c8 * dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end return nothing end @@ -691,7 +691,7 @@ end @inbounds u[i] = uprev[i]+dt*(a81*k1[i]+a83*k3[i]+a84*k4[i]+a85*k5[i]+a86*k6[i]+a87*k7[i]) end f(k8, u, p, t+dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) if integrator.opts.adaptive @tight_loop_macros for i in uidx @inbounds utilde[i] = dt*(bhat1*k1[i] + bhat3*k3[i] + bhat4*k4[i] + bhat5*k5[i] + bhat6*k6[i]) @@ -722,7 +722,7 @@ end @inbounds tmp[i] = uprev[i]+dt*(a111*k[1][i]+a112*k[2][i]+a113*k[3][i]+a114*k[4][i]+a115*k[5][i]+a116*k[6][i]+a117*k[7][i]+a118*k[8][i]+a119*k[9][i]+a1110*k[10][i]) end f(k[11],tmp,p,t+c8*dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end end =# @@ -731,7 +731,7 @@ function initialize!(integrator, cache::DP5ConstantCache) integrator.kshortsize = 4 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -757,7 +757,7 @@ end u = uprev + dt * update integrator.fsallast = f(u, p, t + dt) k7 = integrator.fsallast - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) if integrator.alg isa CompositeAlgorithm g7 = u # Hairer II, page 22 modified to use the Inf norm @@ -790,7 +790,7 @@ function initialize!(integrator, cache::DP5Cache) integrator.fsalfirst = cache.k1 integrator.fsallast = cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::DP5Cache, repeat_step = false) @@ -824,7 +824,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k7, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) if integrator.alg isa CompositeAlgorithm g6 = tmp g7 = u @@ -860,7 +860,7 @@ function initialize!(integrator, cache::RKO65ConstantCache) integrator.kshortsize = 6 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -888,7 +888,7 @@ end integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.k[1] = k1 integrator.k[2] = k2 integrator.k[3] = k3 @@ -918,7 +918,7 @@ function initialize!(integrator, cache::RKO65Cache) integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::RKO65Cache, repeat_step = false) @@ -955,7 +955,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) #println("L238: tmp/u", tmp, u) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) #return nothing end @@ -964,7 +964,7 @@ function initialize!(integrator, cache::FRK65ConstantCache) integrator.kshortsize = 9 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1017,7 +1017,7 @@ end integrator.opts.reltol, integrator.opts.internalnorm, t) integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.k[1] = k1 integrator.k[2] = k2 integrator.k[3] = k3 @@ -1048,7 +1048,7 @@ function initialize!(integrator, cache::FRK65Cache) integrator.k[9] = cache.k9 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::FRK65Cache, repeat_step = false) @@ -1103,7 +1103,7 @@ end step_limiter!(u, integrator, p, t + dt) f(k9, u, p, t + dt) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=dt * (β1tilde * k1 + β4tilde * k4 + β5tilde * k5 + @@ -1122,7 +1122,7 @@ function initialize!(integrator, cache::RKMConstantCache) integrator.kshortsize = 6 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1147,7 +1147,7 @@ end u = uprev + dt * (β1 * k1 + β2 * k2 + β3 * k3 + β4 * k4 + β6 * k6) integrator.fsallast = f(u, p, t + dt) #interpolation then FSAL'd - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.k[1] = k1 integrator.k[2] = k2 integrator.k[3] = k3 @@ -1175,7 +1175,7 @@ function initialize!(integrator, cache::RKMCache) integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::RKMCache, repeat_step = false) @@ -1204,7 +1204,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) return nothing end @@ -1212,7 +1212,7 @@ function initialize!(integrator, cache::PSRK4p7q6ConstantCache) integrator.kshortsize = 6 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = zero(integrator.fsalfirst) @@ -1239,7 +1239,7 @@ function perform_step!(integrator, cache::PSRK4p7q6ConstantCache, repeat_step = k6 = f(tmp, p, t + dt * c6) u = uprev + dt * (b1 * k1 + b2 * k2 + b3 * k3 + b4 * k4 + b5 * k5 + b6 * k6) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.fsallast = k6 integrator.k[1] = k1 @@ -1296,7 +1296,7 @@ function perform_step!(integrator, cache::PSRK4p7q6Cache, repeat_step = false) b6 * k6) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.fsallast = k6 return nothing end @@ -1305,7 +1305,7 @@ function initialize!(integrator, cache::PSRK3p6q5ConstantCache) integrator.kshortsize = 5 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = zero(integrator.fsalfirst) @@ -1329,7 +1329,7 @@ function perform_step!(integrator, cache::PSRK3p6q5ConstantCache, repeat_step = k5 = f(tmp, p, t + dt * c5) u = uprev + dt * (b1 * k1 + b2 * k2 + b3 * k3 + b4 * k4 + b5 * k5) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.fsallast = k5 integrator.k[1] = k1 @@ -1378,7 +1378,7 @@ function perform_step!(integrator, cache::PSRK3p6q5Cache, repeat_step = false) (b1 * k1 + b2 * k2 + b3 * k3 + b4 * k4 + b5 * k5) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.fsallast = k5 return nothing end @@ -1387,7 +1387,7 @@ function initialize!(integrator, cache::PSRK3p5q4ConstantCache) integrator.kshortsize = 4 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = zero(integrator.fsalfirst) @@ -1409,7 +1409,7 @@ function perform_step!(integrator, cache::PSRK3p5q4ConstantCache, repeat_step = u = uprev + dt * (b1 * k1 + b2 * k2 + b3 * k3 + b4 * k4) integrator.fsallast = k4 - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.k[1] = k1 integrator.k[2] = k2 @@ -1452,7 +1452,7 @@ function perform_step!(integrator, cache::PSRK3p5q4Cache, repeat_step = false) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.fsallast = k4 return nothing end @@ -1462,7 +1462,7 @@ function initialize!(integrator, cache::MSRK5ConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) integrator.fsallast = zero(integrator.fsalfirst) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst @inbounds for i in 2:(integrator.kshortsize - 1) integrator.k[i] = zero(integrator.fsalfirst) @@ -1492,7 +1492,7 @@ function perform_step!(integrator, cache::MSRK5ConstantCache, repeat_step = fals u = uprev + dt * (b1 * k1 + b4 * k4 + b5 * k5 + b6 * k6 + b7 * k7 + b8 * k8) k9 = f(u, p, t + dt) integrator.fsallast = k9 - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.k[1] = k1 integrator.k[2] = k2 @@ -1524,7 +1524,7 @@ function initialize!(integrator, cache::MSRK5Cache) integrator.fsallast = cache.k9 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MSRK5Cache, repeat_step = false) @@ -1567,7 +1567,7 @@ function perform_step!(integrator, cache::MSRK5Cache, repeat_step = false) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k9, u, p, t + dt) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.fsallast = k9 return nothing @@ -1578,7 +1578,7 @@ function initialize!(integrator, cache::MSRK6ConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) integrator.fsallast = zero(integrator.fsalfirst) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst @inbounds for i in 2:(integrator.kshortsize - 1) integrator.k[i] = zero(integrator.fsalfirst) @@ -1608,7 +1608,7 @@ function perform_step!(integrator, cache::MSRK6ConstantCache, repeat_step = fals u = uprev + dt * (b1 * k1 + b4 * k4 + b5 * k5 + b6 * k6 + b7 * k7 + b8 * k8) k9 = f(u, p, t + dt) integrator.fsallast = k9 - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.k[1] = k1 integrator.k[2] = k2 @@ -1640,7 +1640,7 @@ function initialize!(integrator, cache::MSRK6Cache) integrator.fsallast = cache.k9 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::MSRK6Cache, repeat_step = false) @@ -1682,7 +1682,7 @@ function perform_step!(integrator, cache::MSRK6Cache, repeat_step = false) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k9, u, p, t + dt) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.fsallast = k9 return nothing @@ -1693,7 +1693,7 @@ function initialize!(integrator, cache::Stepanov5ConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) integrator.fsallast = zero(integrator.fsalfirst) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst @inbounds for i in 2:(integrator.kshortsize - 1) integrator.k[i] = zero(integrator.fsalfirst) @@ -1719,7 +1719,7 @@ function perform_step!(integrator, cache::Stepanov5ConstantCache, repeat_step = u = uprev + dt * (b1 * k1 + b3 * k3 + b4 * k4 + b5 * k5 + b6 * k6) k7 = f(u, p, t + dt) integrator.fsallast = k7 - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) if integrator.opts.adaptive @.. broadcast=false utilde=dt * (btilde1 * k1 + btilde2 * k2 + @@ -1757,7 +1757,7 @@ function initialize!(integrator, cache::Stepanov5Cache) integrator.fsallast = cache.k7 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::Stepanov5Cache, repeat_step = false) @@ -1789,7 +1789,7 @@ function perform_step!(integrator, cache::Stepanov5Cache, repeat_step = false) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k7, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.fsallast = k7 if integrator.opts.adaptive @@ -1810,7 +1810,7 @@ function initialize!(integrator, cache::SIR54ConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) integrator.fsallast = zero(integrator.fsalfirst) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst @inbounds for i in 2:(integrator.kshortsize - 1) integrator.k[i] = zero(integrator.fsalfirst) @@ -1838,7 +1838,7 @@ function perform_step!(integrator, cache::SIR54ConstantCache, repeat_step = fals u = uprev + dt * (b1 * k1 + b2 * k2 + b3 * k3 + b4 * k4 + b5 * k5 + b6 * k6) k8 = f(u, p, t + dt) integrator.fsallast = k8 - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) if integrator.opts.adaptive utilde = dt * (btilde1 * k1 + btilde2 * k2 + btilde3 * k3 + @@ -1878,7 +1878,7 @@ function initialize!(integrator, cache::SIR54Cache) integrator.fsallast = cache.k8 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::SIR54Cache, repeat_step = false) @@ -1916,7 +1916,7 @@ function perform_step!(integrator, cache::SIR54Cache, repeat_step = false) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k8, u, p, t + dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.fsallast = k8 if integrator.opts.adaptive @@ -1938,7 +1938,7 @@ function initialize!(integrator, cache::Alshina2ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1960,7 +1960,7 @@ function perform_step!(integrator, cache::Alshina2ConstantCache, repeat_step = f integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.fsallast = k2 integrator.k[1] = k1 @@ -1979,7 +1979,7 @@ function initialize!(integrator, cache::Alshina2Cache) integrator.fsallast = cache.k2 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::Alshina2Cache, repeat_step = false) @@ -2004,7 +2004,7 @@ function perform_step!(integrator, cache::Alshina2Cache, repeat_step = false) thread) integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.fsallast = k2 return nothing @@ -2014,7 +2014,7 @@ function initialize!(integrator, cache::Alshina3ConstantCache) integrator.kshortsize = 3 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = zero(integrator.fsalfirst) @@ -2039,7 +2039,7 @@ function perform_step!(integrator, cache::Alshina3ConstantCache, repeat_step = f integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.fsallast = k3 integrator.k[1] = k1 @@ -2060,7 +2060,7 @@ function initialize!(integrator, cache::Alshina3Cache) integrator.fsallast = cache.k3 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function perform_step!(integrator, cache::Alshina3Cache, repeat_step = false) @@ -2087,7 +2087,7 @@ function perform_step!(integrator, cache::Alshina3Cache, repeat_step = false) integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.fsallast = k3 return nothing @@ -2097,7 +2097,7 @@ function initialize!(integrator, cache::Alshina6ConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst integrator.k[2] = zero(integrator.fsalfirst) @@ -2131,7 +2131,7 @@ function perform_step!(integrator, cache::Alshina6ConstantCache, repeat_step = f u = uprev + dt * (b1 * k1 + b5 * k5 + b6 * k6 + b7 * k7) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.k[1] = k1 integrator.k[2] = k2 @@ -2194,7 +2194,7 @@ function perform_step!(integrator, cache::Alshina6Cache, repeat_step = false) (b1 * k1 + b5 * k5 + b6 * k6 + b7 * k7) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.fsallast = k7 return nothing end diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl index 80f7a906d7..9b766cb6d0 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl @@ -3,7 +3,7 @@ function initialize!(integrator, cache::SplitEulerConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f.f1(integrator.uprev, integrator.p, integrator.t) + integrator.f.f2(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # Avoid undefined entries if k is an array of arrays @@ -17,7 +17,7 @@ end @unpack t, dt, uprev, u, f, p = integrator u = @.. broadcast=false uprev+dt * integrator.fsalfirst integrator.fsallast = f.f1(u, p, t + dt) + f.f2(u, p, t + dt) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -34,7 +34,7 @@ function initialize!(integrator, cache::SplitEulerCache) integrator.k[2] = integrator.fsallast integrator.f.f1(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point integrator.f.f2(cache.tmp, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsalfirst .+= cache.tmp end @@ -45,6 +45,6 @@ end f.f1(integrator.fsallast, u, p, t + dt) # For the interpolation, needs k at the updated point f.f2(cache.tmp, u, p, t + dt) # For the interpolation, needs k at the updated point integrator.stats.nf2 += 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.fsallast .+= cache.tmp end diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl index b04660be84..f3c2fb53c3 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl @@ -1,7 +1,7 @@ # 2N low storage methods function initialize!(integrator, cache::LowStorageRK2NConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -22,12 +22,12 @@ end # other stages for i in eachindex(A2end) k = f(u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = A2end[i] * tmp + dt * k u = u + B2end[i] * tmp end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.fsalfirst = f(u, p, t + dt) # For interpolation, then FSAL'd integrator.u = u @@ -41,7 +41,7 @@ function initialize!(integrator, cache::LowStorageRK2NCache) integrator.fsalfirst = k # used for get_du integrator.fsallast = k integrator.f(k, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK2NCache, repeat_step = false) @@ -51,7 +51,7 @@ end # u1 f(k, u, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread tmp=dt * k @.. broadcast=false thread=thread u=u + B1 * tmp # other stages @@ -65,7 +65,7 @@ end @.. broadcast=false thread=thread tmp=tmp + dt * k @.. broadcast=false thread=thread u=u + B2end[i] * tmp end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) @@ -74,7 +74,7 @@ end # 2C low storage methods function initialize!(integrator, cache::LowStorageRK2CConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -91,14 +91,14 @@ end # u1 k = integrator.fsalfirst = f(u, p, t) integrator.k[1] = integrator.fsalfirst - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = u + B1 * dt * k # other stages for i in eachindex(A2end) tmp = u + A2end[i] * dt * k k = f(tmp, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = u + B2end[i] * dt * k end @@ -113,7 +113,7 @@ function initialize!(integrator, cache::LowStorageRK2CCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK2CCache, repeat_step = false) @@ -129,18 +129,18 @@ end for i in eachindex(A2end) @.. broadcast=false thread=thread tmp=u + A2end[i] * dt * k f(k, tmp, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread u=u + B2end[i] * dt * k end step_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # 3S low storage methods function initialize!(integrator, cache::LowStorageRK3SConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -161,13 +161,13 @@ end # other stages for i in eachindex(γ12end) k = f(u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = tmp + δ2end[i] * u u = γ12end[i] * u + γ22end[i] * tmp + γ32end[i] * uprev + β2end[i] * dt * k end integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.u = u end @@ -180,7 +180,7 @@ function initialize!(integrator, cache::LowStorageRK3SCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK3SCache, repeat_step = false) @@ -195,7 +195,7 @@ end # other stages for i in eachindex(γ12end) f(k, u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread tmp=tmp + δ2end[i] * u @.. broadcast=false thread=thread u=γ12end[i] * u + γ22end[i] * tmp + γ32end[i] * uprev + @@ -204,13 +204,13 @@ end step_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # 3S+ low storage methods: 3S methods adding another memory location for the embedded method (non-FSAL version) function initialize!(integrator, cache::LowStorageRK3SpConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -226,7 +226,7 @@ end # u1 integrator.fsalfirst = f(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst tmp = uprev u = tmp + β1 * dt * integrator.fsalfirst @@ -237,7 +237,7 @@ end # other stages for i in eachindex(γ12end) k = f(u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = tmp + δ2end[i] * u u = γ12end[i] * u + γ22end[i] * tmp + γ32end[i] * uprev + β2end[i] * dt * k if integrator.opts.adaptive @@ -270,7 +270,7 @@ end # u1 f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread tmp=uprev @.. broadcast=false thread=thread u=tmp + β1 * dt * integrator.fsalfirst if integrator.opts.adaptive @@ -281,7 +281,7 @@ end for i in eachindex(γ12end) stage_limiter!(u, integrator, p, t + c2end[i] * dt) f(k, u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread tmp=tmp + δ2end[i] * u @.. broadcast=false thread=thread u=γ12end[i] * u + γ22end[i] * tmp + γ32end[i] * uprev + β2end[i] * dt * k @@ -304,7 +304,7 @@ end # 3S+ FSAL low storage methods: 3S methods adding another memory location for the embedded method (FSAL version) function initialize!(integrator, cache::LowStorageRK3SpFSALConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -329,7 +329,7 @@ end # other stages for i in eachindex(γ12end) k = f(u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = tmp + δ2end[i] * u u = γ12end[i] * u + γ22end[i] * tmp + γ32end[i] * uprev + β2end[i] * dt * k if integrator.opts.adaptive @@ -339,7 +339,7 @@ end # FSAL integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive utilde = utilde + bhatfsal * dt * integrator.fsallast @@ -362,7 +362,7 @@ function initialize!(integrator, cache::LowStorageRK3SpFSALCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK3SpFSALCache, @@ -382,7 +382,7 @@ end for i in eachindex(γ12end) stage_limiter!(u, integrator, p, t + c2end[i] * dt) f(k, u, p, t + c2end[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread tmp=tmp + δ2end[i] * u @.. broadcast=false thread=thread u=γ12end[i] * u + γ22end[i] * tmp + γ32end[i] * uprev + β2end[i] * dt * k @@ -396,7 +396,7 @@ end # FSAL f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=utilde + bhatfsal * dt * k @@ -410,7 +410,7 @@ end # 2R+ low storage methods function initialize!(integrator, cache::LowStorageRK2RPConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -433,7 +433,7 @@ end gprev = u + Aᵢ[i] * dt * k u = u + Bᵢ[i] * dt * k k = f(gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -449,7 +449,7 @@ end integrator.k[1] = integrator.fsalfirst integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -461,7 +461,7 @@ function initialize!(integrator, cache::LowStorageRK2RPCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK2RPCache, repeat_step = false) @@ -479,7 +479,7 @@ end @.. broadcast=false thread=thread gprev=u + Aᵢ[i] * dt * k @.. broadcast=false thread=thread u=u + Bᵢ[i] * dt * k f(k, gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -497,13 +497,13 @@ end step_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # 3R+ low storage methods function initialize!(integrator, cache::LowStorageRK3RPConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -532,7 +532,7 @@ end uᵢ₋₂ = uᵢ₋₁ uᵢ₋₁ = u k = f(gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -548,7 +548,7 @@ end integrator.k[1] = integrator.fsalfirst integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -560,7 +560,7 @@ function initialize!(integrator, cache::LowStorageRK3RPCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK3RPCache, repeat_step = false) @@ -584,7 +584,7 @@ end @.. broadcast=false thread=thread uᵢ₋₂=uᵢ₋₁ @.. broadcast=false thread=thread uᵢ₋₁=u f(k, gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -603,13 +603,13 @@ end end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # 4R+ low storage methods function initialize!(integrator, cache::LowStorageRK4RPConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -642,7 +642,7 @@ end uᵢ₋₂ = uᵢ₋₁ uᵢ₋₁ = u k = f(gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -658,7 +658,7 @@ end integrator.k[1] = integrator.fsalfirst integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -670,7 +670,7 @@ function initialize!(integrator, cache::LowStorageRK4RPCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK4RPCache, repeat_step = false) @@ -701,7 +701,7 @@ end @.. broadcast=false thread=thread uᵢ₋₂=uᵢ₋₁ @.. broadcast=false thread=thread uᵢ₋₁=u f(k, gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -720,13 +720,13 @@ end end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # 5R+ low storage methods function initialize!(integrator, cache::LowStorageRK5RPConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -763,7 +763,7 @@ end uᵢ₋₂ = uᵢ₋₁ uᵢ₋₁ = u k = f(gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -779,7 +779,7 @@ end integrator.k[1] = integrator.fsalfirst integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -791,7 +791,7 @@ function initialize!(integrator, cache::LowStorageRK5RPCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::LowStorageRK5RPCache, repeat_step = false) @@ -826,7 +826,7 @@ end @.. broadcast=false thread=thread uᵢ₋₂=uᵢ₋₁ @.. broadcast=false thread=thread uᵢ₋₁=u f(k, gprev, p, t + Cᵢ[i] * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end #last stage @@ -845,7 +845,7 @@ end end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, cache::RK46NLCache) @@ -856,7 +856,7 @@ function initialize!(integrator, cache::RK46NLCache) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::RK46NLCache, repeat_step = false) @@ -896,12 +896,12 @@ end step_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) end function initialize!(integrator, cache::RK46NLConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -934,14 +934,14 @@ end u = u + β6 * tmp integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.k[1] = integrator.fsalfirst integrator.u = u end function initialize!(integrator, cache::KYK2014DGSSPRK_3S2_ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -961,7 +961,7 @@ end α_32 * u_2 + dt * β_32 * f(u_2, p, t + c_2 * dt)) integrator.k[1] = integrator.fsalfirst integrator.k[2] = f(integrator.u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.fsallast = integrator.k[2] return nothing end @@ -975,7 +975,7 @@ function initialize!(integrator, cache::KYK2014DGSSPRK_3S2_Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return nothing end @@ -998,6 +998,6 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(integrator.k[2], u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) return nothing end diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/functional.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/functional.jl index d6e9898215..377e9c12a5 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/functional.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/functional.jl @@ -135,7 +135,7 @@ end end end if DiffEqBase.has_stats(integrator) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # compute norm of residuals @@ -201,7 +201,7 @@ end end if DiffEqBase.has_stats(integrator) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # compute norm of residuals diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl index 8757fc362e..c1c8f67db7 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl @@ -156,7 +156,7 @@ Equations II, Springer Series in Computational Mathematics. ISBN end if DiffEqBase.has_stats(integrator) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # update W @@ -195,7 +195,7 @@ end isdae = f isa DAEFunction if DiffEqBase.has_stats(integrator) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end if isdae diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl index 0575a4db5f..23fbca5039 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::AN5ConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -102,7 +102,7 @@ function initialize!(integrator, cache::AN5Cache) integrator.k[6] = cache.tsit5cache.k6 integrator.k[7] = cache.tsit5cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::AN5Cache, repeat_step = false) @@ -188,7 +188,7 @@ function initialize!(integrator, cache::JVODEConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -207,7 +207,7 @@ end cache.order = 1 z[1] = integrator.uprev z[2] = f(uprev, p, t) * dt - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) dts[1] = dt end # Reset time @@ -263,7 +263,7 @@ function initialize!(integrator, cache::JVODECache) integrator.k[6] = cache.tsit5cache.k6 integrator.k[7] = cache.tsit5cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::JVODECache, repeat_step = false) @@ -274,7 +274,7 @@ end cache.order = 1 @.. broadcast=false z[1]=integrator.uprev f(z[2], uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false z[2]=z[2] * dt dts[1] = dt end diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl index 4d5df48685..ec844ed975 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_utils.jl @@ -214,7 +214,7 @@ function nlsolve_functional!(integrator, cache::T) where {T} @unpack ratetmp = cache integrator.f(ratetmp, z[1], p, dt + t) end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) maxiters = 3 div_rate = 2 # Zero out the difference vector @@ -254,7 +254,7 @@ function nlsolve_functional!(integrator, cache::T) where {T} return false end δ_prev = δ - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) isconstcache ? (ratetmp = integrator.f(integrator.u, p, dt + t)) : integrator.f(ratetmp, integrator.u, p, dt + t) end diff --git a/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl b/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl index 0461a3cf65..a61abfe452 100644 --- a/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl +++ b/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, ::QPRK98ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -61,7 +61,7 @@ end dt * (b16_1 * k1 + b16_6 * k6 + b16_7 * k7 + b16_8 * k8 + b16_9 * k9 + b16_10 * k10 + b16_11 * k11 + b16_12 * k12 + b16_13 * k13 + b16_14 * k14), p, t + dt) - integrator.stats.nf += 15 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 15) u = uprev + dt * (w1 * k1 + w8 * k8 + w9 * k9 + w10 * k10 + w11 * k11 + w12 * k12 + w13 * k13 + w14 * k14 + w15 * k15 + w16 * k16) @@ -74,7 +74,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -88,7 +88,7 @@ function initialize!(integrator, cache::QPRK98Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::QPRK98Cache, repeat_step = false) @@ -173,7 +173,7 @@ end stage_limiter!(u, integrator, p, t + dt) f(k16, tmp, p, t + dt) - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) @.. broadcast=false thread=thread u=uprev + dt * (w1 * k1 + w8 * k8 + w9 * k9 @@ -195,6 +195,6 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return nothing end diff --git a/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl b/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl index 70077f9268..008ec1c5d4 100644 --- a/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl +++ b/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl @@ -21,7 +21,7 @@ function initialize!(integrator, cache::NystromCCDefaultInitialization) duprev, uprev = integrator.uprev.x kdu = integrator.f.f1(duprev, uprev, integrator.p, integrator.t) ku = integrator.f.f2(duprev, uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsalfirst = ArrayPartition((kdu, ku)) end @@ -47,7 +47,7 @@ function initialize!(integrator, cache::NystromDefaultInitialization) integrator.k[2] = integrator.fsallast integrator.f.f1(integrator.k[1].x[1], duprev, uprev, integrator.p, integrator.t) integrator.f.f2(integrator.k[1].x[2], duprev, uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 end @@ -81,7 +81,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -119,7 +119,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 end @@ -155,7 +155,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -213,7 +213,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -274,7 +274,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -346,7 +346,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -388,7 +388,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -420,7 +420,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.stats.nf2 += 1 end @@ -437,7 +437,7 @@ end k1cache = ArrayPartition((k.x[1], f.f1(duprev, uprev, p, t + c1 * dt))) kdu = uprev + dt * (c1 * duprev + dt * a21 * k1cache.x[1]) k₂.x[1] = f.f1(duprev, kdu, p, t + c1 * dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) else kdu = uprev2 + dt * (c1 * duprev2 + dt * a21 * k1cache.x[1]) ku = uprev + dt * (c1 * duprev + dt * a21 * k1cache.x[2]) @@ -450,7 +450,7 @@ end integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.stats.nf2 += 1 copyto!(k₂.x[1], k₂.x[2]) k1cache = ArrayPartition((k1cache.x[1], k.x[2])) @@ -475,7 +475,7 @@ end f.f1(k1cache.x[2], duprev, uprev, p, t + c1 * dt) @.. broadcast=false kdu=uprev + dt * (c1 * duprev + dt * a21 * k1cache.x[2]) f.f1(k₂.x[1], duprev, kdu, p, t + c1 * dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) else @.. broadcast=false kdu=uprev2 + dt * (c1 * duprev2 + dt * a21 * k1cache.x[1]) @.. broadcast=false ku=uprev + dt * (c1 * duprev + dt * a21 * k1cache.x[2]) @@ -491,7 +491,7 @@ end end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.stats.nf2 += 1 copyto!(k₂.x[1], k₂.x[2]) copyto!(k1cache.x[2], k1cache.x[1]) @@ -519,7 +519,7 @@ end f.f1(k₂.x[1], duprev, kdu, p, t + c1 * dt) @.. broadcast=false kdu=uprev + dt * (c2 * duprev + dt * a32 * k1cache.x[2]) f.f1(k₃.x[1], duprev, kdu, p, t + c1 * dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) else @.. broadcast=false ku=uprev + dt * (c1 * duprev + dt * a21 * k1cache.x[1]) @.. broadcast=false kdu=uprev2 + dt * (c1 * duprev2 + dt * a21 * k1cache.x[2]) @@ -541,7 +541,7 @@ end end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 copyto!(k₂.x[1], k₂.x[2]) copyto!(k₃.x[1], k₃.x[2]) @@ -571,7 +571,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -609,7 +609,7 @@ end @.. broadcast=false du=duprev + dt * (b1 * k₁ + b2 * k₂ + b3 * k₃ + b4 * k₄) f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 return nothing end @@ -635,7 +635,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -682,7 +682,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -731,7 +731,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -794,7 +794,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -821,7 +821,7 @@ function initialize!(integrator, cache::DPRKN6ConstantCache) kdu = integrator.f.f1(duprev, uprev, integrator.p, integrator.t) ku = integrator.f.f2(duprev, uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsalfirst = ArrayPartition((kdu, ku)) integrator.fsallast = zero(integrator.fsalfirst) @@ -869,7 +869,7 @@ end integrator.k[1] = ArrayPartition(integrator.fsalfirst.x[1], k2) integrator.k[2] = ArrayPartition(k3, k4) integrator.k[3] = ArrayPartition(k5, k6) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.stats.nf2 += 1 if integrator.opts.adaptive @@ -899,7 +899,7 @@ function initialize!(integrator, cache::DPRKN6Cache) integrator.k[3] = ArrayPartition(cache.k5, cache.k6) integrator.f.f1(integrator.fsallast.x[1], duprev, uprev, integrator.p, integrator.t) integrator.f.f2(integrator.fsallast.x[2], duprev, uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 end @@ -948,7 +948,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -994,7 +994,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1060,7 +1060,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -1124,7 +1124,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 9 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 9) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1216,7 +1216,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 9 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 9) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -1333,7 +1333,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 17 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 17) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1509,7 +1509,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 17 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 17) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -1555,7 +1555,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1602,7 +1602,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -1642,7 +1642,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1686,7 +1686,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -1734,7 +1734,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1800,7 +1800,7 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 1 if integrator.opts.adaptive duhat, uhat = utilde.x @@ -1831,7 +1831,7 @@ function initialize!(integrator, cache::RKN4Cache) integrator.k[2] = integrator.fsallast integrator.f.f1(integrator.k[1].x[1], duprev, uprev, integrator.p, integrator.t) integrator.f.f2(integrator.k[1].x[2], duprev, uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 end @@ -1865,7 +1865,7 @@ end integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((f.f1(du, u, p, t + dt), f.f2(du, u, p, t + dt))) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.stats.nf2 += 1 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1905,6 +1905,6 @@ end f.f1(k.x[1], du, u, p, t + dt) f.f2(k.x[2], du, u, p, t + dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.stats.nf2 += 1 end diff --git a/lib/OrdinaryDiffEqRosenbrock/src/generic_rosenbrock.jl b/lib/OrdinaryDiffEqRosenbrock/src/generic_rosenbrock.jl index 32330c27e1..5600b1bc27 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/generic_rosenbrock.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/generic_rosenbrock.jl @@ -270,7 +270,7 @@ function gen_initialize(cachename::Symbol,constcachename::Symbol) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -286,7 +286,7 @@ function gen_initialize(cachename::Symbol,constcachename::Symbol) resize!(integrator.k, integrator.kshortsize) integrator.k .= [fsalfirst,fsallast] integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end end end @@ -314,7 +314,7 @@ function gen_constant_perform_step(tabmask::RosenbrockTableau{Bool,Bool},cachena integrator.stats.nsolve += 1 u=+(uprev,$(aijkj...)) du = f(u, p, t+$(Symbol(:c,i+1))*dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp=+(du,$(Symbol(:dtd,i+1))*dT,$(Cijkj...)) else @@ -366,7 +366,7 @@ function gen_constant_perform_step(tabmask::RosenbrockTableau{Bool,Bool},cachena $(iterexprs...) integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -417,7 +417,7 @@ function gen_perform_step(tabmask::RosenbrockTableau{Bool,Bool},cachename::Symbo integrator.stats.nsolve += 1 @.. broadcast=false u = +(uprev,$(aijkj...)) f( du, u, p, t+$(Symbol(:c,i+1))*dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp = +(du,$dtdj*dT,$(dtCijkj...)) else @@ -483,7 +483,7 @@ function gen_perform_step(tabmask::RosenbrockTableau{Bool,Bool},cachename::Symbo $(iterexprs...) f( fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) $(adaptiveexpr...) end diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl index c476601573..e9028661bf 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl @@ -8,7 +8,7 @@ function initialize!(integrator, cache::Union{Rosenbrock23Cache, integrator.k[1] = k₁ integrator.k[2] = k₂ integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end function initialize!(integrator, @@ -17,7 +17,7 @@ function initialize!(integrator, integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -41,7 +41,7 @@ end if repeat_step f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end calc_rosenbrock_differentiation!(integrator, cache, γ, γ, repeat_step, false) @@ -70,7 +70,7 @@ end @.. broadcast=false u=uprev + dto2 * k₁ stage_limiter!(u, integrator, p, t + dto2) f(f₁, u, p, t + dto2) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I copyto!(tmp, k₁) @@ -94,7 +94,7 @@ end if integrator.opts.adaptive f(fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=fsallast - c₃₂ * (k₂ - f₁) - @@ -153,7 +153,7 @@ end if repeat_step f(integrator.fsalfirst, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end calc_rosenbrock_differentiation!(integrator, cache, γ, γ, repeat_step, false) @@ -182,7 +182,7 @@ end @.. broadcast=false u=uprev + dto2 * k₁ stage_limiter!(u, integrator, p, t + dto2) f(f₁, u, p, t + dto2) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I tmp .= k₁ @@ -203,7 +203,7 @@ end @.. broadcast=false tmp=uprev + dt * k₂ stage_limiter!(u, integrator, p, t + dt) f(fsallast, tmp, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=fsallast - c₃₂ * (k₂ - f₁) - 2(k₁ - fsalfirst) + @@ -252,7 +252,7 @@ end if repeat_step integrator.fsalfirst = f(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end mass_matrix = integrator.f.mass_matrix @@ -269,7 +269,7 @@ end k₁ = _reshape(W \ -_vec((integrator.fsalfirst + γ * dT)), axes(uprev)) integrator.stats.nsolve += 1 f₁ = f(uprev + dto2 * k₁, p, t + dto2) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I k₂ = _reshape(W \ -_vec(f₁ - k₁), axes(uprev)) + k₁ @@ -281,7 +281,7 @@ end if integrator.opts.adaptive integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I k₃ = _reshape( @@ -331,7 +331,7 @@ end if repeat_step integrator.fsalfirst = f(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # Time derivative @@ -346,7 +346,7 @@ end k₁ = _reshape(W \ -_vec((integrator.fsalfirst + γ * dT)), axes(uprev)) integrator.stats.nsolve += 1 f₁ = f(uprev + dto2 * k₁, p, t + dto2) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I k₂ = _reshape(W \ -_vec(f₁ - k₁), axes(uprev)) + k₁ @@ -358,7 +358,7 @@ end integrator.stats.nsolve += 1 tmp = uprev + dt * k₂ integrator.fsallast = f(tmp, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I k₃ = _reshape( @@ -400,7 +400,7 @@ function initialize!(integrator, integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -420,7 +420,7 @@ function initialize!(integrator, integrator.k[1] = fsalfirst integrator.k[2] = fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::Rosenbrock33ConstantCache, @@ -456,7 +456,7 @@ end integrator.stats.nsolve += 1 u = uprev + a21 * k1 du = f(u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd2 * dT + dtC21 * k1 @@ -468,7 +468,7 @@ end integrator.stats.nsolve += 1 u = uprev + a31 * k1 + a32 * k2 du = f(u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd3 * dT + dtC31 * k1 + dtC32 * k2 @@ -480,7 +480,7 @@ end integrator.stats.nsolve += 1 u = uprev + b1 * k1 + b2 * k2 + b3 * k3 integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive utilde = btilde1 * k1 + btilde2 * k2 + btilde3 * k3 @@ -541,7 +541,7 @@ end @.. broadcast=false u=uprev + a21 * k1 stage_limiter!(u, integrator, p, t + c2 * dt) f(du, u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd2 * dT + dtC21 * k1 @@ -562,7 +562,7 @@ end @.. broadcast=false u=uprev + a31 * k1 + a32 * k2 stage_limiter!(u, integrator, p, t + c3 * dt) f(du, u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd3 * dT + dtC31 * k1 + dtC32 * k2 @@ -585,7 +585,7 @@ end step_limiter!(u, integrator, p, t + dt) f(fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @.. broadcast=false utilde=btilde1 * k1 + btilde2 * k2 + btilde3 * k3 @@ -646,7 +646,7 @@ end integrator.stats.nsolve += 1 u = uprev + a31 * k1 + a32 * k2 du = f(u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd3 * dT + dtC31 * k1 + dtC32 * k2 @@ -658,7 +658,7 @@ end integrator.stats.nsolve += 1 u = uprev + a41 * k1 + a42 * k2 + a43 * k3 du = f(u, p, t + dt) #-- c4 = 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd4 * dT + dtC41 * k1 + dtC42 * k2 + dtC43 * k3 @@ -670,7 +670,7 @@ end integrator.stats.nsolve += 1 u = uprev + b1 * k1 + b2 * k2 + b3 * k3 + b4 * k4 integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive utilde = btilde1 * k1 + btilde2 * k2 + btilde3 * k3 + btilde4 * k4 @@ -757,7 +757,7 @@ end @.. broadcast=false u=uprev + a31 * k1 + a32 * k2 stage_limiter!(u, integrator, p, t + c3 * dt) f(du, u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd3 * dT + dtC31 * k1 + dtC32 * k2 @@ -774,7 +774,7 @@ end @.. broadcast=false u=uprev + a41 * k1 + a42 * k2 + a43 * k3 stage_limiter!(u, integrator, p, t + dt) f(du, u, p, t + dt) #-- c4 = 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd4 * dT + dtC41 * k1 + dtC42 * k2 + @@ -795,7 +795,7 @@ end step_limiter!(u, integrator, p, t + dt) f(fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @.. broadcast=false utilde=btilde1 * k1 + btilde2 * k2 + btilde3 * k3 + btilde4 * k4 @@ -883,7 +883,7 @@ end end du = f(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) k3 = copy(du) #-- save for stage 3 linsolve_tmp = du + dtd1 * dT @@ -892,7 +892,7 @@ end integrator.stats.nsolve += 1 u = uprev + a21 * k1 du = f(u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd2 * dT + dtC21 * k1 @@ -913,7 +913,7 @@ end integrator.stats.nsolve += 1 u = uprev + a41 * k1 + a42 * k2 + a43 * k3 du = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + (dtC41 * k1 + dtC42 * k2 + dtC43 * k3) @@ -1016,7 +1016,7 @@ end dtgamma = dt * gamma f(cache.fsalfirst, uprev, p, t) # used in calc_rosenbrock_differentiation! - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) @@ -1042,7 +1042,7 @@ end @.. broadcast=false u=uprev + a21 * k1 stage_limiter!(u, integrator, p, t + c2 * dt) f(du, u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd2 * dT + dtC21 * k1 @@ -1072,7 +1072,7 @@ end @.. broadcast=false u=uprev + a41 * k1 + a42 * k2 + a43 * k3 stage_limiter!(u, integrator, p, t + c2 * dt) f(du, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + @@ -1251,7 +1251,7 @@ end end du = f(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) linsolve_tmp = du + dtd1 * dT @@ -1259,7 +1259,7 @@ end integrator.stats.nsolve += 1 u = uprev + a21 * k1 du = f(u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd2 * dT + dtC21 * k1 @@ -1271,7 +1271,7 @@ end integrator.stats.nsolve += 1 u = uprev + a31 * k1 + a32 * k2 du = f(u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd3 * dT + (dtC31 * k1 + dtC32 * k2) @@ -1283,7 +1283,7 @@ end integrator.stats.nsolve += 1 u = uprev + a41 * k1 + a42 * k2 + a43 * k3 du = f(u, p, t + c4 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd4 * dT + (dtC41 * k1 + dtC42 * k2 + dtC43 * k3) @@ -1295,7 +1295,7 @@ end integrator.stats.nsolve += 1 u = uprev + a51 * k1 + a52 * k2 + a53 * k3 + a54 * k4 du = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + (dtC52 * k2 + dtC54 * k4 + dtC51 * k1 + dtC53 * k3) @@ -1308,7 +1308,7 @@ end integrator.stats.nsolve += 1 u = u + k5 du = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + (dtC61 * k1 + dtC62 * k2 + dtC65 * k5 + dtC64 * k4 + dtC63 * k3) @@ -1379,7 +1379,7 @@ end dtgamma = dt * gamma f(cache.fsalfirst, uprev, p, t) # used in calc_rosenbrock_differentiation! - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) @@ -1405,7 +1405,7 @@ end @.. broadcast=false u=uprev + a21 * k1 stage_limiter!(u, integrator, p, t + c2 * dt) f(du, u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd2 * dT + dtC21 * k1 @@ -1422,7 +1422,7 @@ end @.. broadcast=false u=uprev + a31 * k1 + a32 * k2 stage_limiter!(u, integrator, p, t + c3 * dt) f(du, u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd3 * dT + (dtC31 * k1 + dtC32 * k2) @@ -1439,7 +1439,7 @@ end @.. broadcast=false u=uprev + a41 * k1 + a42 * k2 + a43 * k3 stage_limiter!(u, integrator, p, t + c4 * dt) f(du, u, p, t + c4 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd4 * dT + @@ -1457,7 +1457,7 @@ end @.. broadcast=false u=uprev + a51 * k1 + a52 * k2 + a53 * k3 + a54 * k4 stage_limiter!(u, integrator, p, t + dt) f(du, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + @@ -1474,7 +1474,7 @@ end u .+= k5 f(du, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + (dtC61 * k1 + dtC62 * k2 + dtC65 * k5 + @@ -1578,7 +1578,7 @@ end end du1 = f(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) linsolve_tmp = du1 + dtd1 * dT @@ -1586,7 +1586,7 @@ end integrator.stats.nsolve += 1 u = uprev + a21 * k1 du = f(u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd2 * dT + dtC21 * k1 @@ -1598,7 +1598,7 @@ end integrator.stats.nsolve += 1 u = uprev + a31 * k1 + a32 * k2 du = f(u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd3 * dT + (dtC31 * k1 + dtC32 * k2) @@ -1610,7 +1610,7 @@ end integrator.stats.nsolve += 1 u = uprev + a41 * k1 + a42 * k2 + a43 * k3 du = f(u, p, t + c4 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd4 * dT + (dtC41 * k1 + dtC42 * k2 + dtC43 * k3) @@ -1622,7 +1622,7 @@ end integrator.stats.nsolve += 1 u = uprev + a51 * k1 + a52 * k2 + a53 * k3 + a54 * k4 du = f(u, p, t + c5 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + dtd5 * dT + (dtC52 * k2 + dtC54 * k4 + dtC51 * k1 + dtC53 * k3) @@ -1635,7 +1635,7 @@ end integrator.stats.nsolve += 1 u = uprev + a61 * k1 + a62 * k2 + a63 * k3 + a64 * k4 + a65 * k5 du = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + (dtC61 * k1 + dtC62 * k2 + dtC63 * k3 + dtC64 * k4 + dtC65 * k5) @@ -1649,7 +1649,7 @@ end integrator.stats.nsolve += 1 u = u + k6 du = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + @@ -1666,7 +1666,7 @@ end integrator.stats.nsolve += 1 u = u + k7 du = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I linsolve_tmp = du + @@ -1710,7 +1710,7 @@ end 0.5 * (integrator.k[1] + 0.5 * (integrator.k[2] + 0.5 * integrator.k[3]))) du1 = (0.25 * (integrator.k[2] + integrator.k[3]) - uprev + u) / dt du = f(k2, p, t + dt / 2) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I du2 = du1 - du else @@ -1782,7 +1782,7 @@ end dtgamma = dt * gamma f(cache.fsalfirst, uprev, p, t) # used in calc_rosenbrock_differentiation! - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) calc_rosenbrock_differentiation!(integrator, cache, dtd1, dtgamma, repeat_step, true) @@ -1810,7 +1810,7 @@ end @.. broadcast=false u=uprev + a21 * k1 stage_limiter!(u, integrator, p, t + c2 * dt) f(du, u, p, t + c2 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd2 * dT + dtC21 * k1 @@ -1828,7 +1828,7 @@ end @.. broadcast=false u=uprev + a31 * k1 + a32 * k2 stage_limiter!(u, integrator, p, t + c3 * dt) f(du, u, p, t + c3 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd3 * dT + (dtC31 * k1 + dtC32 * k2) @@ -1846,7 +1846,7 @@ end @.. broadcast=false u=uprev + a41 * k1 + a42 * k2 + a43 * k3 stage_limiter!(u, integrator, p, t + c4 * dt) f(du, u, p, t + c4 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd4 * dT + @@ -1865,7 +1865,7 @@ end @.. broadcast=false u=uprev + a51 * k1 + a52 * k2 + a53 * k3 + a54 * k4 stage_limiter!(u, integrator, p, t + c5 * dt) f(du, u, p, t + c5 * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + dtd5 * dT + @@ -1884,7 +1884,7 @@ end @.. broadcast=false u=uprev + a61 * k1 + a62 * k2 + a63 * k3 + a64 * k4 + a65 * k5 stage_limiter!(u, integrator, p, t + dt) f(du, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + (dtC61 * k1 + dtC62 * k2 + dtC63 * k3 + @@ -1904,7 +1904,7 @@ end u .+= k6 stage_limiter!(u, integrator, p, t + dt) f(du, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + (dtC71 * k1 + dtC72 * k2 + dtC73 * k3 + @@ -1923,7 +1923,7 @@ end u .+= k7 f(du, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I @.. broadcast=false linsolve_tmp=du + (dtC81 * k1 + dtC82 * k2 + dtC83 * k3 + @@ -1971,7 +1971,7 @@ end 0.5 * (integrator.k[1] + 0.5 * (integrator.k[2] + 0.5 * integrator.k[3]))) du1 = (0.25 * (integrator.k[2] + integrator.k[3]) - uprev + u) / dt f(du, k2, p, t + dt / 2) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if mass_matrix === I du2 = du1 - du else diff --git a/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl b/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl index 1b3d6f1a7b..9c2df93493 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl @@ -12,7 +12,7 @@ function initialize!(integrator, integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -38,7 +38,7 @@ function initialize!(integrator, integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::Kvaerno3ConstantCache, @@ -1782,7 +1782,7 @@ end if integrator.f isa SplitFunction f2(k8, u, p, t + dt) k8 .*= dt - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uprev + a81 * z₁ + a84 * z₄ + a85 * z₅ + a86 * z₆ + a87 * z₇ + γ * z₈ + eb1 * k1 + eb4 * k4 + eb5 * k5 + eb6 * k6 + eb7 * k7 + eb8 * k8 @@ -2180,7 +2180,7 @@ end if integrator.f isa SplitFunction f2(k7, u, p, t + dt) k7 .*= dt - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uprev + a73 * z₃ + a74 * z₄ + a75 * z₅ + a76 * z₆ + γ * z₇ + eb3 * k3 + eb4 * k4 + eb5 * k5 + eb6 * k6 + eb7 * k7 end @@ -2623,7 +2623,7 @@ end if integrator.f isa SplitFunction f2(k8, u, p, t + dt) k8 .*= dt - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uprev + a83 * z₃ + a84 * z₄ + a85 * z₅ + a86 * z₆ + a87 * z₇ + γ * z₈ + eb3 * k3 + eb4 * k4 + eb5 * k5 + eb6 * k6 + eb7 * k7 + eb8 * k8 diff --git a/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl b/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl index d94bf0085f..1e9aa802bb 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl @@ -21,7 +21,7 @@ function initialize!(integrator, integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -56,7 +56,7 @@ function initialize!(integrator, integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ImplicitEulerConstantCache, @@ -109,7 +109,7 @@ end integrator.EEst += integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -159,7 +159,7 @@ end else integrator.EEst = 1 end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(integrator.fsallast, u, p, t + dt) if integrator.opts.adaptive && integrator.differential_vars !== nothing @@ -190,7 +190,7 @@ end u = nlsolver.tmp + z integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -220,7 +220,7 @@ end step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(integrator.fsallast, u, p, t + dt) end @@ -289,7 +289,7 @@ end end integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -370,7 +370,7 @@ end end end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(integrator.fsallast, u, p, t + dt) end @@ -606,7 +606,7 @@ end end integrator.fsallast = f(u, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -669,7 +669,7 @@ end integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(integrator.fsallast, u, p, t) end @@ -742,7 +742,7 @@ end end end - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -819,7 +819,7 @@ end end end - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) f(integrator.fsallast, u, p, t + dt) end @@ -872,7 +872,7 @@ end ################################### Finalize integrator.fsallast = f(u, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.u = u @@ -921,7 +921,7 @@ end ################################### Finalize - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(integrator.fsallast, u, p, t) end diff --git a/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl b/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl index 4f39c2e83c..d0a26349f2 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::SSPRK22ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -20,7 +20,7 @@ end # u u = (uprev + u + dt * k) / 2 - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.u = u end @@ -46,7 +46,7 @@ end @.. broadcast=false thread=thread u=(uprev + u + dt * k) / 2 stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) end function initialize!(integrator, cache::KYKSSPRK42Cache) @@ -122,7 +122,7 @@ function initialize!(integrator, cache::SHLDDRK52ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -206,7 +206,7 @@ function initialize!(integrator, cache::SHLDDRK_2NConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -355,7 +355,7 @@ end function initialize!(integrator, cache::SSPRK33ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -378,7 +378,7 @@ end # u u = (uprev + 2 * u + 2 * dt * k) / 3 - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.u = u end @@ -408,12 +408,12 @@ end @.. broadcast=false thread=thread u=(uprev + 2 * u + 2 * dt * k) / 3 stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end function initialize!(integrator, cache::SSPRK53ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -443,7 +443,7 @@ end # u u = α52 * u + α54 * tmp + β54 * dt * k - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.u = u end @@ -482,12 +482,12 @@ end @.. broadcast=false thread=thread u=α52 * u + α54 * tmp + β54 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) end function initialize!(integrator, cache::SSPRK53_2N1ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -518,7 +518,7 @@ end # u u = u + β54 * dt * k - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -558,12 +558,12 @@ end @.. broadcast=false thread=thread u=u + β54 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) end function initialize!(integrator, cache::SSPRK53_2N2ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -594,7 +594,7 @@ end # u u = α50 * uprev + α54 * u + β54 * dt * k - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.u = u end @@ -633,7 +633,7 @@ end @.. broadcast=false thread=thread u=α50 * uprev + α54 * u + β54 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) end function initialize!(integrator, cache::SSPRK53_HConstantCache) @@ -668,7 +668,7 @@ end # u u = u + β54 * dt * k - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.u = u end @@ -707,12 +707,12 @@ end @.. broadcast=false thread=thread u=u + β54 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) end function initialize!(integrator, cache::SSPRK63ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -745,7 +745,7 @@ end # u u = α62 * u₂ + α65 * tmp + β65 * dt * k - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) integrator.u = u end @@ -788,12 +788,12 @@ end @.. broadcast=false thread=thread u=α62 * u₂ + α65 * tmp + β65 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) end function initialize!(integrator, cache::SSPRK73ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -829,7 +829,7 @@ end # u u = α73 * u + α76 * tmp + β76 * dt * k - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.u = u end @@ -876,12 +876,12 @@ end @.. broadcast=false thread=thread u=α73 * u + α76 * tmp + β76 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) end function initialize!(integrator, cache::SSPRK83ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -920,7 +920,7 @@ end # u u = tmp + β87 * dt * k - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.u = u end @@ -971,14 +971,14 @@ end @.. broadcast=false thread=thread u=tmp + β87 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) end function initialize!(integrator, cache::SSPRK43ConstantCache) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1008,7 +1008,7 @@ end # u u = u + dt_2 * k # corresponds to b = (1/6, 1/6, 1/6, 1/2) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) if integrator.opts.adaptive utilde = half_u * (utilde - u) # corresponds to bhat = (1/4, 1/4, 1/4, 1/4) atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -1063,14 +1063,14 @@ end thread) integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) end function initialize!(integrator, cache::SSPRK432ConstantCache) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1100,7 +1100,7 @@ end # u u = u + dt_2 * k - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) if integrator.opts.adaptive utilde = utilde - u atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -1154,14 +1154,14 @@ end thread) integrator.EEst = integrator.opts.internalnorm(atmp, t) end - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) end function initialize!(integrator, cache::SSPRKMSVS32ConstantCache) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1185,7 +1185,7 @@ end k = f(u, p, t + dt) u = uprev + dt * k k = f(u, p, t + dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) u = (uprev + u + dt * k) / 2 if cache.step == 1 u_2 = uprev @@ -1227,12 +1227,12 @@ end end if accpt == true integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.u = u else integrator.fsallast = f(uprev, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.u = uprev end @@ -1250,7 +1250,7 @@ function initialize!(integrator, cache::SSPRKMSVS32Cache) integrator.fsallast = cache.k integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::SSPRKMSVS32Cache, repeat_step = false) @@ -1261,7 +1261,7 @@ end @.. broadcast=false thread=thread u=uprev + dt * fsalfirst stage_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread u=(uprev + u + dt * k) / 2 stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) @@ -1282,7 +1282,7 @@ end step_limiter!(u, integrator, p, t + dt) end cache.step += 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(k, u, p, t + dt) end @@ -1290,7 +1290,7 @@ function initialize!(integrator, cache::SSPRKMSVS43ConstantCache) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1309,17 +1309,17 @@ end if cache.step == 1 u_3 = uprev cache.k3 = f(u_3, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end if cache.step == 2 u_2 = uprev cache.k2 = f(u_2, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end if cache.step == 3 u_1 = uprev cache.k1 = f(u_1, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # u else @@ -1333,7 +1333,7 @@ end u_1 = uprev end integrator.fsallast = f(u, p, t + dt) # For interpolation, then FSAL'd - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[1] = integrator.fsalfirst integrator.u = u cache.step += 1 @@ -1349,7 +1349,7 @@ function initialize!(integrator, cache::SSPRKMSVS43Cache) integrator.fsallast = cache.k integrator.k[1] = integrator.fsalfirst integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::SSPRKMSVS43Cache, repeat_step = false) @@ -1360,24 +1360,24 @@ end @.. broadcast=false thread=thread u=uprev + dt * fsalfirst stage_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread u=(uprev + u + dt * k) / 2 stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) if cache.step == 1 cache.u_3 .= uprev f(k3, u_3, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end if cache.step == 2 cache.u_2 .= uprev f(k2, u_2, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end if cache.step == 3 cache.u_1 .= uprev f(k1, u_1, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end # u else @@ -1393,7 +1393,7 @@ end cache.u_1 .= uprev end cache.step += 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f(k, u, p, t + dt) end @@ -1401,7 +1401,7 @@ function initialize!(integrator, cache::SSPRK932ConstantCache) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -1432,12 +1432,12 @@ end # u5 u = u + dt_6 * k k = f(u, p, t + 5 * dt_6) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) # u6 u = u + dt_6 * k if integrator.opts.adaptive k = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) utilde = (uprev + 6 * u + 6 * dt * k) / 7 end # u6* @@ -1452,7 +1452,7 @@ end # u u = u + dt_6 * k - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if integrator.opts.adaptive utilde = utilde - u atmp = calculate_residuals(utilde, uprev, u, integrator.opts.abstol, @@ -1499,13 +1499,13 @@ end @.. broadcast=false thread=thread u=u + dt_6 * k stage_limiter!(u, integrator, p, t + 5 * dt_6) f(k, u, p, t + 5 * dt_6) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) # u6 @.. broadcast=false thread=thread u=u + dt_6 * k if integrator.opts.adaptive stage_limiter!(u, integrator, p, t + dt) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false thread=thread utilde=(uprev + 6 * u + 6 * dt * k) / 7 end # u6* @@ -1525,7 +1525,7 @@ end @.. broadcast=false thread=thread u=u + dt_6 * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) if integrator.opts.adaptive @.. broadcast=false thread=thread utilde=utilde - u @@ -1538,7 +1538,7 @@ end function initialize!(integrator, cache::SSPRK54ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -1568,7 +1568,7 @@ end # u u = α52 * u₂ + α53 * u₃ + β53 * dt * k₃ + α54 * tmp + β54 * dt * k - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.u = u end @@ -1608,12 +1608,12 @@ end β54 * dt * k stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) end function initialize!(integrator, cache::SSPRK104ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.kshortsize = 1 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -1651,7 +1651,7 @@ end k = f(tmp, p, t + dt) u = (uprev + 9 * (u + dt_6 * k₄) + 15 * (tmp + dt_6 * k)) / 25 - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) integrator.u = u end @@ -1703,5 +1703,5 @@ end 15 * (tmp + dt_6 * k)) / 25 stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) end diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl index 4ddfaaa63b..b79139d3bd 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl @@ -5,7 +5,7 @@ function initialize!(integrator, cache::IRKCConstantCache) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) cache.du₁ = f1(uprev, p, t) cache.du₂ = f2(uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsalfirst = cache.du₁ + cache.du₂ @@ -82,7 +82,7 @@ function perform_step!(integrator, cache::IRKCConstantCache, repeat_step = false f1ⱼ₋₁ = f1(gprev, p, t + Cⱼ₋₁ * dt) f2ⱼ₋₁ = f2(gprev, p, t + Cⱼ₋₁ * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 nlsolver.tmp = (1 - μ - ν) * uprev + μ * gprev + ν * gprev2 + dt * μs * f2ⱼ₋₁ + dt * νs * du₂ + (νs - (1 - μ - ν) * μs₁) * dt * du₁ - @@ -112,7 +112,7 @@ function perform_step!(integrator, cache::IRKCConstantCache, repeat_step = false cache.du₁ = f1(u, p, t + dt) cache.du₂ = f2(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # error estimate if isnewton(nlsolver) && integrator.opts.adaptive @@ -141,7 +141,7 @@ function initialize!(integrator, cache::IRKCCache) integrator.k[2] = integrator.fsallast f1(cache.du₁, uprev, p, t) f2(cache.du₂, uprev, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 @.. broadcast=false integrator.fsalfirst=cache.du₁ + cache.du₂ end @@ -216,7 +216,7 @@ function perform_step!(integrator, cache::IRKCCache, repeat_step = false) f1(f1ⱼ₋₁, gprev, p, t + Cⱼ₋₁ * dt) f2(f2ⱼ₋₁, gprev, p, t + Cⱼ₋₁ * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 @.. broadcast=false nlsolver.tmp=(1 - μ - ν) * uprev + μ * gprev + ν * gprev2 + dt * μs * f2ⱼ₋₁ + dt * νs * du₂ + @@ -249,7 +249,7 @@ function perform_step!(integrator, cache::IRKCCache, repeat_step = false) @.. broadcast=false f2ⱼ₋₁=du₂ f1(du₁, u, p, t + dt) f2(du₂, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 # error estimate if isnewton(nlsolver) && integrator.opts.adaptive diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl index 4edcebe0e5..ec854aa330 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_utils.jl @@ -19,7 +19,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqConstantCache) else fz = fsalfirst z = f(fz, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end else z = cache.zprev @@ -56,7 +56,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqConstantCache) tmp = fz - cache.du₂ else fz = f(z, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = fz - fsalfirst end Δ = integrator.opts.internalnorm(tmp, t) @@ -122,7 +122,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqMutableCache) else @.. broadcast=false fz=fsalfirst f(z, fz, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end else @.. broadcast=false z=ccache.zprev @@ -159,7 +159,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqMutableCache) @.. broadcast=false atmp=fz - cache.du₂ else f(fz, z, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false atmp=fz - fsalfirst end Δ = integrator.opts.internalnorm(atmp, t) diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl index 15188ea209..68149a4e19 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl @@ -2,7 +2,7 @@ function initialize!(integrator, cache::ROCK2ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) alg = unwrap_alg(integrator, true) cache.max_stage = (alg.max_stages < 1 || alg.max_stages > 200) ? 200 : alg.max_stages cache.min_stage = (alg.min_stages > cache.max_stage) ? cache.max_stage : alg.min_stages @@ -46,11 +46,11 @@ end δt₁ = dt * fp1[cache.deg_index] δt₂ = dt * fp2[cache.deg_index] uᵢ₋₂ = f(u, p, tᵢ₋₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) uᵢ₋₁ = u + δt₁ * uᵢ₋₂ tᵢ₋₁ += δt₁ u = f(uᵢ₋₁, p, tᵢ₋₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive tmp = δt₂ * (u - uᵢ₋₂) @@ -66,7 +66,7 @@ end end integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -84,7 +84,7 @@ function initialize!(integrator, cache::ROCK2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ROCK2Cache, repeat_step = false) @@ -125,7 +125,7 @@ end δt₁ = dt * fp1[ccache.deg_index] δt₂ = dt * fp2[ccache.deg_index] f(k, u, p, tᵢ₋₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false uᵢ₋₁=u + δt₁ * k if integrator.opts.adaptive @.. broadcast=false tmp=-δt₂ * k @@ -135,7 +135,7 @@ end c = DiffEqBase.value(sign(δt₁)) * integrator.opts.internalnorm(δt₁, t) tᵢ₋₁ += c f(k, uᵢ₋₁, p, tᵢ₋₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @.. broadcast=false tmp+=δt₂ * k @@ -152,7 +152,7 @@ end end integrator.k[1] = integrator.fsalfirst f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[2] = integrator.fsallast integrator.u = u end @@ -161,7 +161,7 @@ function initialize!(integrator, cache::ROCK4ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) alg = unwrap_alg(integrator, true) cache.max_stage = (alg.max_stages < 1 || alg.max_stages > 152) ? 152 : alg.max_stages cache.min_stage = (alg.min_stages > cache.max_stage) ? cache.max_stage : alg.min_stages @@ -223,7 +223,7 @@ end # 4-stage finishing procedure. # Stage-1 uᵢ₋₁ = f(u, p, tᵢ₋₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) uᵢ₋₂ = u + a₃₁ * uᵢ₋₁ uᵢ₋₃ = u + a₄₁ * uᵢ₋₁ u += B₁ * uᵢ₋₁ @@ -235,7 +235,7 @@ end _c₂ = DiffEqBase.value(sign(c₂)) * integrator.opts.internalnorm(c₂, t) tᵢ₋₂ = tᵢ₋₁ + _c₂ uᵢ₋₁ = f(uᵢ₋₁, p, tᵢ₋₂) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) uᵢ₋₂ += a₃₂ * uᵢ₋₁ uᵢ₋₃ += a₄₂ * uᵢ₋₁ u += B₂ * uᵢ₋₁ @@ -246,7 +246,7 @@ end _c₃ = DiffEqBase.value(sign(c₃)) * integrator.opts.internalnorm(c₃, t) tᵢ₋₂ = tᵢ₋₁ + _c₃ uᵢ₋₂ = f(uᵢ₋₂, p, tᵢ₋₂) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) uᵢ₋₃ += a₄₃ * uᵢ₋₂ u += B₃ * uᵢ₋₂ integrator.opts.adaptive && (tmp += B̂₃ * uᵢ₋₂) @@ -256,12 +256,12 @@ end _c₄ = DiffEqBase.value(sign(c₄)) * integrator.opts.internalnorm(c₄, t) tᵢ₋₂ = tᵢ₋₁ + _c₄ uᵢ₋₃ = f(uᵢ₋₃, p, tᵢ₋₂) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u += B₄ * uᵢ₋₃ integrator.opts.adaptive && (tmp += B̂₄ * uᵢ₋₃) uᵢ₋₁ = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) #Error estimate (embedded method of order 3) if integrator.opts.adaptive @@ -289,7 +289,7 @@ function initialize!(integrator, cache::ROCK4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ROCK4Cache, repeat_step = false) @@ -349,7 +349,7 @@ end # Stage-1 f(k, u, p, tᵢ₋₁) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false uᵢ₋₂=u + a₃₁ * k @.. broadcast=false uᵢ₋₃=u + a₄₁ * k @.. broadcast=false uᵢ₋₁=u + a₂₁ * k @@ -361,7 +361,7 @@ end _c₂ = DiffEqBase.value(sign(c₂)) * integrator.opts.internalnorm(c₂, t) tᵢ₋₂ = tᵢ₋₁ + _c₂ f(k, uᵢ₋₁, p, tᵢ₋₂) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false uᵢ₋₂+=a₃₂ * k @.. broadcast=false uᵢ₋₃+=a₄₂ * k @.. broadcast=false u+=B₂ * k @@ -372,7 +372,7 @@ end _c₃ = DiffEqBase.value(sign(c₃)) * integrator.opts.internalnorm(c₃, t) tᵢ₋₂ = tᵢ₋₁ + _c₃ f(k, uᵢ₋₂, p, tᵢ₋₂) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false uᵢ₋₃+=a₄₃ * k @.. broadcast=false u+=B₃ * k integrator.opts.adaptive && (@.. broadcast=false tmp+=B̂₃ * k) @@ -382,12 +382,12 @@ end _c₄ = DiffEqBase.value(sign(c₄)) * integrator.opts.internalnorm(c₄, t) tᵢ₋₂ = tᵢ₋₁ + _c₄ f(k, uᵢ₋₃, p, tᵢ₋₂) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u+=B₄ * k integrator.opts.adaptive && (tmp += B̂₄ * k) f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) #Error estimate (embedded method of order 3) if integrator.opts.adaptive @@ -406,7 +406,7 @@ function initialize!(integrator, cache::RKCConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -457,7 +457,7 @@ end μs = μ * w1 / w0 #using u as temporary storage u = f(gprev, p, t + dt * th1) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = μ * gprev + ν * gprev2 + (1 - μ - ν) * uprev + dt * μs * (u - νs * fsalfirst) th = μ * th1 + ν * th2 + μs * (1 - νs) if (iter < mdeg) @@ -484,7 +484,7 @@ end end integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -496,7 +496,7 @@ function initialize!(integrator, cache::RKCCache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::RKCCache, repeat_step = false) @@ -542,7 +542,7 @@ end ν = -b / b2 μs = μ * w1 / w0 f(k, gprev, p, t + dt * th1) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=μ * gprev + ν * gprev2 + (1 - μ - ν) * uprev + dt * μs * (k - νs * fsalfirst) th = μ * th1 + ν * th2 + μs * (1 - νs) @@ -570,7 +570,7 @@ end end integrator.k[1] = integrator.fsalfirst f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[2] = integrator.fsallast integrator.u = u end @@ -579,7 +579,7 @@ function initialize!(integrator, cache::ESERK4ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst @@ -615,7 +615,7 @@ end Sᵢ = (cache.Bᵢ[start]) * uᵢ₋₁ for st in 1:mdeg k = f(uᵢ₋₁, p, r) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if st % internal_deg == 1 uᵢ = uᵢ₋₁ + α * hᵢ * k @@ -650,7 +650,7 @@ end end integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -662,7 +662,7 @@ function initialize!(integrator, cache::ESERK4Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ESERK4Cache, repeat_step = false) @@ -695,7 +695,7 @@ end @.. broadcast=false Sᵢ=(cache.constantcache.Bᵢ[start]) * uᵢ₋₁ for st in 1:mdeg f(k, uᵢ₋₁, p, r) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if st % internal_deg == 1 @.. broadcast=false uᵢ=uᵢ₋₁ + α * hᵢ * k @@ -731,7 +731,7 @@ end end integrator.k[1] = integrator.fsalfirst f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[2] = integrator.fsallast integrator.u = u end @@ -740,7 +740,7 @@ function initialize!(integrator, cache::ESERK5ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst @@ -775,7 +775,7 @@ end Sᵢ = (Bᵢ[start]) * uᵢ₋₁ for st in 1:mdeg k = f(uᵢ₋₁, p, r) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if st % internal_deg == 1 uᵢ = uᵢ₋₁ + α * hᵢ * k @@ -810,7 +810,7 @@ end end integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = u end @@ -822,7 +822,7 @@ function initialize!(integrator, cache::ESERK5Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::ESERK5Cache, repeat_step = false) @@ -855,7 +855,7 @@ end @.. broadcast=false Sᵢ=(Bᵢ[start]) * uᵢ₋₁ for st in 1:mdeg f(k, uᵢ₋₁, p, r) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if st % internal_deg == 1 @.. broadcast=false uᵢ=uᵢ₋₁ + α * hᵢ * k @@ -891,7 +891,7 @@ end end integrator.k[1] = integrator.fsalfirst f(integrator.fsallast, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.k[2] = integrator.fsallast integrator.u = u end @@ -900,7 +900,7 @@ function initialize!(integrator, cache::SERK2ConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) integrator.k[1] = integrator.fsalfirst @@ -927,14 +927,14 @@ end Sᵢ = Bᵢ[start] * uprev for i in 1:10 k = f(uᵢ₋₁, p, t + (1 + (i - 1) * internal_deg^2) * α * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = uᵢ₋₁ + α * dt * k Sᵢ = Sᵢ + Bᵢ[start + (i - 1) * internal_deg + 1] * u uᵢ₋₂ = uᵢ₋₁ uᵢ₋₁ = u for j in 2:internal_deg k = f(uᵢ₋₁, p, t + (j^2 + (i - 1) * internal_deg^2) * α * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) u = 2 * uᵢ₋₁ - uᵢ₋₂ + 2 * α * dt * k Sᵢ = Sᵢ + Bᵢ[start + j + (i - 1) * internal_deg] * u if j * i < mdeg @@ -945,7 +945,7 @@ end end u = Sᵢ k = f(u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive tmp = u - uprev - dt * k @@ -966,7 +966,7 @@ function initialize!(integrator, cache::SERK2Cache) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::SERK2Cache, repeat_step = false) @@ -991,14 +991,14 @@ end @.. broadcast=false Sᵢ=Bᵢ[start] * uprev for i in 1:10 f(k, uᵢ₋₁, p, t + (1 + (i - 1) * internal_deg^2) * α * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=uᵢ₋₁ + α * dt * k @.. broadcast=false Sᵢ=Sᵢ + Bᵢ[start + (i - 1) * internal_deg + 1] * u @.. broadcast=false uᵢ₋₂=uᵢ₋₁ @.. broadcast=false uᵢ₋₁=u for j in 2:internal_deg f(k, uᵢ₋₂, p, t + (j^2 + (i - 1) * internal_deg^2) * α * dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false u=2 * uᵢ₋₁ - uᵢ₋₂ + 2 * α * dt * k @.. broadcast=false Sᵢ=Sᵢ + Bᵢ[start + j + (i - 1) * internal_deg] * u if j < mdeg @@ -1009,7 +1009,7 @@ end end @.. broadcast=false u=Sᵢ f(k, u, p, t + dt) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) if integrator.opts.adaptive @.. broadcast=false tmp=u - uprev - dt * k diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_utils.jl b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_utils.jl index 91b89ac73a..9fda5070e5 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_utils.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_utils.jl @@ -15,7 +15,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqConstantCache) else fz = fsalfirst z = f(fz, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end else z = cache.zprev @@ -47,7 +47,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqConstantCache) integrator.eigen_est = 0 for iter in 1:maxiter fz = f(z, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) tmp = fz - fsalfirst Δ = integrator.opts.internalnorm(tmp, t) eig_prev = integrator.eigen_est @@ -104,7 +104,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqMutableCache) else @.. broadcast=false fz=fsalfirst f(z, fz, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end else @.. broadcast=false z=ccache.zprev @@ -136,7 +136,7 @@ function maxeig!(integrator, cache::OrdinaryDiffEqMutableCache) integrator.eigen_est = 0 for iter in 1:maxiter f(fz, z, p, t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @.. broadcast=false atmp=fz - fsalfirst Δ = integrator.opts.internalnorm(atmp, t) eig_prev = integrator.eigen_est diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl index 413f1882a2..c03b2a277e 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl @@ -12,7 +12,7 @@ function initialize!(integrator, cache::SymplecticEulerConstantCache) @muladd du = duprev + integrator.dt * kdu ku = integrator.f.f2(du, uprev, integrator.p, integrator.t) integrator.stats.nf2 += 1 - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) integrator.fsalfirst = ArrayPartition((kdu, kuprev)) integrator.fsallast = ArrayPartition((zero(kdu), ku)) end @@ -30,7 +30,7 @@ end ku = f.f2(du, u, p, t) integrator.stats.nf2 += 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.u = ArrayPartition((du, u)) integrator.fsallast = ArrayPartition((kdu, ku)) @@ -56,7 +56,7 @@ function initialize!(integrator, cache::SymplecticEulerCache) integrator.f.f2(kuprev, duprev, uprev, integrator.p, integrator.t) @muladd @.. broadcast=false du=duprev + integrator.dt * kdu integrator.f.f2(ku, du, uprev, integrator.p, integrator.t) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 2 end @@ -70,7 +70,7 @@ end # Now actually compute the step # Do it at the end for interpolations! integrator.stats.nf2 += 1 - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) f.f1(kdu, duprev, u, p, t) @.. broadcast=false du=duprev + dt * kdu f.f2(ku, du, u, p, t) @@ -155,7 +155,7 @@ function initialize!(integrator, integrator.f.f1(integrator.k[2].x[1], duprev, uprev, integrator.p, integrator.t) verify_f2(integrator.f.f2, integrator.k[2].x[2], duprev, uprev, integrator.p, integrator.t, integrator, cache) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 end @@ -170,7 +170,7 @@ function initialize!(integrator, kdu = integrator.f.f1(duprev, uprev, integrator.p, integrator.t) ku = verify_f2(integrator.f.f2, duprev, uprev, integrator.p, integrator.t, integrator, cache) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) integrator.stats.nf2 += 1 integrator.fsallast = ArrayPartition((kdu, ku)) integrator.k[2] = integrator.fsallast @@ -191,7 +191,7 @@ end # v(t+Δt) = v(t) + 1/2*(a(t)+a(t+Δt))*Δt du = duprev + dt * (half * ku + half * kdu) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) store_symp_state!(integrator, cache, du, u, kdu, du) end @@ -206,7 +206,7 @@ end half = cache.half @.. broadcast=false u=uprev + dt * duprev + dtsq * (half * ku) f.f1(kdu, duprev, u, p, t + dt) - integrator.stats.nf += 2 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 2) # v(t+Δt) = v(t) + 1/2*(a(t)+a(t+Δt))*Δt @.. broadcast=false du=duprev + dt * (half * ku + half * kdu) @@ -234,7 +234,7 @@ end kdu = f.f1(du, u, p, tnew) ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.stats.nf2 += 2 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -260,7 +260,7 @@ end f.f1(kdu, du, u, p, tnew) f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) integrator.stats.nf2 += 2 store_symp_state!(integrator, cache, kdu, ku) end @@ -294,7 +294,7 @@ end kdu = f.f1(du, u, p, tnew) ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 3 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -328,7 +328,7 @@ end f.f1(kdu, du, u, p, tnew) f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 4 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 4) integrator.stats.nf2 += 3 store_symp_state!(integrator, cache, kdu, ku) end @@ -370,7 +370,7 @@ end kdu = f.f1(du, u, p, tnew) ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.stats.nf2 += 4 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -412,7 +412,7 @@ end f.f1(kdu, du, u, p, tnew) f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.stats.nf2 += 4 store_symp_state!(integrator, cache, kdu, ku) end @@ -462,11 +462,11 @@ end if alg isa McAte42 du = du + dt * a5 * kdu kdu = f.f1(du, u, p, tnew) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.stats.nf2 += 5 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -516,11 +516,11 @@ end if alg isa McAte42 @.. broadcast=false du=du + dt * a5 * kdu f.f1(kdu, du, u, p, tnew) - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 5 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) integrator.stats.nf2 += 5 store_symp_state!(integrator, cache, kdu, ku) end @@ -577,7 +577,7 @@ end kdu = f.f1(du, u, p, tnew) ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.stats.nf2 += 6 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -634,7 +634,7 @@ end f.f1(kdu, du, u, p, tnew) f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 7 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) integrator.stats.nf2 += 6 store_symp_state!(integrator, cache, kdu, ku) end @@ -704,7 +704,7 @@ end # @.. broadcast=false du = du + dt*a8*kdu ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.stats.nf2 += 8 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -774,7 +774,7 @@ end # @.. broadcast=false du = du + dt*a8*kdu f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) integrator.stats.nf2 += 8 store_symp_state!(integrator, cache, kdu, ku) end @@ -858,7 +858,7 @@ end # @.. broadcast=false du = du + dt*a10*kdu ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) integrator.stats.nf2 += 10 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -942,7 +942,7 @@ end # @.. broadcast=false du = du + dt*a10*kdu f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) integrator.stats.nf2 += 10 store_symp_state!(integrator, cache, kdu, ku) end @@ -1068,7 +1068,7 @@ end # @.. broadcast=false du = du + dt*a16*kdu ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) integrator.stats.nf2 += 16 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -1195,7 +1195,7 @@ end # @.. broadcast=false du = du + dt*a16*kdu f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) integrator.stats.nf2 += 16 store_symp_state!(integrator, cache, kdu, ku) end @@ -1336,7 +1336,7 @@ end # @.. broadcast=false du = du + dt*a18*kdu ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 18 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 18) integrator.stats.nf2 += 18 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -1477,7 +1477,7 @@ end # @.. broadcast=false du = du + dt*a18*kdu f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 18 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 18) integrator.stats.nf2 += 18 store_symp_state!(integrator, cache, kdu, ku) end @@ -1748,7 +1748,7 @@ end # @.. broadcast=false du = du + dt*a30*kdu ku = f.f2(du, u, p, tnew) - integrator.stats.nf += 36 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 36) integrator.stats.nf2 += 36 store_symp_state!(integrator, cache, du, u, kdu, ku) end @@ -2019,7 +2019,7 @@ end # @.. broadcast=false du = du + dt*a30*kdu f.f2(ku, du, u, p, tnew) - integrator.stats.nf += 36 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 36) integrator.stats.nf2 += 36 store_symp_state!(integrator, cache, kdu, ku) end diff --git a/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl b/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl index a17c23a618..dd702ce5e9 100644 --- a/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl +++ b/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl @@ -109,7 +109,7 @@ function initialize!(integrator, cache::Tsit5ConstantCache) integrator.kshortsize = 7 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) # Avoid undefined entries if k is an array of arrays integrator.fsallast = zero(integrator.fsalfirst) @@ -136,7 +136,7 @@ end u = uprev + dt * (a71 * k1 + a72 * k2 + a73 * k3 + a74 * k4 + a75 * k5 + a76 * k6) integrator.fsallast = f(u, p, t + dt) k7 = integrator.fsallast - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) if integrator.alg isa CompositeAlgorithm g7 = u # Hairer II, page 22 modified to use the Inf norm @@ -175,7 +175,7 @@ function initialize!(integrator, cache::Tsit5Cache) integrator.k[6] = cache.k6 integrator.k[7] = cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) return nothing end @@ -210,7 +210,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k7, u, p, t + dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) if integrator.alg isa CompositeAlgorithm g7 = u g6 = tmp diff --git a/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl b/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl index 75704ce69e..73e3fa9718 100644 --- a/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl @@ -1,6 +1,6 @@ function initialize!(integrator, cache::Vern6ConstantCache) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) alg = unwrap_alg(integrator, false) cache.lazy ? (integrator.kshortsize = 9) : (integrator.kshortsize = 12) integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -37,7 +37,7 @@ end u = uprev + dt * (a91 * k1 + a94 * k4 + a95 * k5 + a96 * k6 + a97 * k7 + a98 * k8) integrator.fsallast = f(u, p, t + dt) k9 = integrator.fsallast - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) if integrator.alg isa CompositeAlgorithm g9 = u integrator.eigen_est = integrator.opts.internalnorm( @@ -85,7 +85,7 @@ end a1211 * k[11]), p, t + c12 * dt) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) end integrator.u = u @@ -115,7 +115,7 @@ function initialize!(integrator, cache::Vern6Cache) end integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - integrator.stats.nf += 1 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @muladd function perform_step!(integrator, cache::Vern6Cache, repeat_step = false) @@ -158,7 +158,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k9, u, p, t + dt) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) if integrator.alg isa CompositeAlgorithm g9 = u g8 = tmp @@ -202,7 +202,7 @@ end a1206 * k[6] + a1207 * k[7] + a1208 * k[8] + a1209 * k[9] + a1210 * k[10] + a1211 * k[11]) - integrator.stats.nf += 3 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) f(k[12], tmp, p, t + c12 * dt) end return nothing @@ -245,7 +245,7 @@ end dt * (a101 * k1 + a103 * k3 + a104 * k4 + a105 * k5 + a106 * k6 + a107 * k7) k9 = f(g9, p, t + dt) k10 = f(g10, p, t + dt) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) u = uprev + dt * (b1 * k1 + b4 * k4 + b5 * k5 + b6 * k6 + b7 * k7 + b8 * k8 + b9 * k9) if integrator.alg isa CompositeAlgorithm integrator.eigen_est = integrator.opts.internalnorm( @@ -316,7 +316,7 @@ end a1612 * k[12] + a1613 * k[13]), p, t + c16 * dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) end end @@ -406,7 +406,7 @@ end b9 * k9) stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) if integrator.alg isa CompositeAlgorithm g10 = u g9 = tmp @@ -474,7 +474,7 @@ end a1611 * k[11] + a1612 * k[12] + a1613 * k[13]) f(k[16], tmp, p, t + c16 * dt) - integrator.stats.nf += 6 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 6) end return nothing end @@ -534,7 +534,7 @@ end a1309 * k9 + a1310 * k10) k12 = f(g12, p, t + dt) k13 = f(g13, p, t + dt) - integrator.stats.nf += 13 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 13) u = uprev + dt * (b1 * k1 + b6 * k6 + b7 * k7 + b8 * k8 + b9 * k9 + b10 * k10 + b11 * k11 + b12 * k12) @@ -625,7 +625,7 @@ end a2114 * k[14] + a2115 * k[15] + a2116 * k[16] + a2117 * k[17]), p, t + c21 * dt) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) end end @@ -726,7 +726,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k13, u, p, t + dt) - integrator.stats.nf += 13 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 13) if integrator.alg isa CompositeAlgorithm g13 = u g12 = tmp @@ -831,7 +831,7 @@ end a2112 * k[12] + a2114 * k[14] + a2115 * k[15] + a2116 * k[16] + a2117 * k[17]) - integrator.stats.nf += 8 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 8) f(k[21], tmp, p, t + c21 * dt) end return nothing @@ -901,7 +901,7 @@ end a1611 * k11 + a1612 * k12 + a1613 * k13) k15 = f(g15, p, t + dt) k16 = f(g16, p, t + dt) - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) u = uprev + dt * (b1 * k1 + b8 * k8 + b9 * k9 + b10 * k10 + b11 * k11 + b12 * k12 + b13 * k13 + b14 * k14 + b15 * k15) @@ -1011,7 +1011,7 @@ end a2620 * k[14] + a2621 * k[15]), p, t + c26 * dt) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) end end @@ -1131,7 +1131,7 @@ end stage_limiter!(u, integrator, p, t + dt) step_limiter!(u, integrator, p, t + dt) f(k16, u, p, t + dt) - integrator.stats.nf += 16 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 16) if integrator.alg isa CompositeAlgorithm g16 = u g15 = tmp @@ -1261,7 +1261,7 @@ end a2618 * k[12] + a2619 * k[13] + a2620 * k[14] + a2621 * k[15]) - integrator.stats.nf += 10 + OrdinaryDiffEqCore.increment_nf!(integrator.stats, 10) f(k[20], tmp, p, t + c26 * dt) end return nothing From 0305da20551b5223f67ae9f5a8cfa92661986e29 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 07:20:00 -0400 Subject: [PATCH 06/55] Bump OrdinaryDiffEqCore requirements and import --- lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml | 2 +- .../src/OrdinaryDiffEqAdamsBashforthMoulton.jl | 1 + lib/OrdinaryDiffEqBDF/Project.toml | 2 +- lib/OrdinaryDiffEqCore/Project.toml | 2 +- lib/OrdinaryDiffEqDefault/Project.toml | 2 +- lib/OrdinaryDiffEqDifferentiation/Project.toml | 2 +- .../src/OrdinaryDiffEqDifferentiation.jl | 1 + lib/OrdinaryDiffEqExponentialRK/Project.toml | 2 +- lib/OrdinaryDiffEqExtrapolation/Project.toml | 2 +- .../src/OrdinaryDiffEqExtrapolation.jl | 1 + lib/OrdinaryDiffEqFIRK/Project.toml | 2 +- lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl | 1 + lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl | 1 + lib/OrdinaryDiffEqFunctionMap/Project.toml | 2 +- lib/OrdinaryDiffEqHighOrderRK/Project.toml | 2 +- lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl | 1 + lib/OrdinaryDiffEqIMEXMultistep/Project.toml | 2 +- lib/OrdinaryDiffEqLinear/Project.toml | 2 +- lib/OrdinaryDiffEqLowOrderRK/Project.toml | 2 +- lib/OrdinaryDiffEqLowStorageRK/Project.toml | 2 +- lib/OrdinaryDiffEqNonlinearSolve/Project.toml | 2 +- lib/OrdinaryDiffEqNordsieck/Project.toml | 2 +- lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl | 2 +- lib/OrdinaryDiffEqPDIRK/Project.toml | 2 +- lib/OrdinaryDiffEqPRK/Project.toml | 2 +- lib/OrdinaryDiffEqQPRK/Project.toml | 2 +- lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl | 1 + lib/OrdinaryDiffEqRKN/Project.toml | 2 +- lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl | 1 + lib/OrdinaryDiffEqRosenbrock/Project.toml | 2 +- lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl | 2 ++ lib/OrdinaryDiffEqSDIRK/Project.toml | 2 +- lib/OrdinaryDiffEqSSPRK/Project.toml | 2 +- lib/OrdinaryDiffEqStabilizedIRK/Project.toml | 2 +- .../src/OrdinaryDiffEqStabilizedIRK.jl | 1 + lib/OrdinaryDiffEqStabilizedRK/Project.toml | 2 +- .../src/OrdinaryDiffEqStabilizedRK.jl | 1 + lib/OrdinaryDiffEqSymplecticRK/Project.toml | 2 +- .../src/OrdinaryDiffEqSymplecticRK.jl | 1 + lib/OrdinaryDiffEqTsit5/Project.toml | 2 +- lib/OrdinaryDiffEqVerner/Project.toml | 2 +- 41 files changed, 42 insertions(+), 29 deletions(-) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml b/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml index bf8227cebc..0bc84c87db 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml @@ -22,7 +22,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqLowOrderRK = "<0.0.1, 1" Polyester = "0.7.16" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl index 4a6951f9e3..05b2a19bb4 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl @@ -14,6 +14,7 @@ import RecursiveArrayTools: recursivefill! using MuladdMacro, FastBroadcast import Static: False import ADTypes: AutoForwardDiff +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqBDF/Project.toml b/lib/OrdinaryDiffEqBDF/Project.toml index 554298b9fd..efd5726b28 100644 --- a/lib/OrdinaryDiffEqBDF/Project.toml +++ b/lib/OrdinaryDiffEqBDF/Project.toml @@ -31,7 +31,7 @@ LinearAlgebra = "<0.0.1, 1" MacroTools = "0.5.13" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" OrdinaryDiffEqSDIRK = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqCore/Project.toml b/lib/OrdinaryDiffEqCore/Project.toml index da7cb6e978..54e9b821eb 100644 --- a/lib/OrdinaryDiffEqCore/Project.toml +++ b/lib/OrdinaryDiffEqCore/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqCore" uuid = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/lib/OrdinaryDiffEqDefault/Project.toml b/lib/OrdinaryDiffEqDefault/Project.toml index bbcf79a48a..28fda89b62 100644 --- a/lib/OrdinaryDiffEqDefault/Project.toml +++ b/lib/OrdinaryDiffEqDefault/Project.toml @@ -24,7 +24,7 @@ EnumX = "1.0.4" LinearAlgebra = "<0.0.1, 1" LinearSolve = "2.32.0" OrdinaryDiffEqBDF = "<0.0.1, 1" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqRosenbrock = "<0.0.1, 1" OrdinaryDiffEqTsit5 = "<0.0.1, 1" OrdinaryDiffEqVerner = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqDifferentiation/Project.toml b/lib/OrdinaryDiffEqDifferentiation/Project.toml index 45728b4d86..399a3d542c 100644 --- a/lib/OrdinaryDiffEqDifferentiation/Project.toml +++ b/lib/OrdinaryDiffEqDifferentiation/Project.toml @@ -33,7 +33,7 @@ FunctionWrappersWrappers = "0.1" InteractiveUtils = "1.10" LinearAlgebra = "1.10" LinearSolve = "2" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Random = "<0.0.1, 1" SafeTestsets = "0.1.0" SciMLBase = "2" diff --git a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl index 4fdbd9f54b..e490647c60 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl @@ -30,6 +30,7 @@ using DiffEqBase: TimeGradientWrapper, UJacobianWrapper, TimeDerivativeWrapper, UDerivativeWrapper using SciMLBase: AbstractSciMLOperator +import OrdinaryDiffEqCore using OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, OrdinaryDiffEqAdaptiveImplicitAlgorithm, DAEAlgorithm, OrdinaryDiffEqImplicitAlgorithm, CompositeAlgorithm, diff --git a/lib/OrdinaryDiffEqExponentialRK/Project.toml b/lib/OrdinaryDiffEqExponentialRK/Project.toml index c3dadcf16a..a2fab24e98 100644 --- a/lib/OrdinaryDiffEqExponentialRK/Project.toml +++ b/lib/OrdinaryDiffEqExponentialRK/Project.toml @@ -25,7 +25,7 @@ FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" LinearSolve = "2.32.0" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqSDIRK = "<0.0.1, 1" OrdinaryDiffEqTsit5 = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqExtrapolation/Project.toml b/lib/OrdinaryDiffEqExtrapolation/Project.toml index 96da66f8ba..325138cd55 100644 --- a/lib/OrdinaryDiffEqExtrapolation/Project.toml +++ b/lib/OrdinaryDiffEqExtrapolation/Project.toml @@ -20,7 +20,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" LinearSolve = "2.32.0" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" Polyester = "0.7.16" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl b/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl index 1497208b5f..0d556b647e 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl @@ -18,6 +18,7 @@ import OrdinaryDiffEqCore: alg_order, alg_maximum_order, get_current_adaptive_or _digest_beta1_beta2, timedepentdtmin, _unwrap_val, _reshape, _vec using DiffEqBase, FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools, LinearSolve +import OrdinaryDiffEqCore import OrdinaryDiffEqDifferentiation: TimeDerivativeWrapper, UDerivativeWrapper, calc_J, WOperator, TimeGradientWrapper, UJacobianWrapper, build_grad_config, diff --git a/lib/OrdinaryDiffEqFIRK/Project.toml b/lib/OrdinaryDiffEqFIRK/Project.toml index 38efd4bb8c..200b1c0544 100644 --- a/lib/OrdinaryDiffEqFIRK/Project.toml +++ b/lib/OrdinaryDiffEqFIRK/Project.toml @@ -24,7 +24,7 @@ LinearAlgebra = "<0.0.1, 1" LinearSolve = "2.32.0" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl b/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl index 7f0a163319..9d92ae5b59 100644 --- a/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl +++ b/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl @@ -22,6 +22,7 @@ using SciMLOperators: AbstractSciMLOperator using LinearAlgebra: I, UniformScaling, mul!, lu import LinearSolve import FastBroadcast: @.. +import OrdinaryDiffEqCore using OrdinaryDiffEqDifferentiation: UJacobianWrapper, build_J_W, build_jac_config, UDerivativeWrapper, calc_J!, dolinsolve, calc_J, diff --git a/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl b/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl index a4ad6d2fd3..e49507ebae 100644 --- a/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl +++ b/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl @@ -13,6 +13,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools using DiffEqBase: @def, @tight_loop_macros using Static: False +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqFunctionMap/Project.toml b/lib/OrdinaryDiffEqFunctionMap/Project.toml index 6a4bf4bfcc..a556751605 100644 --- a/lib/OrdinaryDiffEqFunctionMap/Project.toml +++ b/lib/OrdinaryDiffEqFunctionMap/Project.toml @@ -18,7 +18,7 @@ DiffEqBase = "6.152.2" DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Random = "<0.0.1, 1" RecursiveArrayTools = "3.27.0" Reexport = "1.2.2" diff --git a/lib/OrdinaryDiffEqHighOrderRK/Project.toml b/lib/OrdinaryDiffEqHighOrderRK/Project.toml index be9ca6047f..d1ac67c08b 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqHighOrderRK/Project.toml @@ -18,7 +18,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Random = "<0.0.1, 1" RecursiveArrayTools = "3.27.0" Reexport = "1.2.2" diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl b/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl index 3905b53291..2de86d9be4 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl @@ -18,6 +18,7 @@ using DiffEqBase import FastBroadcast: @.. import RecursiveArrayTools: recursivefill! using DiffEqBase: @def, @tight_loop_macros +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqIMEXMultistep/Project.toml b/lib/OrdinaryDiffEqIMEXMultistep/Project.toml index 7ae0574146..2630b04224 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/Project.toml +++ b/lib/OrdinaryDiffEqIMEXMultistep/Project.toml @@ -15,7 +15,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69" DiffEqBase = "6.152.2" DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqLinear/Project.toml b/lib/OrdinaryDiffEqLinear/Project.toml index c96fcad0fd..97e550b764 100644 --- a/lib/OrdinaryDiffEqLinear/Project.toml +++ b/lib/OrdinaryDiffEqLinear/Project.toml @@ -20,7 +20,7 @@ DiffEqBase = "6.152.2" DiffEqDevTools = "2.44.4" ExponentialUtilities = "1.26.1" LinearAlgebra = "<0.0.1, 1" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqRosenbrock = "<0.0.1, 1" OrdinaryDiffEqTsit5 = "<0.0.1, 1" OrdinaryDiffEqVerner = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqLowOrderRK/Project.toml b/lib/OrdinaryDiffEqLowOrderRK/Project.toml index abe5cd293e..9e0653e46a 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqLowOrderRK/Project.toml @@ -21,7 +21,7 @@ FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Random = "<0.0.1, 1" RecursiveArrayTools = "3.27.0" Reexport = "1.2.2" diff --git a/lib/OrdinaryDiffEqLowStorageRK/Project.toml b/lib/OrdinaryDiffEqLowStorageRK/Project.toml index f4d3444218..9805d351fd 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/Project.toml +++ b/lib/OrdinaryDiffEqLowStorageRK/Project.toml @@ -24,7 +24,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Polyester = "0.7.16" PrecompileTools = "1.2.1" Preferences = "1.4.3" diff --git a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml index 983362d14a..cba61bf922 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml +++ b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml @@ -36,7 +36,7 @@ LinearAlgebra = "<0.0.1, 1" LinearSolve = "2.32.0" MuladdMacro = "0.2.4" NonlinearSolve = "3.14.0" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" PreallocationTools = "0.4.23" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqNordsieck/Project.toml b/lib/OrdinaryDiffEqNordsieck/Project.toml index b5d6e1e924..e663aeccd9 100644 --- a/lib/OrdinaryDiffEqNordsieck/Project.toml +++ b/lib/OrdinaryDiffEqNordsieck/Project.toml @@ -22,7 +22,7 @@ FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqTsit5 = "<0.0.1, 1" Polyester = "0.7.16" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl index 20c7d37c00..acec784635 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl @@ -15,7 +15,7 @@ using MuladdMacro, FastBroadcast, RecursiveArrayTools import LinearAlgebra: rmul! import Static: False using OrdinaryDiffEqTsit5: Tsit5ConstantCache, Tsit5Cache - +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqPDIRK/Project.toml b/lib/OrdinaryDiffEqPDIRK/Project.toml index 934fdf6e95..e48807d200 100644 --- a/lib/OrdinaryDiffEqPDIRK/Project.toml +++ b/lib/OrdinaryDiffEqPDIRK/Project.toml @@ -19,7 +19,7 @@ DiffEqBase = "6.152.2" DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" Polyester = "0.7.16" diff --git a/lib/OrdinaryDiffEqPRK/Project.toml b/lib/OrdinaryDiffEqPRK/Project.toml index 558f4ba96c..0c2a6dc582 100644 --- a/lib/OrdinaryDiffEqPRK/Project.toml +++ b/lib/OrdinaryDiffEqPRK/Project.toml @@ -16,7 +16,7 @@ DiffEqBase = "6.152.2" DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Polyester = "0.7.16" Random = "<0.0.1, 1" Reexport = "1.2.2" diff --git a/lib/OrdinaryDiffEqQPRK/Project.toml b/lib/OrdinaryDiffEqQPRK/Project.toml index d846f141d3..24b2fe7910 100644 --- a/lib/OrdinaryDiffEqQPRK/Project.toml +++ b/lib/OrdinaryDiffEqQPRK/Project.toml @@ -18,7 +18,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Random = "<0.0.1, 1" RecursiveArrayTools = "3.27.0" Reexport = "1.2.2" diff --git a/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl b/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl index ff9c44761b..52d279452f 100644 --- a/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl +++ b/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl @@ -11,6 +11,7 @@ import OrdinaryDiffEqCore: OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqConsta using Static: False using MuladdMacro, FastBroadcast using RecursiveArrayTools: recursive_unitless_bottom_eltype, recursivefill! +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqRKN/Project.toml b/lib/OrdinaryDiffEqRKN/Project.toml index 35904fa591..ae198f596e 100644 --- a/lib/OrdinaryDiffEqRKN/Project.toml +++ b/lib/OrdinaryDiffEqRKN/Project.toml @@ -17,7 +17,7 @@ DiffEqBase = "6.152.2" DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Polyester = "0.7.16" Random = "<0.0.1, 1" RecursiveArrayTools = "3.27.0" diff --git a/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl b/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl index f1ee815891..fd7f206b74 100644 --- a/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl +++ b/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl @@ -13,6 +13,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, trivial_limiter!, _ode_interpolant!, _ode_addsteps! using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools using DiffEqBase: @def, @tight_loop_macros +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqRosenbrock/Project.toml b/lib/OrdinaryDiffEqRosenbrock/Project.toml index a6beaa8c5e..d0dec8acf2 100644 --- a/lib/OrdinaryDiffEqRosenbrock/Project.toml +++ b/lib/OrdinaryDiffEqRosenbrock/Project.toml @@ -35,7 +35,7 @@ LinearSolve = "2.32.0" MacroTools = "0.5.13" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" Polyester = "0.7.16" diff --git a/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl b/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl index 4c4d4a9f34..d86694bba0 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl @@ -23,6 +23,8 @@ import ForwardDiff using FiniteDiff using LinearAlgebra: mul!, diag, diagm, I, Diagonal, norm import ADTypes: AutoForwardDiff +import OrdinaryDiffEqCore + using OrdinaryDiffEqDifferentiation: TimeDerivativeWrapper, TimeGradientWrapper, UDerivativeWrapper, UJacobianWrapper, wrapprecs, calc_tderivative, build_grad_config, diff --git a/lib/OrdinaryDiffEqSDIRK/Project.toml b/lib/OrdinaryDiffEqSDIRK/Project.toml index 2634167fc5..29ee9c1562 100644 --- a/lib/OrdinaryDiffEqSDIRK/Project.toml +++ b/lib/OrdinaryDiffEqSDIRK/Project.toml @@ -24,7 +24,7 @@ FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MacroTools = "0.5.13" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqSSPRK/Project.toml b/lib/OrdinaryDiffEqSSPRK/Project.toml index 716273ee14..d8a784019b 100644 --- a/lib/OrdinaryDiffEqSSPRK/Project.toml +++ b/lib/OrdinaryDiffEqSSPRK/Project.toml @@ -22,7 +22,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqLowStorageRK = "<0.0.1, 1" Polyester = "0.7.16" PrecompileTools = "1.2.1" diff --git a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml index 4c7db7ca66..11b8ece1fa 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml @@ -20,7 +20,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqDifferentiation = "<0.0.1, 1" OrdinaryDiffEqNonlinearSolve = "<0.0.1, 1" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl index 5071e559d1..bc816a0275 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl @@ -17,6 +17,7 @@ using OrdinaryDiffEqNonlinearSolve: NLNewton, nlsolve!, isnewton, build_nlsolver markfirststage!, du_alias_or_new, get_W using FastBroadcast, MuladdMacro, RecursiveArrayTools import StaticArrays: SArray, MVector, SVector, @SVector, StaticArray, MMatrix, SA +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqStabilizedRK/Project.toml b/lib/OrdinaryDiffEqStabilizedRK/Project.toml index d8de539f80..b9e75f2f8b 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedRK/Project.toml @@ -19,7 +19,7 @@ FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" ODEProblemLibrary = "0.1.8" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Random = "<0.0.1, 1" RecursiveArrayTools = "3.27.0" Reexport = "1.2.2" diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl b/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl index 3728f78cec..6cddba3664 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl @@ -12,6 +12,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, calculate_residuals!, constvalue, _unwrap_val, full_cache using FastBroadcast, MuladdMacro, RecursiveArrayTools import StaticArrays: SArray, MVector, SVector, @SVector, StaticArray, MMatrix, SA +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqSymplecticRK/Project.toml b/lib/OrdinaryDiffEqSymplecticRK/Project.toml index 79a947a99f..5c04b31fe7 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/Project.toml +++ b/lib/OrdinaryDiffEqSymplecticRK/Project.toml @@ -18,7 +18,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" OrdinaryDiffEqRKN = "<0.0.1, 1" OrdinaryDiffEqTsit5 = "<0.0.1, 1" Polyester = "0.7.16" diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl b/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl index 864460c3d6..e395152161 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl @@ -13,6 +13,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, explicit_rk_docstring, trivial_limiter!, _ode_interpolant!, _ode_addsteps! using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqTsit5/Project.toml b/lib/OrdinaryDiffEqTsit5/Project.toml index 7f03587a92..bb6e57e416 100644 --- a/lib/OrdinaryDiffEqTsit5/Project.toml +++ b/lib/OrdinaryDiffEqTsit5/Project.toml @@ -22,7 +22,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" PrecompileTools = "1.2.1" Preferences = "1.4.3" Random = "<0.0.1, 1" diff --git a/lib/OrdinaryDiffEqVerner/Project.toml b/lib/OrdinaryDiffEqVerner/Project.toml index 4055334d39..4dc9e39f19 100644 --- a/lib/OrdinaryDiffEqVerner/Project.toml +++ b/lib/OrdinaryDiffEqVerner/Project.toml @@ -23,7 +23,7 @@ DiffEqDevTools = "2.44.4" FastBroadcast = "0.3.5" LinearAlgebra = "<0.0.1, 1" MuladdMacro = "0.2.4" -OrdinaryDiffEqCore = "<0.0.1, 1" +OrdinaryDiffEqCore = "1.1" Polyester = "0.7.16" PrecompileTools = "1.2.1" Preferences = "1.4.3" From 15776df18a7ce945e0f84d132404718ab78abdf1 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 07:53:45 -0400 Subject: [PATCH 07/55] more core and 20 years ago --- .../src/OrdinaryDiffEqNonlinearSolve.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl b/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl index a8e06ca692..c00ac00848 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl +++ b/lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl @@ -22,6 +22,7 @@ using ForwardDiff: Dual using LinearSolve: I, rmul!, norm, mul!, ldiv! using RecursiveArrayTools: recursivecopy! import SciMLStructures: canonicalize, Tunable, isscimlstructure +import OrdinaryDiffEqCore import SciMLOperators: islinear import OrdinaryDiffEqCore: nlsolve_f, set_new_W!, set_W_γdt! From fc5632c4c36c0189a2018117c7b7100d653c6a0d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 08:17:28 -0400 Subject: [PATCH 08/55] more imports --- .../src/OrdinaryDiffEqExponentialRK.jl | 1 + lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl | 1 + lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl b/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl index c3c7fd4108..bfe8715f03 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl @@ -10,6 +10,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, ismultistep, ExponentialAlgorithm, fsal_typeof, isdtchangeable, calculate_residuals, calculate_residuals!, full_cache +import OrdinaryDiffEqCore using RecursiveArrayTools using MuladdMacro, FastBroadcast using LinearAlgebra: axpy!, mul! diff --git a/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl b/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl index 039f313ffb..7240d44878 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl @@ -12,6 +12,7 @@ import RecursiveArrayTools: recursivecopy! import FastBroadcast: @.. import MuladdMacro: @muladd import Static: False +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase diff --git a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl index acec784635..17a340ae54 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl @@ -16,6 +16,7 @@ import LinearAlgebra: rmul! import Static: False using OrdinaryDiffEqTsit5: Tsit5ConstantCache, Tsit5Cache import OrdinaryDiffEqCore + using Reexport @reexport using DiffEqBase From 66bbe6f4966a8650c53c4d6fc34f48cc4f8c6185 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 08:32:46 -0400 Subject: [PATCH 09/55] more --- lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl b/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl index 79cace5764..d8c194df93 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl @@ -24,6 +24,7 @@ import LinearAlgebra: norm import RecursiveArrayTools: recursivefill!, recursive_unitless_bottom_eltype import Static: False using DiffEqBase: @def, @tight_loop_macros +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase From 0b36dd76fb685adc65b8aff1f645f111f80b04d8 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 08:44:57 -0400 Subject: [PATCH 10/55] another --- lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl b/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl index 4dfdbbbdc7..559bc471ce 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl @@ -9,6 +9,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, alg_stability_size, full_cache using TruncatedStacktraces, RecursiveArrayTools, FastBroadcast, MuladdMacro, DiffEqBase import LinearAlgebra: norm +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase From 8e53448a0cc7e88fc23e4e9416c6cc3092934a14 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 08:54:07 -0400 Subject: [PATCH 11/55] import --- lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl b/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl index be54cf8d48..75d94d5677 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl @@ -17,6 +17,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, using TruncatedStacktraces, MuladdMacro, MacroTools, FastBroadcast, RecursiveArrayTools using SciMLBase: SplitFunction using LinearAlgebra: mul!, I +import OrdinaryDiffEqCore using OrdinaryDiffEqDifferentiation: UJacobianWrapper, dolinsolve using OrdinaryDiffEqNonlinearSolve: du_alias_or_new, markfirststage!, build_nlsolver, From c62476c6fa50106d1c5526ceb577cb88fe719c8b Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 09:11:10 -0400 Subject: [PATCH 12/55] more imports --- lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl b/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl index d2117cbd55..02b839cb32 100644 --- a/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl +++ b/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl @@ -13,6 +13,7 @@ using LinearAlgebra: mul!, I using SciMLOperators: AbstractSciMLOperator using ExponentialUtilities using RecursiveArrayTools +import OrdinaryDiffEqCore using Reexport @reexport using DiffEqBase From 235545b34e44100d2cd9449215134d217c4efa86 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 09:33:17 -0400 Subject: [PATCH 13/55] Update derivative_utils.jl --- .../src/derivative_utils.jl | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl b/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl index 43c039d26c..9f2fc85b25 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/derivative_utils.jl @@ -922,7 +922,29 @@ function LinearSolve.init_cacheval( assumptions::OperatorAssumptions) end -for alg in subtypes(LinearSolve.AbstractFactorization) +for alg in [LinearSolve.AppleAccelerateLUFactorization, + LinearSolve.BunchKaufmanFactorization, + LinearSolve.CHOLMODFactorization, + LinearSolve.CholeskyFactorization, + LinearSolve.CudaOffloadFactorization, + LinearSolve.DiagonalFactorization, + LinearSolve.FastLUFactorization, + LinearSolve.FastQRFactorization, + LinearSolve.GenericFactorization, + LinearSolve.GenericLUFactorization, + LinearSolve.KLUFactorization, + LinearSolve.LDLtFactorization, + LinearSolve.LUFactorization, + LinearSolve.MKLLUFactorization, + LinearSolve.MetalLUFactorization, + LinearSolve.NormalBunchKaufmanFactorization, + LinearSolve.NormalCholeskyFactorization, + LinearSolve.QRFactorization, + LinearSolve.RFLUFactorization, + LinearSolve.SVDFactorization, + LinearSolve.SimpleLUFactorization, + LinearSolve.SparspakFactorization, + LinearSolve.UMFPACKFactorization] @eval function LinearSolve.init_cacheval(alg::$alg, A::WOperator, b, u, Pl, Pr, maxiters::Int, abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions) From bead708e4f6a49cde7d38c568be63b96015088a4 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 09:33:31 -0400 Subject: [PATCH 14/55] Update lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl --- .../src/OrdinaryDiffEqDifferentiation.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl index 9551a6b856..927e9cc7ab 100644 --- a/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl +++ b/lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl @@ -51,7 +51,6 @@ else struct OrdinaryDiffEqTag end end -include("utils.jl") include("alg_utils.jl") include("linsolve_utils.jl") include("derivative_utils.jl") From fb5d9ea49687d26d4e2d7953a4f31810bbfc0123 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 09:33:42 -0400 Subject: [PATCH 15/55] Delete lib/OrdinaryDiffEqDifferentiation/src/utils.jl --- .../src/utils.jl | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 lib/OrdinaryDiffEqDifferentiation/src/utils.jl diff --git a/lib/OrdinaryDiffEqDifferentiation/src/utils.jl b/lib/OrdinaryDiffEqDifferentiation/src/utils.jl deleted file mode 100644 index e2b9d3fd6f..0000000000 --- a/lib/OrdinaryDiffEqDifferentiation/src/utils.jl +++ /dev/null @@ -1,31 +0,0 @@ -# Reimplementation of InteractiveUtils.subtypes -# Used to remove the direct dependency - -subtypes(x::Type) = _subtypes_in!(Base.loaded_modules_array(), x) -function _subtypes_in!(mods::Array, x::Type) - xt = Base.unwrap_unionall(x) - if !isabstracttype(x) || !isa(xt, DataType) - # Fast path - return Type[] - end - sts = Vector{Any}() - while !isempty(mods) - m = pop!(mods) - xt = xt::DataType - for s in names(m, all = true) - if isdefined(m, s) && !Base.isdeprecated(m, s) - t = getfield(m, s) - dt = isa(t, UnionAll) ? Base.unwrap_unionall(t) : t - if isa(dt, DataType) - if dt.name.name === s && dt.name.module == m && supertype(dt).name == xt.name - ti = typeintersect(t, x) - ti != Base.Bottom && push!(sts, ti) - end - elseif isa(t, Module) && nameof(t) === s && parentmodule(t) === m && t !== m - t === Base || push!(mods, t) # exclude Base, since it also parented by Main - end - end - end - end - return permute!(sts, sortperm(map(string, sts))) -end \ No newline at end of file From 8c819cbf15b956ed13d045e4e7501e84ad1f5408 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 09:45:57 -0400 Subject: [PATCH 16/55] last one --- .../src/OrdinaryDiffEqIMEXMultistep.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl index dc1bbc310f..7a8327c6f7 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl @@ -7,7 +7,7 @@ import OrdinaryDiffEqCore: alg_order, issplit, OrdinaryDiffEqNewtonAlgorithm, _u full_cache using FastBroadcast - +import OrdinaryDiffEqCore using OrdinaryDiffEqDifferentiation: dolinsolve using OrdinaryDiffEqNonlinearSolve: NLNewton, build_nlsolver, markfirststage!, nlsolve!, nlsolvefail, du_alias_or_new From a2375138746dcca306333d169523f754bbc4d77d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 11:00:16 -0400 Subject: [PATCH 17/55] Update Project.toml --- lib/OrdinaryDiffEqDifferentiation/Project.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/OrdinaryDiffEqDifferentiation/Project.toml b/lib/OrdinaryDiffEqDifferentiation/Project.toml index 45728b4d86..1997df268e 100644 --- a/lib/OrdinaryDiffEqDifferentiation/Project.toml +++ b/lib/OrdinaryDiffEqDifferentiation/Project.toml @@ -11,7 +11,6 @@ FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898" FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf" -InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" @@ -30,7 +29,6 @@ FastBroadcast = "0.3" FiniteDiff = "2" ForwardDiff = "0.10" FunctionWrappersWrappers = "0.1" -InteractiveUtils = "1.10" LinearAlgebra = "1.10" LinearSolve = "2" OrdinaryDiffEqCore = "<0.0.1, 1" From a57ef07ede7e87a62392fddd52602c6fd20b5331 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 17 Aug 2024 12:22:52 -0400 Subject: [PATCH 18/55] WIP: Refactor ODEIntegrator to not allow undef fsal states This was used as a performance optimization early on, dropping the construction of those two vectors since we already construct so much in the caches, we might as well reuse one of the cache pointers. And it's also built into some methods what cache pointer that must be. So the integrator is made with undef's and then during initialization phase the pointers are set. However, this is unnecessary and adds some complexity. For one, it makes the constructor a bit of a mess. But for two, it gives Enzyme issues as demonstrated in https://github.com/SciML/OrdinaryDiffEq.jl/pull/2282. A better solution is then to just, construct the type correctly. To do this, we simply need to refactor the information of what vectors correspond to fsal first and last into a function that is per-cache, and use that function in the integrator construction. That's already done in this PR. All that's required to complete this PR is to ensure this refactor is done on every method. --- .../src/caches/basic_caches.jl | 12 ++--- .../src/integrators/type.jl | 50 ------------------- lib/OrdinaryDiffEqCore/src/solve.jl | 4 +- lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl | 5 +- .../src/tsit_perform_step.jl | 2 - lib/OrdinaryDiffEqVerner/src/verner_caches.jl | 11 ++-- .../src/verner_rk_perform_step.jl | 2 - 7 files changed, 16 insertions(+), 70 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index 1609b03fac..5901737d1c 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -4,13 +4,16 @@ abstract type OrdinaryDiffEqMutableCache <: OrdinaryDiffEqCache end struct ODEEmptyCache <: OrdinaryDiffEqConstantCache end struct ODEChunkCache{CS} <: OrdinaryDiffEqConstantCache end +# Don't worry about the potential alloc on a constant cache +get_fsalfirstlast(cache::OrdinaryDiffEqConstantCache) = zero(cache.u), zero(cache.u) + mutable struct CompositeCache{T, F} <: OrdinaryDiffEqCache caches::T choice_function::F current::Int end -TruncatedStacktraces.@truncate_stacktrace CompositeCache 1 +get_fsalfirstlast(cache::CompositeCache) = get_fsalfirstlast(cache.caches[1]) mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache args::A @@ -28,12 +31,7 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache end end -TruncatedStacktraces.@truncate_stacktrace DefaultCache 1 - -if isdefined(Base, :Experimental) && isdefined(Base.Experimental, :silence!) - Base.Experimental.silence!(CompositeCache) - Base.Experimental.silence!(DefaultCache) -end +get_fsalfirstlast(cache::DefaultCache) = get_fsalfirstlast(cache.cache1) function alg_cache(alg::CompositeAlgorithm, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqCore/src/integrators/type.jl b/lib/OrdinaryDiffEqCore/src/integrators/type.jl index a361302f9e..ae3f441d8e 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/type.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/type.jl @@ -136,54 +136,4 @@ mutable struct ODEIntegrator{algType <: Union{OrdinaryDiffEqAlgorithm, DAEAlgori differential_vars::DV fsalfirst::FSALType fsallast::FSALType - - function ODEIntegrator{algType, IIP, uType, duType, tType, pType, eigenType, EEstT, - tTypeNoUnits, tdirType, ksEltype, SolType, - F, CacheType, O, FSALType, EventErrorType, CallbackCacheType, - InitializeAlgType, DV}(sol, u, du, k, t, dt, f, p, uprev, uprev2, - duprev, tprev, - alg, dtcache, dtchangeable, dtpropose, tdir, - eigen_est, EEst, qold, q11, erracc, dtacc, - success_iter, - iter, saveiter, saveiter_dense, cache, - callback_cache, - kshortsize, force_stepfail, last_stepfail, - just_hit_tstop, - do_error_check, - event_last_time, vector_event_last_time, - last_event_error, - accept_step, isout, reeval_fsal, u_modified, - reinitialize, isdae, - opts, stats, - initializealg, differential_vars) where {algType, IIP, uType, - duType, tType, pType, - eigenType, EEstT, - tTypeNoUnits, tdirType, - ksEltype, SolType, F, - CacheType, O, - FSALType, - EventErrorType, - CallbackCacheType, - InitializeAlgType, DV} - new{algType, IIP, uType, duType, tType, pType, eigenType, EEstT, tTypeNoUnits, - tdirType, ksEltype, SolType, - F, CacheType, O, FSALType, EventErrorType, - CallbackCacheType, InitializeAlgType, DV - }(sol, u, du, k, t, dt, f, p, uprev, uprev2, duprev, tprev, - alg, dtcache, dtchangeable, dtpropose, tdir, - eigen_est, EEst, qold, q11, erracc, dtacc, success_iter, - iter, saveiter, saveiter_dense, cache, callback_cache, - kshortsize, force_stepfail, last_stepfail, just_hit_tstop, - do_error_check, - event_last_time, vector_event_last_time, last_event_error, - accept_step, isout, reeval_fsal, u_modified, reinitialize, isdae, - opts, stats, initializealg, differential_vars) # Leave off fsalfirst and last - end -end - -if isdefined(Base, :Experimental) && isdefined(Base.Experimental, :silence!) - Base.Experimental.silence!(ODEIntegrator) end -# When this is changed, DelayDiffEq.jl must be changed as well! - -TruncatedStacktraces.@truncate_stacktrace ODEIntegrator 2 1 3 4 diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index 27287e28ad..abc66270c1 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -469,6 +469,7 @@ function DiffEqBase.__init( reinitiailize = true saveiter = 0 # Starts at 0 so first save is at 1 saveiter_dense = 0 + faslfirst, fsallast = get_fsalfirstlast(cache) integrator = ODEIntegrator{typeof(_alg), isinplace(prob), uType, typeof(du), tType, typeof(p), @@ -494,7 +495,8 @@ function DiffEqBase.__init( last_event_error, accept_step, isout, reeval_fsal, u_modified, reinitiailize, isdae, - opts, stats, initializealg, differential_vars) + opts, stats, initializealg, differential_vars, + faslfirst, fsallast) if initialize_integrator if isdae || SciMLBase.has_initializeprob(prob.f) diff --git a/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl b/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl index 0ecdc60cde..7d8162654d 100644 --- a/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl +++ b/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl @@ -16,9 +16,6 @@ step_limiter!::StepLimiter thread::Thread end -if isdefined(Base, :Experimental) && isdefined(Base.Experimental, :silence!) - Base.Experimental.silence!(Tsit5Cache) -end function alg_cache(alg::Tsit5, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -39,7 +36,7 @@ function alg_cache(alg::Tsit5, u, rate_prototype, ::Type{uEltypeNoUnits}, alg.stage_limiter!, alg.step_limiter!, alg.thread) end -TruncatedStacktraces.@truncate_stacktrace Tsit5Cache 1 +get_fsalfirstlast(cache::Tsit5Cache) = (cache.k1, cache.k7) function alg_cache(alg::Tsit5, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl b/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl index dd702ce5e9..25f280880f 100644 --- a/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl +++ b/lib/OrdinaryDiffEqTsit5/src/tsit_perform_step.jl @@ -163,8 +163,6 @@ end function initialize!(integrator, cache::Tsit5Cache) integrator.kshortsize = 7 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k7 # setup pointers resize!(integrator.k, integrator.kshortsize) # Setup k pointers integrator.k[1] = cache.k1 diff --git a/lib/OrdinaryDiffEqVerner/src/verner_caches.jl b/lib/OrdinaryDiffEqVerner/src/verner_caches.jl index 6de34d0559..4bb44d3e36 100644 --- a/lib/OrdinaryDiffEqVerner/src/verner_caches.jl +++ b/lib/OrdinaryDiffEqVerner/src/verner_caches.jl @@ -23,7 +23,7 @@ lazy::Bool end -TruncatedStacktraces.@truncate_stacktrace Vern6Cache 1 +get_fsalfirstlast(cache::Vern6Cache) = (cache.k1, cache.k9) function alg_cache(alg::Vern6, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -86,7 +86,8 @@ end lazy::Bool end -TruncatedStacktraces.@truncate_stacktrace Vern7Cache 1 +# fake values since non-FSAL method +get_fsalfirstlast(cache::Vern7Cache) = (cache.k1, cache.k2) function alg_cache(alg::Vern7, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -151,7 +152,8 @@ end lazy::Bool end -TruncatedStacktraces.@truncate_stacktrace Vern8Cache 1 +# fake values since non-FSAL method +get_fsalfirstlast(cache::Vern8Cache) = (cache.k1, cache.k2) function alg_cache(alg::Vern8, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -224,7 +226,8 @@ end lazy::Bool end -TruncatedStacktraces.@truncate_stacktrace Vern9Cache 1 +# fake values since non-FSAL method +get_fsalfirstlast(cache::Vern9Cache) = (cache.k1, cache.k2) function alg_cache(alg::Vern9, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl b/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl index 73e3fa9718..898be5af5d 100644 --- a/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqVerner/src/verner_rk_perform_step.jl @@ -94,8 +94,6 @@ end function initialize!(integrator, cache::Vern6Cache) alg = unwrap_alg(integrator, false) cache.lazy ? (integrator.kshortsize = 9) : (integrator.kshortsize = 12) - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k9 @unpack k = integrator resize!(k, integrator.kshortsize) k[1] = cache.k1 From 338d9a388c2b4e068e738324c89e402bca0ee63d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:12:21 -0400 Subject: [PATCH 19/55] do a whole bunch of them --- .../OrdinaryDiffEqAdamsBashforthMoulton.jl | 2 +- .../src/adams_bashforth_moulton_caches.jl | 30 ++++--- .../adams_bashforth_moulton_perform_step.jl | 24 ++---- .../src/OrdinaryDiffEqBDF.jl | 3 +- lib/OrdinaryDiffEqBDF/src/bdf_caches.jl | 17 ++-- lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl | 21 ++--- lib/OrdinaryDiffEqBDF/src/dae_caches.jl | 9 +- lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl | 6 +- .../src/OrdinaryDiffEqExplicitRK.jl | 2 +- .../src/explicit_rk_caches.jl | 2 +- .../src/explicit_rk_perform_step.jl | 2 - .../src/OrdinaryDiffEqExponentialRK.jl | 2 +- .../src/OrdinaryDiffEqExtrapolation.jl | 2 +- .../src/extrapolation_caches.jl | 17 ++-- .../src/extrapolation_perform_step.jl | 21 ++--- .../src/OrdinaryDiffEqFIRK.jl | 2 +- .../src/OrdinaryDiffEqFeagin.jl | 2 +- lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl | 9 +- .../src/feagin_rk_perform_step.jl | 9 +- .../src/OrdinaryDiffEqFunctionMap.jl | 2 +- .../src/functionmap_caches.jl | 1 + .../src/OrdinaryDiffEqIMEXMultistep.jl | 2 +- .../src/imex_multistep_caches.jl | 6 +- .../src/imex_multistep_perform_step.jl | 6 +- .../src/OrdinaryDiffEqLinear.jl | 2 +- lib/OrdinaryDiffEqLinear/src/linear_caches.jl | 39 +++++---- .../src/linear_perform_step.jl | 51 ++++-------- .../src/OrdinaryDiffEqLowOrderRK.jl | 2 +- .../src/OrdinaryDiffEqLowStorageRK.jl | 2 +- .../src/low_storage_rk_caches.jl | 25 +++--- .../src/low_storage_rk_perform_step.jl | 30 +++---- .../src/OrdinaryDiffEqNordsieck.jl | 2 +- .../src/nordsieck_caches.jl | 2 + .../src/nordsieck_perform_step.jl | 4 - .../src/OrdinaryDiffEqPDIRK.jl | 2 +- lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl | 3 + .../src/OrdinaryDiffEqPRK.jl | 2 +- lib/OrdinaryDiffEqPRK/src/prk_caches.jl | 1 + lib/OrdinaryDiffEqPRK/src/prk_perform_step.jl | 2 - .../src/OrdinaryDiffEqQPRK.jl | 2 +- lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl | 1 + .../src/qprk_perform_step.jl | 2 - .../src/OrdinaryDiffEqRKN.jl | 1 + lib/OrdinaryDiffEqRKN/src/rkn_caches.jl | 45 +++++----- lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl | 8 -- lib/OrdinaryDiffEqRKN/src/rkn_tableaus.jl | 29 +++---- .../src/OrdinaryDiffEqRosenbrock.jl | 2 +- .../src/rosenbrock_caches.jl | 9 ++ .../src/rosenbrock_perform_step.jl | 2 - .../src/kencarp_kvaerno_perform_step.jl | 43 ---------- lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl | 40 ++++----- .../src/sdirk_perform_step.jl | 44 +--------- lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl | 82 +++++++++---------- .../src/ssprk_perform_step.jl | 51 ++++-------- .../src/OrdinaryDiffEqStabilizedIRK.jl | 2 +- .../src/OrdinaryDiffEqStabilizedRK.jl | 2 +- .../src/OrdinaryDiffEqSymplecticRK.jl | 2 +- .../src/symplectic_caches.jl | 33 ++++---- .../src/symplectic_perform_step.jl | 31 ++----- .../src/OrdinaryDiffEqTsit5.jl | 2 +- .../src/OrdinaryDiffEqVerner.jl | 2 +- 61 files changed, 327 insertions(+), 476 deletions(-) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl index 05b2a19bb4..2b86ce4923 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/OrdinaryDiffEqAdamsBashforthMoulton.jl @@ -7,7 +7,7 @@ import OrdinaryDiffEqCore: OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCac OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqAdamsVarOrderVarStepAlgorithm, constvalue, calculate_residuals, calculate_residuals!, - trivial_limiter!, + trivial_limiter!, get_fsalfirstlast, full_cache import OrdinaryDiffEqLowOrderRK: BS3ConstantCache, BS3Cache, RK4ConstantCache, RK4Cache import RecursiveArrayTools: recursivefill! diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl index 29a021f0ca..40f792dd96 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl @@ -1,4 +1,8 @@ -@cache mutable struct AB3Cache{uType, rateType} <: OrdinaryDiffEqMutableCache +abstract type ABMMutableCache <: OrdinaryDiffEqMutableCache end +abstract type ABMVariableCoefficientMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::ABMMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::ABMVariableCoefficientMutableCache) = (cache.fsalfirst, cache.k4) +@cache mutable struct AB3Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType fsalfirst::rateType @@ -38,7 +42,7 @@ function alg_cache(alg::AB3, u, rate_prototype, ::Type{uEltypeNoUnits}, AB3ConstantCache(k2, k3, 1) end -@cache mutable struct ABM32Cache{uType, rateType} <: OrdinaryDiffEqMutableCache +@cache mutable struct ABM32Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType fsalfirst::rateType @@ -78,7 +82,7 @@ function alg_cache(alg::ABM32, u, rate_prototype, ::Type{uEltypeNoUnits}, ABM32ConstantCache(k2, k3, 1) end -@cache mutable struct AB4Cache{uType, rateType} <: OrdinaryDiffEqMutableCache +@cache mutable struct AB4Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType fsalfirst::rateType @@ -128,7 +132,7 @@ function alg_cache(alg::AB4, u, rate_prototype, ::Type{uEltypeNoUnits}, AB4ConstantCache(k2, k3, k4, 1) end -@cache mutable struct ABM43Cache{uType, rateType} <: OrdinaryDiffEqMutableCache +@cache mutable struct ABM43Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType fsalfirst::rateType @@ -184,7 +188,7 @@ function alg_cache(alg::ABM43, u, rate_prototype, ::Type{uEltypeNoUnits}, ABM43ConstantCache(k2, k3, k4, 1) end -@cache mutable struct AB5Cache{uType, rateType} <: OrdinaryDiffEqMutableCache +@cache mutable struct AB5Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType fsalfirst::rateType @@ -236,7 +240,7 @@ function alg_cache(alg::AB5, u, rate_prototype, ::Type{uEltypeNoUnits}, AB5ConstantCache(k2, k3, k4, k5, 1) end -@cache mutable struct ABM54Cache{uType, rateType} <: OrdinaryDiffEqMutableCache +@cache mutable struct ABM54Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType fsalfirst::rateType @@ -312,7 +316,7 @@ end @cache mutable struct VCAB3Cache{uType, rateType, TabType, bs3Type, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType @@ -408,7 +412,7 @@ end @cache mutable struct VCAB4Cache{uType, rateType, rk4cacheType, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType @@ -504,7 +508,7 @@ end @cache mutable struct VCAB5Cache{uType, rateType, rk4cacheType, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType @@ -602,7 +606,7 @@ end @cache mutable struct VCABM3Cache{ uType, rateType, TabType, bs3Type, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType @@ -708,7 +712,7 @@ end @cache mutable struct VCABM4Cache{uType, rateType, rk4cacheType, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType @@ -813,7 +817,7 @@ end @cache mutable struct VCABM5Cache{uType, rateType, rk4cacheType, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType @@ -919,7 +923,7 @@ end @cache mutable struct VCABMCache{uType, rateType, dtType, tArrayType, cArrayType, uNoUnitsType, coefType, dtArrayType} <: - OrdinaryDiffEqMutableCache + ABMVariableCoefficientMutableCache u::uType uprev::uType fsalfirst::rateType diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl index d5fa5a27f1..077fdfb4ec 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_perform_step.jl @@ -24,8 +24,7 @@ function initialize!(integrator, ABM43Cache, ABM54Cache}) @unpack fsalfirst, k = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -551,8 +550,7 @@ end function initialize!(integrator, cache::VCAB3Cache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -685,8 +683,7 @@ end function initialize!(integrator, cache::VCAB4Cache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -834,8 +831,7 @@ end function initialize!(integrator, cache::VCAB5Cache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -981,8 +977,7 @@ end function initialize!(integrator, cache::VCABM3Cache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1125,8 +1120,7 @@ end function initialize!(integrator, cache::VCABM4Cache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1282,8 +1276,7 @@ end function initialize!(integrator, cache::VCABM5Cache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1459,8 +1452,7 @@ end function initialize!(integrator, cache::VCABMCache) @unpack fsalfirst, k4 = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k4 + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl b/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl index a7fa419b64..28d3ab39c3 100644 --- a/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl +++ b/lib/OrdinaryDiffEqBDF/src/OrdinaryDiffEqBDF.jl @@ -19,7 +19,8 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, default_controller, stepsize_controller!, step_accept_controller!, step_reject_controller!, post_newton_controller!, - u_modified!, DAEAlgorithm, _unwrap_val, DummyController + u_modified!, DAEAlgorithm, _unwrap_val, DummyController, + get_fsalfirstlast using OrdinaryDiffEqSDIRK: ImplicitEulerConstantCache, ImplicitEulerCache using TruncatedStacktraces, MuladdMacro, MacroTools, FastBroadcast, RecursiveArrayTools diff --git a/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl b/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl index 78a64c7c7b..b2b3f9440b 100644 --- a/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl +++ b/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl @@ -1,3 +1,6 @@ +abstract type BDFMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::BDFMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) + @cache mutable struct ABDF2ConstantCache{N, dtType, rate_prototype} <: OrdinaryDiffEqConstantCache nlsolver::N @@ -22,7 +25,7 @@ function alg_cache(alg::ABDF2, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache mutable struct ABDF2Cache{uType, rateType, uNoUnitsType, N, dtType, StepLimiter} <: - OrdinaryDiffEqMutableCache + BDFMutableCache uₙ::uType uₙ₋₁::uType uₙ₋₂::uType @@ -78,7 +81,7 @@ end du₂::rateType end -@cache mutable struct SBDFCache{uType, rateType, N} <: OrdinaryDiffEqMutableCache +@cache mutable struct SBDFCache{uType, rateType, N} <: BDFMutableCache cnt::Int ark::Bool u::uType @@ -164,7 +167,7 @@ end end @cache mutable struct QNDF1Cache{uType, rateType, coefType, coefType1, coefType2, - uNoUnitsType, N, dtType, StepLimiter} <: OrdinaryDiffEqMutableCache + uNoUnitsType, N, dtType, StepLimiter} <: BDFMutableCache uprev2::uType fsalfirst::rateType D::coefType1 @@ -252,7 +255,7 @@ end end @cache mutable struct QNDF2Cache{uType, rateType, coefType, coefType1, coefType2, - uNoUnitsType, N, dtType, StepLimiter} <: OrdinaryDiffEqMutableCache + uNoUnitsType, N, dtType, StepLimiter} <: BDFMutableCache uprev2::uType uprev3::uType fsalfirst::rateType @@ -383,7 +386,7 @@ end @cache mutable struct QNDFCache{MO, UType, RUType, rateType, N, coefType, dtType, EEstType, gammaType, uType, uNoUnitsType, StepLimiter} <: - OrdinaryDiffEqMutableCache + BDFMutableCache fsalfirst::rateType dd::uType utilde::uType @@ -462,7 +465,7 @@ function alg_cache(alg::QNDF{MO}, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache mutable struct MEBDF2Cache{uType, rateType, uNoUnitsType, N} <: - OrdinaryDiffEqMutableCache + BDFMutableCache u::uType uprev::uType uprev2::uType @@ -574,7 +577,7 @@ end @cache mutable struct FBDFCache{ MO, N, rateType, uNoUnitsType, tsType, tType, uType, uuType, coeffType, EEstType, rType, wType, StepLimiter} <: - OrdinaryDiffEqMutableCache + BDFMutableCache fsalfirst::rateType nlsolver::N ts::tsType diff --git a/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl b/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl index a040c6076d..c410bf6a36 100644 --- a/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl +++ b/lib/OrdinaryDiffEqBDF/src/bdf_perform_step.jl @@ -86,8 +86,7 @@ end function initialize!(integrator, cache::ABDF2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -255,8 +254,7 @@ function initialize!(integrator, cache::SBDFCache) @unpack uprev, p, t = integrator @unpack f1, f2 = integrator.f integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -412,8 +410,7 @@ end function initialize!(integrator, cache::QNDF1Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -608,8 +605,7 @@ end function initialize!(integrator, cache::QNDF2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -833,8 +829,7 @@ end function initialize!(integrator, cache::QNDFCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1010,8 +1005,7 @@ end function initialize!(integrator, cache::MEBDF2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -1218,8 +1212,7 @@ end function initialize!(integrator, cache::FBDFCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqBDF/src/dae_caches.jl b/lib/OrdinaryDiffEqBDF/src/dae_caches.jl index cc53b10a61..aa6ba9e7be 100644 --- a/lib/OrdinaryDiffEqBDF/src/dae_caches.jl +++ b/lib/OrdinaryDiffEqBDF/src/dae_caches.jl @@ -1,5 +1,8 @@ +abstract type DAEBDFMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::DAEBDFMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) + @cache mutable struct DImplicitEulerCache{uType, rateType, uNoUnitsType, N} <: - OrdinaryDiffEqMutableCache + DAEBDFMutableCache u::uType uprev::uType uprev2::uType @@ -68,7 +71,7 @@ function alg_cache(alg::DABDF2, du, u, res_prototype, rate_prototype, end @cache mutable struct DABDF2Cache{uType, rateType, uNoUnitsType, N, dtType} <: - OrdinaryDiffEqMutableCache + DAEBDFMutableCache uₙ::uType uₙ₋₁::uType uₙ₋₂::uType @@ -171,7 +174,7 @@ end @cache mutable struct DFBDFCache{MO, N, rateType, uNoUnitsType, tsType, tType, uType, uuType, coeffType, EEstType, rType, wType} <: - OrdinaryDiffEqMutableCache + DAEBDFMutableCache fsalfirst::rateType nlsolver::N ts::tsType diff --git a/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl b/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl index 2be69e8277..fd9b007963 100644 --- a/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl +++ b/lib/OrdinaryDiffEqBDF/src/dae_perform_step.jl @@ -160,8 +160,7 @@ end end function initialize!(integrator, cache::DABDF2Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + integrator.kshortsize = 2 @unpack k₁, k₂ = cache.eulercache @@ -352,8 +351,7 @@ end function initialize!(integrator, cache::DFBDFCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl b/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl index 559bc471ce..6274afbf6f 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/OrdinaryDiffEqExplicitRK.jl @@ -6,7 +6,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, alg_stability_size, unwrap_alg, OrdinaryDiffEqMutableCache, initialize!, perform_step!, isfsal, CompositeAlgorithm, calculate_residuals!, calculate_residuals, - full_cache + full_cache, get_fsalfirstlast using TruncatedStacktraces, RecursiveArrayTools, FastBroadcast, MuladdMacro, DiffEqBase import LinearAlgebra: norm import OrdinaryDiffEqCore diff --git a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl index 11cd6360ea..ad060c05b5 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl @@ -11,7 +11,7 @@ tab::TabType end -TruncatedStacktraces.@truncate_stacktrace ExplicitRKCache 1 +get_fsalfirstlast(cache::ExplicitRKCache) = (cache.kk[1], cache.fsallast) function alg_cache(alg::ExplicitRK, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl index a2133263b5..093c62b4f8 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_perform_step.jl @@ -75,8 +75,6 @@ end function initialize!(integrator, cache::ExplicitRKCache) integrator.kshortsize = 2 - integrator.fsallast = cache.fsallast - integrator.fsalfirst = cache.kk[1] resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl b/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl index bfe8715f03..5e0043aa35 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/OrdinaryDiffEqExponentialRK.jl @@ -9,7 +9,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, ismultistep, OrdinaryDiffEqAdaptiveExponentialAlgorithm, CompositeAlgorithm, ExponentialAlgorithm, fsal_typeof, isdtchangeable, calculate_residuals, calculate_residuals!, - full_cache + full_cache, get_fsalfirstlast import OrdinaryDiffEqCore using RecursiveArrayTools using MuladdMacro, FastBroadcast diff --git a/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl b/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl index 0d556b647e..fd4dc8d7b3 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/OrdinaryDiffEqExtrapolation.jl @@ -16,7 +16,7 @@ import OrdinaryDiffEqCore: alg_order, alg_maximum_order, get_current_adaptive_or DEFAULT_PRECS, full_cache, constvalue, PolyesterThreads, Sequential, BaseThreads, _digest_beta1_beta2, timedepentdtmin, _unwrap_val, - _reshape, _vec + _reshape, _vec, get_fsalfirstlast using DiffEqBase, FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools, LinearSolve import OrdinaryDiffEqCore import OrdinaryDiffEqDifferentiation: TimeDerivativeWrapper, UDerivativeWrapper, calc_J, diff --git a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl index 34bb50d377..0917d03e11 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl @@ -1,10 +1,13 @@ +abstract type ExtrapolationMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::ExtrapolationMutableCache) = (cache.fsalfirst, cache.k) + @cache mutable struct AitkenNevilleCache{ uType, rateType, arrayType, dtType, uNoUnitsType -} <: OrdinaryDiffEqMutableCache +} <: ExtrapolationMutableCache u::uType uprev::uType tmp::uType @@ -86,7 +89,7 @@ end dtType, JType, WType, F, JCType, GCType, uNoUnitsType, TFType, UFType, sequenceType} <: - OrdinaryDiffEqMutableCache + ExtrapolationMutableCache uprev::uType u_tmps::Array{uType, 1} u_tmps2::Array{uType, 1} @@ -921,7 +924,7 @@ end @cache mutable struct ExtrapolationMidpointDeuflhardCache{uType, uNoUnitsType, rateType, QType, extrapolation_coefficients -} <: OrdinaryDiffEqMutableCache +} <: ExtrapolationMutableCache # Values that are mutated utilde::uType u_temp1::uType @@ -1005,7 +1008,7 @@ end rateType, JType, WType, F, JCType, GCType, uNoUnitsType, TFType, UFType} <: - OrdinaryDiffEqMutableCache + ExtrapolationMutableCache # Values that are mutated utilde::uType u_temp1::uType @@ -1228,7 +1231,7 @@ end @cache mutable struct ExtrapolationMidpointHairerWannerCache{uType, uNoUnitsType, rateType, QType, extrapolation_coefficients} <: - OrdinaryDiffEqMutableCache + ExtrapolationMutableCache # Values that are mutated utilde::uType u_temp1::uType @@ -1371,7 +1374,7 @@ end extrapolation_coefficients, JType, WType, F, JCType, GCType, TFType, UFType} <: - OrdinaryDiffEqMutableCache + ExtrapolationMutableCache # Values that are mutated utilde::uType u_temp1::uType @@ -1568,7 +1571,7 @@ end extrapolation_coefficients, JType, WType, F, JCType, GCType, TFType, UFType} <: - OrdinaryDiffEqMutableCache + ExtrapolationMutableCache # Values that are mutated utilde::uType u_temp1::uType diff --git a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl index 8e4f3554a6..ad26439864 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_perform_step.jl @@ -1,8 +1,7 @@ function initialize!(integrator, cache::AitkenNevilleCache) integrator.kshortsize = 2 @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -251,10 +250,7 @@ end function initialize!(integrator, cache::ImplicitEulerExtrapolationCache) integrator.kshortsize = 2 - - integrator.fsalfirst = zero(first(cache.k_tmps)) integrator.f(integrator.fsalfirst, integrator.u, integrator.p, integrator.t) - integrator.fsallast = zero(integrator.fsalfirst) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -723,8 +719,7 @@ end function initialize!(integrator, cache::ExtrapolationMidpointDeuflhardCache) # cf. initialize! of MidpointCache @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1135,8 +1130,7 @@ end function initialize!(integrator, cache::ImplicitDeuflhardExtrapolationCache) # cf. initialize! of MidpointCache @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1807,8 +1801,7 @@ end function initialize!(integrator, cache::ExtrapolationMidpointHairerWannerCache) # cf. initialize! of MidpointCache @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -2508,8 +2501,7 @@ end function initialize!(integrator, cache::ImplicitHairerWannerExtrapolationCache) # cf. initialize! of MidpointCache @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -3207,8 +3199,7 @@ end function initialize!(integrator, cache::ImplicitEulerBarycentricExtrapolationCache) # cf. initialize! of MidpointCache @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl b/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl index 9d92ae5b59..f7039b2cfc 100644 --- a/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl +++ b/lib/OrdinaryDiffEqFIRK/src/OrdinaryDiffEqFIRK.jl @@ -15,7 +15,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, step_reject_controller!, PredictiveController, alg_can_repeat_jac, NewtonAlgorithm, fac_default_gamma, - get_current_adaptive_order, + get_current_adaptive_order, get_fsalfirstlast, isfirk using MuladdMacro, DiffEqBase, RecursiveArrayTools using SciMLOperators: AbstractSciMLOperator diff --git a/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl b/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl index e49507ebae..5573a4dea2 100644 --- a/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl +++ b/lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl @@ -7,7 +7,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, alg_cache, _vec, _reshape, @cache, isfsal, full_cache, - constvalue, _unwrap_val, + constvalue, _unwrap_val, get_fsalfirstlast, explicit_rk_docstring, trivial_limiter!, _ode_interpolant!, _ode_addsteps! using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools diff --git a/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl b/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl index ad0b7551d2..58335ce53e 100644 --- a/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl +++ b/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl @@ -1,5 +1,8 @@ +abstract type FeaginCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::FeaginCache) = (cache.fsalfirst, cache.k) + @cache struct Feagin10Cache{uType, uNoUnitsType, rateType, TabType, StepLimiter} <: - OrdinaryDiffEqMutableCache + FeaginCache u::uType uprev::uType fsalfirst::rateType @@ -65,7 +68,7 @@ function alg_cache(alg::Feagin10, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct Feagin12Cache{uType, uNoUnitsType, rateType, TabType, StepLimiter} <: - OrdinaryDiffEqMutableCache + FeaginCache u::uType uprev::uType fsalfirst::rateType @@ -148,7 +151,7 @@ function alg_cache(alg::Feagin12, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct Feagin14Cache{uType, uNoUnitsType, rateType, TabType, StepLimiter} <: - OrdinaryDiffEqMutableCache + FeaginCache u::uType uprev::uType fsalfirst::rateType diff --git a/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl b/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl index 01f352fd39..296f5ece4f 100644 --- a/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqFeagin/src/feagin_rk_perform_step.jl @@ -86,8 +86,7 @@ end end function initialize!(integrator, cache::Feagin10Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -418,8 +417,7 @@ end end function initialize!(integrator, cache::Feagin12Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -909,8 +907,7 @@ end end function initialize!(integrator, cache::Feagin14Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl b/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl index 7240d44878..c13a3e1fee 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/OrdinaryDiffEqFunctionMap.jl @@ -4,7 +4,7 @@ import OrdinaryDiffEqCore: isfsal, beta2_default, beta1_default, OrdinaryDiffEqA initialize!, perform_step!, @unpack, unwrap_alg, OrdinaryDiffEqMutableCache, alg_cache, @cache, _ode_addsteps!, _ode_interpolant!, - _ode_interpolant, + _ode_interpolant, get_fsalfirstlast, alg_order, OrdinaryDiffEqConstantCache, dt_required, isdiscretecache, isdiscretealg, full_cache using DiffEqBase diff --git a/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl b/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl index 67dab2ae37..1fe3992fd5 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl @@ -3,6 +3,7 @@ uprev::uType tmp::rateType end +get_fsalfirstlast(cache::FunctionMapCache) = (cache.u, cache.uprev) function alg_cache(alg::FunctionMap, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl index 7a8327c6f7..020d094b37 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/OrdinaryDiffEqIMEXMultistep.jl @@ -4,7 +4,7 @@ import OrdinaryDiffEqCore: alg_order, issplit, OrdinaryDiffEqNewtonAlgorithm, _u DEFAULT_PRECS, OrdinaryDiffEqConstantCache, OrdinaryDiffEqMutableCache, @cache, alg_cache, initialize!, perform_step!, @unpack, - full_cache + full_cache, get_fsalfirstlast using FastBroadcast import OrdinaryDiffEqCore diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl index b1ec7eac99..95bc14cf59 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl @@ -1,4 +1,6 @@ # IMEX Multistep methods +abstract type IMEXMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::IMEXMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) # CNAB2 @@ -10,7 +12,7 @@ tprev2::tType end -@cache mutable struct CNAB2Cache{uType, rateType, N, tType} <: OrdinaryDiffEqMutableCache +@cache mutable struct CNAB2Cache{uType, rateType, N, tType} <: IMEXMutableCache u::uType uprev::uType uprev2::uType @@ -67,7 +69,7 @@ end tprev2::tType end -@cache mutable struct CNLF2Cache{uType, rateType, N, tType} <: OrdinaryDiffEqMutableCache +@cache mutable struct CNLF2Cache{uType, rateType, N, tType} <: IMEXMutableCache u::uType uprev::uType uprev2::uType diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl index eb3e820509..6a38280fb9 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_perform_step.jl @@ -56,8 +56,7 @@ end function initialize!(integrator, cache::CNAB2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -159,8 +158,7 @@ end function initialize!(integrator, cache::CNLF2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl b/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl index 02b839cb32..1edc26727d 100644 --- a/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl +++ b/lib/OrdinaryDiffEqLinear/src/OrdinaryDiffEqLinear.jl @@ -7,7 +7,7 @@ import OrdinaryDiffEqCore: alg_order, alg_extrapolates, dt_required, OrdinaryDiffEqMutableCache, @cache, alg_cache, OrdinaryDiffEqConstantCache, initialize!, perform_step!, @unpack, unwrap_alg, - calculate_residuals!, + calculate_residuals!, get_fsalfirstlast, _vec, isdtchangeable, full_cache using LinearAlgebra: mul!, I using SciMLOperators: AbstractSciMLOperator diff --git a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl index 59d27eacf2..deb9bb9f64 100644 --- a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl +++ b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl @@ -1,5 +1,8 @@ +abstract type OrdinaryDiffEqMutableCache <: LinearMutableCache end +get_fsalfirstlast(cache::LinearMutableCache) = (cache.fsalfirst, cache.k) + @cache struct MagnusMidpointCache{uType, rateType, WType, expType} <: - OrdinaryDiffEqMutableCache + LinearMutableCache u::uType uprev::uType uprev2::uType @@ -31,7 +34,7 @@ function alg_cache(alg::MagnusMidpoint, u, rate_prototype, ::Type{uEltypeNoUnits MagnusMidpointConstantCache() end -@cache struct RKMK2Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct RKMK2Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -63,7 +66,7 @@ function alg_cache(alg::RKMK2, u, rate_prototype, ::Type{uEltypeNoUnits}, RKMK2ConstantCache() end -@cache struct LieRK4Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct LieRK4Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -95,7 +98,7 @@ function alg_cache(alg::LieRK4, u, rate_prototype, ::Type{uEltypeNoUnits}, LieRK4ConstantCache() end -@cache struct CG3Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct CG3Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -127,7 +130,7 @@ function alg_cache(alg::CG3, u, rate_prototype, ::Type{uEltypeNoUnits}, CG3ConstantCache() end -@cache struct CG2Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct CG2Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -159,7 +162,7 @@ function alg_cache(alg::CG2, u, rate_prototype, ::Type{uEltypeNoUnits}, CG2ConstantCache() end -@cache struct CG4aCache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct CG4aCache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -187,7 +190,7 @@ function alg_cache(alg::CG4a, u, rate_prototype, uEltypeNoUnits, CG4aConstantCache() end -@cache struct RKMK4Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct RKMK4Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -220,7 +223,7 @@ function alg_cache(alg::RKMK4, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct MagnusAdapt4Cache{uType, rateType, WType, uNoUnitsType, expType} <: - OrdinaryDiffEqMutableCache + LinearMutableCache u::uType uprev::uType uprev2::uType @@ -258,7 +261,7 @@ function alg_cache(alg::MagnusAdapt4, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusAdapt4ConstantCache() end -@cache struct MagnusNC8Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct MagnusNC8Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -290,7 +293,7 @@ function alg_cache(alg::MagnusNC8, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusNC8ConstantCache() end -@cache struct MagnusGL4Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct MagnusGL4Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -322,7 +325,7 @@ function alg_cache(alg::MagnusGL4, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusGL4ConstantCache() end -@cache struct MagnusGL8Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct MagnusGL8Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -354,7 +357,7 @@ function alg_cache(alg::MagnusGL8, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusGL8ConstantCache() end -@cache struct MagnusNC6Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct MagnusNC6Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -386,7 +389,7 @@ function alg_cache(alg::MagnusNC6, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusNC6ConstantCache() end -@cache struct MagnusGL6Cache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct MagnusGL6Cache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -418,7 +421,7 @@ function alg_cache(alg::MagnusGL6, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusGL6ConstantCache() end @cache struct MagnusGauss4Cache{uType, rateType, WType, expType} <: - OrdinaryDiffEqMutableCache + LinearMutableCache u::uType uprev::uType uprev2::uType @@ -450,7 +453,7 @@ function alg_cache(alg::MagnusGauss4, u, rate_prototype, ::Type{uEltypeNoUnits}, MagnusGauss4ConstantCache() end -@cache struct LieEulerCache{uType, rateType, WType, expType} <: OrdinaryDiffEqMutableCache +@cache struct LieEulerCache{uType, rateType, WType, expType} <: LinearMutableCache u::uType uprev::uType uprev2::uType @@ -482,7 +485,7 @@ function alg_cache(alg::LieEuler, u, rate_prototype, ::Type{uEltypeNoUnits}, LieEulerConstantCache() end -@cache struct CayleyEulerCache{uType, rateType} <: OrdinaryDiffEqMutableCache +@cache struct CayleyEulerCache{uType, rateType} <: LinearMutableCache u::uType uprev::uType tmp::uType @@ -511,7 +514,7 @@ function alg_cache(alg::CayleyEuler, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct MagnusLeapfrogCache{uType, rateType, WType, expType} <: - OrdinaryDiffEqMutableCache + LinearMutableCache u::uType uprev::uType uprev2::uType @@ -553,7 +556,7 @@ function alg_cache(alg::LinearExponential, u, rate_prototype, ::Type{uEltypeNoUn end @cache struct LinearExponentialCache{uType, rateType, KsType, expType} <: - OrdinaryDiffEqMutableCache + LinearMutableCache u::uType uprev::uType tmp::uType diff --git a/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl b/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl index 98fa7e400e..6ad1582659 100644 --- a/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl +++ b/lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl @@ -1,7 +1,6 @@ function initialize!(integrator, cache::MagnusMidpointCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -32,8 +31,7 @@ function perform_step!(integrator, cache::MagnusMidpointCache, repeat_step = fal end function initialize!(integrator, cache::LieRK4Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -85,8 +83,7 @@ end function initialize!(integrator, cache::RKMK4Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -129,8 +126,7 @@ end function initialize!(integrator, cache::RKMK2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -163,8 +159,7 @@ end function initialize!(integrator, cache::CG3Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -199,8 +194,7 @@ end function initialize!(integrator, cache::CG2Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -228,8 +222,7 @@ end function initialize!(integrator, cache::CG4aCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -276,8 +269,7 @@ end function initialize!(integrator, cache::MagnusAdapt4Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -345,8 +337,7 @@ end function initialize!(integrator, cache::MagnusNC8Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -421,8 +412,7 @@ end function initialize!(integrator, cache::MagnusGL4Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -457,8 +447,7 @@ end function initialize!(integrator, cache::MagnusGL8Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -525,8 +514,7 @@ end function initialize!(integrator, cache::MagnusNC6Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -573,8 +561,7 @@ end function initialize!(integrator, cache::MagnusGL6Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -617,8 +604,7 @@ end function initialize!(integrator, cache::MagnusGauss4Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -655,8 +641,7 @@ end function initialize!(integrator, cache::LieEulerCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -687,8 +672,7 @@ end function initialize!(integrator, cache::MagnusLeapfrogCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -857,8 +841,7 @@ end function initialize!(integrator, cache::CayleyEulerCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl b/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl index d8c194df93..1f83cc628b 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/OrdinaryDiffEqLowOrderRK.jl @@ -16,7 +16,7 @@ import OrdinaryDiffEqCore: alg_order, isfsal, beta2_default, beta1_default, copyat_or_push!, AutoAlgSwitch, _ode_interpolant, _ode_interpolant!, full_cache, accept_step_controller, DerivativeOrderNotPossibleError, - has_lazy_interpolation, du_cache, u_cache + has_lazy_interpolation, du_cache, u_cache, get_fsalfirstlast using SciMLBase import MuladdMacro: @muladd import FastBroadcast: @.. diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl b/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl index 96f754d4cd..2e7f9fb8e2 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/OrdinaryDiffEqLowStorageRK.jl @@ -11,7 +11,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, calculate_residuals!, alg_cache, _vec, _reshape, @cache, isfsal, full_cache, constvalue, _unwrap_val, trivial_limiter!, perform_step!, initialize!, - explicit_rk_docstring + explicit_rk_docstring, get_fsalfirstlast using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools, Adapt import StaticArrays: SArray, MVector, SVector, @SVector, StaticArray, MMatrix, SA import Static: False diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl index 4e5712e005..da11904bae 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl @@ -1,6 +1,9 @@ +abstract type OrdinaryDiffEqMutableCache <: LowStorageRKMutableCache end +get_fsalfirstlast(cache::LowStorageRKMutableCache) = (cache.fsalfirst, cache.k) + # 2N low storage methods introduced by Williamson @cache struct LowStorageRK2NCache{uType, rateType, TabType, StageLimiter, StepLimiter, - Thread} <: OrdinaryDiffEqMutableCache + Thread} <: LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -118,7 +121,7 @@ end @cache struct KYK2014DGSSPRK_3S2_Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -206,7 +209,7 @@ function alg_cache(alg::RK46NL, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct RK46NLCache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -736,7 +739,7 @@ end # 2C low storage methods introduced by Calvo, Franco, Rández (2004) @cache struct LowStorageRK2CCache{uType, rateType, TabType, StageLimiter, StepLimiter, - Thread} <: OrdinaryDiffEqMutableCache + Thread} <: LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -859,7 +862,7 @@ end # 3S low storage methods introduced by Ketcheson @cache struct LowStorageRK3SCache{uType, rateType, TabType, StageLimiter, StepLimiter, - Thread} <: OrdinaryDiffEqMutableCache + Thread} <: LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -1744,7 +1747,7 @@ end # Compressible Computational Fluid Dynamics # [arXiv:2104.06836](https://arxiv.org/abs/2104.06836) @cache struct LowStorageRK3SpCache{uType, rateType, uNoUnitsType, TabType, StageLimiter, - StepLimiter, Thread} <: OrdinaryDiffEqMutableCache + StepLimiter, Thread} <: LowStorageRKMutableCache u::uType uprev::uType fsalfirst::rateType @@ -2140,7 +2143,7 @@ end # [arXiv:2104.06836](https://arxiv.org/abs/2104.06836) @cache struct LowStorageRK3SpFSALCache{ uType, rateType, uNoUnitsType, TabType, StageLimiter, - StepLimiter, Thread} <: OrdinaryDiffEqMutableCache + StepLimiter, Thread} <: LowStorageRKMutableCache u::uType uprev::uType fsalfirst::rateType @@ -2534,7 +2537,7 @@ end # 2R+ low storage methods introduced by van der Houwen @cache struct LowStorageRK2RPCache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -2940,7 +2943,7 @@ end # 3R+ low storage methods introduced by van der Houwen @cache struct LowStorageRK3RPCache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -3464,7 +3467,7 @@ end # 4R+ low storage methods introduced by van der Houwen @cache struct LowStorageRK4RPCache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + LowStorageRKMutableCache u::uType uprev::uType k::rateType @@ -3845,7 +3848,7 @@ end # 5R+ low storage methods introduced by van der Houwen @cache struct LowStorageRK5RPCache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + LowStorageRKMutableCache u::uType uprev::uType k::rateType diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl index f3c2fb53c3..d6d8eee20d 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl @@ -107,8 +107,7 @@ end function initialize!(integrator, cache::LowStorageRK2CCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -174,8 +173,7 @@ end function initialize!(integrator, cache::LowStorageRK3SCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -256,8 +254,7 @@ end function initialize!(integrator, cache::LowStorageRK3SpCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -355,8 +352,7 @@ end function initialize!(integrator, cache::LowStorageRK3SpFSALCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -455,8 +451,7 @@ end function initialize!(integrator, cache::LowStorageRK2RPCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -554,8 +549,7 @@ end function initialize!(integrator, cache::LowStorageRK3RPCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -664,8 +658,7 @@ end function initialize!(integrator, cache::LowStorageRK4RPCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -785,8 +778,7 @@ end function initialize!(integrator, cache::LowStorageRK5RPCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -850,8 +842,7 @@ end function initialize!(integrator, cache::RK46NLCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -968,8 +959,7 @@ end function initialize!(integrator, cache::KYK2014DGSSPRK_3S2_Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl index 17a340ae54..ae0b0ea0d1 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/OrdinaryDiffEqNordsieck.jl @@ -9,7 +9,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, qsteady_max_default, initialize!, perform_step!, stepsize_controller!, step_accept_controller!, step_reject_controller!, calculate_residuals, calculate_residuals!, - get_current_adaptive_order, + get_current_adaptive_order, get_fsalfirstlast, ode_interpolant, ode_interpolant!, trivial_limiter! using MuladdMacro, FastBroadcast, RecursiveArrayTools import LinearAlgebra: rmul! diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl index 6b0717a494..32d5b94c24 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl @@ -264,3 +264,5 @@ function alg_cache(alg::JVODE, u, rate_prototype, ::Type{uEltypeNoUnits}, c_LTE₊₁, c_LTE, c_LTE₋₁, c_conv, c_𝒟, prev_𝒟, dts, Δ, atmp, tsit5cache, 2, 1, 1, 2, η, η, η, η, η) end + +get_fsalfirstlast(cache::Union{JVODE, AN5}) = get_fsalfirstlast(cache.tsit5cache) \ No newline at end of file diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl index 23fbca5039..bafee1f5c8 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl @@ -90,8 +90,6 @@ end function initialize!(integrator, cache::AN5Cache) integrator.kshortsize = 7 - integrator.fsalfirst = cache.tsit5cache.k1 - integrator.fsallast = cache.tsit5cache.k7 # setup pointers resize!(integrator.k, integrator.kshortsize) # Setup k pointers integrator.k[1] = cache.tsit5cache.k1 @@ -251,8 +249,6 @@ end function initialize!(integrator, cache::JVODECache) integrator.kshortsize = 7 - integrator.fsalfirst = cache.tsit5cache.k1 - integrator.fsallast = cache.tsit5cache.k7 # setup pointers resize!(integrator.k, integrator.kshortsize) # Setup k pointers integrator.k[1] = cache.tsit5cache.k1 diff --git a/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl b/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl index e7f0251bca..ccdf6a9131 100644 --- a/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl +++ b/lib/OrdinaryDiffEqPDIRK/src/OrdinaryDiffEqPDIRK.jl @@ -5,7 +5,7 @@ import OrdinaryDiffEqCore: isfsal, alg_order, _unwrap_val, OrdinaryDiffEqMutableCache, constvalue, alg_cache, uses_uprev, @unpack, unwrap_alg, @cache, DEFAULT_PRECS, @threaded, initialize!, perform_step!, isthreaded, - full_cache + full_cache, get_fsalfirstlast import StaticArrays: SVector import MuladdMacro: @muladd import FastBroadcast: @.. diff --git a/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl b/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl index 76a1a793f9..64ed8788a9 100644 --- a/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl +++ b/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl @@ -7,6 +7,9 @@ tab::TabType end +# Non-FSAL +get_fsalfirstlast(cache::PDIRK44Cache) = (cache.u, cache.uprev) + struct PDIRK44ConstantCache{N, TabType} <: OrdinaryDiffEqConstantCache nlsolver::N tab::TabType diff --git a/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl b/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl index 085a6f2f6e..e2d35fe635 100644 --- a/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl +++ b/lib/OrdinaryDiffEqPRK/src/OrdinaryDiffEqPRK.jl @@ -2,7 +2,7 @@ module OrdinaryDiffEqPRK import OrdinaryDiffEqCore: OrdinaryDiffEqAlgorithm, alg_order, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, constvalue, @unpack, @cache, - alg_cache, + alg_cache, get_fsalfirstlast, unwrap_alg, perform_step!, @threaded, initialize!, isthreaded, full_cache import MuladdMacro: @muladd diff --git a/lib/OrdinaryDiffEqPRK/src/prk_caches.jl b/lib/OrdinaryDiffEqPRK/src/prk_caches.jl index b61685ace2..2b08bf88ff 100644 --- a/lib/OrdinaryDiffEqPRK/src/prk_caches.jl +++ b/lib/OrdinaryDiffEqPRK/src/prk_caches.jl @@ -11,6 +11,7 @@ fsalfirst::rateType tab::TabType end +get_fsalfirstlast(cache::KuttaPRK2p5Cache) = (cache.fsalfirst, cache.k) struct KuttaPRK2p5ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache α21::T diff --git a/lib/OrdinaryDiffEqPRK/src/prk_perform_step.jl b/lib/OrdinaryDiffEqPRK/src/prk_perform_step.jl index 201ec2e35d..8ece51ff87 100644 --- a/lib/OrdinaryDiffEqPRK/src/prk_perform_step.jl +++ b/lib/OrdinaryDiffEqPRK/src/prk_perform_step.jl @@ -58,8 +58,6 @@ end function initialize!(integrator, cache::KuttaPRK2p5Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # FSAL for interpolation diff --git a/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl b/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl index 52d279452f..cb09e4bb99 100644 --- a/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl +++ b/lib/OrdinaryDiffEqQPRK/src/OrdinaryDiffEqQPRK.jl @@ -5,7 +5,7 @@ import OrdinaryDiffEqCore: OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqConsta OrdinaryDiffEqMutableCache, OrdinaryDiffEqAdaptiveAlgorithm, @fold, @OnDemandTableauExtract, trivial_limiter!, alg_cache, alg_order, initialize!, - perform_step!, + perform_step!, get_fsalfirstlast, constvalue, calculate_residuals!, calculate_residuals, full_cache using Static: False diff --git a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl index 5993508289..19afe55557 100644 --- a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl +++ b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl @@ -1,4 +1,5 @@ struct QPRK98ConstantCache <: OrdinaryDiffEqConstantCache end +get_fsalfirstlast(cache::QPRK98Cache) = (cache.fsalfirst, cache.k) @cache struct QPRK98Cache{ uType, rateType, uNoUnitsType, StageLimiter, StepLimiter, Thread} <: diff --git a/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl b/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl index a61abfe452..9c7784e2bb 100644 --- a/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl +++ b/lib/OrdinaryDiffEqQPRK/src/qprk_perform_step.jl @@ -81,8 +81,6 @@ end end function initialize!(integrator, cache::QPRK98Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl b/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl index fd7f206b74..4385ace2a7 100644 --- a/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl +++ b/lib/OrdinaryDiffEqRKN/src/OrdinaryDiffEqRKN.jl @@ -10,6 +10,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev, alg_cache, _vec, _reshape, @cache, isfsal, full_cache, constvalue, _unwrap_val, _ode_interpolant, + get_fsalfirstlast, trivial_limiter!, _ode_interpolant!, _ode_addsteps! using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools using DiffEqBase: @def, @tight_loop_macros diff --git a/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl b/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl index 02014deef1..27f2348020 100644 --- a/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl +++ b/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl @@ -1,4 +1,7 @@ -@cache struct Nystrom4Cache{uType, rateType, reducedRateType} <: OrdinaryDiffEqMutableCache +abstract type NystromMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::NystromMutableCache) = (cache.fsalfirst, cache.k) + +@cache struct Nystrom4Cache{uType, rateType, reducedRateType} <: NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -9,7 +12,7 @@ tmp::uType end -# struct Nystrom4ConstantCache <: OrdinaryDiffEqConstantCache end +# struct Nystrom4ConstantCache <: NystromConstantCache end function alg_cache(alg::Nystrom4, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -25,7 +28,7 @@ function alg_cache(alg::Nystrom4, u, rate_prototype, ::Type{uEltypeNoUnits}, Nystrom4Cache(u, uprev, k₁, k₂, k₃, k₄, k, tmp) end -struct Nystrom4ConstantCache <: OrdinaryDiffEqConstantCache end +struct Nystrom4ConstantCache <: NystromConstantCache end function alg_cache(alg::Nystrom4, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -37,7 +40,7 @@ end # alg_cache(alg::Nystrom4,u,rate_prototype,::Type{uEltypeNoUnits},::Type{uBottomEltypeNoUnits},::Type{tTypeNoUnits},uprev,uprev2,f,t,dt,reltol,p,calck,::Val{false}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} = Nystrom4ConstantCache(constvalue(uBottomEltypeNoUnits),constvalue(tTypeNoUnits)) @cache struct FineRKN4Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -79,7 +82,7 @@ function alg_cache(alg::FineRKN4, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct FineRKN5Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -125,7 +128,7 @@ function alg_cache(alg::FineRKN5, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct Nystrom4VelocityIndependentCache{uType, rateType, reducedRateType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -148,7 +151,7 @@ function alg_cache(alg::Nystrom4VelocityIndependent, u, rate_prototype, Nystrom4VelocityIndependentCache(u, uprev, k₁, k₂, k₃, k, tmp) end -struct Nystrom4VelocityIndependentConstantCache <: OrdinaryDiffEqConstantCache end +struct Nystrom4VelocityIndependentConstantCache <: NystromConstantCache end function alg_cache(alg::Nystrom4VelocityIndependent, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, @@ -157,7 +160,7 @@ function alg_cache(alg::Nystrom4VelocityIndependent, u, rate_prototype, Nystrom4VelocityIndependentConstantCache() end -@cache struct IRKN3Cache{uType, rateType, TabType} <: OrdinaryDiffEqMutableCache +@cache struct IRKN3Cache{uType, rateType, TabType} <: NystromMutableCache u::uType uprev::uType uprev2::uType @@ -192,7 +195,7 @@ function alg_cache(alg::IRKN3, u, rate_prototype, ::Type{uEltypeNoUnits}, IRKN3ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct IRKN4Cache{uType, rateType, TabType} <: OrdinaryDiffEqMutableCache +@cache struct IRKN4Cache{uType, rateType, TabType} <: NystromMutableCache u::uType uprev::uType uprev2::uType @@ -230,7 +233,7 @@ function alg_cache(alg::IRKN4, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct Nystrom5VelocityIndependentCache{uType, rateType, reducedRateType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -267,7 +270,7 @@ function alg_cache(alg::Nystrom5VelocityIndependent, u, rate_prototype, end struct DPRKN4Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -307,7 +310,7 @@ function alg_cache(alg::DPRKN4, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct DPRKN5Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -351,7 +354,7 @@ function alg_cache(alg::DPRKN5, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct DPRKN6Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -395,7 +398,7 @@ function alg_cache(alg::DPRKN6, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct DPRKN6FMCache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -439,7 +442,7 @@ function alg_cache(alg::DPRKN6FM, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct DPRKN8Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -489,7 +492,7 @@ function alg_cache(alg::DPRKN8, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct DPRKN12Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -557,7 +560,7 @@ function alg_cache(alg::DPRKN12, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct ERKN4Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -597,7 +600,7 @@ function alg_cache(alg::ERKN4, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct ERKN5Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -637,7 +640,7 @@ function alg_cache(alg::ERKN5, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct ERKN7Cache{uType, rateType, reducedRateType, uNoUnitsType, TabType} <: - OrdinaryDiffEqMutableCache + NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -682,7 +685,7 @@ function alg_cache(alg::ERKN7, u, rate_prototype, ::Type{uEltypeNoUnits}, ERKN7ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct RKN4Cache{uType, rateType, reducedRateType} <: OrdinaryDiffEqMutableCache +@cache struct RKN4Cache{uType, rateType, reducedRateType} <: NystromMutableCache u::uType uprev::uType fsalfirst::rateType @@ -705,7 +708,7 @@ function alg_cache(alg::RKN4, u, rate_prototype, ::Type{uEltypeNoUnits}, RKN4Cache(u, uprev, k₁, k₂, k₃, k, tmp) end -struct RKN4ConstantCache <: OrdinaryDiffEqConstantCache end +struct RKN4ConstantCache <: NystromConstantCache end function alg_cache(alg::RKN4, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl b/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl index 008ec1c5d4..8031ca1723 100644 --- a/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl +++ b/lib/OrdinaryDiffEqRKN/src/rkn_perform_step.jl @@ -38,9 +38,6 @@ const NystromDefaultInitialization = Union{Nystrom4Cache, FineRKN4Cache, FineRKN function initialize!(integrator, cache::NystromDefaultInitialization) @unpack fsalfirst, k = cache duprev, uprev = integrator.uprev.x - - integrator.fsalfirst = fsalfirst - integrator.fsallast = k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -889,9 +886,6 @@ end function initialize!(integrator, cache::DPRKN6Cache) @unpack fsalfirst, k = cache duprev, uprev = integrator.uprev.x - - integrator.fsalfirst = fsalfirst - integrator.fsallast = k integrator.kshortsize = 3 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = ArrayPartition(cache.fsalfirst.x[1], cache.k2) @@ -1823,8 +1817,6 @@ end function initialize!(integrator, cache::RKN4Cache) @unpack fsalfirst, k = cache duprev, uprev = integrator.uprev.x - integrator.fsalfirst = fsalfirst - integrator.fsallast = k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqRKN/src/rkn_tableaus.jl b/lib/OrdinaryDiffEqRKN/src/rkn_tableaus.jl index c9b50e05ff..c5d2fd7fa6 100644 --- a/lib/OrdinaryDiffEqRKN/src/rkn_tableaus.jl +++ b/lib/OrdinaryDiffEqRKN/src/rkn_tableaus.jl @@ -1,4 +1,5 @@ -struct FineRKN4ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +abstract type NystromConstantCache <: OrdinaryDiffEqConstantCache end +struct FineRKN4ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -99,7 +100,7 @@ function FineRKN4ConstantCache(T::Type, T2::Type) bptilde3, bptilde4, bptilde5) end -struct FineRKN5ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct FineRKN5ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -266,7 +267,7 @@ function FineRKN5ConstantCache(T::Type, T2::Type) bptilde3, bptilde4, bptilde5, bptilde6, bptilde7) end -struct IRKN3ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct IRKN3ConstantCache{T, T2} <: NystromConstantCache bconst1::T bconst2::T c1::T2 @@ -301,7 +302,7 @@ function IRKN3ConstantCache(T::Type, T2::Type) IRKN3ConstantCache(bconst1, bconst2, c1, a21, b1, b2, bbar1, bbar2) end -struct IRKN4ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct IRKN4ConstantCache{T, T2} <: NystromConstantCache bconst1::T bconst2::T c1::T2 @@ -351,7 +352,7 @@ function IRKN4ConstantCache(T::Type, T2::Type) IRKN4ConstantCache(bconst1, bconst2, c1, c2, a21, a32, b1, b2, b3, bbar1, bbar2, bbar3) end -struct Nystrom5VelocityIndependentConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Nystrom5VelocityIndependentConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 a21::T @@ -412,7 +413,7 @@ function Nystrom5VelocityIndependentConstantCache(T::Type, T2::Type) bbar2, bbar3, b1, b2, b3, b4) end -struct ERKN4ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct ERKN4ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -499,7 +500,7 @@ function ERKN4ConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloats convert(T, 0.0016835016835016834)) end -struct ERKN5ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct ERKN5ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -581,7 +582,7 @@ function ERKN5ConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloats convert(T, -0.0025465161641516788)) end -struct ERKN7ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct ERKN7ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -739,7 +740,7 @@ function ERKN7ConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloats convert(T, 0.5)) end -struct DPRKN4ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct DPRKN4ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -826,7 +827,7 @@ function DPRKN4ConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloat bp1, bp2, bp3, bp4, btilde1, btilde2, btilde3, btilde4, bptilde1, bptilde2, bptilde3, bptilde4) end -struct DPRKN5ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct DPRKN5ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -966,7 +967,7 @@ function DPRKN5ConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloat bptilde1, bptilde3, bptilde4, bptilde5, bptilde6) end -struct DPRKN6ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct DPRKN6ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -1252,7 +1253,7 @@ function DPRKN6ConstantCache(T::Type, T2::Type) rp64, rp63, rp62, rp61) end -struct DPRKN6FMConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct DPRKN6FMConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -1398,7 +1399,7 @@ function DPRKN6FMConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFlo bptilde1, bptilde2, bptilde3, bptilde4, bptilde5) end -struct DPRKN8ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct DPRKN8ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 @@ -1643,7 +1644,7 @@ function DPRKN8ConstantCache(T::Type{<:CompiledFloats}, T2::Type{<:CompiledFloat convert(T, -0.15)) end -struct DPRKN12ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct DPRKN12ConstantCache{T, T2} <: NystromConstantCache c1::T2 c2::T2 c3::T2 diff --git a/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl b/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl index d86694bba0..ae3b93b291 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/OrdinaryDiffEqRosenbrock.jl @@ -8,7 +8,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, isWmethod, isfsal, _un _vec, _reshape, perform_step!, trivial_limiter!, OrdinaryDiffEqRosenbrockAdaptiveAlgorithm, OrdinaryDiffEqRosenbrockAlgorithm, generic_solver_docstring, - namify, initialize!, perform_step!, + namify, initialize!, perform_step!, get_fsalfirstlast, constvalue, only_diagonal_mass_matrix, calculate_residuals, has_stiff_interpolation, ODEIntegrator, resize_non_user_cache!, _ode_addsteps!, full_cache, diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl index 9cec7d99e6..aa0782557d 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl @@ -1,4 +1,8 @@ abstract type RosenbrockMutableCache <: OrdinaryDiffEqMutableCache end + +# Fake values since non-FSAL +get_fsalfirstlast(cache::RosenbrockMutableCache) = (cache.u, cache.uprev) + ################################################################################ # Shampine's Low-order Rosenbrocks @@ -1127,6 +1131,11 @@ function alg_cache( constvalue(tTypeNoUnits)), J, W, linsolve) end + +get_fsalfirstlast(cache::Union{Rosenbrock23Cache,Rosenbrock32Cache, Rosenbrock33Cache, +Rosenbrock34Cache, +Rosenbrock4Cache}) = (cache.fsalfirst, cache.fsallast) + ################################################################################ ### RosenbrockW6S4O diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl index e9028661bf..9966f9ff8b 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl @@ -2,8 +2,6 @@ function initialize!(integrator, cache::Union{Rosenbrock23Cache, Rosenbrock32Cache}) integrator.kshortsize = 2 @unpack k₁, k₂, fsalfirst, fsallast = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = fsallast resize!(integrator.k, integrator.kshortsize) integrator.k[1] = k₁ integrator.k[2] = k₂ diff --git a/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl b/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl index 9c2df93493..20d497abff 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_perform_step.jl @@ -1,46 +1,3 @@ -function initialize!(integrator, - cache::Union{Kvaerno3ConstantCache, - KenCarp3ConstantCache, - Kvaerno4ConstantCache, - KenCarp4ConstantCache, - KenCarp47ConstantCache, - Kvaerno5ConstantCache, - KenCarp5ConstantCache, - KenCarp58ConstantCache, - CFNLIRK3ConstantCache - }) - integrator.kshortsize = 2 - integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) - integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) - - # Avoid undefined entries if k is an array of arrays - integrator.fsallast = zero(integrator.fsalfirst) - integrator.k[1] = integrator.fsalfirst - integrator.k[2] = integrator.fsallast -end - -function initialize!(integrator, - cache::Union{Kvaerno3Cache, - KenCarp3Cache, - Kvaerno4Cache, - KenCarp4Cache, - Kvaerno5Cache, - KenCarp5Cache, - CFNLIRK3Cache, - KenCarp47Cache, - KenCarp58Cache - }) - integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) - resize!(integrator.k, integrator.kshortsize) - integrator.k[1] = integrator.fsalfirst - integrator.k[2] = integrator.fsallast - integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # For the interpolation, needs k at the updated point - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) -end - @muladd function perform_step!(integrator, cache::Kvaerno3ConstantCache, repeat_step = false) @unpack t, dt, uprev, u, f, p = integrator diff --git a/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl b/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl index 5664341626..f3bd709e9d 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl @@ -1,4 +1,6 @@ abstract type SDIRKMutableCache <: OrdinaryDiffEqMutableCache end +abstract type SDIRKConstantCache <: OrdinaryDiffEqConstantCache end +get_fsalfirstlast(cache::SDIRKMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) @cache mutable struct ImplicitEulerCache{ uType, rateType, uNoUnitsType, N, AV, StepLimiter} <: @@ -32,7 +34,7 @@ function alg_cache(alg::ImplicitEuler, u, rate_prototype, ::Type{uEltypeNoUnits} u, uprev, uprev2, fsalfirst, atmp, nlsolver, algebraic_vars, alg.step_limiter!) end -mutable struct ImplicitEulerConstantCache{N} <: OrdinaryDiffEqConstantCache +mutable struct ImplicitEulerConstantCache{N} <: SDIRKConstantCache nlsolver::N end @@ -46,7 +48,7 @@ function alg_cache(alg::ImplicitEuler, u, rate_prototype, ::Type{uEltypeNoUnits} ImplicitEulerConstantCache(nlsolver) end -mutable struct ImplicitMidpointConstantCache{N} <: OrdinaryDiffEqConstantCache +mutable struct ImplicitMidpointConstantCache{N} <: SDIRKConstantCache nlsolver::N end @@ -80,7 +82,7 @@ function alg_cache(alg::ImplicitMidpoint, u, rate_prototype, ::Type{uEltypeNoUni ImplicitMidpointCache(u, uprev, fsalfirst, nlsolver, alg.step_limiter!) end -mutable struct TrapezoidConstantCache{uType, tType, N} <: OrdinaryDiffEqConstantCache +mutable struct TrapezoidConstantCache{uType, tType, N} <: SDIRKConstantCache uprev3::uType tprev2::tType nlsolver::N @@ -132,7 +134,7 @@ function alg_cache(alg::Trapezoid, u, rate_prototype, ::Type{uEltypeNoUnits}, u, uprev, uprev2, fsalfirst, atmp, uprev3, tprev2, nlsolver, alg.step_limiter!) end -mutable struct TRBDF2ConstantCache{Tab, N} <: OrdinaryDiffEqConstantCache +mutable struct TRBDF2ConstantCache{Tab, N} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -179,7 +181,7 @@ function alg_cache(alg::TRBDF2, u, rate_prototype, ::Type{uEltypeNoUnits}, TRBDF2Cache(u, uprev, fsalfirst, zprev, zᵧ, atmp, nlsolver, tab, alg.step_limiter!) end -mutable struct SDIRK2ConstantCache{N} <: OrdinaryDiffEqConstantCache +mutable struct SDIRK2ConstantCache{N} <: SDIRKConstantCache nlsolver::N end @@ -222,7 +224,7 @@ function alg_cache(alg::SDIRK2, u, rate_prototype, ::Type{uEltypeNoUnits}, SDIRK2Cache(u, uprev, fsalfirst, z₁, z₂, atmp, nlsolver, alg.step_limiter!) end -struct SDIRK22ConstantCache{uType, tType, N, Tab} <: OrdinaryDiffEqConstantCache +struct SDIRK22ConstantCache{uType, tType, N, Tab} <: SDIRKConstantCache uprev3::uType tprev2::tType nlsolver::N @@ -278,7 +280,7 @@ function alg_cache(alg::SDIRK22, u, rate_prototype, ::Type{uEltypeNoUnits}, u, uprev, uprev2, fsalfirst, atmp, uprev3, tprev2, nlsolver, tab, alg.step_limiter!) # shouldn't this be SDIRK22Cache instead of SDIRK22? end -mutable struct SSPSDIRK2ConstantCache{N} <: OrdinaryDiffEqConstantCache +mutable struct SSPSDIRK2ConstantCache{N} <: SDIRKConstantCache nlsolver::N end @@ -318,7 +320,7 @@ function alg_cache(alg::SSPSDIRK2, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPSDIRK2Cache(u, uprev, fsalfirst, z₁, z₂, nlsolver) end -mutable struct Cash4ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct Cash4ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -369,7 +371,7 @@ function alg_cache(alg::Cash4, u, rate_prototype, ::Type{uEltypeNoUnits}, Cash4Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, atmp, nlsolver, tab) end -mutable struct SFSDIRK4ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct SFSDIRK4ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -421,7 +423,7 @@ function alg_cache(alg::SFSDIRK4, u, rate_prototype, ::Type{uEltypeNoUnits}, SFSDIRK4Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, atmp, nlsolver, tab) end -mutable struct SFSDIRK5ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct SFSDIRK5ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -475,7 +477,7 @@ function alg_cache(alg::SFSDIRK5, u, rate_prototype, ::Type{uEltypeNoUnits}, SFSDIRK5Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, z₆, atmp, nlsolver, tab) end -mutable struct SFSDIRK6ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct SFSDIRK6ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -529,7 +531,7 @@ function alg_cache(alg::SFSDIRK6, u, rate_prototype, ::Type{uEltypeNoUnits}, SFSDIRK6Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, z₆, atmp, nlsolver, tab) end -mutable struct SFSDIRK7ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct SFSDIRK7ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -585,7 +587,7 @@ function alg_cache(alg::SFSDIRK7, u, rate_prototype, ::Type{uEltypeNoUnits}, SFSDIRK7Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, z₆, z₇, atmp, nlsolver, tab) end -mutable struct SFSDIRK8ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct SFSDIRK8ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -643,7 +645,7 @@ function alg_cache(alg::SFSDIRK8, u, rate_prototype, ::Type{uEltypeNoUnits}, SFSDIRK8Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, z₆, z₇, z₈, atmp, nlsolver, tab) end -mutable struct Hairer4ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct Hairer4ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -749,7 +751,7 @@ function alg_cache(alg::ESDIRK54I8L2SA, u, rate_prototype, ::Type{uEltypeNoUnits tab) end -mutable struct ESDIRK54I8L2SAConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct ESDIRK54I8L2SAConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -804,7 +806,7 @@ function alg_cache(alg::ESDIRK436L2SA2, u, rate_prototype, ::Type{uEltypeNoUnits tab) end -mutable struct ESDIRK436L2SA2ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct ESDIRK436L2SA2ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -861,7 +863,7 @@ function alg_cache(alg::ESDIRK437L2SA, u, rate_prototype, ::Type{uEltypeNoUnits} tab) end -mutable struct ESDIRK437L2SAConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct ESDIRK437L2SAConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -918,7 +920,7 @@ function alg_cache(alg::ESDIRK547L2SA2, u, rate_prototype, ::Type{uEltypeNoUnits tab) end -mutable struct ESDIRK547L2SA2ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct ESDIRK547L2SA2ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -980,7 +982,7 @@ function alg_cache(alg::ESDIRK659L2SA, u, rate_prototype, ::Type{uEltypeNoUnits} nlsolver, tab) end -mutable struct ESDIRK659L2SAConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +mutable struct ESDIRK659L2SAConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end diff --git a/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl b/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl index 1e9aa802bb..a0f33020dc 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/sdirk_perform_step.jl @@ -1,23 +1,4 @@ -function initialize!(integrator, - cache::Union{ImplicitEulerConstantCache, - ImplicitMidpointConstantCache, - TrapezoidConstantCache, - TRBDF2ConstantCache, - SDIRK2ConstantCache, - SDIRK22ConstantCache, - SSPSDIRK2ConstantCache, - Cash4ConstantCache, - Hairer4ConstantCache, - ESDIRK54I8L2SAConstantCache, - ESDIRK436L2SA2ConstantCache, - ESDIRK437L2SAConstantCache, - ESDIRK547L2SA2ConstantCache, - ESDIRK659L2SAConstantCache, - SFSDIRK4ConstantCache, - SFSDIRK5ConstantCache, - SFSDIRK6ConstantCache, - SFSDIRK7ConstantCache, - SFSDIRK8ConstantCache}) +function initialize!(integrator, cache::SDIRKConstantCache) integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal @@ -29,29 +10,8 @@ function initialize!(integrator, integrator.k[2] = integrator.fsallast end -function initialize!(integrator, - cache::Union{ImplicitEulerCache, - ImplicitMidpointCache, - TrapezoidCache, - TRBDF2Cache, - SDIRK2Cache, - SDIRK22Cache, - SSPSDIRK2Cache, - Cash4Cache, - Hairer4Cache, - ESDIRK54I8L2SACache, - ESDIRK436L2SA2Cache, - ESDIRK437L2SACache, - ESDIRK547L2SA2Cache, - ESDIRK659L2SACache, - SFSDIRK4Cache, - SFSDIRK5Cache, - SFSDIRK6Cache, - SFSDIRK7Cache, - SFSDIRK8Cache}) +function initialize!(integrator, cache::SDIRKMutableCache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl b/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl index b2c8833c69..afb5c70474 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl @@ -1,5 +1,8 @@ -@cache struct SSPRK22Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +abstract type SSPRKMutableCache <: OrdinaryDiffEqMutableCache end +abstract type SSPRKConstantCache <: OrdinaryDiffEqConstantCache end +get_fsalfirstlast(cache::SSPRKMutableCache) = (cache.fsalfirst, cache.k) + +@cache struct SSPRK22Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -9,7 +12,7 @@ thread::Thread end -struct SSPRK22ConstantCache <: OrdinaryDiffEqConstantCache end +struct SSPRK22ConstantCache <: SSPRKConstantCache end function alg_cache(alg::SSPRK22, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -31,8 +34,7 @@ function alg_cache(alg::SSPRK22, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK22ConstantCache() end -@cache struct SSPRK33Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK33Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -42,7 +44,7 @@ end thread::Thread end -struct SSPRK33ConstantCache <: OrdinaryDiffEqConstantCache end +struct SSPRK33ConstantCache <: SSPRKConstantCache end function alg_cache(alg::SSPRK33, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -71,7 +73,7 @@ end StageLimiter, StepLimiter, Thread -} <: OrdinaryDiffEqMutableCache +} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -83,7 +85,7 @@ end thread::Thread end -struct KYKSSPRK42ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct KYKSSPRK42ConstantCache{T, T2} <: SSPRKConstantCache α20::T α21::T α30::T @@ -142,8 +144,7 @@ function alg_cache(alg::KYKSSPRK42, u, rate_prototype, ::Type{uEltypeNoUnits}, KYKSSPRK42ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SSPRK53Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK53Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -155,7 +156,7 @@ end thread::Thread end -struct SSPRK53ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK53ConstantCache{T, T2} <: SSPRKConstantCache α30::T α32::T α40::T @@ -216,8 +217,7 @@ function alg_cache(alg::SSPRK53, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK53ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SHLDDRK52Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SHLDDRK52Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -229,7 +229,7 @@ end thread::Thread end -struct SHLDDRK52ConstantCache{T1, T2} <: OrdinaryDiffEqConstantCache +struct SHLDDRK52ConstantCache{T1, T2} <: SSPRKConstantCache α2::T1 α3::T1 α4::T1 @@ -296,7 +296,7 @@ end thread::Thread end -mutable struct SHLDDRK_2NConstantCache{T1, T2} <: OrdinaryDiffEqConstantCache +mutable struct SHLDDRK_2NConstantCache{T1, T2} <: SSPRKConstantCache α21::T1 α31::T1 α41::T1 @@ -395,7 +395,7 @@ end StageLimiter, StepLimiter, Thread -} <: OrdinaryDiffEqMutableCache +} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -406,7 +406,7 @@ end thread::Thread end -struct SSPRK53_2N1ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK53_2N1ConstantCache{T, T2} <: SSPRKConstantCache α40::T α43::T β10::T @@ -466,7 +466,7 @@ end StageLimiter, StepLimiter, Thread -} <: OrdinaryDiffEqMutableCache +} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -477,7 +477,7 @@ end thread::Thread end -struct SSPRK53_2N2ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK53_2N2ConstantCache{T, T2} <: SSPRKConstantCache α30::T α32::T α50::T @@ -534,8 +534,7 @@ function alg_cache(alg::SSPRK53_2N2, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK53_2N2ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SSPRK53_HCache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK53_HCache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -547,7 +546,7 @@ end thread::Thread end -struct SSPRK53_HConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK53_HConstantCache{T, T2} <: SSPRKConstantCache α30::T α32::T α40::T @@ -606,8 +605,7 @@ function alg_cache(alg::SSPRK53_H, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK53_HConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SSPRK63Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK63Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -620,7 +618,7 @@ end thread::Thread end -struct SSPRK63ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK63ConstantCache{T, T2} <: SSPRKConstantCache α40::T α41::T α43::T @@ -685,8 +683,7 @@ function alg_cache(alg::SSPRK63, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK63ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SSPRK73Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK73Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -699,7 +696,7 @@ end thread::Thread end -struct SSPRK73ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK73ConstantCache{T, T2} <: SSPRKConstantCache α40::T α43::T α50::T @@ -773,8 +770,7 @@ function alg_cache(alg::SSPRK73, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK73ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SSPRK83Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK83Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -788,7 +784,7 @@ end thread::Thread end -struct SSPRK83ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK83ConstantCache{T, T2} <: SSPRKConstantCache α50::T α51::T α54::T @@ -869,7 +865,7 @@ function alg_cache(alg::SSPRK83, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct SSPRK43Cache{uType, rateType, uNoUnitsType, TabType, StageLimiter, - StepLimiter, Thread} <: OrdinaryDiffEqMutableCache + StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -882,7 +878,7 @@ end thread::Thread end -struct SSPRK43ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK43ConstantCache{T, T2} <: SSPRKConstantCache one_third_u::T two_thirds_u::T half_u::T @@ -930,7 +926,7 @@ end StageLimiter, StepLimiter, Thread -} <: OrdinaryDiffEqMutableCache +} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -942,7 +938,7 @@ end thread::Thread end -struct SSPRK432ConstantCache <: OrdinaryDiffEqConstantCache end +struct SSPRK432ConstantCache <: SSPRKConstantCache end function alg_cache(alg::SSPRK432, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -969,7 +965,7 @@ function alg_cache(alg::SSPRK432, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache mutable struct SSPRKMSVS32Cache{uType, rateType, dtArrayType, dtType, StageLimiter, - StepLimiter, Thread} <: OrdinaryDiffEqMutableCache + StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType fsalfirst::rateType @@ -1099,7 +1095,7 @@ end StageLimiter, StepLimiter, Thread -} <: OrdinaryDiffEqMutableCache +} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -1111,7 +1107,7 @@ end thread::Thread end -struct SSPRK932ConstantCache <: OrdinaryDiffEqConstantCache end +struct SSPRK932ConstantCache <: SSPRKConstantCache end function alg_cache(alg::SSPRK932, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -1137,8 +1133,7 @@ function alg_cache(alg::SSPRK932, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK932ConstantCache() end -@cache struct SSPRK54Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK54Cache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -1153,7 +1148,7 @@ end thread::Thread end -struct SSPRK54ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SSPRK54ConstantCache{T, T2} <: SSPRKConstantCache β10::T α20::T α21::T @@ -1226,8 +1221,7 @@ function alg_cache(alg::SSPRK54, u, rate_prototype, ::Type{uEltypeNoUnits}, SSPRK54ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SSPRK104Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache +@cache struct SSPRK104Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -1239,7 +1233,7 @@ end thread::Thread end -struct SSPRK104ConstantCache <: OrdinaryDiffEqConstantCache end +struct SSPRK104ConstantCache <: SSPRKConstantCache end function alg_cache(alg::SSPRK104, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl b/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl index d0a26349f2..cbdf80f982 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/ssprk_perform_step.jl @@ -26,8 +26,7 @@ end function initialize!(integrator, cache::SSPRK22Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -51,8 +50,7 @@ end function initialize!(integrator, cache::KYKSSPRK42Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -159,8 +157,7 @@ end function initialize!(integrator, cache::SHLDDRK52Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -271,8 +268,7 @@ end function initialize!(integrator, cache::SHLDDRK_2NCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -384,8 +380,7 @@ end function initialize!(integrator, cache::SSPRK33Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -449,8 +444,7 @@ end function initialize!(integrator, cache::SSPRK53Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -524,8 +518,7 @@ end function initialize!(integrator, cache::SSPRK53_2N1Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -600,8 +593,7 @@ end function initialize!(integrator, cache::SSPRK53_2N2Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -674,8 +666,7 @@ end function initialize!(integrator, cache::SSPRK53_HCache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -751,8 +742,7 @@ end function initialize!(integrator, cache::SSPRK63Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -835,8 +825,7 @@ end function initialize!(integrator, cache::SSPRK73Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -926,8 +915,7 @@ end function initialize!(integrator, cache::SSPRK83Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1020,8 +1008,7 @@ end function initialize!(integrator, cache::SSPRK43Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1112,8 +1099,7 @@ end function initialize!(integrator, cache::SSPRK432Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1464,8 +1450,7 @@ end function initialize!(integrator, cache::SSPRK932Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1574,8 +1559,7 @@ end function initialize!(integrator, cache::SSPRK54Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -1657,8 +1641,7 @@ end function initialize!(integrator, cache::SSPRK104Cache) @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k + integrator.kshortsize = 1 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl index bc816a0275..cd2cfa4a5f 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/OrdinaryDiffEqStabilizedIRK.jl @@ -10,7 +10,7 @@ import OrdinaryDiffEqCore: alg_order, alg_maximum_order, OrdinaryDiffEqAdaptiveAlgorithm, OrdinaryDiffEqAdaptiveImplicitAlgorithm, alg_cache, _unwrap_val, DEFAULT_PRECS, @cache, - _reshape, _vec, full_cache + _reshape, _vec, full_cache, get_fsalfirstlast using OrdinaryDiffEqDifferentiation: dolinsolve, update_W! using OrdinaryDiffEqNonlinearSolve: NLNewton, nlsolve!, isnewton, build_nlsolver, diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl b/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl index 6cddba3664..10a03b8d2b 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/OrdinaryDiffEqStabilizedRK.jl @@ -9,7 +9,7 @@ import OrdinaryDiffEqCore: alg_order, alg_adaptive_order, calculate_residuals!, OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache, OrdinaryDiffEqAdaptiveAlgorithm, calc_dt_propose!, alg_cache, _vec, _reshape, @cache, - constvalue, _unwrap_val, full_cache + constvalue, _unwrap_val, full_cache, get_fsalfirstlast using FastBroadcast, MuladdMacro, RecursiveArrayTools import StaticArrays: SArray, MVector, SVector, @SVector, StaticArray, MMatrix, SA import OrdinaryDiffEqCore diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl b/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl index e395152161..67dc1e38d8 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/OrdinaryDiffEqSymplecticRK.jl @@ -11,7 +11,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, alg_cache, _vec, _reshape, @cache, isfsal, full_cache, constvalue, _unwrap_val, explicit_rk_docstring, trivial_limiter!, - _ode_interpolant!, _ode_addsteps! + _ode_interpolant!, _ode_addsteps!, get_fsalfirstlast using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools import OrdinaryDiffEqCore diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl index 71c55340dc..fb94f2db99 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl @@ -1,4 +1,9 @@ -@cache struct SymplecticEulerCache{uType, rateType} <: OrdinaryDiffEqMutableCache +abstract type HamiltonMutableCache <: OrdinaryDiffEqMutableCache end +abstract type HamiltonConstantCache <: OrdinaryDiffEqConstantCache end + +get_fsalfirstlast(cache::Union{HamiltonMutableCache, VelocityVerletCache, SymplecticEulerCache}) = (cache.fsalfirst, cache.k) + +@cache struct SymplecticEulerCache{uType, rateType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -13,7 +18,7 @@ function alg_cache(alg::SymplecticEuler, u, rate_prototype, ::Type{uEltypeNoUnit SymplecticEulerCache(u, uprev, zero(u), zero(rate_prototype), zero(rate_prototype)) end -struct SymplecticEulerConstantCache <: OrdinaryDiffEqConstantCache end +struct SymplecticEulerConstantCache <: HamiltonConstantCache end function alg_cache(alg::SymplecticEuler, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -32,7 +37,7 @@ end half::uEltypeNoUnits end -struct VelocityVerletConstantCache{uEltypeNoUnits} <: OrdinaryDiffEqConstantCache +struct VelocityVerletConstantCache{uEltypeNoUnits} <: HamiltonConstantCache half::uEltypeNoUnits end @@ -54,7 +59,7 @@ function alg_cache(alg::VelocityVerlet, u, rate_prototype, ::Type{uEltypeNoUnits VelocityVerletConstantCache(uEltypeNoUnits(1 // 2)) end -@cache struct Symplectic2Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic2Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -120,7 +125,7 @@ function alg_cache(alg::McAte2, u, rate_prototype, ::Type{uEltypeNoUnits}, McAte2ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct Symplectic3Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic3Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -165,7 +170,7 @@ function alg_cache(alg::McAte3, u, rate_prototype, ::Type{uEltypeNoUnits}, McAte3ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct Symplectic4Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic4Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -210,7 +215,7 @@ function alg_cache(alg::CandyRoz4, u, rate_prototype, ::Type{uEltypeNoUnits}, McAte4ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct Symplectic45Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic45Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -256,7 +261,7 @@ function alg_cache(alg::McAte42, u, rate_prototype, ::Type{uEltypeNoUnits}, McAte42ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct Symplectic5Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic5Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -283,7 +288,7 @@ function alg_cache(alg::McAte5, u, rate_prototype, ::Type{uEltypeNoUnits}, McAte5ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct Symplectic6Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic6Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -310,7 +315,7 @@ function alg_cache(alg::Yoshida6, u, rate_prototype, ::Type{uEltypeNoUnits}, Yoshida6ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct Symplectic62Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct Symplectic62Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -337,7 +342,7 @@ function alg_cache(alg::KahanLi6, u, rate_prototype, ::Type{uEltypeNoUnits}, KahanLi6ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct McAte8Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct McAte8Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -364,7 +369,7 @@ function alg_cache(alg::McAte8, u, rate_prototype, ::Type{uEltypeNoUnits}, McAte8ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct KahanLi8Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct KahanLi8Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -391,7 +396,7 @@ function alg_cache(alg::KahanLi8, u, rate_prototype, ::Type{uEltypeNoUnits}, KahanLi8ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -@cache struct SofSpa10Cache{uType, rateType, tableauType} <: OrdinaryDiffEqMutableCache +@cache struct SofSpa10Cache{uType, rateType, tableauType} <: HamiltonMutableCache u::uType uprev::uType tmp::uType @@ -416,4 +421,4 @@ function alg_cache(alg::SofSpa10, u, rate_prototype, ::Type{uEltypeNoUnits}, dt, reltol, p, calck, ::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits} SofSpa10ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) -end +end \ No newline at end of file diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl index c03b2a277e..06173ff5f2 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_perform_step.jl @@ -40,9 +40,6 @@ end function initialize!(integrator, cache::SymplecticEulerCache) integrator.kshortsize = 2 - @unpack k, fsalfirst = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = k resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -76,34 +73,20 @@ end f.f2(ku, du, u, p, t) end -const MutableCachesHamilton = Union{Symplectic2Cache, Symplectic3Cache, - Symplectic4Cache, Symplectic45Cache, Symplectic5Cache, - Symplectic6Cache, Symplectic62Cache, - McAte8Cache, KahanLi8Cache, SofSpa10Cache} -const MutableCachesNewton = Union{VelocityVerletCache} - -const ConstantCachesHamilton = Union{Symplectic2ConstantCache, Symplectic3ConstantCache, - Symplectic4ConstantCache, Symplectic45ConstantCache, - Symplectic5ConstantCache, - Symplectic6ConstantCache, Symplectic62ConstantCache, - McAte8ConstantCache, KahanLi8ConstantCache, - SofSpa10ConstantCache} -const ConstantCachesNewton = Union{VelocityVerletConstantCache} - # some of the algorithms are designed only for the case # f.f2(p, q, pa, t) = p which is the Newton/Lagrange equations # If called with different functions (which are possible in the Hamiltonian case) # an exception is thrown to avoid silently calculate wrong results. -verify_f2(f, p, q, pa, t, ::Any, ::C) where {C <: ConstantCachesHamilton} = f(p, q, pa, t) -function verify_f2(f, res, p, q, pa, t, ::Any, ::C) where {C <: MutableCachesHamilton} +verify_f2(f, p, q, pa, t, ::Any, ::C) where {C <: HamiltonConstantCache} = f(p, q, pa, t) +function verify_f2(f, res, p, q, pa, t, ::Any, ::C) where {C <: HamiltonMutableCache} f(res, p, q, pa, t) end -function verify_f2(f, p, q, pa, t, integrator, ::C) where {C <: ConstantCachesNewton} +function verify_f2(f, p, q, pa, t, integrator, ::C) where {C <: VelocityVerletConstantCache} res = f(p, q, pa, t) res == p ? p : throwex(integrator) end -function verify_f2(f, res, p, q, pa, t, integrator, ::C) where {C <: MutableCachesNewton} +function verify_f2(f, res, p, q, pa, t, integrator, ::C) where {C <: VelocityVerletCache} f(res, p, q, pa, t) res == p ? res : throwex(integrator) end @@ -142,9 +125,7 @@ end function initialize!(integrator, cache::C) where {C <: - Union{MutableCachesHamilton, MutableCachesNewton}} - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + Union{HamiltonMutableCache, VelocityVerletCache}} integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) @@ -162,7 +143,7 @@ end function initialize!(integrator, cache::C) where { C <: - Union{ConstantCachesHamilton, ConstantCachesNewton}} + Union{HamiltonConstantCache, VelocityVerletConstantCache}} integrator.kshortsize = 2 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) diff --git a/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl b/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl index 7588e184a3..db816c222f 100644 --- a/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl +++ b/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl @@ -9,7 +9,7 @@ import OrdinaryDiffEqCore: alg_order, alg_stability_size, explicit_rk_docstring, CompiledFloats, @OnDemandTableauExtract, initialize!, perform_step!, CompositeAlgorithm, _ode_addsteps!, copyat_or_push!, - AutoAlgSwitch, + AutoAlgSwitch, get_fsalfirstlast full_cache, DerivativeOrderNotPossibleError import Static: False import MuladdMacro: @muladd diff --git a/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl b/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl index abef90fe8b..b5c2ec183e 100644 --- a/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl +++ b/lib/OrdinaryDiffEqVerner/src/OrdinaryDiffEqVerner.jl @@ -13,7 +13,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, _ode_interpolant!, _ode_addsteps!, @fold, @OnDemandTableauExtract, AutoAlgSwitch, DerivativeOrderNotPossibleError, - has_lazy_interpolation + has_lazy_interpolation, get_fsalfirstlast using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools using DiffEqBase: @def, @tight_loop_macros using Static: False From b39af4940d4fea0018aedca2cffb02bc725b0587 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:22:14 -0400 Subject: [PATCH 20/55] just rks left --- .../src/exponential_rk_caches.jl | 2 ++ .../src/exponential_rk_perform_step.jl | 4 ---- lib/OrdinaryDiffEqFIRK/src/firk_caches.jl | 9 ++++++--- lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl | 6 ------ .../src/irkc_caches.jl | 2 ++ .../src/irkc_perform_step.jl | 2 -- lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl | 15 +++++++++------ .../src/rkc_perform_step.jl | 16 ++++------------ 8 files changed, 23 insertions(+), 33 deletions(-) diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl index 4ce453b028..e5b8f38661 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl @@ -2,6 +2,7 @@ # Classical ExpRK method caches abstract type ExpRKCache <: OrdinaryDiffEqMutableCache end abstract type ExpRKConstantCache <: OrdinaryDiffEqConstantCache end +get_fsalfirstlast(cache::ExpRKCache) = (zero(cache.rtmp), zero(cache.rtmp)) # Precomputation of exponential-like operators """ @@ -891,6 +892,7 @@ end B1::expType # ϕ1(hA) + ϕ2(hA) B0::expType # -ϕ2(hA) end +get_fsalfirstlast(cache::ETD2) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) function alg_cache(alg::ETD2, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl index 12abd86a98..5944b40e88 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_perform_step.jl @@ -24,10 +24,8 @@ function initialize!(integrator, cache::ExpRKConstantCache) end function initialize!(integrator, cache::ExpRKCache) # Pre-start fsal - integrator.fsalfirst = zero(cache.rtmp) integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) - integrator.fsallast = zero(integrator.fsalfirst) # Initialize interpolation derivatives integrator.kshortsize = 2 @@ -1595,7 +1593,6 @@ function initialize!(integrator, cache::ETD2Cache) rate_prototype = cache.rtmp1 # Pre-start fsal - integrator.fsalfirst = ETD2Fsal(rate_prototype) @unpack lin, nl = integrator.fsalfirst integrator.f.f1(lin, integrator.uprev, integrator.p, integrator.t) integrator.f.f2(nl, integrator.uprev, integrator.p, integrator.t) @@ -1603,7 +1600,6 @@ function initialize!(integrator, cache::ETD2Cache) integrator.stats.nf2 += 1 # Avoid undefined entries if k is an array of arrays - integrator.fsallast = ETD2Fsal(rate_prototype) integrator.k[1] = lin + nl integrator.k[2] = zero(rate_prototype) end diff --git a/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl b/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl index 2416b02687..17e3ee087c 100644 --- a/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl +++ b/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl @@ -1,3 +1,6 @@ +abstract type OrdinaryDiffEqMutableCache <: FIRKMutableCache end +get_fsalfirstlast(cache::FIRKMutableCache) = (cache.fsalfirst, cache.k) + mutable struct RadauIIA3ConstantCache{F, Tab, Tol, Dt, U, JType} <: OrdinaryDiffEqConstantCache uf::F @@ -30,7 +33,7 @@ function alg_cache(alg::RadauIIA3, u, rate_prototype, ::Type{uEltypeNoUnits}, end mutable struct RadauIIA3Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Type, UF, JC, - F1, Tab, Tol, Dt, rTol, aTol, StepLimiter} <: OrdinaryDiffEqMutableCache + F1, Tab, Tol, Dt, rTol, aTol, StepLimiter} <: FIRKMutableCache u::uType uprev::uType z1::uType @@ -156,7 +159,7 @@ end mutable struct RadauIIA5Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Type, W2Type, UF, JC, F1, F2, Tab, Tol, Dt, rTol, aTol, StepLimiter} <: - OrdinaryDiffEqMutableCache + FIRKMutableCache u::uType uprev::uType z1::uType @@ -307,7 +310,7 @@ end mutable struct RadauIIA9Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Type, W2Type, UF, JC, F1, F2, Tab, Tol, Dt, rTol, aTol, StepLimiter} <: - OrdinaryDiffEqMutableCache + FIRKMutableCache u::uType uprev::uType z1::uType diff --git a/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl b/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl index 4c55660956..bb0009cdd7 100644 --- a/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl +++ b/lib/OrdinaryDiffEqFIRK/src/firk_perform_step.jl @@ -66,8 +66,6 @@ end function initialize!(integrator, cache::RadauIIA3Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -78,8 +76,6 @@ end function initialize!(integrator, cache::RadauIIA5Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast @@ -100,8 +96,6 @@ end function initialize!(integrator, cache::RadauIIA9Cache) integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl index 42e989d307..629ff8ed1c 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl @@ -23,6 +23,8 @@ end constantcache::C end +get_fsalfirstlast(cache::IRKCCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) + function alg_cache(alg::IRKC, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, dt, reltol, p, calck, diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl index b79139d3bd..da07d95c41 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_perform_step.jl @@ -134,8 +134,6 @@ function initialize!(integrator, cache::IRKCCache) @unpack uprev, p, t = integrator @unpack f1, f2 = integrator.f integrator.kshortsize = 2 - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = du_alias_or_new(cache.nlsolver, integrator.fsalfirst) resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl index 2b7534cd90..47cb9211e1 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl @@ -1,3 +1,6 @@ +abstract type StabilizedRKMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::StabilizedRKMutableCache) = (cache.fsalfirst, cache.k) + mutable struct ROCK2ConstantCache{T, T2, zType} <: OrdinaryDiffEqConstantCache ms::SVector{46, Int} fp1::SVector{46, T} @@ -11,7 +14,7 @@ mutable struct ROCK2ConstantCache{T, T2, zType} <: OrdinaryDiffEqConstantCache max_stage::Int end @cache struct ROCK2Cache{uType, rateType, uNoUnitsType, C <: ROCK2ConstantCache} <: - OrdinaryDiffEqMutableCache + StabilizedRKMutableCache u::uType uprev::uType uᵢ₋₁::uType @@ -62,7 +65,7 @@ mutable struct ROCK4ConstantCache{T, T2, T3, T4, zType} <: OrdinaryDiffEqConstan end @cache struct ROCK4Cache{uType, rateType, uNoUnitsType, C <: ROCK4ConstantCache} <: - OrdinaryDiffEqMutableCache + StabilizedRKMutableCache u::uType uprev::uType uᵢ₋₁::uType @@ -105,7 +108,7 @@ mutable struct RKCConstantCache{zType} <: OrdinaryDiffEqConstantCache zprev::zType end @cache struct RKCCache{uType, rateType, uNoUnitsType, C <: RKCConstantCache} <: - OrdinaryDiffEqMutableCache + StabilizedRKMutableCache u::uType uprev::uType gprev::uType @@ -151,7 +154,7 @@ mutable struct ESERK4ConstantCache{T, zType} <: OrdinaryDiffEqConstantCache end @cache struct ESERK4Cache{uType, rateType, uNoUnitsType, C <: ESERK4ConstantCache} <: - OrdinaryDiffEqMutableCache + StabilizedRKMutableCache u::uType uprev::uType uᵢ::uType @@ -201,7 +204,7 @@ mutable struct ESERK5ConstantCache{T, zType} <: OrdinaryDiffEqConstantCache end @cache struct ESERK5Cache{uType, rateType, uNoUnitsType, C <: ESERK5ConstantCache} <: - OrdinaryDiffEqMutableCache + StabilizedRKMutableCache u::uType uprev::uType uᵢ::uType @@ -249,7 +252,7 @@ mutable struct SERK2ConstantCache{T, zType} <: OrdinaryDiffEqConstantCache end @cache struct SERK2Cache{uType, rateType, uNoUnitsType, C <: SERK2ConstantCache} <: - OrdinaryDiffEqMutableCache + StabilizedRKMutableCache u::uType uprev::uType uᵢ₋₁::uType diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl index 68149a4e19..9bcdb59674 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_perform_step.jl @@ -73,8 +73,6 @@ end function initialize!(integrator, cache::ROCK2Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst # done by pointers, no copying - integrator.fsallast = cache.k alg = unwrap_alg(integrator, true) cache.constantcache.max_stage = (alg.max_stages < 1 || alg.max_stages > 200) ? 200 : alg.max_stages @@ -278,8 +276,7 @@ end function initialize!(integrator, cache::ROCK4Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + alg = unwrap_alg(integrator, true) cache.constantcache.max_stage = (alg.max_stages < 1 || alg.max_stages > 152) ? 152 : alg.max_stages @@ -491,8 +488,6 @@ end function initialize!(integrator, cache::RKCCache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst # done by pointers, no copying - integrator.fsallast = cache.k integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal @@ -657,8 +652,7 @@ end function initialize!(integrator, cache::ESERK4Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) @@ -817,8 +811,7 @@ end function initialize!(integrator, cache::ESERK5Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) @@ -961,8 +954,7 @@ end function initialize!(integrator, cache::SERK2Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k + integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) From d4c8abc7fa467dd65612ced32e6ca3e4461626c5 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:35:26 -0400 Subject: [PATCH 21/55] done? --- .../src/high_order_rk_caches.jl | 11 +- .../src/high_order_rk_perform_step.jl | 8 - .../src/fixed_timestep_perform_step.jl | 5 + .../src/low_order_rk_perform_step.jl | 202 ++---------------- 4 files changed, 31 insertions(+), 195 deletions(-) diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl index bfb55ef511..9b3d282244 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl @@ -1,6 +1,8 @@ +abstract type HighOrderRKMutableCache <: OrdinaryDiffEqMutableCache end +get_fsalfirstlast(cache::HighOrderRKMutableCache) = (cache.fsalfirst, cache.k) @cache struct TanYam7Cache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + HighOrderRKMutableCache u::uType uprev::uType fsalfirst::rateType @@ -55,7 +57,7 @@ function alg_cache(alg::TanYam7, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache struct DP8Cache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, - Thread} <: OrdinaryDiffEqMutableCache + Thread} <: HighOrderRKMutableCache u::uType uprev::uType k1::rateType @@ -90,6 +92,7 @@ end step_limiter!::StepLimiter thread::Thread end +get_fsalfirstlast(cache::DP8Cache) = (cache.k1, cache.k13) function alg_cache(alg::DP8, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -141,7 +144,7 @@ end @cache struct TsitPap8Cache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + HighOrderRKMutableCache u::uType uprev::uType fsalfirst::rateType @@ -204,7 +207,7 @@ end @cache struct PFRK87Cache{ uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: - OrdinaryDiffEqMutableCache + HighOrderRKMutableCache u::uType uprev::uType fsalfirst::rateType diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl index 8027c7a1eb..5a623da48e 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_perform_step.jl @@ -54,8 +54,6 @@ end end function initialize!(integrator, cache::TanYam7Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -308,8 +306,6 @@ end end function initialize!(integrator, cache::TsitPap8Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst @@ -620,8 +616,6 @@ function initialize!(integrator, cache::DP8Cache) cache.dense_tmp6, cache.dense_tmp7 ] - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k13 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @@ -1006,8 +1000,6 @@ end end function initialize!(integrator, cache::PFRK87Cache) - integrator.fsalfirst = cache.fsalfirst - integrator.fsallast = cache.k integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) integrator.k[1] = integrator.fsalfirst diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl index e3f510e405..b384d755ea 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl @@ -21,6 +21,7 @@ function perform_step!(integrator, cache::EulerConstantCache, repeat_step = fals integrator.u = u end +get_fsalfirstlast(cache::EulerCache) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::EulerCache) integrator.kshortsize = 2 @unpack k, fsalfirst = cache @@ -96,6 +97,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::Union{HeunCache, RalstonCache}) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::Union{HeunCache, RalstonCache}) integrator.kshortsize = 2 @unpack k, fsalfirst = cache @@ -187,6 +189,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::MidpointCache) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::MidpointCache) @unpack k, fsalfirst = cache integrator.fsalfirst = fsalfirst @@ -285,6 +288,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::RK4Cache) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::RK4Cache) @unpack tmp, fsalfirst, k₂, k₃, k₄, k = cache integrator.fsalfirst = fsalfirst @@ -416,6 +420,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::Anas5Cache) = (cache.k1, cache.k7) function initialize!(integrator, cache::Anas5Cache) integrator.kshortsize = 7 resize!(integrator.k, integrator.kshortsize) diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl index c9f662ce04..0d6b22d3bd 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl @@ -33,11 +33,10 @@ end integrator.u = u end +get_fsalfirstlast(cache::BS3Cache) = (cache.fsalfirst, cache.k4) function initialize!(integrator, cache::BS3Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.fsalfirst # done by pointers, no copying - integrator.fsallast = cache.k4 integrator.k[1] = integrator.fsalfirst integrator.k[2] = integrator.fsallast integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal @@ -114,6 +113,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::OwrenZen3Cache) = (cache.k1, cache.k4) function initialize!(integrator, cache::OwrenZen3Cache) integrator.kshortsize = 4 resize!(integrator.k, integrator.kshortsize) @@ -121,8 +121,6 @@ function initialize!(integrator, cache::OwrenZen3Cache) integrator.k[2] = cache.k2 integrator.k[3] = cache.k3 integrator.k[4] = cache.k4 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k4 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @@ -197,6 +195,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::OwrenZen4Cache) = (cache.k1, cache.k6) function initialize!(integrator, cache::OwrenZen4Cache) integrator.kshortsize = 6 resize!(integrator.k, integrator.kshortsize) @@ -206,8 +205,6 @@ function initialize!(integrator, cache::OwrenZen4Cache) integrator.k[4] = cache.k4 integrator.k[5] = cache.k5 integrator.k[6] = cache.k6 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k6 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @@ -248,44 +245,6 @@ end return nothing end -#= -@muladd function perform_step!(integrator, cache::OwrenZen4Cache, repeat_step=false) - @unpack t,dt,uprev,u,f,p = integrator - uidx = eachindex(integrator.uprev) - @unpack k1,k2,k3,k4,k5,k6,utilde,tmp,atmp = cache - @unpack a21,a31,a32,a41,a42,a43,a51,a52,a53,a54,a61,a63,a64,a65,c1,c2,c3,c4,btilde1,btilde3,btilde4,btilde5 = cache.tab - a = dt*a21 - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+a*k1[i] - end - f(k2, tmp, p, t+c1*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a31*k1[i]+a32*k2[i]) - end - f(k3, tmp, p, t+c2*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a41*k1[i]+a42*k2[i]+a43*k3[i]) - end - f(k4, tmp, p, t+c3*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a51*k1[i]+a52*k2[i]+a53*k3[i]+a54*k4[i]) - end - f(k5, tmp, p, t+c4*dt) - @tight_loop_macros for i in uidx - @inbounds u[i] = uprev[i]+dt*(a61*k1[i]+a63*k3[i]+a64*k4[i]+a65*k5[i]) - end - f(k6, u, p, t+dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 5) - if integrator.opts.adaptive - @tight_loop_macros for i in uidx - @inbounds utilde[i] = dt*(btilde1*k1[i] + btilde3*k3[i] + btilde4*k4[i] + btilde5*k5[i]) - end - calculate_residuals!(atmp, utilde, uprev, u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm,t) - integrator.EEst = integrator.opts.internalnorm(atmp,t) - end -end -=# - function initialize!(integrator, cache::OwrenZen5ConstantCache) integrator.kshortsize = 8 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -338,6 +297,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::OwrenZen5Cache) = (cache.k1, cache.k8) function initialize!(integrator, cache::OwrenZen5Cache) integrator.kshortsize = 8 resize!(integrator.k, integrator.kshortsize) @@ -349,8 +309,6 @@ function initialize!(integrator, cache::OwrenZen5Cache) integrator.k[6] = cache.k6 integrator.k[7] = cache.k7 integrator.k[8] = cache.k8 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k8 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @@ -405,52 +363,6 @@ end return nothing end -#= -@muladd function perform_step!(integrator, cache::OwrenZen5Cache, repeat_step=false) - @unpack t,dt,uprev,u,f,p = integrator - uidx = eachindex(integrator.uprev) - @unpack k1,k2,k3,k4,k5,k6,k7,k8,utilde,tmp,atmp = cache - @unpack a21,a31,a32,a41,a42,a51,a52,a53,a54,a61,a62,a63,a64,a65,a71,a72,a73,a74,a75,a76,a81,a83,a84,a85,a86,a87,c1,c2,c3,c4,c5,c6,btilde1,btilde3,btilde4,btilde5,btilde6,btilde7 = cache.tab - a = dt*a21 - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+a*k1[i] - end - f(k2, tmp, p, t+c1*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a31*k1[i]+a32*k2[i]) - end - f(k3, tmp, p, t+c2*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a41*k1[i]+a42*k2[i]+k3[i]) - end - f(k4, tmp, p, t+c3*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a51*k1[i]+a52*k2[i]+a53*k3[i]+a54*k4[i]) - end - f(k5, tmp, p, t+c4*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a61*k1[i]+a62*k2[i]+a63*k3[i]+a64*k4[i]+a65*k5[i]) - end - f(k6, tmp, p, t+c5*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a71*k1[i]+a72*k2[i]+a73*k3[i]+a74*k4[i]+a75*k5[i]+a76*k6[i]) - end - f(k7, tmp, p, t+c6*dt) - @tight_loop_macros for i in uidx - @inbounds u[i] = uprev[i]+dt*(a81*k1[i]+a83*k3[i]+a84*k4[i]+a85*k5[i]+a86*k6[i]+a87*k7[i]) - end - f(k8, u, p, t+dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) - if integrator.opts.adaptive - @tight_loop_macros for i in uidx - @inbounds utilde[i] = dt*(btilde1*k1[i] + btilde3*k3[i] + btilde4*k4[i] + btilde5*k5[i] + btilde6*k6[i] + btilde7*k7[i]) - end - calculate_residuals!(atmp, utilde, uprev, u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm,t) - integrator.EEst = integrator.opts.internalnorm(atmp,t) - end -end -=# - function initialize!(integrator, cache::BS5ConstantCache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 8) : (integrator.kshortsize = 11) @@ -542,6 +454,7 @@ end end end +get_fsalfirstlast(cache::BS5Cache) = (cache.k1, cache.k8) function initialize!(integrator, cache::BS5Cache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 8) : (integrator.kshortsize = 11) @@ -560,9 +473,6 @@ function initialize!(integrator, cache::BS5Cache) integrator.k[10] = similar(cache.k1) integrator.k[11] = similar(cache.k1) end - - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k8 # setup pointers integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @@ -656,77 +566,6 @@ end return nothing end -#= -@muladd function perform_step!(integrator, cache::BS5Cache, repeat_step=false) - @unpack t,dt,uprev,u,f,p = integrator - uidx = eachindex(integrator.uprev) - @unpack k1,k2,k3,k4,k5,k6,k7,k8,utilde,tmp,atmp = cache - @unpack c1,c2,c3,c4,c5,a21,a31,a32,a41,a42,a43,a51,a52,a53,a54,a61,a62,a63,a64,a65,a71,a72,a73,a74,a75,a76,a81,a83,a84,a85,a86,a87,bhat1,bhat3,bhat4,bhat5,bhat6,btilde1,btilde3,btilde4,btilde5,btilde6,btilde7,btilde8 = cache.tab - a = dt*a21 - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+a*k1[i] - end - f(k2, tmp, p, t+c1*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a31*k1[i]+a32*k2[i]) - end - f(k3, tmp, p, t+c2*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a41*k1[i]+a42*k2[i]+a43*k3[i]) - end - f(k4, tmp, p, t+c3*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a51*k1[i]+a52*k2[i]+a53*k3[i]+a54*k4[i]) - end - f(k5, tmp, p, t+c4*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a61*k1[i]+a62*k2[i]+a63*k3[i]+a64*k4[i]+a65*k5[i]) - end - f(k6, tmp, p, t+c5*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a71*k1[i]+a72*k2[i]+a73*k3[i]+a74*k4[i]+a75*k5[i]+a76*k6[i]) - end - f(k7, tmp, p, t+dt) - @tight_loop_macros for i in uidx - @inbounds u[i] = uprev[i]+dt*(a81*k1[i]+a83*k3[i]+a84*k4[i]+a85*k5[i]+a86*k6[i]+a87*k7[i]) - end - f(k8, u, p, t+dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 7) - if integrator.opts.adaptive - @tight_loop_macros for i in uidx - @inbounds utilde[i] = dt*(bhat1*k1[i] + bhat3*k3[i] + bhat4*k4[i] + bhat5*k5[i] + bhat6*k6[i]) - end - calculate_residuals!(atmp, utilde, uprev, u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm,t) - EEst1 = integrator.opts.internalnorm(atmp,t) - @tight_loop_macros for i in uidx - @inbounds utilde[i] = dt*(btilde1*k1[i] + btilde3*k3[i] + btilde4*k4[i] + btilde5*k5[i] + btilde6*k6[i] + btilde7*k7[i] + btilde8*k8[i]) - end - calculate_residuals!(atmp, utilde, uprev, u, integrator.opts.abstol, integrator.opts.reltol,integrator.opts.internalnorm,t) - EEst2 = integrator.opts.internalnorm(atmp,t) - integrator.EEst = max(EEst1,EEst2) - end - - alg = unwrap_alg(integrator, false) - if !alg.lazy && (integrator.opts.adaptive == false || accept_step_controller(integrator, integrator.opts.controller)) - k = integrator.k - @unpack c6,c7,c8,a91,a92,a93,a94,a95,a96,a97,a98,a101,a102,a103,a104,a105,a106,a107,a108,a109,a111,a112,a113,a114,a115,a116,a117,a118,a119,a1110 = cache.tab - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a91*k[1][i]+a92*k[2][i]+a93*k[3][i]+a94*k[4][i]+a95*k[5][i]+a96*k[6][i]+a97*k[7][i]+a98*k[8][i]) - end - f(k[9],tmp,p,t+c6*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a101*k[1][i]+a102*k[2][i]+a103*k[3][i]+a104*k[4][i]+a105*k[5][i]+a106*k[6][i]+a107*k[7][i]+a108*k[8][i]+a109*k[9][i]) - end - f(k[10],tmp,p,t+c7*dt) - @tight_loop_macros for i in uidx - @inbounds tmp[i] = uprev[i]+dt*(a111*k[1][i]+a112*k[2][i]+a113*k[3][i]+a114*k[4][i]+a115*k[5][i]+a116*k[6][i]+a117*k[7][i]+a118*k[8][i]+a119*k[9][i]+a1110*k[10][i]) - end - f(k[11],tmp,p,t+c8*dt) - OrdinaryDiffEqCore.increment_nf!(integrator.stats, 3) - end -end -=# - function initialize!(integrator, cache::DP5ConstantCache) integrator.kshortsize = 4 integrator.k = typeof(integrator.k)(undef, integrator.kshortsize) @@ -780,6 +619,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::DP5Cache) = (cache.k1, cache.k7) function initialize!(integrator, cache::DP5Cache) integrator.kshortsize = 4 resize!(integrator.k, integrator.kshortsize) @@ -787,8 +627,6 @@ function initialize!(integrator, cache::DP5Cache) integrator.k[2] = cache.bspl integrator.k[3] = cache.dense_tmp3 integrator.k[4] = cache.dense_tmp4 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k7 integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) end @@ -898,14 +736,12 @@ end integrator.u = u end +get_fsalfirstlast(cache::RKO65Cache) = (cache.k1, cache.k6) function initialize!(integrator, cache::RKO65Cache) @unpack k, fsalfirst = cache integrator.kshortsize = 6 resize!(integrator.k, integrator.kshortsize) - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k6 # setup pointers - integrator.k[1] = cache.k1 integrator.k[2] = cache.k2 integrator.k[3] = cache.k3 @@ -913,9 +749,6 @@ function initialize!(integrator, cache::RKO65Cache) integrator.k[5] = cache.k5 integrator.k[6] = cache.k6 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k6 # setup pointers - integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -1030,10 +863,9 @@ end integrator.u = u end +get_fsalfirstlast(cache::FRK65Cache) = (cache.k1, cache.k9) function initialize!(integrator, cache::FRK65Cache) integrator.kshortsize = 9 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k9 resize!(integrator.k, integrator.kshortsize) @@ -1159,6 +991,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::RKMCache) = (cache.k1, zero(cache.k1)) function initialize!(integrator, cache::RKMCache) @unpack k, fsalfirst = cache integrator.kshortsize = 6 @@ -1170,9 +1003,6 @@ function initialize!(integrator, cache::RKMCache) integrator.k[5] = cache.k5 integrator.k[6] = cache.k6 - integrator.fsalfirst = cache.k1 - integrator.fsallast = zero(integrator.fsalfirst) # setup pointers - integrator.f(integrator.fsalfirst, integrator.uprev, integrator.p, integrator.t) # Pre-start fsal OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1) @@ -1251,6 +1081,7 @@ function perform_step!(integrator, cache::PSRK4p7q6ConstantCache, repeat_step = integrator.u = u end +get_fsalfirstlast(cache::RKMCache) = (cache.k1, cache.k6) function initialize!(integrator, cache::PSRK4p7q6Cache) @unpack uprev, f, p, t = integrator @@ -1262,8 +1093,6 @@ function initialize!(integrator, cache::PSRK4p7q6Cache) integrator.k[4] = cache.k4 integrator.k[5] = cache.k5 integrator.k[6] = cache.k6 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k6 end function perform_step!(integrator, cache::PSRK4p7q6Cache, repeat_step = false) @@ -1340,6 +1169,7 @@ function perform_step!(integrator, cache::PSRK3p6q5ConstantCache, repeat_step = integrator.u = u end +get_fsalfirstlast(cache::PSRK3p6q5Cache) = (cache.k1, cache.k5) function initialize!(integrator, cache::PSRK3p6q5Cache) @unpack uprev, f, p, t = integrator @@ -1350,8 +1180,6 @@ function initialize!(integrator, cache::PSRK3p6q5Cache) integrator.k[3] = cache.k3 integrator.k[4] = cache.k4 integrator.k[5] = cache.k5 - integrator.fsalfirst = cache.k1 - integrator.fsallast = cache.k5 end function perform_step!(integrator, cache::PSRK3p6q5Cache, repeat_step = false) @@ -1418,6 +1246,7 @@ function perform_step!(integrator, cache::PSRK3p5q4ConstantCache, repeat_step = integrator.u = u end +get_fsalfirstlast(cache::PSRK3p5q4Cache) = (cache.k1, cache.k4) function initialize!(integrator, cache::PSRK3p5q4Cache) @unpack uprev, f, p, t = integrator @@ -1506,6 +1335,7 @@ function perform_step!(integrator, cache::MSRK5ConstantCache, repeat_step = fals integrator.u = u end +get_fsalfirstlast(cache::MSRK5Cache) = (cache.k1, cache.k9) function initialize!(integrator, cache::MSRK5Cache) @unpack uprev, f, p, t = integrator @@ -1622,6 +1452,7 @@ function perform_step!(integrator, cache::MSRK6ConstantCache, repeat_step = fals integrator.u = u end +get_fsalfirstlast(cache::MSRK6Cache) = (cache.k1, cache.k9) function initialize!(integrator, cache::MSRK6Cache) @unpack uprev, f, p, t = integrator @@ -1741,6 +1572,7 @@ function perform_step!(integrator, cache::Stepanov5ConstantCache, repeat_step = integrator.u = u end +get_fsalfirstlast(cache::Stepanov5Cache) = (cache.k1, cache.k7) function initialize!(integrator, cache::Stepanov5Cache) @unpack uprev, f, p, t = integrator @@ -1861,6 +1693,7 @@ function perform_step!(integrator, cache::SIR54ConstantCache, repeat_step = fals integrator.u = u end +get_fsalfirstlast(cache::SIR54Cache) = (cache.k1, cache.k8) function initialize!(integrator, cache::SIR54Cache) @unpack uprev, f, p, t = integrator @@ -1968,6 +1801,7 @@ function perform_step!(integrator, cache::Alshina2ConstantCache, repeat_step = f integrator.u = u end +get_fsalfirstlast(cache::Alshina2Cache) = (cache.k1, cache.k2) function initialize!(integrator, cache::Alshina2Cache) @unpack uprev, f, p, t = integrator @@ -2048,6 +1882,7 @@ function perform_step!(integrator, cache::Alshina3ConstantCache, repeat_step = f integrator.u = u end +get_fsalfirstlast(cache::Alshina3Cache) = (cache.k1, cache.k3) function initialize!(integrator, cache::Alshina3Cache) @unpack uprev, f, p, t = integrator @@ -2143,6 +1978,7 @@ function perform_step!(integrator, cache::Alshina6ConstantCache, repeat_step = f integrator.u = u end +get_fsalfirstlast(cache::Alshina6Cache) = (cache.k1, cache.k7) function initialize!(integrator, cache::Alshina6Cache) @unpack uprev, f, p, t = integrator From fe4668e377a0c7e47631f40bd6218580019f29ce Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:40:33 -0400 Subject: [PATCH 22/55] a few fixes --- lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl | 2 +- lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl index da11904bae..5aab2d4c57 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl @@ -1,4 +1,4 @@ -abstract type OrdinaryDiffEqMutableCache <: LowStorageRKMutableCache end +abstract type LowStorageRKMutableCache <: OrdinaryDiffEqMutableCache end get_fsalfirstlast(cache::LowStorageRKMutableCache) = (cache.fsalfirst, cache.k) # 2N low storage methods introduced by Williamson diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl index fb94f2db99..450667d2dc 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl @@ -1,8 +1,6 @@ abstract type HamiltonMutableCache <: OrdinaryDiffEqMutableCache end abstract type HamiltonConstantCache <: OrdinaryDiffEqConstantCache end -get_fsalfirstlast(cache::Union{HamiltonMutableCache, VelocityVerletCache, SymplecticEulerCache}) = (cache.fsalfirst, cache.k) - @cache struct SymplecticEulerCache{uType, rateType} <: HamiltonMutableCache u::uType uprev::uType @@ -421,4 +419,6 @@ function alg_cache(alg::SofSpa10, u, rate_prototype, ::Type{uEltypeNoUnits}, dt, reltol, p, calck, ::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits} SofSpa10ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) -end \ No newline at end of file +end + +get_fsalfirstlast(cache::Union{HamiltonMutableCache, VelocityVerletCache, SymplecticEulerCache}) = (cache.fsalfirst, cache.k) From 9d429ade27138a566d5a2b31ca0aa174b9dc4a0c Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:47:21 -0400 Subject: [PATCH 23/55] a few more fixes --- lib/OrdinaryDiffEqFIRK/src/firk_caches.jl | 2 +- lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl b/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl index 17e3ee087c..ddd84b572e 100644 --- a/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl +++ b/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl @@ -1,4 +1,4 @@ -abstract type OrdinaryDiffEqMutableCache <: FIRKMutableCache end +abstract type FIRKMutableCache <: OrdinaryDiffEqMutableCache end get_fsalfirstlast(cache::FIRKMutableCache) = (cache.fsalfirst, cache.k) mutable struct RadauIIA3ConstantCache{F, Tab, Tol, Dt, U, JType} <: diff --git a/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl b/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl index db816c222f..b6e147f7e2 100644 --- a/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl +++ b/lib/OrdinaryDiffEqTsit5/src/OrdinaryDiffEqTsit5.jl @@ -9,7 +9,7 @@ import OrdinaryDiffEqCore: alg_order, alg_stability_size, explicit_rk_docstring, CompiledFloats, @OnDemandTableauExtract, initialize!, perform_step!, CompositeAlgorithm, _ode_addsteps!, copyat_or_push!, - AutoAlgSwitch, get_fsalfirstlast + AutoAlgSwitch, get_fsalfirstlast, full_cache, DerivativeOrderNotPossibleError import Static: False import MuladdMacro: @muladd From 5eec4e30769ef79fe48abe72a5eb8717dd219eb8 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:53:38 -0400 Subject: [PATCH 24/55] fix default cache fsal --- .../src/caches/basic_caches.jl | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index 5901737d1c..b5ae0270c6 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -31,7 +31,26 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache end end -get_fsalfirstlast(cache::DefaultCache) = get_fsalfirstlast(cache.cache1) +function get_fsalfirstlast(cache::DefaultCache) + if isbitstype(T1) + get_fsalfirstlast(cache.cache1) + end + if isbitstype(T2) + get_fsalfirstlast(cache.cache2) + end + if isbitstype(T3) + get_fsalfirstlast(cache.cache3) + end + if isbitstype(T4) + get_fsalfirstlast(cache.cache4) + end + if isbitstype(T5) + get_fsalfirstlast(cache.cache5) + end + if isbitstype(T6) + get_fsalfirstlast(cache.cache6) + end +end function alg_cache(alg::CompositeAlgorithm, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, From d24852b7bb90c7c6e6457f5f8cc43ef8d0474edc Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 02:55:17 -0400 Subject: [PATCH 25/55] safer rosenbrock --- lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl index aa0782557d..11448cc456 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl @@ -1,7 +1,7 @@ abstract type RosenbrockMutableCache <: OrdinaryDiffEqMutableCache end # Fake values since non-FSAL -get_fsalfirstlast(cache::RosenbrockMutableCache) = (cache.u, cache.uprev) +get_fsalfirstlast(cache::RosenbrockMutableCache) = (zero(cache.u), zero(cache.u)) ################################################################################ From 9fbeeff0a3ab7bf09fc962afbe05aaa6c6a00cd0 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:03:18 -0400 Subject: [PATCH 26/55] fix --- lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index b5ae0270c6..3d20cbf9b5 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -31,7 +31,7 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache end end -function get_fsalfirstlast(cache::DefaultCache) +function get_fsalfirstlast(cache::DefaultCache{T1, T2, T3, T4, T5, T6}) where {T1, T2, T3, T4, T5, T6} if isbitstype(T1) get_fsalfirstlast(cache.cache1) end From dd4ac1648d79ae63569318ccbd7fb2a2a5fc0d98 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:14:18 -0400 Subject: [PATCH 27/55] fix default handling --- .../src/caches/basic_caches.jl | 26 ++++--------------- .../perform_step/composite_perform_step.jl | 18 +++++++++++++ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index 3d20cbf9b5..0462b238b0 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -15,7 +15,7 @@ end get_fsalfirstlast(cache::CompositeCache) = get_fsalfirstlast(cache.caches[1]) -mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache +mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F, uType} <: OrdinaryDiffEqCache args::A choice_function::F current::Int @@ -25,31 +25,15 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F} <: OrdinaryDiffEqCache cache4::T4 cache5::T5 cache6::T6 + u::uType function DefaultCache{T1, T2, T3, T4, T5, T6, F}( args, choice_function, current) where {T1, T2, T3, T4, T5, T6, F} new{T1, T2, T3, T4, T5, T6, typeof(args), F}(args, choice_function, current) end end -function get_fsalfirstlast(cache::DefaultCache{T1, T2, T3, T4, T5, T6}) where {T1, T2, T3, T4, T5, T6} - if isbitstype(T1) - get_fsalfirstlast(cache.cache1) - end - if isbitstype(T2) - get_fsalfirstlast(cache.cache2) - end - if isbitstype(T3) - get_fsalfirstlast(cache.cache3) - end - if isbitstype(T4) - get_fsalfirstlast(cache.cache4) - end - if isbitstype(T5) - get_fsalfirstlast(cache.cache5) - end - if isbitstype(T6) - get_fsalfirstlast(cache.cache6) - end +function get_fsalfirstlast(cache::DefaultCache) + (u,u) end function alg_cache(alg::CompositeAlgorithm, u, rate_prototype, ::Type{uEltypeNoUnits}, @@ -77,7 +61,7 @@ function alg_cache(alg::CompositeAlgorithm{CS, Tuple{A1, A2, A3, A4, A5, A6}}, u T5 = Base.promote_op(alg_cache, A5, argT...) T6 = Base.promote_op(alg_cache, A6, argT...) cache = DefaultCache{T1, T2, T3, T4, T5, T6, typeof(alg.choice_function)}( - args, alg.choice_function, 1) + args, alg.choice_function, 1, u) algs = alg.algs # If the type is a bitstype we need to initialize it correctly here since isdefined will always return true. if isbitstype(T1) diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index 2eb19e1688..38c57a167c 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -32,24 +32,42 @@ function initialize!(integrator, cache::DefaultCache) init_ith_default_cache(cache, algs, cache.current) if cache.current == 1 initialize!(integrator, cache.cache1) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache1) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif cache.current == 2 initialize!(integrator, cache.cache2) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache2) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[2]) elseif cache.current == 3 initialize!(integrator, cache.cache3) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache3) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[3]) elseif cache.current == 4 initialize!(integrator, cache.cache4) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache4) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[4]) elseif cache.current == 5 initialize!(integrator, cache.cache5) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache5) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[5]) elseif cache.current == 6 initialize!(integrator, cache.cache6) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache6) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[6]) end From 5ca4d13023ec196dac9c7d378262f2dada5efc56 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:14:52 -0400 Subject: [PATCH 28/55] fix other composites --- .../src/perform_step/composite_perform_step.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index 38c57a167c..b840ebeb41 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -95,8 +95,14 @@ function initialize!(integrator, cache::CompositeCache{Tuple{T1, T2}, F}) where cache.current = cache.choice_function(integrator) if cache.current == 1 initialize!(integrator, @inbounds(cache.caches[1])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1]) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif cache.current == 2 initialize!(integrator, @inbounds(cache.caches[2])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2]) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], integrator.alg.algs[2]) end From 99abecd92619bf81f7ad37bf665d31821bbad87c Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:15:28 -0400 Subject: [PATCH 29/55] handle all --- .../src/perform_step/composite_perform_step.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index b840ebeb41..906607a8b0 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -78,13 +78,22 @@ function initialize!(integrator, cache::CompositeCache) cache.current = cache.choice_function(integrator) if cache.current == 1 initialize!(integrator, @inbounds(cache.caches[1])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1]) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif cache.current == 2 initialize!(integrator, @inbounds(cache.caches[2])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2]) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast # the controller was initialized by default for integrator.alg.algs[1] reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], integrator.alg.algs[2]) else initialize!(integrator, @inbounds(cache.caches[cache.current])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[cache.current]) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], integrator.alg.algs[cache.current]) end From e2c51e8581fce21566b4d3803443b697454d755c Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:20:03 -0400 Subject: [PATCH 30/55] typo --- lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index 0462b238b0..d4ee969082 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -60,7 +60,7 @@ function alg_cache(alg::CompositeAlgorithm{CS, Tuple{A1, A2, A3, A4, A5, A6}}, u T4 = Base.promote_op(alg_cache, A4, argT...) T5 = Base.promote_op(alg_cache, A5, argT...) T6 = Base.promote_op(alg_cache, A6, argT...) - cache = DefaultCache{T1, T2, T3, T4, T5, T6, typeof(alg.choice_function)}( + cache = DefaultCache{T1, T2, T3, T4, T5, T6, typeof(alg.choice_function), typeof(u)}( args, alg.choice_function, 1, u) algs = alg.algs # If the type is a bitstype we need to initialize it correctly here since isdefined will always return true. From a176a62e8e9018f94076feb5a33db7ed2a07f13f Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:24:47 -0400 Subject: [PATCH 31/55] handle constructors --- lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index d4ee969082..aba848f04e 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -26,14 +26,14 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F, uType} <: OrdinaryDiff cache5::T5 cache6::T6 u::uType - function DefaultCache{T1, T2, T3, T4, T5, T6, F}( - args, choice_function, current) where {T1, T2, T3, T4, T5, T6, F} - new{T1, T2, T3, T4, T5, T6, typeof(args), F}(args, choice_function, current) + function DefaultCache{T1, T2, T3, T4, T5, T6, F, uType}( + args, choice_function, current, u) where {T1, T2, T3, T4, T5, T6, F, uType} + new{T1, T2, T3, T4, T5, T6, typeof(args), F, uType}(args, choice_function, current, u) end end function get_fsalfirstlast(cache::DefaultCache) - (u,u) + (cache.u,cache.u) # will be overwritten by the cache choice end function alg_cache(alg::CompositeAlgorithm, u, rate_prototype, ::Type{uEltypeNoUnits}, From dd97b726f711c37aabdf4aa4ceda4adbb8c168b7 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:47:15 -0400 Subject: [PATCH 32/55] fix argument order --- lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index aba848f04e..7a3bee2710 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -5,7 +5,7 @@ struct ODEEmptyCache <: OrdinaryDiffEqConstantCache end struct ODEChunkCache{CS} <: OrdinaryDiffEqConstantCache end # Don't worry about the potential alloc on a constant cache -get_fsalfirstlast(cache::OrdinaryDiffEqConstantCache) = zero(cache.u), zero(cache.u) +get_fsalfirstlast(cache::OrdinaryDiffEqConstantCache) = (zero(cache.u), zero(cache.u)) mutable struct CompositeCache{T, F} <: OrdinaryDiffEqCache caches::T @@ -19,13 +19,13 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F, uType} <: OrdinaryDiff args::A choice_function::F current::Int + u::uType cache1::T1 cache2::T2 cache3::T3 cache4::T4 cache5::T5 cache6::T6 - u::uType function DefaultCache{T1, T2, T3, T4, T5, T6, F, uType}( args, choice_function, current, u) where {T1, T2, T3, T4, T5, T6, F, uType} new{T1, T2, T3, T4, T5, T6, typeof(args), F, uType}(args, choice_function, current, u) From 619d49c0831a5ee8c90d33b787d804a2fd84d969 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 03:52:38 -0400 Subject: [PATCH 33/55] fix --- lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl index 19afe55557..d12ebc95bf 100644 --- a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl +++ b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl @@ -1,5 +1,3 @@ -struct QPRK98ConstantCache <: OrdinaryDiffEqConstantCache end -get_fsalfirstlast(cache::QPRK98Cache) = (cache.fsalfirst, cache.k) @cache struct QPRK98Cache{ uType, rateType, uNoUnitsType, StageLimiter, StepLimiter, Thread} <: @@ -31,6 +29,8 @@ get_fsalfirstlast(cache::QPRK98Cache) = (cache.fsalfirst, cache.k) thread::Thread end +get_fsalfirstlast(cache::QPRK98Cache) = (cache.fsalfirst, cache.k) + function alg_cache(alg::QPRK98, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, dt, reltol, p, calck, From 840e3b9feb90834454531fbb4007d06ec5af3ab7 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:01:29 -0400 Subject: [PATCH 34/55] move things around --- lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl index d12ebc95bf..59b7ddc1d7 100644 --- a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl +++ b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl @@ -1,3 +1,4 @@ +struct QPRK98ConstantCache <: OrdinaryDiffEqConstantCache end @cache struct QPRK98Cache{ uType, rateType, uNoUnitsType, StageLimiter, StepLimiter, Thread} <: From d3829c185c52c0c8cdc13ba1478a5869719b42e0 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:06:50 -0400 Subject: [PATCH 35/55] flip --- lib/OrdinaryDiffEqLinear/src/linear_caches.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl index deb9bb9f64..0ae3d77d8d 100644 --- a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl +++ b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl @@ -1,4 +1,4 @@ -abstract type OrdinaryDiffEqMutableCache <: LinearMutableCache end +abstract type LinearMutableCache <: OrdinaryDiffEqMutableCache end get_fsalfirstlast(cache::LinearMutableCache) = (cache.fsalfirst, cache.k) @cache struct MagnusMidpointCache{uType, rateType, WType, expType} <: From 645520f1803056b65d932fe8f72e34fadfa70a36 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:14:24 -0400 Subject: [PATCH 36/55] pass u for allowing the creation of constant cache fsal --- .../src/adams_bashforth_moulton_caches.jl | 4 +- lib/OrdinaryDiffEqBDF/src/bdf_caches.jl | 2 +- lib/OrdinaryDiffEqBDF/src/dae_caches.jl | 2 +- .../src/caches/basic_caches.jl | 6 +-- .../perform_step/composite_perform_step.jl | 25 ++++++------ lib/OrdinaryDiffEqCore/src/solve.jl | 2 +- .../src/explicit_rk_caches.jl | 2 +- .../src/exponential_rk_caches.jl | 4 +- .../src/extrapolation_caches.jl | 2 +- lib/OrdinaryDiffEqFIRK/src/firk_caches.jl | 2 +- lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl | 2 +- .../src/functionmap_caches.jl | 2 +- .../src/high_order_rk_caches.jl | 4 +- .../src/imex_multistep_caches.jl | 2 +- lib/OrdinaryDiffEqLinear/src/linear_caches.jl | 2 +- .../src/fixed_timestep_perform_step.jl | 10 ++--- .../src/low_order_rk_perform_step.jl | 38 +++++++++---------- .../src/low_storage_rk_caches.jl | 2 +- .../src/nordsieck_caches.jl | 2 +- lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl | 2 +- lib/OrdinaryDiffEqPRK/src/prk_caches.jl | 2 +- lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl | 2 +- lib/OrdinaryDiffEqRKN/src/rkn_caches.jl | 2 +- .../src/rosenbrock_caches.jl | 19 +++++----- lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl | 2 +- lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl | 2 +- .../src/irkc_caches.jl | 2 +- .../src/rkc_caches.jl | 2 +- .../src/symplectic_caches.jl | 2 +- lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl | 2 +- lib/OrdinaryDiffEqVerner/src/verner_caches.jl | 8 ++-- 31 files changed, 83 insertions(+), 79 deletions(-) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl index 40f792dd96..fda72a8cd8 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/src/adams_bashforth_moulton_caches.jl @@ -1,7 +1,7 @@ abstract type ABMMutableCache <: OrdinaryDiffEqMutableCache end abstract type ABMVariableCoefficientMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::ABMMutableCache) = (cache.fsalfirst, cache.k) -get_fsalfirstlast(cache::ABMVariableCoefficientMutableCache) = (cache.fsalfirst, cache.k4) +get_fsalfirstlast(cache::ABMMutableCache,u) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::ABMVariableCoefficientMutableCache,u) = (cache.fsalfirst, cache.k4) @cache mutable struct AB3Cache{uType, rateType} <: ABMMutableCache u::uType uprev::uType diff --git a/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl b/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl index b2b3f9440b..7cdc4b580f 100644 --- a/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl +++ b/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl @@ -1,5 +1,5 @@ abstract type BDFMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::BDFMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) +get_fsalfirstlast(cache::BDFMutableCache,u) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) @cache mutable struct ABDF2ConstantCache{N, dtType, rate_prototype} <: OrdinaryDiffEqConstantCache diff --git a/lib/OrdinaryDiffEqBDF/src/dae_caches.jl b/lib/OrdinaryDiffEqBDF/src/dae_caches.jl index aa6ba9e7be..b84b5e4016 100644 --- a/lib/OrdinaryDiffEqBDF/src/dae_caches.jl +++ b/lib/OrdinaryDiffEqBDF/src/dae_caches.jl @@ -1,5 +1,5 @@ abstract type DAEBDFMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::DAEBDFMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) +get_fsalfirstlast(cache::DAEBDFMutableCache,u) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) @cache mutable struct DImplicitEulerCache{uType, rateType, uNoUnitsType, N} <: DAEBDFMutableCache diff --git a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl index 7a3bee2710..f8aef04cda 100644 --- a/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl +++ b/lib/OrdinaryDiffEqCore/src/caches/basic_caches.jl @@ -5,7 +5,7 @@ struct ODEEmptyCache <: OrdinaryDiffEqConstantCache end struct ODEChunkCache{CS} <: OrdinaryDiffEqConstantCache end # Don't worry about the potential alloc on a constant cache -get_fsalfirstlast(cache::OrdinaryDiffEqConstantCache) = (zero(cache.u), zero(cache.u)) +get_fsalfirstlast(cache::OrdinaryDiffEqConstantCache,u) = (zero(u), zero(u)) mutable struct CompositeCache{T, F} <: OrdinaryDiffEqCache caches::T @@ -13,7 +13,7 @@ mutable struct CompositeCache{T, F} <: OrdinaryDiffEqCache current::Int end -get_fsalfirstlast(cache::CompositeCache) = get_fsalfirstlast(cache.caches[1]) +get_fsalfirstlast(cache::CompositeCache,u) = get_fsalfirstlast(cache.caches[1],u) mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F, uType} <: OrdinaryDiffEqCache args::A @@ -32,7 +32,7 @@ mutable struct DefaultCache{T1, T2, T3, T4, T5, T6, A, F, uType} <: OrdinaryDiff end end -function get_fsalfirstlast(cache::DefaultCache) +function get_fsalfirstlast(cache::DefaultCache,u) (cache.u,cache.u) # will be overwritten by the cache choice end diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index 906607a8b0..ca8698f322 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -30,42 +30,43 @@ function initialize!(integrator, cache::DefaultCache) cache.current = cache.choice_function(integrator) algs = integrator.alg.algs init_ith_default_cache(cache, algs, cache.current) + u = integrator.u if cache.current == 1 initialize!(integrator, cache.cache1) - fsalfirst, fsallast = get_fsalfirstlast(cache.cache1) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache1,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast elseif cache.current == 2 initialize!(integrator, cache.cache2) - fsalfirst, fsallast = get_fsalfirstlast(cache.cache2) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache2,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[2]) elseif cache.current == 3 initialize!(integrator, cache.cache3) - fsalfirst, fsallast = get_fsalfirstlast(cache.cache3) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache3,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[3]) elseif cache.current == 4 initialize!(integrator, cache.cache4) - fsalfirst, fsallast = get_fsalfirstlast(cache.cache4) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache4,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[4]) elseif cache.current == 5 initialize!(integrator, cache.cache5) - fsalfirst, fsallast = get_fsalfirstlast(cache.cache5) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache5,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[5]) elseif cache.current == 6 initialize!(integrator, cache.cache6) - fsalfirst, fsallast = get_fsalfirstlast(cache.cache6) + fsalfirst, fsallast = get_fsalfirstlast(cache.cache6,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast # the controller was initialized by default for algs[1] @@ -76,14 +77,15 @@ end function initialize!(integrator, cache::CompositeCache) cache.current = cache.choice_function(integrator) + u = integrator.u if cache.current == 1 initialize!(integrator, @inbounds(cache.caches[1])) - fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1]) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast elseif cache.current == 2 initialize!(integrator, @inbounds(cache.caches[2])) - fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2]) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast # the controller was initialized by default for integrator.alg.algs[1] @@ -91,7 +93,7 @@ function initialize!(integrator, cache::CompositeCache) integrator.alg.algs[2]) else initialize!(integrator, @inbounds(cache.caches[cache.current])) - fsalfirst, fsallast = get_fsalfirstlast(cache.caches[cache.current]) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[cache.current],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], @@ -102,14 +104,15 @@ end function initialize!(integrator, cache::CompositeCache{Tuple{T1, T2}, F}) where {T1, T2, F} cache.current = cache.choice_function(integrator) + u = integrator.u if cache.current == 1 initialize!(integrator, @inbounds(cache.caches[1])) - fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1]) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast elseif cache.current == 2 initialize!(integrator, @inbounds(cache.caches[2])) - fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2]) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index abc66270c1..9d1966d591 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -469,7 +469,7 @@ function DiffEqBase.__init( reinitiailize = true saveiter = 0 # Starts at 0 so first save is at 1 saveiter_dense = 0 - faslfirst, fsallast = get_fsalfirstlast(cache) + faslfirst, fsallast = get_fsalfirstlast(cache,u) integrator = ODEIntegrator{typeof(_alg), isinplace(prob), uType, typeof(du), tType, typeof(p), diff --git a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl index ad060c05b5..853e216b06 100644 --- a/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl +++ b/lib/OrdinaryDiffEqExplicitRK/src/explicit_rk_caches.jl @@ -11,7 +11,7 @@ tab::TabType end -get_fsalfirstlast(cache::ExplicitRKCache) = (cache.kk[1], cache.fsallast) +get_fsalfirstlast(cache::ExplicitRKCache,u) = (cache.kk[1], cache.fsallast) function alg_cache(alg::ExplicitRK, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl index e5b8f38661..4a2eb869db 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl @@ -2,7 +2,7 @@ # Classical ExpRK method caches abstract type ExpRKCache <: OrdinaryDiffEqMutableCache end abstract type ExpRKConstantCache <: OrdinaryDiffEqConstantCache end -get_fsalfirstlast(cache::ExpRKCache) = (zero(cache.rtmp), zero(cache.rtmp)) +get_fsalfirstlast(cache::ExpRKCache,u) = (zero(cache.rtmp), zero(cache.rtmp)) # Precomputation of exponential-like operators """ @@ -892,7 +892,7 @@ end B1::expType # ϕ1(hA) + ϕ2(hA) B0::expType # -ϕ2(hA) end -get_fsalfirstlast(cache::ETD2) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) +get_fsalfirstlast(cache::ETD2,u) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) function alg_cache(alg::ETD2, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl index 0917d03e11..aba94d6935 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl @@ -1,5 +1,5 @@ abstract type ExtrapolationMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::ExtrapolationMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::ExtrapolationMutableCache,u) = (cache.fsalfirst, cache.k) @cache mutable struct AitkenNevilleCache{ uType, diff --git a/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl b/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl index ddd84b572e..516775e085 100644 --- a/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl +++ b/lib/OrdinaryDiffEqFIRK/src/firk_caches.jl @@ -1,5 +1,5 @@ abstract type FIRKMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::FIRKMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::FIRKMutableCache,u) = (cache.fsalfirst, cache.k) mutable struct RadauIIA3ConstantCache{F, Tab, Tol, Dt, U, JType} <: OrdinaryDiffEqConstantCache diff --git a/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl b/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl index 58335ce53e..927d4778b2 100644 --- a/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl +++ b/lib/OrdinaryDiffEqFeagin/src/feagin_caches.jl @@ -1,5 +1,5 @@ abstract type FeaginCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::FeaginCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::FeaginCache,u) = (cache.fsalfirst, cache.k) @cache struct Feagin10Cache{uType, uNoUnitsType, rateType, TabType, StepLimiter} <: FeaginCache diff --git a/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl b/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl index 1fe3992fd5..401a55adeb 100644 --- a/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl +++ b/lib/OrdinaryDiffEqFunctionMap/src/functionmap_caches.jl @@ -3,7 +3,7 @@ uprev::uType tmp::rateType end -get_fsalfirstlast(cache::FunctionMapCache) = (cache.u, cache.uprev) +get_fsalfirstlast(cache::FunctionMapCache,u) = (cache.u, cache.uprev) function alg_cache(alg::FunctionMap, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl index 9b3d282244..2f8a0f4244 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/high_order_rk_caches.jl @@ -1,5 +1,5 @@ abstract type HighOrderRKMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::HighOrderRKMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::HighOrderRKMutableCache,u) = (cache.fsalfirst, cache.k) @cache struct TanYam7Cache{uType, rateType, uNoUnitsType, TabType, StageLimiter, StepLimiter, Thread} <: HighOrderRKMutableCache @@ -92,7 +92,7 @@ end step_limiter!::StepLimiter thread::Thread end -get_fsalfirstlast(cache::DP8Cache) = (cache.k1, cache.k13) +get_fsalfirstlast(cache::DP8Cache,u) = (cache.k1, cache.k13) function alg_cache(alg::DP8, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl index 95bc14cf59..20d33b9d1b 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl +++ b/lib/OrdinaryDiffEqIMEXMultistep/src/imex_multistep_caches.jl @@ -1,6 +1,6 @@ # IMEX Multistep methods abstract type IMEXMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::IMEXMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) +get_fsalfirstlast(cache::IMEXMutableCache,u) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) # CNAB2 diff --git a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl index 0ae3d77d8d..980470dfd2 100644 --- a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl +++ b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl @@ -1,5 +1,5 @@ abstract type LinearMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::LinearMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::LinearMutableCache,u) = (cache.fsalfirst, cache.k) @cache struct MagnusMidpointCache{uType, rateType, WType, expType} <: LinearMutableCache diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl index b384d755ea..c4ab6f12a6 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/fixed_timestep_perform_step.jl @@ -21,7 +21,7 @@ function perform_step!(integrator, cache::EulerConstantCache, repeat_step = fals integrator.u = u end -get_fsalfirstlast(cache::EulerCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::EulerCache,u) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::EulerCache) integrator.kshortsize = 2 @unpack k, fsalfirst = cache @@ -97,7 +97,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::Union{HeunCache, RalstonCache}) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::Union{HeunCache, RalstonCache},u) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::Union{HeunCache, RalstonCache}) integrator.kshortsize = 2 @unpack k, fsalfirst = cache @@ -189,7 +189,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::MidpointCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::MidpointCache,u) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::MidpointCache) @unpack k, fsalfirst = cache integrator.fsalfirst = fsalfirst @@ -288,7 +288,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::RK4Cache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::RK4Cache,u) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::RK4Cache) @unpack tmp, fsalfirst, k₂, k₃, k₄, k = cache integrator.fsalfirst = fsalfirst @@ -420,7 +420,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::Anas5Cache) = (cache.k1, cache.k7) +get_fsalfirstlast(cache::Anas5Cache,u) = (cache.k1, cache.k7) function initialize!(integrator, cache::Anas5Cache) integrator.kshortsize = 7 resize!(integrator.k, integrator.kshortsize) diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl index 0d6b22d3bd..d51d08ac99 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl @@ -33,7 +33,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::BS3Cache) = (cache.fsalfirst, cache.k4) +get_fsalfirstlast(cache::BS3Cache,u) = (cache.fsalfirst, cache.k4) function initialize!(integrator, cache::BS3Cache) integrator.kshortsize = 2 resize!(integrator.k, integrator.kshortsize) @@ -113,7 +113,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::OwrenZen3Cache) = (cache.k1, cache.k4) +get_fsalfirstlast(cache::OwrenZen3Cache,u) = (cache.k1, cache.k4) function initialize!(integrator, cache::OwrenZen3Cache) integrator.kshortsize = 4 resize!(integrator.k, integrator.kshortsize) @@ -195,7 +195,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::OwrenZen4Cache) = (cache.k1, cache.k6) +get_fsalfirstlast(cache::OwrenZen4Cache,u) = (cache.k1, cache.k6) function initialize!(integrator, cache::OwrenZen4Cache) integrator.kshortsize = 6 resize!(integrator.k, integrator.kshortsize) @@ -297,7 +297,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::OwrenZen5Cache) = (cache.k1, cache.k8) +get_fsalfirstlast(cache::OwrenZen5Cache,u) = (cache.k1, cache.k8) function initialize!(integrator, cache::OwrenZen5Cache) integrator.kshortsize = 8 resize!(integrator.k, integrator.kshortsize) @@ -454,7 +454,7 @@ end end end -get_fsalfirstlast(cache::BS5Cache) = (cache.k1, cache.k8) +get_fsalfirstlast(cache::BS5Cache,u) = (cache.k1, cache.k8) function initialize!(integrator, cache::BS5Cache) alg = unwrap_alg(integrator, false) alg.lazy ? (integrator.kshortsize = 8) : (integrator.kshortsize = 11) @@ -619,7 +619,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::DP5Cache) = (cache.k1, cache.k7) +get_fsalfirstlast(cache::DP5Cache,u) = (cache.k1, cache.k7) function initialize!(integrator, cache::DP5Cache) integrator.kshortsize = 4 resize!(integrator.k, integrator.kshortsize) @@ -736,7 +736,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::RKO65Cache) = (cache.k1, cache.k6) +get_fsalfirstlast(cache::RKO65Cache,u) = (cache.k1, cache.k6) function initialize!(integrator, cache::RKO65Cache) @unpack k, fsalfirst = cache integrator.kshortsize = 6 @@ -863,7 +863,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::FRK65Cache) = (cache.k1, cache.k9) +get_fsalfirstlast(cache::FRK65Cache,u) = (cache.k1, cache.k9) function initialize!(integrator, cache::FRK65Cache) integrator.kshortsize = 9 @@ -991,7 +991,7 @@ end integrator.u = u end -get_fsalfirstlast(cache::RKMCache) = (cache.k1, zero(cache.k1)) +get_fsalfirstlast(cache::RKMCache,u) = (cache.k1, zero(cache.k1)) function initialize!(integrator, cache::RKMCache) @unpack k, fsalfirst = cache integrator.kshortsize = 6 @@ -1081,7 +1081,7 @@ function perform_step!(integrator, cache::PSRK4p7q6ConstantCache, repeat_step = integrator.u = u end -get_fsalfirstlast(cache::RKMCache) = (cache.k1, cache.k6) +get_fsalfirstlast(cache::RKMCache,u) = (cache.k1, cache.k6) function initialize!(integrator, cache::PSRK4p7q6Cache) @unpack uprev, f, p, t = integrator @@ -1169,7 +1169,7 @@ function perform_step!(integrator, cache::PSRK3p6q5ConstantCache, repeat_step = integrator.u = u end -get_fsalfirstlast(cache::PSRK3p6q5Cache) = (cache.k1, cache.k5) +get_fsalfirstlast(cache::PSRK3p6q5Cache,u) = (cache.k1, cache.k5) function initialize!(integrator, cache::PSRK3p6q5Cache) @unpack uprev, f, p, t = integrator @@ -1246,7 +1246,7 @@ function perform_step!(integrator, cache::PSRK3p5q4ConstantCache, repeat_step = integrator.u = u end -get_fsalfirstlast(cache::PSRK3p5q4Cache) = (cache.k1, cache.k4) +get_fsalfirstlast(cache::PSRK3p5q4Cache,u) = (cache.k1, cache.k4) function initialize!(integrator, cache::PSRK3p5q4Cache) @unpack uprev, f, p, t = integrator @@ -1335,7 +1335,7 @@ function perform_step!(integrator, cache::MSRK5ConstantCache, repeat_step = fals integrator.u = u end -get_fsalfirstlast(cache::MSRK5Cache) = (cache.k1, cache.k9) +get_fsalfirstlast(cache::MSRK5Cache,u) = (cache.k1, cache.k9) function initialize!(integrator, cache::MSRK5Cache) @unpack uprev, f, p, t = integrator @@ -1452,7 +1452,7 @@ function perform_step!(integrator, cache::MSRK6ConstantCache, repeat_step = fals integrator.u = u end -get_fsalfirstlast(cache::MSRK6Cache) = (cache.k1, cache.k9) +get_fsalfirstlast(cache::MSRK6Cache,u) = (cache.k1, cache.k9) function initialize!(integrator, cache::MSRK6Cache) @unpack uprev, f, p, t = integrator @@ -1572,7 +1572,7 @@ function perform_step!(integrator, cache::Stepanov5ConstantCache, repeat_step = integrator.u = u end -get_fsalfirstlast(cache::Stepanov5Cache) = (cache.k1, cache.k7) +get_fsalfirstlast(cache::Stepanov5Cache,u) = (cache.k1, cache.k7) function initialize!(integrator, cache::Stepanov5Cache) @unpack uprev, f, p, t = integrator @@ -1693,7 +1693,7 @@ function perform_step!(integrator, cache::SIR54ConstantCache, repeat_step = fals integrator.u = u end -get_fsalfirstlast(cache::SIR54Cache) = (cache.k1, cache.k8) +get_fsalfirstlast(cache::SIR54Cache,u) = (cache.k1, cache.k8) function initialize!(integrator, cache::SIR54Cache) @unpack uprev, f, p, t = integrator @@ -1801,7 +1801,7 @@ function perform_step!(integrator, cache::Alshina2ConstantCache, repeat_step = f integrator.u = u end -get_fsalfirstlast(cache::Alshina2Cache) = (cache.k1, cache.k2) +get_fsalfirstlast(cache::Alshina2Cache,u) = (cache.k1, cache.k2) function initialize!(integrator, cache::Alshina2Cache) @unpack uprev, f, p, t = integrator @@ -1882,7 +1882,7 @@ function perform_step!(integrator, cache::Alshina3ConstantCache, repeat_step = f integrator.u = u end -get_fsalfirstlast(cache::Alshina3Cache) = (cache.k1, cache.k3) +get_fsalfirstlast(cache::Alshina3Cache,u) = (cache.k1, cache.k3) function initialize!(integrator, cache::Alshina3Cache) @unpack uprev, f, p, t = integrator @@ -1978,7 +1978,7 @@ function perform_step!(integrator, cache::Alshina6ConstantCache, repeat_step = f integrator.u = u end -get_fsalfirstlast(cache::Alshina6Cache) = (cache.k1, cache.k7) +get_fsalfirstlast(cache::Alshina6Cache,u) = (cache.k1, cache.k7) function initialize!(integrator, cache::Alshina6Cache) @unpack uprev, f, p, t = integrator diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl index 5aab2d4c57..c2f4ca4623 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_caches.jl @@ -1,5 +1,5 @@ abstract type LowStorageRKMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::LowStorageRKMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::LowStorageRKMutableCache,u) = (cache.fsalfirst, cache.k) # 2N low storage methods introduced by Williamson @cache struct LowStorageRK2NCache{uType, rateType, TabType, StageLimiter, StepLimiter, diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl index 32d5b94c24..ba65b6ce66 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl @@ -265,4 +265,4 @@ function alg_cache(alg::JVODE, u, rate_prototype, ::Type{uEltypeNoUnits}, dts, Δ, atmp, tsit5cache, 2, 1, 1, 2, η, η, η, η, η) end -get_fsalfirstlast(cache::Union{JVODE, AN5}) = get_fsalfirstlast(cache.tsit5cache) \ No newline at end of file +get_fsalfirstlast(cache::Union{JVODE, AN5},u) = get_fsalfirstlast(cache.tsit5cache,u) \ No newline at end of file diff --git a/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl b/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl index 64ed8788a9..0b1d86d995 100644 --- a/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl +++ b/lib/OrdinaryDiffEqPDIRK/src/pdirk_caches.jl @@ -8,7 +8,7 @@ end # Non-FSAL -get_fsalfirstlast(cache::PDIRK44Cache) = (cache.u, cache.uprev) +get_fsalfirstlast(cache::PDIRK44Cache,u) = (cache.u, cache.uprev) struct PDIRK44ConstantCache{N, TabType} <: OrdinaryDiffEqConstantCache nlsolver::N diff --git a/lib/OrdinaryDiffEqPRK/src/prk_caches.jl b/lib/OrdinaryDiffEqPRK/src/prk_caches.jl index 2b08bf88ff..17c5fa8ba5 100644 --- a/lib/OrdinaryDiffEqPRK/src/prk_caches.jl +++ b/lib/OrdinaryDiffEqPRK/src/prk_caches.jl @@ -11,7 +11,7 @@ fsalfirst::rateType tab::TabType end -get_fsalfirstlast(cache::KuttaPRK2p5Cache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::KuttaPRK2p5Cache,u) = (cache.fsalfirst, cache.k) struct KuttaPRK2p5ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache α21::T diff --git a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl index 59b7ddc1d7..667d45823b 100644 --- a/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl +++ b/lib/OrdinaryDiffEqQPRK/src/qprk_caches.jl @@ -30,7 +30,7 @@ struct QPRK98ConstantCache <: OrdinaryDiffEqConstantCache end thread::Thread end -get_fsalfirstlast(cache::QPRK98Cache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::QPRK98Cache,u) = (cache.fsalfirst, cache.k) function alg_cache(alg::QPRK98, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, diff --git a/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl b/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl index 27f2348020..649052ce8c 100644 --- a/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl +++ b/lib/OrdinaryDiffEqRKN/src/rkn_caches.jl @@ -1,5 +1,5 @@ abstract type NystromMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::NystromMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::NystromMutableCache,u) = (cache.fsalfirst, cache.k) @cache struct Nystrom4Cache{uType, rateType, reducedRateType} <: NystromMutableCache u::uType diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl index 11448cc456..8a69d2fc99 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl @@ -1,7 +1,8 @@ abstract type RosenbrockMutableCache <: OrdinaryDiffEqMutableCache end +abstract type RosenbrockConstantCache <: OrdinaryDiffEqConstantCache end # Fake values since non-FSAL -get_fsalfirstlast(cache::RosenbrockMutableCache) = (zero(cache.u), zero(cache.u)) +get_fsalfirstlast(cache::RosenbrockMutableCache,u) = (zero(u), zero(u)) ################################################################################ @@ -162,7 +163,7 @@ function alg_cache(alg::Rosenbrock32, u, rate_prototype, ::Type{uEltypeNoUnits}, end struct Rosenbrock23ConstantCache{T, TF, UF, JType, WType, F, AD} <: - OrdinaryDiffEqConstantCache + RosenbrockConstantCache c₃₂::T d::T tf::TF @@ -192,7 +193,7 @@ function alg_cache(alg::Rosenbrock23, u, rate_prototype, ::Type{uEltypeNoUnits}, end struct Rosenbrock32ConstantCache{T, TF, UF, JType, WType, F, AD} <: - OrdinaryDiffEqConstantCache + RosenbrockConstantCache c₃₂::T d::T tf::TF @@ -226,7 +227,7 @@ end ### 3rd order specialized Rosenbrocks struct Rosenbrock33ConstantCache{TF, UF, Tab, JType, WType, F} <: - OrdinaryDiffEqConstantCache + RosenbrockConstantCache tf::TF uf::UF tab::Tab @@ -395,7 +396,7 @@ function alg_cache(alg::Rodas3, u, rate_prototype, ::Type{uEltypeNoUnits}, end struct Rosenbrock34ConstantCache{TF, UF, Tab, JType, WType, F} <: - OrdinaryDiffEqConstantCache + RosenbrockConstantCache tf::TF uf::UF tab::Tab @@ -448,7 +449,7 @@ jac_cache(c::Rosenbrock4Cache) = (c.J, c.W) ### Rodas methods struct Rodas23WConstantCache{TF, UF, Tab, JType, WType, F, AD} <: - OrdinaryDiffEqConstantCache + RosenbrockConstantCache tf::TF uf::UF tab::Tab @@ -458,7 +459,7 @@ struct Rodas23WConstantCache{TF, UF, Tab, JType, WType, F, AD} <: autodiff::AD end -struct Rodas3PConstantCache{TF, UF, Tab, JType, WType, F, AD} <: OrdinaryDiffEqConstantCache +struct Rodas3PConstantCache{TF, UF, Tab, JType, WType, F, AD} <: RosenbrockConstantCache tf::TF uf::UF tab::Tab @@ -662,7 +663,7 @@ end ### Rodas4 methods -struct Rodas4ConstantCache{TF, UF, Tab, JType, WType, F, AD} <: OrdinaryDiffEqConstantCache +struct Rodas4ConstantCache{TF, UF, Tab, JType, WType, F, AD} <: RosenbrockConstantCache tf::TF uf::UF tab::Tab @@ -953,7 +954,7 @@ end ### Rosenbrock5 -struct Rosenbrock5ConstantCache{TF, UF, Tab, JType, WType, F} <: OrdinaryDiffEqConstantCache +struct Rosenbrock5ConstantCache{TF, UF, Tab, JType, WType, F} <: RosenbrockConstantCache tf::TF uf::UF tab::Tab diff --git a/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl b/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl index f3bd709e9d..21c4f878ee 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/sdirk_caches.jl @@ -1,6 +1,6 @@ abstract type SDIRKMutableCache <: OrdinaryDiffEqMutableCache end abstract type SDIRKConstantCache <: OrdinaryDiffEqConstantCache end -get_fsalfirstlast(cache::SDIRKMutableCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) +get_fsalfirstlast(cache::SDIRKMutableCache,u) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) @cache mutable struct ImplicitEulerCache{ uType, rateType, uNoUnitsType, N, AV, StepLimiter} <: diff --git a/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl b/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl index afb5c70474..8b7e0b68fb 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl @@ -1,6 +1,6 @@ abstract type SSPRKMutableCache <: OrdinaryDiffEqMutableCache end abstract type SSPRKConstantCache <: OrdinaryDiffEqConstantCache end -get_fsalfirstlast(cache::SSPRKMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::SSPRKMutableCache,u) = (cache.fsalfirst, cache.k) @cache struct SSPRK22Cache{uType, rateType, StageLimiter, StepLimiter, Thread} <: SSPRKMutableCache u::uType diff --git a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl index 629ff8ed1c..80f92326f9 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl +++ b/lib/OrdinaryDiffEqStabilizedIRK/src/irkc_caches.jl @@ -23,7 +23,7 @@ end constantcache::C end -get_fsalfirstlast(cache::IRKCCache) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) +get_fsalfirstlast(cache::IRKCCache,u) = (cache.fsalfirst, du_alias_or_new(cache.nlsolver, cache.fsalfirst)) function alg_cache(alg::IRKC, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl index 47cb9211e1..cbdaa5cc2e 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl +++ b/lib/OrdinaryDiffEqStabilizedRK/src/rkc_caches.jl @@ -1,5 +1,5 @@ abstract type StabilizedRKMutableCache <: OrdinaryDiffEqMutableCache end -get_fsalfirstlast(cache::StabilizedRKMutableCache) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::StabilizedRKMutableCache,u) = (cache.fsalfirst, cache.k) mutable struct ROCK2ConstantCache{T, T2, zType} <: OrdinaryDiffEqConstantCache ms::SVector{46, Int} diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl index 450667d2dc..6112a89792 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_caches.jl @@ -421,4 +421,4 @@ function alg_cache(alg::SofSpa10, u, rate_prototype, ::Type{uEltypeNoUnits}, SofSpa10ConstantCache(constvalue(uBottomEltypeNoUnits), constvalue(tTypeNoUnits)) end -get_fsalfirstlast(cache::Union{HamiltonMutableCache, VelocityVerletCache, SymplecticEulerCache}) = (cache.fsalfirst, cache.k) +get_fsalfirstlast(cache::Union{HamiltonMutableCache, VelocityVerletCache, SymplecticEulerCache},u) = (cache.fsalfirst, cache.k) diff --git a/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl b/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl index 7d8162654d..b8bc6b611b 100644 --- a/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl +++ b/lib/OrdinaryDiffEqTsit5/src/tsit_caches.jl @@ -36,7 +36,7 @@ function alg_cache(alg::Tsit5, u, rate_prototype, ::Type{uEltypeNoUnits}, alg.stage_limiter!, alg.step_limiter!, alg.thread) end -get_fsalfirstlast(cache::Tsit5Cache) = (cache.k1, cache.k7) +get_fsalfirstlast(cache::Tsit5Cache,u) = (cache.k1, cache.k7) function alg_cache(alg::Tsit5, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqVerner/src/verner_caches.jl b/lib/OrdinaryDiffEqVerner/src/verner_caches.jl index 4bb44d3e36..a118fc9f24 100644 --- a/lib/OrdinaryDiffEqVerner/src/verner_caches.jl +++ b/lib/OrdinaryDiffEqVerner/src/verner_caches.jl @@ -23,7 +23,7 @@ lazy::Bool end -get_fsalfirstlast(cache::Vern6Cache) = (cache.k1, cache.k9) +get_fsalfirstlast(cache::Vern6Cache,u) = (cache.k1, cache.k9) function alg_cache(alg::Vern6, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -87,7 +87,7 @@ end end # fake values since non-FSAL method -get_fsalfirstlast(cache::Vern7Cache) = (cache.k1, cache.k2) +get_fsalfirstlast(cache::Vern7Cache,u) = (cache.k1, cache.k2) function alg_cache(alg::Vern7, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -153,7 +153,7 @@ end end # fake values since non-FSAL method -get_fsalfirstlast(cache::Vern8Cache) = (cache.k1, cache.k2) +get_fsalfirstlast(cache::Vern8Cache,u) = (cache.k1, cache.k2) function alg_cache(alg::Vern8, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, @@ -227,7 +227,7 @@ end end # fake values since non-FSAL method -get_fsalfirstlast(cache::Vern9Cache) = (cache.k1, cache.k2) +get_fsalfirstlast(cache::Vern9Cache,u) = (cache.k1, cache.k2) function alg_cache(alg::Vern9, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, From 34c390e89d63e25952ae3b75544610bf448b3655 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:26:10 -0400 Subject: [PATCH 37/55] a few more --- lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl | 1 + lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl | 2 +- lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl index aba94d6935..d0c9401634 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl @@ -128,6 +128,7 @@ end diff1::Array{uType, 1} diff2::Array{uType, 1} end +get_fsalfirstlast(cache::ExtrapolationMutableCache,u) = (zero(u), zero(u)) @cache mutable struct ImplicitEulerExtrapolationConstantCache{QType, dtType, arrayType, TF, UF, sequenceType} <: diff --git a/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl b/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl index 2de86d9be4..aa19504945 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl +++ b/lib/OrdinaryDiffEqHighOrderRK/src/OrdinaryDiffEqHighOrderRK.jl @@ -9,7 +9,7 @@ import OrdinaryDiffEqCore: alg_order, qmax_default, qmin_default, beta2_default, alg_cache, uses_uprev, initialize!, perform_step!, OrdinaryDiffEqConstantCache, calculate_residuals!, calculate_residuals, CompiledFloats, - copyat_or_push!, + copyat_or_push!, get_fsalfirstlast, unwrap_alg, _ode_interpolant, _ode_interpolant!, DerivativeOrderNotPossibleError, full_cache, isdp8 import Static: False diff --git a/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl b/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl index 51d4dd66d3..fde64f8ef7 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/OrdinaryDiffEqSSPRK.jl @@ -12,7 +12,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, constvalue, _unwrap_val, explicit_rk_docstring, trivial_limiter!, _ode_interpolant, _ode_interpolant!, - _ode_addsteps! + _ode_addsteps!, get_fsalfirstlast using FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools using DiffEqBase: @def using Static: False From 091109aab377753f82914b6c2bb03c69897549b4 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:34:58 -0400 Subject: [PATCH 38/55] more --- .../src/low_storage_rk_perform_step.jl | 2 ++ lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl index d6d8eee20d..f76fcb4eb6 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowStorageRK/src/low_storage_rk_perform_step.jl @@ -33,6 +33,8 @@ end integrator.u = u end +get_fsalfirstlast(cache::LowStorageRK2NCache,u) = (cache.k, cache.k) + function initialize!(integrator, cache::LowStorageRK2NCache) @unpack k, tmp, williamson_condition = cache integrator.kshortsize = 1 diff --git a/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl b/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl index 75d94d5677..0d8ff786a1 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/OrdinaryDiffEqSDIRK.jl @@ -13,7 +13,7 @@ import OrdinaryDiffEqCore: alg_order, calculate_residuals!, constvalue, _unwrap_val, _ode_interpolant, trivial_limiter!, _ode_interpolant!, isesdirk, issplit, - ssp_coefficient + ssp_coefficient, get_fsalfirstlast using TruncatedStacktraces, MuladdMacro, MacroTools, FastBroadcast, RecursiveArrayTools using SciMLBase: SplitFunction using LinearAlgebra: mul!, I From 7119fa9cfe19b0016e9af73d3245796b2aeac838 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:44:15 -0400 Subject: [PATCH 39/55] fix missing init --- .../src/kencarp_kvaerno_caches.jl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_caches.jl b/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_caches.jl index e239a42f10..a122c5fee0 100644 --- a/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_caches.jl +++ b/lib/OrdinaryDiffEqSDIRK/src/kencarp_kvaerno_caches.jl @@ -1,4 +1,4 @@ -mutable struct Kvaerno3ConstantCache{Tab, N} <: OrdinaryDiffEqConstantCache +mutable struct Kvaerno3ConstantCache{Tab, N} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -50,7 +50,7 @@ function alg_cache(alg::Kvaerno3, u, rate_prototype, ::Type{uEltypeNoUnits}, u, uprev, fsalfirst, z₁, z₂, z₃, z₄, atmp, nlsolver, tab, alg.step_limiter!) end -@cache mutable struct KenCarp3ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct KenCarp3ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -121,7 +121,7 @@ function alg_cache(alg::KenCarp3, u, rate_prototype, ::Type{uEltypeNoUnits}, k3, k4, atmp, nlsolver, tab, alg.step_limiter!) end -@cache mutable struct CFNLIRK3ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct CFNLIRK3ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -181,7 +181,7 @@ function alg_cache(alg::CFNLIRK3, u, rate_prototype, ::Type{uEltypeNoUnits}, CFNLIRK3Cache(u, uprev, fsalfirst, z₁, z₂, z₃, z₄, k1, k2, k3, k4, atmp, nlsolver, tab) end -@cache mutable struct Kvaerno4ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct Kvaerno4ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -235,7 +235,7 @@ function alg_cache(alg::Kvaerno4, u, rate_prototype, ::Type{uEltypeNoUnits}, u, uprev, fsalfirst, z₁, z₂, z₃, z₄, z₅, atmp, nlsolver, tab, alg.step_limiter!) end -@cache mutable struct KenCarp4ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct KenCarp4ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -318,7 +318,7 @@ function alg_cache(alg::KenCarp4, u, rate_prototype, ::Type{uEltypeNoUnits}, nlsolver, tab, alg.step_limiter!) end -@cache mutable struct Kvaerno5ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct Kvaerno5ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -377,7 +377,7 @@ function alg_cache(alg::Kvaerno5, u, rate_prototype, ::Type{uEltypeNoUnits}, z₇, atmp, nlsolver, tab, alg.step_limiter!) end -@cache mutable struct KenCarp5ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct KenCarp5ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -467,7 +467,7 @@ function alg_cache(alg::KenCarp5, u, rate_prototype, ::Type{uEltypeNoUnits}, k1, k2, k3, k4, k5, k6, k7, k8, atmp, nlsolver, tab, alg.step_limiter!) end -@cache mutable struct KenCarp47ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct KenCarp47ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end @@ -551,7 +551,7 @@ function alg_cache(alg::KenCarp47, u, rate_prototype, ::Type{uEltypeNoUnits}, k1, k2, k3, k4, k5, k6, k7, atmp, nlsolver, tab) end -@cache mutable struct KenCarp58ConstantCache{N, Tab} <: OrdinaryDiffEqConstantCache +@cache mutable struct KenCarp58ConstantCache{N, Tab} <: SDIRKConstantCache nlsolver::N tab::Tab end From 9acf18b03be79c638dd748fd85236b97187be27d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 04:54:04 -0400 Subject: [PATCH 40/55] a few fixes --- lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl | 2 +- lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl index d0c9401634..7ede4e5b1a 100644 --- a/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl +++ b/lib/OrdinaryDiffEqExtrapolation/src/extrapolation_caches.jl @@ -128,7 +128,7 @@ end diff1::Array{uType, 1} diff2::Array{uType, 1} end -get_fsalfirstlast(cache::ExtrapolationMutableCache,u) = (zero(u), zero(u)) +get_fsalfirstlast(cache::ImplicitEulerExtrapolationCache,u) = (zero(u), zero(u)) @cache mutable struct ImplicitEulerExtrapolationConstantCache{QType, dtType, arrayType, TF, UF, sequenceType} <: diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl index d51d08ac99..b7f8bdd7f0 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/low_order_rk_perform_step.jl @@ -1081,7 +1081,7 @@ function perform_step!(integrator, cache::PSRK4p7q6ConstantCache, repeat_step = integrator.u = u end -get_fsalfirstlast(cache::RKMCache,u) = (cache.k1, cache.k6) +get_fsalfirstlast(cache::PSRK4p7q6Cache,u) = (cache.k1, cache.k6) function initialize!(integrator, cache::PSRK4p7q6Cache) @unpack uprev, f, p, t = integrator From 23cc8d5e5ad810e190ea925cfc6924ca143cf370 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 05:01:27 -0400 Subject: [PATCH 41/55] fix resizing for new fsal memory --- .../src/integrators/integrator_interface.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl index 99592d1069..cc858c49c2 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl @@ -221,6 +221,8 @@ function resize!(integrator::ODEIntegrator, i::Int) # may be required for things like units c !== nothing && resize!(c, i) end + resize!(integrator.fsalfirst, i) + resize!(integrator.fsallast, i) resize_f!(integrator.f, i) resize_nlsolver!(integrator, i) resize_J_W!(cache, integrator, i) @@ -233,6 +235,8 @@ function resize!(integrator::ODEIntegrator, i::NTuple{N, Int}) where {N} for c in full_cache(cache) resize!(c, i) end + resize!(integrator.fsalfirst, i) + resize!(integrator.fsallast, i) resize_f!(integrator.f, i) # TODO the parts below need to be adapted for implicit methods isdefined(integrator.cache, :nlsolver) && resize_nlsolver!(integrator, i) From 25efbffc04366b5ec83463a1e27a4c1ce4703c7c Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 05:32:12 -0400 Subject: [PATCH 42/55] fix more typos --- lib/OrdinaryDiffEqLinear/src/linear_caches.jl | 2 ++ lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl | 2 +- lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl index 980470dfd2..b18605f1fa 100644 --- a/lib/OrdinaryDiffEqLinear/src/linear_caches.jl +++ b/lib/OrdinaryDiffEqLinear/src/linear_caches.jl @@ -565,6 +565,8 @@ end exp_cache::expType end +get_fsalfirstlast(cache::LinearExponentialCache,u) = (zero(u), zero(u)) + function _phiv_timestep_caches(u_prototype, maxiter::Int, p::Int) n = length(u_prototype) T = eltype(u_prototype) diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl index 8a69d2fc99..4a266e77f3 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl @@ -1135,7 +1135,7 @@ end get_fsalfirstlast(cache::Union{Rosenbrock23Cache,Rosenbrock32Cache, Rosenbrock33Cache, Rosenbrock34Cache, -Rosenbrock4Cache}) = (cache.fsalfirst, cache.fsallast) +Rosenbrock4Cache},u) = (cache.fsalfirst, cache.fsallast) ################################################################################ diff --git a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl index 9966f9ff8b..a724abbc52 100644 --- a/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl +++ b/lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl @@ -412,8 +412,6 @@ function initialize!(integrator, Rosenbrock4Cache}) integrator.kshortsize = 2 @unpack fsalfirst, fsallast = cache - integrator.fsalfirst = fsalfirst - integrator.fsallast = fsallast resize!(integrator.k, integrator.kshortsize) integrator.k[1] = fsalfirst integrator.k[2] = fsallast From 0384d07c50f12c4f6ad3d973c2cc12981d3712ec Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 10:23:01 -0400 Subject: [PATCH 43/55] fix all solver specific tests --- lib/OrdinaryDiffEqBDF/src/dae_caches.jl | 3 +++ .../src/exponential_rk_caches.jl | 2 +- .../src/nordsieck_caches.jl | 2 +- lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl | 6 ++---- .../src/symplectic_tableaus.jl | 20 +++++++++---------- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/OrdinaryDiffEqBDF/src/dae_caches.jl b/lib/OrdinaryDiffEqBDF/src/dae_caches.jl index b84b5e4016..00bfb4ca5a 100644 --- a/lib/OrdinaryDiffEqBDF/src/dae_caches.jl +++ b/lib/OrdinaryDiffEqBDF/src/dae_caches.jl @@ -12,6 +12,9 @@ get_fsalfirstlast(cache::DAEBDFMutableCache,u) = (cache.fsalfirst, du_alias_or_n nlsolver::N end +# Not FSAL +get_fsalfirstlast(cache::DImplicitEulerCache,u) = (u,u) + mutable struct DImplicitEulerConstantCache{N} <: OrdinaryDiffEqConstantCache nlsolver::N end diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl index 4a2eb869db..3e6ac4dc85 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl @@ -892,7 +892,7 @@ end B1::expType # ϕ1(hA) + ϕ2(hA) B0::expType # -ϕ2(hA) end -get_fsalfirstlast(cache::ETD2,u) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) +get_fsalfirstlast(cache::ETD2Cache,u) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) function alg_cache(alg::ETD2, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, diff --git a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl index ba65b6ce66..fb175b5e38 100644 --- a/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl +++ b/lib/OrdinaryDiffEqNordsieck/src/nordsieck_caches.jl @@ -265,4 +265,4 @@ function alg_cache(alg::JVODE, u, rate_prototype, ::Type{uEltypeNoUnits}, dts, Δ, atmp, tsit5cache, 2, 1, 1, 2, η, η, η, η, η) end -get_fsalfirstlast(cache::Union{JVODE, AN5},u) = get_fsalfirstlast(cache.tsit5cache,u) \ No newline at end of file +get_fsalfirstlast(cache::Union{JVODECache, AN5Cache},u) = get_fsalfirstlast(cache.tsit5cache,u) \ No newline at end of file diff --git a/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl b/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl index 8b7e0b68fb..cdd41f568b 100644 --- a/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl +++ b/lib/OrdinaryDiffEqSSPRK/src/ssprk_caches.jl @@ -282,8 +282,7 @@ function alg_cache(alg::SHLDDRK52, u, rate_prototype, ::Type{uEltypeNoUnits}, end @cache mutable struct SHLDDRK_2NCache{uType, rateType, TabType, StageLimiter, StepLimiter, - Thread} <: - OrdinaryDiffEqMutableCache + Thread} <: SSPRKMutableCache u::uType uprev::uType k::rateType @@ -1028,8 +1027,7 @@ end StageLimiter, StepLimiter, Thread -} <: - OrdinaryDiffEqMutableCache +} <: SSPRKMutableCache u::uType uprev::uType fsalfirst::rateType diff --git a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_tableaus.jl b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_tableaus.jl index 98676979c3..fd5acd6e61 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_tableaus.jl +++ b/lib/OrdinaryDiffEqSymplecticRK/src/symplectic_tableaus.jl @@ -1,4 +1,4 @@ -struct Symplectic2ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic2ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T b1::T @@ -29,7 +29,7 @@ function VerletLeapfrogConstantCache(T, T2) Symplectic2ConstantCache{T, T2}(a1, a2, b1, b2) end -struct Symplectic3ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic3ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -58,7 +58,7 @@ function McAte3ConstantCache(T, T2) Symplectic3ConstantCache{T, T2}(a1, a2, a3, b1, b2, b3) end -struct Symplectic4ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic4ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -105,7 +105,7 @@ function McAte4ConstantCache(T::Type, T2::Type) Symplectic4ConstantCache{T, T2}(a1, a2, a3, a4, b1, b2, b3, b4) end -struct Symplectic45ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic45ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -163,7 +163,7 @@ function McAte42ConstantCache(T::Type, T2::Type) Symplectic45ConstantCache{T, T2}(a1, a2, a3, a4, a5, b1, b2, b3, b4, b5) end -struct Symplectic5ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic5ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -210,7 +210,7 @@ function McAte5ConstantCache(T::Type, T2::Type) Symplectic5ConstantCache{T, T2}(a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6) end -struct Symplectic6ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic6ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -250,7 +250,7 @@ function Yoshida6ConstantCache(T, T2) b7, b8) end -struct Symplectic62ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct Symplectic62ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -323,7 +323,7 @@ function KahanLi6ConstantCache(T::Type, T2::Type) b4, b5, b6, b7, b8, b9, b10) end -struct McAte8ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct McAte8ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -436,7 +436,7 @@ function McAte8ConstantCache(T::Type, T2::Type) b15, b16) end -struct KahanLi8ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct KahanLi8ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T @@ -561,7 +561,7 @@ function KahanLi8ConstantCache(T::Type, T2::Type) b14, b15, b16, b17, b18) end -struct SofSpa10ConstantCache{T, T2} <: OrdinaryDiffEqConstantCache +struct SofSpa10ConstantCache{T, T2} <: HamiltonConstantCache a1::T a2::T a3::T From e4f132873ac82e5be2d1e32bb468fc85aaf8de4f Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 11:10:15 -0400 Subject: [PATCH 44/55] fix composite fsals --- .../perform_step/composite_perform_step.jl | 24 +++++++++++++++++++ lib/OrdinaryDiffEqCore/src/solve.jl | 2 +- .../src/split_perform_step.jl | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index ca8698f322..4f96d7b104 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -172,8 +172,14 @@ function choose_algorithm!(integrator, cache.current = new_current if new_current == 1 initialize!(integrator, @inbounds(cache.caches[1])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1],u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif new_current == 2 initialize!(integrator, @inbounds(cache.caches[2])) + fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2],u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast end if old_current == 1 && new_current == 2 reset_alg_dependent_opts!(integrator, integrator.alg.algs[1], @@ -199,21 +205,39 @@ function choose_algorithm!(integrator, cache::DefaultCache) if new_current == 1 initialize!(integrator, @inbounds(cache.cache1)) new_cache = cache.cache1 + fsalfirst, fsallast = get_fsalfirstlast(cache.cache1,u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif new_current == 2 initialize!(integrator, @inbounds(cache.cache2)) new_cache = cache.cache2 + fsalfirst, fsallast = get_fsalfirstlast(cache.cache2,u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif new_current == 3 initialize!(integrator, @inbounds(cache.cache3)) new_cache = cache.cache3 + fsalfirst, fsallast = get_fsalfirstlast(cache.cache3,u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif new_current == 4 initialize!(integrator, @inbounds(cache.cache4)) new_cache = cache.cache4 + fsalfirst, fsallast = get_fsalfirstlast(cache.cache4,u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif new_current == 5 initialize!(integrator, @inbounds(cache.cache5)) new_cache = cache.cache5 + fsalfirst, fsallast = get_fsalfirstlast(cache.cache5,u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast elseif new_current == 6 initialize!(integrator, @inbounds(cache.cache6)) new_cache = cache.cache6 + fsalfirst, fsallast = get_fsalfirstlast(cache.cache6,u) + integrator.fsalfirst = fsalfirst + integrator.fsallast = fsallast end if old_current == 1 diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index 9d1966d591..0a902b3004 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -469,7 +469,7 @@ function DiffEqBase.__init( reinitiailize = true saveiter = 0 # Starts at 0 so first save is at 1 saveiter_dense = 0 - faslfirst, fsallast = get_fsalfirstlast(cache,u) + faslfirst, fsallast = get_fsalfirstlast(cache,rate_prototype) integrator = ODEIntegrator{typeof(_alg), isinplace(prob), uType, typeof(du), tType, typeof(p), diff --git a/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl b/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl index 9b766cb6d0..997610988f 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl +++ b/lib/OrdinaryDiffEqLowOrderRK/src/split_perform_step.jl @@ -24,6 +24,7 @@ end integrator.u = u end +get_fsalfirstlast(cache::SplitEulerCache,u) = (cache.fsalfirst, cache.k) function initialize!(integrator, cache::SplitEulerCache) integrator.kshortsize = 2 @unpack k, fsalfirst = cache From 5fb9951085f28cfff1641a8e382b775c0fa763e2 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 11:27:47 -0400 Subject: [PATCH 45/55] handle u --- .../src/perform_step/composite_perform_step.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index 4f96d7b104..eea5c77275 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -168,6 +168,7 @@ function choose_algorithm!(integrator, cache::CompositeCache{Tuple{T1, T2}, F}) where {T1, T2, F} new_current = cache.choice_function(integrator) old_current = cache.current + u = integrator.u @inbounds if new_current != old_current cache.current = new_current if new_current == 1 @@ -198,6 +199,7 @@ end function choose_algorithm!(integrator, cache::DefaultCache) new_current = cache.choice_function(integrator) old_current = cache.current + u = integrator.u @inbounds if new_current != old_current algs = integrator.alg.algs cache.current = new_current From 6c6c838049aa6081a9c2c34df8f5eb944e045bb3 Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Sun, 18 Aug 2024 11:27:51 -0400 Subject: [PATCH 46/55] update DiffEqBase --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index f9bc63a003..0343caf0b5 100644 --- a/Project.toml +++ b/Project.toml @@ -79,7 +79,7 @@ ADTypes = "0.2, 1" Adapt = "3.0, 4" ArrayInterface = "7" DataStructures = "0.18" -DiffEqBase = "6.147" +DiffEqBase = "6.154" DocStringExtensions = "0.9" EnumX = "1" ExponentialUtilities = "1" From 59c253f01a9fdb16ea83dd87762ae5f6a406d3b1 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 12:31:03 -0400 Subject: [PATCH 47/55] set fsal before initialization --- .../perform_step/composite_perform_step.jl | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl index eea5c77275..c3b277a7bc 100644 --- a/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl +++ b/lib/OrdinaryDiffEqCore/src/perform_step/composite_perform_step.jl @@ -32,43 +32,43 @@ function initialize!(integrator, cache::DefaultCache) init_ith_default_cache(cache, algs, cache.current) u = integrator.u if cache.current == 1 - initialize!(integrator, cache.cache1) fsalfirst, fsallast = get_fsalfirstlast(cache.cache1,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, cache.cache1) elseif cache.current == 2 - initialize!(integrator, cache.cache2) fsalfirst, fsallast = get_fsalfirstlast(cache.cache2,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, cache.cache2) # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[2]) elseif cache.current == 3 - initialize!(integrator, cache.cache3) fsalfirst, fsallast = get_fsalfirstlast(cache.cache3,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, cache.cache3) # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[3]) elseif cache.current == 4 - initialize!(integrator, cache.cache4) fsalfirst, fsallast = get_fsalfirstlast(cache.cache4,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, cache.cache4) # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[4]) elseif cache.current == 5 - initialize!(integrator, cache.cache5) fsalfirst, fsallast = get_fsalfirstlast(cache.cache5,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, cache.cache5) # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[5]) elseif cache.current == 6 - initialize!(integrator, cache.cache6) fsalfirst, fsallast = get_fsalfirstlast(cache.cache6,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, cache.cache6) # the controller was initialized by default for algs[1] reset_alg_dependent_opts!(integrator.opts.controller, algs[1], algs[6]) end @@ -79,23 +79,23 @@ function initialize!(integrator, cache::CompositeCache) cache.current = cache.choice_function(integrator) u = integrator.u if cache.current == 1 - initialize!(integrator, @inbounds(cache.caches[1])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[1])) elseif cache.current == 2 - initialize!(integrator, @inbounds(cache.caches[2])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[2])) # the controller was initialized by default for integrator.alg.algs[1] reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], integrator.alg.algs[2]) else - initialize!(integrator, @inbounds(cache.caches[cache.current])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[cache.current],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[cache.current])) reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], integrator.alg.algs[cache.current]) end @@ -106,15 +106,15 @@ function initialize!(integrator, cache::CompositeCache{Tuple{T1, T2}, F}) where cache.current = cache.choice_function(integrator) u = integrator.u if cache.current == 1 - initialize!(integrator, @inbounds(cache.caches[1])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[1])) elseif cache.current == 2 - initialize!(integrator, @inbounds(cache.caches[2])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[2])) reset_alg_dependent_opts!(integrator.opts.controller, integrator.alg.algs[1], integrator.alg.algs[2]) end @@ -172,15 +172,15 @@ function choose_algorithm!(integrator, @inbounds if new_current != old_current cache.current = new_current if new_current == 1 - initialize!(integrator, @inbounds(cache.caches[1])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[1],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[1])) elseif new_current == 2 - initialize!(integrator, @inbounds(cache.caches[2])) fsalfirst, fsallast = get_fsalfirstlast(cache.caches[2],u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.caches[2])) end if old_current == 1 && new_current == 2 reset_alg_dependent_opts!(integrator, integrator.alg.algs[1], @@ -205,41 +205,41 @@ function choose_algorithm!(integrator, cache::DefaultCache) cache.current = new_current init_ith_default_cache(cache, algs, new_current) if new_current == 1 - initialize!(integrator, @inbounds(cache.cache1)) - new_cache = cache.cache1 fsalfirst, fsallast = get_fsalfirstlast(cache.cache1,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.cache1)) + new_cache = cache.cache1 elseif new_current == 2 - initialize!(integrator, @inbounds(cache.cache2)) - new_cache = cache.cache2 fsalfirst, fsallast = get_fsalfirstlast(cache.cache2,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.cache2)) + new_cache = cache.cache2 elseif new_current == 3 - initialize!(integrator, @inbounds(cache.cache3)) - new_cache = cache.cache3 fsalfirst, fsallast = get_fsalfirstlast(cache.cache3,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.cache3)) + new_cache = cache.cache3 elseif new_current == 4 - initialize!(integrator, @inbounds(cache.cache4)) - new_cache = cache.cache4 fsalfirst, fsallast = get_fsalfirstlast(cache.cache4,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.cache4)) + new_cache = cache.cache4 elseif new_current == 5 - initialize!(integrator, @inbounds(cache.cache5)) - new_cache = cache.cache5 fsalfirst, fsallast = get_fsalfirstlast(cache.cache5,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.cache5)) + new_cache = cache.cache5 elseif new_current == 6 - initialize!(integrator, @inbounds(cache.cache6)) - new_cache = cache.cache6 fsalfirst, fsallast = get_fsalfirstlast(cache.cache6,u) integrator.fsalfirst = fsalfirst integrator.fsallast = fsallast + initialize!(integrator, @inbounds(cache.cache6)) + new_cache = cache.cache6 end if old_current == 1 From 35371402f699040ef6f3da29d4cb3735718f0f77 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 14:31:19 -0400 Subject: [PATCH 48/55] fix FSAL type? --- lib/OrdinaryDiffEqCore/src/integrators/type.jl | 2 -- lib/OrdinaryDiffEqCore/src/solve.jl | 2 +- lib/OrdinaryDiffEqExponentialRK/src/alg_utils.jl | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/src/integrators/type.jl b/lib/OrdinaryDiffEqCore/src/integrators/type.jl index ae3f441d8e..1f9bef031d 100644 --- a/lib/OrdinaryDiffEqCore/src/integrators/type.jl +++ b/lib/OrdinaryDiffEqCore/src/integrators/type.jl @@ -48,8 +48,6 @@ mutable struct DEOptions{absType, relType, QT, tType, Controller, F1, F2, F3, F4 stop_at_next_tstop::Bool end -TruncatedStacktraces.@truncate_stacktrace DEOptions - """ ODEIntegrator diff --git a/lib/OrdinaryDiffEqCore/src/solve.jl b/lib/OrdinaryDiffEqCore/src/solve.jl index 0a902b3004..cef15ee62b 100644 --- a/lib/OrdinaryDiffEqCore/src/solve.jl +++ b/lib/OrdinaryDiffEqCore/src/solve.jl @@ -476,7 +476,7 @@ function DiffEqBase.__init( typeof(eigen_est), typeof(EEst), QT, typeof(tdir), typeof(k), SolType, FType, cacheType, - typeof(opts), fsal_typeof(_alg, rate_prototype), + typeof(opts), typeof(faslfirst), typeof(last_event_error), typeof(callback_cache), typeof(initializealg), typeof(differential_vars)}( sol, u, du, k, t, tType(dt), f, p, diff --git a/lib/OrdinaryDiffEqExponentialRK/src/alg_utils.jl b/lib/OrdinaryDiffEqExponentialRK/src/alg_utils.jl index 7de64363c4..5819ec3531 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/alg_utils.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/alg_utils.jl @@ -31,10 +31,5 @@ function DiffEqBase.prepare_alg( end fsal_typeof(alg::ETD2, rate_prototype) = ETD2Fsal{typeof(rate_prototype)} -function fsal_typeof(alg::CompositeAlgorithm, rate_prototype) - fsal = map(x -> fsal_typeof(x, rate_prototype), alg.algs) - @assert length(unique(fsal))==1 "`fsal_typeof` must be consistent" - return fsal[1] -end ismultistep(alg::ETD2) = true From a0d1c9e06e1029cafcf78a68cf36be61f4aca779 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 16:00:11 -0400 Subject: [PATCH 49/55] another --- lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl index 3e6ac4dc85..042b2d55ba 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl @@ -872,6 +872,8 @@ struct ETD2ConstantCache{expType} <: OrdinaryDiffEqConstantCache B0::expType # -ϕ2(hA) end +get_fsalfirstlast(cache::ETD2ConstantCache,u) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) + function alg_cache(alg::ETD2, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, dt, reltol, p, calck, From eda0929c7a17a1274727fbb983af204cee59fa7c Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 17:56:45 -0400 Subject: [PATCH 50/55] done --- lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl index 042b2d55ba..65b662f825 100644 --- a/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl +++ b/lib/OrdinaryDiffEqExponentialRK/src/exponential_rk_caches.jl @@ -872,7 +872,7 @@ struct ETD2ConstantCache{expType} <: OrdinaryDiffEqConstantCache B0::expType # -ϕ2(hA) end -get_fsalfirstlast(cache::ETD2ConstantCache,u) = (ETD2Fsal(cache.rtmp1), ETD2Fsal(cache.rtmp1)) +get_fsalfirstlast(cache::ETD2ConstantCache,u) = (ETD2Fsal(u), ETD2Fsal(u)) function alg_cache(alg::ETD2, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, From 4856d99aacc2579eea5a17c0502168d1a2bd479d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sun, 18 Aug 2024 22:10:21 -0400 Subject: [PATCH 51/55] Setup for DelayDiffEq downstream --- lib/OrdinaryDiffEqCore/Project.toml | 2 +- lib/OrdinaryDiffEqCore/src/alg_utils.jl | 6 ++++++ src/OrdinaryDiffEq.jl | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/OrdinaryDiffEqCore/Project.toml b/lib/OrdinaryDiffEqCore/Project.toml index 54e9b821eb..c9d0466b5d 100644 --- a/lib/OrdinaryDiffEqCore/Project.toml +++ b/lib/OrdinaryDiffEqCore/Project.toml @@ -38,7 +38,7 @@ TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" [extensions] -OrdinaryDiffEqCoreEnzymeCore = "EnzymeCore" +OrdinaryDiffEqCoreEnzymeCoreExt = "EnzymeCore" [compat] ADTypes = "0.2, 1" diff --git a/lib/OrdinaryDiffEqCore/src/alg_utils.jl b/lib/OrdinaryDiffEqCore/src/alg_utils.jl index 8f657a93f8..b8d1fdd9ba 100644 --- a/lib/OrdinaryDiffEqCore/src/alg_utils.jl +++ b/lib/OrdinaryDiffEqCore/src/alg_utils.jl @@ -113,6 +113,12 @@ function fsal_typeof(alg::Union{OrdinaryDiffEqAlgorithm, DAEAlgorithm}, rate_pro typeof(rate_prototype) end +function fsal_typeof(alg::CompositeAlgorithm, rate_prototype) + fsal = map(x -> fsal_typeof(x, rate_prototype), alg.algs) + @assert length(unique(fsal))==1 "`fsal_typeof` must be consistent" + return fsal[1] +end + isimplicit(alg::Union{OrdinaryDiffEqAlgorithm, DAEAlgorithm}) = false isimplicit(alg::OrdinaryDiffEqAdaptiveImplicitAlgorithm) = true isimplicit(alg::OrdinaryDiffEqImplicitAlgorithm) = true diff --git a/src/OrdinaryDiffEq.jl b/src/OrdinaryDiffEq.jl index 7b5be48b4a..b012ef46f8 100644 --- a/src/OrdinaryDiffEq.jl +++ b/src/OrdinaryDiffEq.jl @@ -58,7 +58,7 @@ import OrdinaryDiffEqCore: trivial_limiter!, CompositeAlgorithm, alg_order, _change_t_via_interpolation!, ODEIntegrator, _ode_interpolant!, current_interpolant, resize_nlsolver!, _ode_interpolant, handle_tstop!, _postamble!, update_uprev!, resize_J_W!, - DAEAlgorithm + DAEAlgorithm, get_fsalfirstlast export CompositeAlgorithm, ShampineCollocationInit, BrownFullBasicInit, NoInit AutoSwitch From 3456aec5e5550cc6489716ab2e65eb05bd8a9948 Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Mon, 19 Aug 2024 15:37:24 -0400 Subject: [PATCH 52/55] fix oop BDF gamma type and terk_tmp type --- lib/OrdinaryDiffEqBDF/src/algorithms.jl | 4 ++-- lib/OrdinaryDiffEqBDF/src/bdf_caches.jl | 6 ++--- lib/OrdinaryDiffEqBDF/src/controllers.jl | 18 +++++++------- test/interface/linear_solver_test.jl | 30 +++++++++++++++++------- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/lib/OrdinaryDiffEqBDF/src/algorithms.jl b/lib/OrdinaryDiffEqBDF/src/algorithms.jl index 387a9d6a72..1a4c960c7b 100644 --- a/lib/OrdinaryDiffEqBDF/src/algorithms.jl +++ b/lib/OrdinaryDiffEqBDF/src/algorithms.jl @@ -150,7 +150,7 @@ end function QNDF1(; chunk_size = Val{0}(), autodiff = Val{true}(), standardtag = Val{true}(), concrete_jac = nothing, diff_type = Val{:forward}, linsolve = nothing, precs = DEFAULT_PRECS, nlsolve = NLNewton(), - extrapolant = :linear, kappa = -0.1850, + extrapolant = :linear, kappa = -37//200, controller = :Standard, step_limiter! = trivial_limiter!) QNDF1{ _unwrap_val(chunk_size), _unwrap_val(autodiff), typeof(linsolve), typeof(nlsolve), @@ -233,7 +233,7 @@ function QNDF(; max_order::Val{MO} = Val{5}(), chunk_size = Val{0}(), diff_type = Val{:forward}, linsolve = nothing, precs = DEFAULT_PRECS, nlsolve = NLNewton(), κ = nothing, tol = nothing, - extrapolant = :linear, kappa = promote(-0.1850, -1 // 9, -0.0823, -0.0415, 0), + extrapolant = :linear, kappa = (-37//200, -1//9, -823//10000, -83//2000, 0//1), controller = :Standard, step_limiter! = trivial_limiter!) where {MO} QNDF{MO, _unwrap_val(chunk_size), _unwrap_val(autodiff), typeof(linsolve), typeof(nlsolve), typeof(precs), diff_type, _unwrap_val(standardtag), diff --git a/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl b/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl index 7cdc4b580f..9d60023c13 100644 --- a/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl +++ b/lib/OrdinaryDiffEqBDF/src/bdf_caches.jl @@ -358,7 +358,7 @@ function alg_cache(alg::QNDF{MO}, u, rate_prototype, ::Type{uEltypeNoUnits}, ::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits } where {MO} max_order = MO - γ, c = one(eltype(alg.kappa)), 1 + γ, c = one(uEltypeNoUnits), 1 nlsolver = build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, γ, c, Val(false)) dtprev = one(dt) @@ -539,7 +539,7 @@ function alg_cache(alg::FBDF{MO}, u, rate_prototype, ::Type{uEltypeNoUnits}, dt, reltol, p, calck, ::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits } where {MO} - γ, c = 1.0, 1.0 + γ, c = one(uEltypeNoUnits), 1 max_order = MO nlsolver = build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, γ, c, Val(false)) @@ -614,7 +614,7 @@ function alg_cache(alg::FBDF{MO}, u, rate_prototype, ::Type{uEltypeNoUnits}, dt, reltol, p, calck, ::Val{true}) where {MO, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits} - γ, c = 1.0, 1.0 + γ, c = one(uEltypeNoUnits), 1 fsalfirst = zero(rate_prototype) max_order = MO nlsolver = build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, diff --git a/lib/OrdinaryDiffEqBDF/src/controllers.jl b/lib/OrdinaryDiffEqBDF/src/controllers.jl index f3cbdf2d03..c001e6a586 100644 --- a/lib/OrdinaryDiffEqBDF/src/controllers.jl +++ b/lib/OrdinaryDiffEqBDF/src/controllers.jl @@ -172,7 +172,7 @@ function choose_order!(alg::FBDF, integrator, terk_tmp = @.. broadcast=false fd_weights[k - 2, 1]*u vc = _vec(terk_tmp) for i in 2:(k - 2) - @.. broadcast=false @views vc += fd_weights[i, k - 2] * u_history[:, i - 1] + @.. @views vc += fd_weights[i, k - 2] * u_history[:, i - 1] end @.. broadcast=false terk_tmp*=abs(dt^(k - 2)) calculate_residuals!(atmp, _vec(terk_tmp), _vec(uprev), _vec(u), @@ -204,22 +204,24 @@ function choose_order!(alg::FBDF, integrator, terkm1 = terkm2 fd_weights = calc_finite_difference_weights(ts_tmp, t + dt, k - 2, Val(max_order)) - terk_tmp = @.. broadcast=false fd_weights[k - 2, 1]*u + local terk_tmp if u isa Number + terk_tmp = fd_weights[k - 2, 1]*u for i in 2:(k - 2) terk_tmp += fd_weights[i, k - 2] * u_history[i - 1] end terk_tmp *= abs(dt^(k - 2)) else - vc = _vec(terk_tmp) + # we need terk_tmp to be mutable. + # so it can be updated + terk_tmp = similar(u) + @.. terk_tmp = fd_weights[k - 2, 1]*_vec(u) for i in 2:(k - 2) - @.. broadcast=false @views vc += fd_weights[i, k - 2] * - u_history[:, i - 1] + @.. @views terk_tmp += fd_weights[i, k - 2] * u_history[:, i - 1] end - terk_tmp = reshape(vc, size(terk_tmp)) - terk_tmp *= @.. broadcast=false abs(dt^(k - 2)) + @.. terk_tmp *= abs(dt^(k - 2)) end - atmp = calculate_residuals(_vec(terk_tmp), _vec(uprev), _vec(u), + atmp = calculate_residuals(terk_tmp, _vec(uprev), _vec(u), integrator.opts.abstol, integrator.opts.reltol, integrator.opts.internalnorm, t) terkm2 = integrator.opts.internalnorm(atmp, t) diff --git a/test/interface/linear_solver_test.jl b/test/interface/linear_solver_test.jl index 515fbd3459..98fe0707ab 100644 --- a/test/interface/linear_solver_test.jl +++ b/test/interface/linear_solver_test.jl @@ -161,14 +161,14 @@ end using OrdinaryDiffEq, StaticArrays, LinearSolve, ParameterizedFunctions hires = @ode_def Hires begin - dy1 = -1.71 * y1 + 0.43 * y2 + 8.32 * y3 + 0.0007 - dy2 = 1.71 * y1 - 8.75 * y2 - dy3 = -10.03 * y3 + 0.43 * y4 + 0.035 * y5 - dy4 = 8.32 * y2 + 1.71 * y3 - 1.12 * y4 - dy5 = -1.745 * y5 + 0.43 * y6 + 0.43 * y7 - dy6 = -280.0 * y6 * y8 + 0.69 * y4 + 1.71 * y5 - 0.43 * y6 + 0.69 * y7 - dy7 = 280.0 * y6 * y8 - 1.81 * y7 - dy8 = -280.0 * y6 * y8 + 1.81 * y7 + dy1 = -1.71f0 * y1 + 0.43f0 * y2 + 8.32f0 * y3 + 0.0007f0 + 1f-18*t + dy2 = 1.71f0 * y1 - 8.75f0 * y2 + dy3 = -10.03f0 * y3 + 0.43f0 * y4 + 0.035f0 * y5 + dy4 = 8.32f0 * y2 + 1.71f0 * y3 - 1.12f0 * y4 + dy5 = -1.745f0 * y5 + 0.43f0 * y6 + 0.43f0 * y7 + dy6 = -280.0f0 * y6 * y8 + 0.69f0 * y4 + 1.71f0 * y5 - 0.43f0 * y6 + 0.69f0 * y7 + dy7 = 280.0f0 * y6 * y8 - 1.81f0 * y7 + dy8 = -280.0f0 * y6 * y8 + 1.81f0 * y7 end u0 = zeros(8) @@ -178,7 +178,11 @@ u0[8] = 0.0057 probiip = ODEProblem{true}(hires, u0, (0.0, 10.0)) proboop = ODEProblem{false}(hires, u0, (0.0, 10.0)) probstatic = ODEProblem{false}(hires, SVector{8}(u0), (0.0, 10.0)) +probiipf32 = ODEProblem{true}(hires, Float32.(u0), (0f0, 10f0)) +proboopf32 = ODEProblem{false}(hires, Float32.(u0), (0f0, 10f0)) +probstaticf32 = ODEProblem{false}(hires, SVector{8}(Float32.(u0)), (0f0, 10f0)) probs = (; probiip, proboop, probstatic) +probsf32 = (;probiipf32, proboopf32, probstaticf32) qndf = QNDF() krylov_qndf = QNDF(linsolve = KrylovJL_GMRES()) fbdf = FBDF() @@ -197,3 +201,13 @@ refsol = solve(probiip, FBDF(), abstol = 1e-12, reltol = 1e-12) end end end + +@testset "Hires Float32 calc_W tests" begin + @testset "$probname" for (probname, prob) in pairs(probsf32) + @testset "$solname" for (solname, solver) in pairs(solvers) + sol = solve(prob, solver, maxiters = 2e4) + @test sol.retcode == ReturnCode.Success + @test isapprox(sol.u[end], refsol.u[end], rtol = 1e-2, atol = 1e-5) + end + end +end From 7f002250a4cd4614908899e4d741d12884038b0b Mon Sep 17 00:00:00 2001 From: oscarddssmith Date: Mon, 19 Aug 2024 15:39:25 -0400 Subject: [PATCH 53/55] tighten tols --- test/interface/linear_solver_test.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/interface/linear_solver_test.jl b/test/interface/linear_solver_test.jl index 98fe0707ab..12a449d603 100644 --- a/test/interface/linear_solver_test.jl +++ b/test/interface/linear_solver_test.jl @@ -207,7 +207,7 @@ end @testset "$solname" for (solname, solver) in pairs(solvers) sol = solve(prob, solver, maxiters = 2e4) @test sol.retcode == ReturnCode.Success - @test isapprox(sol.u[end], refsol.u[end], rtol = 1e-2, atol = 1e-5) + @test isapprox(sol.u[end], refsol.u[end], rtol = 2e-3, atol = 1e-6) end end end From 33915d35d77c95ecf7d1157df4749b379f99d35e Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Mon, 19 Aug 2024 19:32:11 -0400 Subject: [PATCH 54/55] bump all --- lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml | 2 +- lib/OrdinaryDiffEqBDF/Project.toml | 2 +- lib/OrdinaryDiffEqDefault/Project.toml | 2 +- lib/OrdinaryDiffEqDifferentiation/Project.toml | 2 +- lib/OrdinaryDiffEqExplicitRK/Project.toml | 2 +- lib/OrdinaryDiffEqExponentialRK/Project.toml | 2 +- lib/OrdinaryDiffEqExtrapolation/Project.toml | 2 +- lib/OrdinaryDiffEqFIRK/Project.toml | 2 +- lib/OrdinaryDiffEqFeagin/Project.toml | 2 +- lib/OrdinaryDiffEqFunctionMap/Project.toml | 2 +- lib/OrdinaryDiffEqHighOrderRK/Project.toml | 2 +- lib/OrdinaryDiffEqIMEXMultistep/Project.toml | 2 +- lib/OrdinaryDiffEqLinear/Project.toml | 2 +- lib/OrdinaryDiffEqLowOrderRK/Project.toml | 2 +- lib/OrdinaryDiffEqLowStorageRK/Project.toml | 2 +- lib/OrdinaryDiffEqNonlinearSolve/Project.toml | 2 +- lib/OrdinaryDiffEqNordsieck/Project.toml | 2 +- lib/OrdinaryDiffEqPDIRK/Project.toml | 2 +- lib/OrdinaryDiffEqPRK/Project.toml | 2 +- lib/OrdinaryDiffEqQPRK/Project.toml | 2 +- lib/OrdinaryDiffEqRKN/Project.toml | 2 +- lib/OrdinaryDiffEqRosenbrock/Project.toml | 2 +- lib/OrdinaryDiffEqSDIRK/Project.toml | 2 +- lib/OrdinaryDiffEqSSPRK/Project.toml | 2 +- lib/OrdinaryDiffEqStabilizedIRK/Project.toml | 2 +- lib/OrdinaryDiffEqStabilizedRK/Project.toml | 2 +- lib/OrdinaryDiffEqSymplecticRK/Project.toml | 2 +- lib/OrdinaryDiffEqTsit5/Project.toml | 2 +- lib/OrdinaryDiffEqVerner/Project.toml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml b/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml index 0bc84c87db..1c1e832dab 100644 --- a/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml +++ b/lib/OrdinaryDiffEqAdamsBashforthMoulton/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqAdamsBashforthMoulton" uuid = "89bda076-bce5-4f1c-845f-551c83cdda9a" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/lib/OrdinaryDiffEqBDF/Project.toml b/lib/OrdinaryDiffEqBDF/Project.toml index efd5726b28..677446afb1 100644 --- a/lib/OrdinaryDiffEqBDF/Project.toml +++ b/lib/OrdinaryDiffEqBDF/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqBDF" uuid = "6ad6398a-0878-4a85-9266-38940aa047c8" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" diff --git a/lib/OrdinaryDiffEqDefault/Project.toml b/lib/OrdinaryDiffEqDefault/Project.toml index 28fda89b62..689c006a29 100644 --- a/lib/OrdinaryDiffEqDefault/Project.toml +++ b/lib/OrdinaryDiffEqDefault/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqDefault" uuid = "50262376-6c5a-4cf5-baba-aaf4f84d72d7" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqDifferentiation/Project.toml b/lib/OrdinaryDiffEqDifferentiation/Project.toml index 9bf99689c9..f1a8b2371c 100644 --- a/lib/OrdinaryDiffEqDifferentiation/Project.toml +++ b/lib/OrdinaryDiffEqDifferentiation/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqDifferentiation" uuid = "4302a76b-040a-498a-8c04-15b101fed76b" authors = ["Chris Rackauckas ", "Yingbo Ma "] -version = "1.0.0" +version = "1.1.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/lib/OrdinaryDiffEqExplicitRK/Project.toml b/lib/OrdinaryDiffEqExplicitRK/Project.toml index 0f3a77a9f1..f0640c2e31 100644 --- a/lib/OrdinaryDiffEqExplicitRK/Project.toml +++ b/lib/OrdinaryDiffEqExplicitRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqExplicitRK" uuid = "9286f039-9fbf-40e8-bf65-aa933bdc4db0" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqExponentialRK/Project.toml b/lib/OrdinaryDiffEqExponentialRK/Project.toml index a2fab24e98..3dce2d7dd4 100644 --- a/lib/OrdinaryDiffEqExponentialRK/Project.toml +++ b/lib/OrdinaryDiffEqExponentialRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqExponentialRK" uuid = "e0540318-69ee-4070-8777-9e2de6de23de" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqExtrapolation/Project.toml b/lib/OrdinaryDiffEqExtrapolation/Project.toml index 325138cd55..8889d5355e 100644 --- a/lib/OrdinaryDiffEqExtrapolation/Project.toml +++ b/lib/OrdinaryDiffEqExtrapolation/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqExtrapolation" uuid = "becaefa8-8ca2-5cf9-886d-c06f3d2bd2c4" authors = ["Chris Rackauckas ", "Yingbo Ma "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqFIRK/Project.toml b/lib/OrdinaryDiffEqFIRK/Project.toml index 200b1c0544..308a831ced 100644 --- a/lib/OrdinaryDiffEqFIRK/Project.toml +++ b/lib/OrdinaryDiffEqFIRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqFIRK" uuid = "5960d6e9-dd7a-4743-88e7-cf307b64f125" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqFeagin/Project.toml b/lib/OrdinaryDiffEqFeagin/Project.toml index a2dd1f3423..8bdd4a7222 100644 --- a/lib/OrdinaryDiffEqFeagin/Project.toml +++ b/lib/OrdinaryDiffEqFeagin/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqFeagin" uuid = "101fe9f7-ebb6-4678-b671-3a81e7194747" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqFunctionMap/Project.toml b/lib/OrdinaryDiffEqFunctionMap/Project.toml index a556751605..e401f0748c 100644 --- a/lib/OrdinaryDiffEqFunctionMap/Project.toml +++ b/lib/OrdinaryDiffEqFunctionMap/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqFunctionMap" uuid = "d3585ca7-f5d3-4ba6-8057-292ed1abd90f" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqHighOrderRK/Project.toml b/lib/OrdinaryDiffEqHighOrderRK/Project.toml index d1ac67c08b..7a6f19a94f 100644 --- a/lib/OrdinaryDiffEqHighOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqHighOrderRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqHighOrderRK" uuid = "d28bc4f8-55e1-4f49-af69-84c1a99f0f58" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqIMEXMultistep/Project.toml b/lib/OrdinaryDiffEqIMEXMultistep/Project.toml index 2630b04224..ff8bd8f36b 100644 --- a/lib/OrdinaryDiffEqIMEXMultistep/Project.toml +++ b/lib/OrdinaryDiffEqIMEXMultistep/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqIMEXMultistep" uuid = "9f002381-b378-40b7-97a6-27a27c83f129" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqLinear/Project.toml b/lib/OrdinaryDiffEqLinear/Project.toml index 97e550b764..107dd521f1 100644 --- a/lib/OrdinaryDiffEqLinear/Project.toml +++ b/lib/OrdinaryDiffEqLinear/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqLinear" uuid = "521117fe-8c41-49f8-b3b6-30780b3f0fb5" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqLowOrderRK/Project.toml b/lib/OrdinaryDiffEqLowOrderRK/Project.toml index 9e0653e46a..737d7e9e1f 100644 --- a/lib/OrdinaryDiffEqLowOrderRK/Project.toml +++ b/lib/OrdinaryDiffEqLowOrderRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqLowOrderRK" uuid = "1344f307-1e59-4825-a18e-ace9aa3fa4c6" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqLowStorageRK/Project.toml b/lib/OrdinaryDiffEqLowStorageRK/Project.toml index 9805d351fd..75053fd953 100644 --- a/lib/OrdinaryDiffEqLowStorageRK/Project.toml +++ b/lib/OrdinaryDiffEqLowStorageRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqLowStorageRK" uuid = "b0944070-b475-4768-8dec-fb6eb410534d" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml index cba61bf922..d0a8add51a 100644 --- a/lib/OrdinaryDiffEqNonlinearSolve/Project.toml +++ b/lib/OrdinaryDiffEqNonlinearSolve/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqNonlinearSolve" uuid = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8" authors = ["Chris Rackauckas ", "Yingbo Ma "] -version = "1.0.0" +version = "1.1.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/lib/OrdinaryDiffEqNordsieck/Project.toml b/lib/OrdinaryDiffEqNordsieck/Project.toml index e663aeccd9..8acc1dd828 100644 --- a/lib/OrdinaryDiffEqNordsieck/Project.toml +++ b/lib/OrdinaryDiffEqNordsieck/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqNordsieck" uuid = "c9986a66-5c92-4813-8696-a7ec84c806c8" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqPDIRK/Project.toml b/lib/OrdinaryDiffEqPDIRK/Project.toml index e48807d200..115a797565 100644 --- a/lib/OrdinaryDiffEqPDIRK/Project.toml +++ b/lib/OrdinaryDiffEqPDIRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqPDIRK" uuid = "5dd0a6cf-3d4b-4314-aa06-06d4e299bc89" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqPRK/Project.toml b/lib/OrdinaryDiffEqPRK/Project.toml index 0c2a6dc582..f34b93901b 100644 --- a/lib/OrdinaryDiffEqPRK/Project.toml +++ b/lib/OrdinaryDiffEqPRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqPRK" uuid = "5b33eab2-c0f1-4480-b2c3-94bc1e80bda1" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqQPRK/Project.toml b/lib/OrdinaryDiffEqQPRK/Project.toml index 24b2fe7910..d0fc6065d0 100644 --- a/lib/OrdinaryDiffEqQPRK/Project.toml +++ b/lib/OrdinaryDiffEqQPRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqQPRK" uuid = "04162be5-8125-4266-98ed-640baecc6514" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqRKN/Project.toml b/lib/OrdinaryDiffEqRKN/Project.toml index ae198f596e..09dc6999b8 100644 --- a/lib/OrdinaryDiffEqRKN/Project.toml +++ b/lib/OrdinaryDiffEqRKN/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqRKN" uuid = "af6ede74-add8-4cfd-b1df-9a4dbb109d7a" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqRosenbrock/Project.toml b/lib/OrdinaryDiffEqRosenbrock/Project.toml index d0dec8acf2..14f0d057bf 100644 --- a/lib/OrdinaryDiffEqRosenbrock/Project.toml +++ b/lib/OrdinaryDiffEqRosenbrock/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqRosenbrock" uuid = "43230ef6-c299-4910-a778-202eb28ce4ce" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/lib/OrdinaryDiffEqSDIRK/Project.toml b/lib/OrdinaryDiffEqSDIRK/Project.toml index 29ee9c1562..6204b7309e 100644 --- a/lib/OrdinaryDiffEqSDIRK/Project.toml +++ b/lib/OrdinaryDiffEqSDIRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqSDIRK" uuid = "2d112036-d095-4a1e-ab9a-08536f3ecdbf" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqSSPRK/Project.toml b/lib/OrdinaryDiffEqSSPRK/Project.toml index d8a784019b..4875988c14 100644 --- a/lib/OrdinaryDiffEqSSPRK/Project.toml +++ b/lib/OrdinaryDiffEqSSPRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqSSPRK" uuid = "669c94d9-1f4b-4b64-b377-1aa079aa2388" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml index 11b8ece1fa..da92cbbb91 100644 --- a/lib/OrdinaryDiffEqStabilizedIRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedIRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqStabilizedIRK" uuid = "e3e12d00-db14-5390-b879-ac3dd2ef6296" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqStabilizedRK/Project.toml b/lib/OrdinaryDiffEqStabilizedRK/Project.toml index b9e75f2f8b..950345829a 100644 --- a/lib/OrdinaryDiffEqStabilizedRK/Project.toml +++ b/lib/OrdinaryDiffEqStabilizedRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqStabilizedRK" uuid = "358294b1-0aab-51c3-aafe-ad5ab194a2ad" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqSymplecticRK/Project.toml b/lib/OrdinaryDiffEqSymplecticRK/Project.toml index 5c04b31fe7..9c32d09c76 100644 --- a/lib/OrdinaryDiffEqSymplecticRK/Project.toml +++ b/lib/OrdinaryDiffEqSymplecticRK/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqSymplecticRK" uuid = "fa646aed-7ef9-47eb-84c4-9443fc8cbfa8" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqTsit5/Project.toml b/lib/OrdinaryDiffEqTsit5/Project.toml index bb6e57e416..91b6491873 100644 --- a/lib/OrdinaryDiffEqTsit5/Project.toml +++ b/lib/OrdinaryDiffEqTsit5/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqTsit5" uuid = "b1df2697-797e-41e3-8120-5422d3b24e4a" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" diff --git a/lib/OrdinaryDiffEqVerner/Project.toml b/lib/OrdinaryDiffEqVerner/Project.toml index 4dc9e39f19..6c0788b1c7 100644 --- a/lib/OrdinaryDiffEqVerner/Project.toml +++ b/lib/OrdinaryDiffEqVerner/Project.toml @@ -1,7 +1,7 @@ name = "OrdinaryDiffEqVerner" uuid = "79d7bb75-1356-48c1-b8c0-6832512096c2" authors = ["ParamThakkar123 "] -version = "1.0.0" +version = "1.1.0" [deps] DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" From bd56fc5ff725e750e8fd77fdd763fd69fdd10530 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 20 Aug 2024 13:25:45 -0400 Subject: [PATCH 55/55] update firk order --- lib/OrdinaryDiffEqFIRK/src/alg_utils.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OrdinaryDiffEqFIRK/src/alg_utils.jl b/lib/OrdinaryDiffEqFIRK/src/alg_utils.jl index 46dfcb8206..692a86bb88 100644 --- a/lib/OrdinaryDiffEqFIRK/src/alg_utils.jl +++ b/lib/OrdinaryDiffEqFIRK/src/alg_utils.jl @@ -10,4 +10,4 @@ isfirk(alg::RadauIIA9) = true alg_adaptive_order(alg::RadauIIA3) = 1 alg_adaptive_order(alg::RadauIIA5) = 3 -alg_adaptive_order(alg::RadauIIA9) = 7 +alg_adaptive_order(alg::RadauIIA9) = 5