Skip to content

Commit

Permalink
Merge refactors into extrapolation
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Apr 27, 2019
1 parent 2b4626f commit ed420fb
Show file tree
Hide file tree
Showing 91 changed files with 16,592 additions and 4,853 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ os:
- linux
# - osx
julia:
- 1.0
- nightly
- 1.1
# - nightly
env:
- GROUP=Interface
- GROUP=Integrators
- GROUP=Regression
- GROUP=AlgConvergence_I
- GROUP=AlgConvergence_II
- GROUP=AlgConvergence_III
matrix:
allow_failures:
- julia: nightly
#matrix:
# allow_failures:
# - julia: nightly
notifications:
email: false
after_success:
Expand Down
6 changes: 3 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
julia 1.0
DiffEqBase 5.3.2
DiffEqBase 5.6.3
DiffEqOperators 3.2.0
Parameters 0.10.0
ForwardDiff 0.7.0
ForwardDiff 0.10.3
GenericSVD 0.0.2
NLsolve 0.14.1
RecursiveArrayTools 0.18.6
DiffEqDiffTools 0.4.0
Reexport
MuladdMacro 0.2.1
StaticArrays
StaticArrays 0.10.3
DataStructures 0.15.0
ExponentialUtilities 1.2.0
12 changes: 6 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
environment:
matrix:
- julia_version: 1.0 # latest 1.0.x
# - julia_version: 1.0 # latest 1.0.x
- julia_version: 1 # latest 1.x.y
- julia_version: nightly
# - julia_version: nightly

platform:
- x86 # 32-bit
#- x86 # 32-bit
- x64 # 64-bit

# Uncomment the following lines to allow failures on nightly julia
# (tests will run but not make your overall status red)
matrix:
allow_failures:
- julia_version: nightly
#matrix:
# allow_failures:
# - julia_version: nightly

branches:
only:
Expand Down
23 changes: 15 additions & 8 deletions src/OrdinaryDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module OrdinaryDiffEq
set_abstol!, postamble!, last_step_failed,
isautodifferentiable

using DiffEqBase: check_error!, @def
using DiffEqBase: check_error!, @def, @..

macro tight_loop_macros(ex)
:($(esc(ex)))
Expand All @@ -53,7 +53,6 @@ module OrdinaryDiffEq
include("nlsolve/type.jl")
include("nlsolve/newton.jl")
include("nlsolve/functional.jl")
include("nlsolve/anderson.jl")
include("nlsolve/utils.jl")

include("caches/basic_caches.jl")
Expand All @@ -77,6 +76,7 @@ module OrdinaryDiffEq
include("caches/bdf_caches.jl")
include("caches/rkc_caches.jl")
include("caches/extrapolation_caches.jl")
include("caches/prk_caches.jl")

include("cache_utils.jl")

Expand All @@ -94,6 +94,7 @@ module OrdinaryDiffEq
include("tableaus/rkc_tableaus.jl")

include("integrators/type.jl")
include("integrators/controllers.jl")
include("integrators/integrator_utils.jl")
include("integrators/integrator_interface.jl")

Expand Down Expand Up @@ -123,6 +124,7 @@ module OrdinaryDiffEq
include("perform_step/bdf_perform_step.jl")
include("perform_step/rkc_perform_step.jl")
include("perform_step/extrapolation_perform_step.jl")
include("perform_step/prk_perform_step.jl")

include("dense/generic_dense.jl")
include("dense/interpolants.jl")
Expand Down Expand Up @@ -169,23 +171,26 @@ module OrdinaryDiffEq
export ORK256, CarpenterKennedy2N54, HSLDDRK64, DGLDDRK73_C, DGLDDRK84_C, DGLDDRK84_F, NDBLSRK124, NDBLSRK134, NDBLSRK144,
CFRLDDRK64, TSLDDRK74,
CKLLSRK43_2,CKLLSRK54_3C,CKLLSRK95_4S,CKLLSRK95_4C,CKLLSRK95_4M,
CKLLSRK54_3C_3R, CKLLSRK54_3M_3R, CKLLSRK54_3N_3R, CKLLSRK85_4C_3R, CKLLSRK85_4M_3R, CKLLSRK85_4P_3R,
CKLLSRK54_3N_4R, CKLLSRK54_3M_4R, CKLLSRK65_4M_4R, CKLLSRK85_4FM_4R, CKLLSRK75_4M_5R,
ParsaniKetchesonDeconinck3S32, ParsaniKetchesonDeconinck3S82,
ParsaniKetchesonDeconinck3S53, ParsaniKetchesonDeconinck3S173,
ParsaniKetchesonDeconinck3S94, ParsaniKetchesonDeconinck3S184,
ParsaniKetchesonDeconinck3S105, ParsaniKetchesonDeconinck3S205
ParsaniKetchesonDeconinck3S105, ParsaniKetchesonDeconinck3S205,
KYK2014DGSSPRK_3S2

export RadauIIA5

export ImplicitEuler, ImplicitMidpoint, Trapezoid, TRBDF2, SDIRK2, Kvaerno3,
KenCarp3, Cash4, Hairer4, Hairer42, SSPSDIRK2, Kvaerno4, Kvaerno5,
KenCarp4, KenCarp5
KenCarp4, KenCarp5, ESDIRK54I8L2SA

export GenericImplicitEuler, GenericTrapezoid

export MidpointSplitting, LinearExponential

export Rosenbrock23, Rosenbrock32, RosShamp4, Veldd4, Velds4, GRK4T, GRK4A,
Ros4LStab, ROS3P, Rodas3, Rodas4, Rodas42, Rodas4P, Rodas5
Ros4LStab, ROS3P, Rodas3, Rodas4, Rodas42, Rodas4P, Rodas5, RosenbrockW6S4OS

export GenericIIF1, GenericIIF2

Expand All @@ -201,7 +206,7 @@ module OrdinaryDiffEq
export Nystrom4, Nystrom4VelocityIndependent, Nystrom5VelocityIndependent,
IRKN3, IRKN4, DPRKN6, DPRKN8, DPRKN12, ERKN4, ERKN5

export ROCK2, ROCK4, RKC, IRKC
export ROCK2, ROCK4, RKC, IRKC, ESERK5

export AB3, AB4, AB5, ABM32, ABM43, ABM54

Expand All @@ -222,7 +227,9 @@ module OrdinaryDiffEq
export AutoSwitch, AutoTsit5, AutoDP5,
AutoVern6, AutoVern7, AutoVern8, AutoVern9

export RichardsonEuler, ExtrapolationMidpointDeuflhard, ExtrapolationMidpointHairerWanner
export AitkenNeville, ExtrapolationMidpointDeuflhard, ExtrapolationMidpointHairerWanner

export NLNewton, NLAnderson, NLFunctional
export KuttaPRK2p5

export NLNewton, NLFunctional, NLAnderson
end # module
14 changes: 7 additions & 7 deletions src/adams_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function ϕ_and_ϕstar!(cache, du, k)
β[i] = β[i-1] * ξ/ξ0
ξ += dts[i]
if typeof(cache) <: OrdinaryDiffEqMutableCache
@. ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
@. ϕstar_n[i] = β[i] * ϕ_n[i]
@.. ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
@.. ϕstar_n[i] = β[i] * ϕ_n[i]
else
ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
ϕstar_n[i] = β[i] * ϕ_n[i]
Expand All @@ -47,8 +47,8 @@ function ϕ_and_ϕstar!(cache::Union{VCABMConstantCache,VCABMCache}, du, k)
β[i] = β[i-1] * ξ/ξ0
ξ += dts[i]
if typeof(cache) <: OrdinaryDiffEqMutableCache
@. ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
@. ϕstar_n[i] = β[i] * ϕ_n[i]
@.. ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
@.. ϕstar_n[i] = β[i] * ϕ_n[i]
else
ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
ϕstar_n[i] = β[i] * ϕ_n[i]
Expand All @@ -64,8 +64,8 @@ function expand_ϕ_and_ϕstar!(cache, i)
ξ0 += dts[i]
β[i] = β[i-1] * ξ/ξ0
if typeof(cache) <: OrdinaryDiffEqMutableCache
@. ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
@. ϕstar_n[i] = β[i] * ϕ_n[i]
@.. ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
@.. ϕstar_n[i] = β[i] * ϕ_n[i]
else
ϕ_n[i] = ϕ_n[i-1] - ϕstar_nm1[i-1]
ϕstar_n[i] = β[i] * ϕ_n[i]
Expand All @@ -78,7 +78,7 @@ function ϕ_np1!(cache, du_np1, k)
for i = 1:k
if i != 1
if typeof(cache) <: OrdinaryDiffEqMutableCache
@. ϕ_np1[i] = ϕ_np1[i-1] - ϕstar_n[i-1]
@.. ϕ_np1[i] = ϕ_np1[i-1] - ϕstar_n[i-1]
else
ϕ_np1[i] = ϕ_np1[i-1] - ϕstar_n[i-1]
end
Expand Down
67 changes: 66 additions & 1 deletion src/alg_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ isfsal(alg::Rodas4P) = false
isfsal(alg::Vern7) = false
isfsal(alg::Vern8) = false
isfsal(alg::Vern9) = false
# Pseudo Non-FSAL
isfsal(alg::ORK256) = false
isfsal(alg::CarpenterKennedy2N54) = false
isfsal(alg::HSLDDRK64) = false
isfsal(alg::DGLDDRK73_C) = false
isfsal(alg::DGLDDRK84_C) = false
isfsal(alg::DGLDDRK84_F) = false
isfsal(alg::NDBLSRK124) = false
isfsal(alg::NDBLSRK134) = false
isfsal(alg::NDBLSRK144) = false
get_current_isfsal(alg, cache) = isfsal(alg)
get_current_isfsal(alg::CompositeAlgorithm, cache) = isfsal(alg.algs[cache.current])

Expand Down Expand Up @@ -81,6 +91,7 @@ alg_extrapolates(alg::SDIRK2) = true
alg_extrapolates(alg::Kvaerno3) = true
alg_extrapolates(alg::Kvaerno4) = true
alg_extrapolates(alg::Kvaerno5) = true
alg_extrapolates(alg::ESDIRK54I8L2SA) = true
alg_extrapolates(alg::KenCarp3) = true
alg_extrapolates(alg::KenCarp4) = true
alg_extrapolates(alg::KenCarp5) = true
Expand Down Expand Up @@ -117,7 +128,7 @@ get_current_adaptive_order(alg::CompositeAlgorithm,cache) = alg_adaptive_order(a

alg_order(alg::FunctionMap) = 0
alg_order(alg::Euler) = 1
alg_order(alg::RichardsonEuler) = alg.init_order
alg_order(alg::AitkenNeville) = alg.init_order
alg_order(alg::Heun) = 2
alg_order(alg::Ralston) = 2
alg_order(alg::LawsonEuler) = 1
Expand All @@ -139,6 +150,7 @@ alg_order(alg::Exprb32) = 3
alg_order(alg::Exprb43) = 4
alg_order(alg::Anas5) = 5
alg_order(alg::RK46NL) = 4
alg_order(alg::KuttaPRK2p5) = 5


alg_order(alg::SymplecticEuler) = 1
Expand Down Expand Up @@ -190,6 +202,17 @@ alg_order(alg::CKLLSRK54_3C) = 4
alg_order(alg::CKLLSRK95_4S) = 5
alg_order(alg::CKLLSRK95_4C) = 5
alg_order(alg::CKLLSRK95_4M) = 5
alg_order(alg::CKLLSRK54_3C_3R) = 4
alg_order(alg::CKLLSRK54_3M_3R) = 4
alg_order(alg::CKLLSRK54_3N_3R) = 4
alg_order(alg::CKLLSRK85_4C_3R) = 5
alg_order(alg::CKLLSRK85_4M_3R) = 5
alg_order(alg::CKLLSRK85_4P_3R) = 5
alg_order(alg::CKLLSRK54_3N_4R) = 4
alg_order(alg::CKLLSRK54_3M_4R) = 4
alg_order(alg::CKLLSRK65_4M_4R) = 5
alg_order(alg::CKLLSRK85_4FM_4R) = 5
alg_order(alg::CKLLSRK75_4M_5R) = 5
alg_order(alg::ParsaniKetchesonDeconinck3S32) = 2
alg_order(alg::ParsaniKetchesonDeconinck3S82) = 2
alg_order(alg::ParsaniKetchesonDeconinck3S53) = 3
Expand All @@ -198,6 +221,7 @@ alg_order(alg::ParsaniKetchesonDeconinck3S94) = 4
alg_order(alg::ParsaniKetchesonDeconinck3S184) = 4
alg_order(alg::ParsaniKetchesonDeconinck3S105) = 5
alg_order(alg::ParsaniKetchesonDeconinck3S205) = 5
alg_order(alg::KYK2014DGSSPRK_3S2) = 2

alg_order(alg::SSPRK22) = 2
alg_order(alg::SSPRKMSVS32) = 2
Expand Down Expand Up @@ -246,6 +270,7 @@ alg_order(alg::SDIRK2) = 2
alg_order(alg::Kvaerno3) = 3
alg_order(alg::Kvaerno4) = 4
alg_order(alg::Kvaerno5) = 5
alg_order(alg::ESDIRK54I8L2SA) = 5
alg_order(alg::KenCarp3) = 3
alg_order(alg::KenCarp4) = 4
alg_order(alg::KenCarp5) = 5
Expand All @@ -270,6 +295,7 @@ alg_order(alg::Rodas4) = 4
alg_order(alg::Rodas42) = 4
alg_order(alg::Rodas4P) = 4
alg_order(alg::Rodas5) = 5
alg_order(alg::RosenbrockW6S4OS)=4

alg_order(alg::AB3) = 3
alg_order(alg::AB4) = 4
Expand Down Expand Up @@ -303,6 +329,9 @@ alg_order(alg::SBDF) = alg.order

alg_order(alg::ROCK2) = 2
alg_order(alg::ROCK4) = 4

alg_order(alg::ESERK5) = 5

alg_order(alg::RKC) = 2
alg_order(alg::IRKC) = 2

Expand Down Expand Up @@ -358,6 +387,7 @@ beta1_default(alg::ExtrapolationMidpointDeuflhard,beta2) = 1//(2alg.n_init+1)
beta1_default(alg::ExtrapolationMidpointHairerWanner,beta2) = 1//(2alg.n_init+1)

gamma_default(alg::OrdinaryDiffEqAlgorithm) = 9//10
gamma_default(alg::ESERK5) = 8//10
gamma_default(alg::RKC) = 8//10
gamma_default(alg::IRKC) = 8//10
gamma_default(alg::ExtrapolationMidpointDeuflhard) = (1//4)^beta1_default(alg,beta2_default(alg))
Expand Down Expand Up @@ -406,6 +436,7 @@ ssp_coefficient(alg::SSPRKMSVS43) = 0.33
ssp_coefficient(alg::SSPRK932) = 6
ssp_coefficient(alg::SSPRK54) = 1.508
ssp_coefficient(alg::SSPRK104) = 6
ssp_coefficient(alg::KYK2014DGSSPRK_3S2) = 0.8417

# We shouldn't do this probably.
#ssp_coefficient(alg::ImplicitEuler) = Inf
Expand All @@ -421,6 +452,7 @@ alg_stability_size(alg::Vern9) = 4.4762

alg_can_repeat_jac(alg::OrdinaryDiffEqAlgorithm) = false
alg_can_repeat_jac(alg::OrdinaryDiffEqNewtonAdaptiveAlgorithm) = true
alg_can_repeat_jac(alg::IRKC) = false

function unwrap_alg(integrator, is_stiff)
alg = integrator.alg
Expand All @@ -435,6 +467,20 @@ function unwrap_alg(integrator, is_stiff)
end
end

function unwrap_cache(integrator, is_stiff)
alg = integrator.alg
cache = integrator.cache
iscomp = alg isa CompositeAlgorithm
if !iscomp
return cache
elseif alg.choice_function isa AutoSwitch
num = is_stiff ? 2 : 1
return cache.caches[num]
else
return cache.caches[integrator.cache.current]
end
end

# Whether `uprev` is used in the algorithm directly.
uses_uprev(alg::OrdinaryDiffEqAlgorithm, adaptive::Bool) = true
uses_uprev(alg::ORK256, adaptive::Bool) = false
Expand All @@ -454,3 +500,22 @@ uses_uprev(alg::CKLLSRK54_3C, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK95_4S, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK95_4C, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK95_4M, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK54_3C_3R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK54_3M_3R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK54_3N_3R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK85_4C_3R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK85_4M_3R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK85_4P_3R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK54_3N_4R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK54_3M_4R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK65_4M_4R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK85_4FM_4R, adaptive::Bool) = adaptive
uses_uprev(alg::CKLLSRK75_4M_5R, adaptive::Bool) = adaptive

ispredictive(alg::OrdinaryDiffEqAlgorithm) = false
ispredictive(alg::Union{RKC}) = true
ispredictive(alg::OrdinaryDiffEqNewtonAdaptiveAlgorithm) = alg.controller === :Predictive
isstandard(alg::OrdinaryDiffEqNewtonAdaptiveAlgorithm) = alg.controller === :Standard
isstandard(alg::Union{GenericImplicitEuler,GenericTrapezoid,VCABM}) = true
isstandard(alg::OrdinaryDiffEqAlgorithm) = false
ispi(alg::OrdinaryDiffEqAlgorithm) = !(ispredictive(alg) || isstandard(alg))
Loading

0 comments on commit ed420fb

Please sign in to comment.