Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare to remove OrdinaryDiffEq dependency #299

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
OrdinaryDiffEqDefault = "50262376-6c5a-4cf5-baba-aaf4f84d72d7"
OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b"
OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8"
OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Expand All @@ -22,6 +27,11 @@ ArrayInterface = "7"
DataStructures = "0.18"
DiffEqBase = "6.122"
OrdinaryDiffEq = "6.69"
OrdinaryDiffEqCore = "1.9.0"
OrdinaryDiffEqDefault = "1.1.0"
OrdinaryDiffEqDifferentiation = "1.1.0"
OrdinaryDiffEqNonlinearSolve = "1.2.2"
OrdinaryDiffEqRosenbrock = "1.2.0"
RecursiveArrayTools = "2, 3"
Reexport = "0.2, 1.0"
SciMLBase = "1.90, 2"
Expand Down
14 changes: 4 additions & 10 deletions src/DelayDiffEq.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module DelayDiffEq

using Reexport
import OrdinaryDiffEqCore, OrdinaryDiffEqNonlinearSolve, OrdinaryDiffEqDifferentiation, OrdinaryDiffEqRosenbrock
@reexport using OrdinaryDiffEq

using DataStructures
Expand All @@ -18,16 +19,9 @@ using DiffEqBase: AbstractDDEAlgorithm, AbstractDDEIntegrator, AbstractODEIntegr

using DiffEqBase: @..

if isdefined(OrdinaryDiffEq, :FastConvergence)
using OrdinaryDiffEq: FastConvergence, Convergence, SlowConvergence,
VerySlowConvergence,
Divergence, AbstractNLSolverCache, NLNewton,
NLAnderson, NLFunctional
else
using DiffEqBase: FastConvergence, Convergence, SlowConvergence, VerySlowConvergence,
Divergence, AbstractNLSolverCache
end
using OrdinaryDiffEq: RosenbrockMutableCache
using OrdinaryDiffEqNonlinearSolve: NLNewton, NLAnderson, NLFunctional, AbstractNLSolverCache,
FastConvergence, Convergence, SlowConvergence, VerySlowConvergence, Divergence
using OrdinaryDiffEqRosenbrock: RosenbrockMutableCache

import SciMLBase

Expand Down
60 changes: 30 additions & 30 deletions src/alg_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,49 @@ SciMLBase.isadaptive(alg::AbstractMethodOfStepsAlgorithm) = SciMLBase.isadaptive
function isconstrained(alg::AbstractMethodOfStepsAlgorithm{constrained}) where {constrained}
constrained
end
OrdinaryDiffEq.uses_uprev(alg::AbstractMethodOfStepsAlgorithm, adaptive) = true
OrdinaryDiffEqCore.uses_uprev(alg::AbstractMethodOfStepsAlgorithm, adaptive) = true

function OrdinaryDiffEq.isimplicit(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.isimplicit(alg.alg)
function OrdinaryDiffEqCore.isimplicit(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.isimplicit(alg.alg)
end
function OrdinaryDiffEq.isdtchangeable(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.isdtchangeable(alg.alg)
function OrdinaryDiffEqCore.isdtchangeable(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.isdtchangeable(alg.alg)
end
function OrdinaryDiffEq.ismultistep(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.ismultistep(alg.alg)
function OrdinaryDiffEqCore.ismultistep(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.ismultistep(alg.alg)
end
function OrdinaryDiffEq.isautoswitch(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.isautoswitch(alg.alg)
function OrdinaryDiffEqCore.isautoswitch(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.isautoswitch(alg.alg)
end
function OrdinaryDiffEq.get_chunksize(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.get_chunksize(alg.alg)
function OrdinaryDiffEqCore.get_chunksize(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.get_chunksize(alg.alg)
end
function OrdinaryDiffEq.get_chunksize_int(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.get_chunksize_int(alg.alg)
function OrdinaryDiffEqCore.get_chunksize_int(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.get_chunksize_int(alg.alg)
end
function OrdinaryDiffEq.alg_autodiff(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.alg_autodiff(alg.alg)
function OrdinaryDiffEqCore.alg_autodiff(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.alg_autodiff(alg.alg)
end
function OrdinaryDiffEq.alg_difftype(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.alg_difftype(alg.alg)
function OrdinaryDiffEqCore.alg_difftype(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.alg_difftype(alg.alg)
end
function OrdinaryDiffEq.standardtag(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.standardtag(alg.alg)
function OrdinaryDiffEqCore.standardtag(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.standardtag(alg.alg)
end
function OrdinaryDiffEq.concrete_jac(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.concrete_jac(alg.alg)
function OrdinaryDiffEqCore.concrete_jac(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.concrete_jac(alg.alg)
end
function OrdinaryDiffEq.alg_extrapolates(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.alg_extrapolates(alg.alg)
function OrdinaryDiffEqCore.alg_extrapolates(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.alg_extrapolates(alg.alg)
end
function OrdinaryDiffEq.alg_order(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.alg_order(alg.alg)
function OrdinaryDiffEqCore.alg_order(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.alg_order(alg.alg)
end
function OrdinaryDiffEq.alg_maximum_order(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.alg_maximum_order(alg.alg)
function OrdinaryDiffEqCore.alg_maximum_order(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.alg_maximum_order(alg.alg)
end
function OrdinaryDiffEq.alg_adaptive_order(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEq.alg_adaptive_order(alg.alg)
function OrdinaryDiffEqCore.alg_adaptive_order(alg::AbstractMethodOfStepsAlgorithm)
OrdinaryDiffEqCore.alg_adaptive_order(alg.alg)
end

"""
Expand All @@ -68,7 +68,7 @@ end
Return if algorithm `alg` is a composite algorithm.
"""
iscomposite(alg) = false
iscomposite(::OrdinaryDiffEq.OrdinaryDiffEqCompositeAlgorithm) = true
iscomposite(::OrdinaryDiffEqCore.OrdinaryDiffEqCompositeAlgorithm) = true
iscomposite(alg::AbstractMethodOfStepsAlgorithm) = iscomposite(alg.alg)

function DiffEqBase.prepare_alg(alg::MethodOfSteps, u0, p, prob)
Expand Down
8 changes: 4 additions & 4 deletions src/fpsolve/fpsolve.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
OrdinaryDiffEq.initial_η(fpsolver::FPSolver, integrator::DDEIntegrator) = fpsolver.ηold
OrdinaryDiffEqNonlinearSolve.initial_η(fpsolver::FPSolver, integrator::DDEIntegrator) = fpsolver.ηold

OrdinaryDiffEq.apply_step!(fpsolver::FPSolver, integrator::DDEIntegrator) = nothing
OrdinaryDiffEqNonlinearSolve.apply_step!(fpsolver::FPSolver, integrator::DDEIntegrator) = nothing

function DiffEqBase.postamble!(fpsolver::FPSolver, integrator::DDEIntegrator)
integrator.stats.nfpiter += fpsolver.iter

if OrdinaryDiffEq.nlsolvefail(fpsolver)
if OrdinaryDiffEqNonlinearSolve.nlsolvefail(fpsolver)
integrator.stats.nfpconvfail += 1
end
integrator.force_stepfail = OrdinaryDiffEq.nlsolvefail(fpsolver) ||
integrator.force_stepfail = OrdinaryDiffEqNonlinearSolve.nlsolvefail(fpsolver) ||
integrator.force_stepfail

nothing
Expand Down
18 changes: 9 additions & 9 deletions src/fpsolve/functional.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLFunctional},
function OrdinaryDiffEqNonlinearSolve.compute_step!(fpsolver::FPSolver{<:NLFunctional},
integrator::DDEIntegrator)
# update ODE integrator to next time interval together with correct interpolation
if fpsolver.iter == 1
Expand All @@ -10,7 +10,7 @@ function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLFunctional},
compute_step_fixedpoint!(fpsolver, integrator)
end

function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLAnderson, false},
function OrdinaryDiffEqNonlinearSolve.compute_step!(fpsolver::FPSolver{<:NLAnderson, false},
integrator::DDEIntegrator)
@unpack cache, iter = fpsolver
@unpack aa_start = cache
Expand All @@ -23,7 +23,7 @@ function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLAnderson, false},
cache.z₊old = integrator.u
elseif previter > aa_start
# actually perform Anderson acceleration
integrator.u = OrdinaryDiffEq.anderson(integrator.u, cache)
integrator.u = OrdinaryDiffEqNonlinearSolve.anderson(integrator.u, cache)
integrator.stats.nsolve += 1
end

Expand All @@ -39,7 +39,7 @@ function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLAnderson, false},
compute_step_fixedpoint!(fpsolver, integrator)
end

function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLAnderson, true},
function OrdinaryDiffEqNonlinearSolve.compute_step!(fpsolver::FPSolver{<:NLAnderson, true},
integrator::DDEIntegrator)
@unpack cache, iter = fpsolver
@unpack aa_start = cache
Expand All @@ -52,7 +52,7 @@ function OrdinaryDiffEq.compute_step!(fpsolver::FPSolver{<:NLAnderson, true},
@.. cache.z₊old = integrator.u
elseif previter > aa_start
# actually perform Anderson acceleration
OrdinaryDiffEq.anderson!(integrator.u, cache)
OrdinaryDiffEqNonlinearSolve.anderson!(integrator.u, cache)
integrator.stats.nsolve += 1
end

Expand All @@ -77,11 +77,11 @@ function compute_step_fixedpoint!(
ode_integrator = integrator.integrator

# recompute next integration step
OrdinaryDiffEq.perform_step!(integrator, integrator.cache, true)
OrdinaryDiffEqCore.perform_step!(integrator, integrator.cache, true)

# compute residuals
dz = integrator.u .- ode_integrator.u
atmp = OrdinaryDiffEq.calculate_residuals(dz, ode_integrator.u, integrator.u,
atmp = OrdinaryDiffEqNonlinearSolve.calculate_residuals(dz, ode_integrator.u, integrator.u,
opts.abstol, opts.reltol, opts.internalnorm,
t)

Expand All @@ -103,11 +103,11 @@ function compute_step_fixedpoint!(
ode_integrator = integrator.integrator

# recompute next integration step
OrdinaryDiffEq.perform_step!(integrator, integrator.cache, true)
OrdinaryDiffEqCore.perform_step!(integrator, integrator.cache, true)

# compute residuals
@.. dz = integrator.u - ode_integrator.u
OrdinaryDiffEq.calculate_residuals!(atmp, dz, ode_integrator.u, integrator.u,
OrdinaryDiffEqNonlinearSolve.calculate_residuals!(atmp, dz, ode_integrator.u, integrator.u,
opts.abstol, opts.reltol, opts.internalnorm, t)

opts.internalnorm(atmp, t)
Expand Down
4 changes: 2 additions & 2 deletions src/fpsolve/type.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# solver
mutable struct FPSolver{algType, iip, uTolType, C <: AbstractNLSolverCache} <:
OrdinaryDiffEq.AbstractNLSolver{algType, iip}
OrdinaryDiffEqNonlinearSolve.AbstractNLSolver{algType, iip}
alg::algType
κ::uTolType
fast_convergence_cutoff::uTolType
ηold::uTolType
iter::Int
maxiters::Int
status::OrdinaryDiffEq.NLStatus
status::OrdinaryDiffEqNonlinearSolve.NLStatus
cache::C
nfails::Int
end
Expand Down
Loading
Loading