Skip to content

Commit

Permalink
Merge pull request #2267 from ParamThakkar123/feagin
Browse files Browse the repository at this point in the history
Added Feagin Package
  • Loading branch information
ChrisRackauckas authored Jun 30, 2024
2 parents 7986c8b + 4a4350f commit d8c625d
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 54 deletions.
19 changes: 19 additions & 0 deletions lib/OrdinaryDiffEqFeagin/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name = "OrdinaryDiffEqFeagin"
uuid = "101fe9f7-ebb6-4678-b671-3a81e7194747"
authors = ["ParamThakkar123 <paramthakkar864@gmail.com>"]
version = "1.0.0"

[deps]
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"

[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"

[compat]
julia = "1.10"

[targets]
test = ["DiffEqDevTools", "Random", "SafeTestsets", "Test"]
25 changes: 25 additions & 0 deletions lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module OrdinaryDiffEqFeagin

import OrdinaryDiffEq: alg_order, calculate_residuals!,
initialize!, perform_step!, @unpack, unwrap_alg,
calculate_residuals,
OrdinaryDiffEqAlgorithm,
OrdinaryDiffEqMutableCache, OrdinaryDiffEqConstantCache,
OrdinaryDiffEqAdaptiveAlgorithm, CompiledFloats, uses_uprev,
alg_cache, _vec, _reshape, @cache, isfsal, full_cache,
constvalue, _unwrap_val, du_alias_or_new,
explicit_rk_docstring, trivial_limiter!,
_ode_interpolant!, _ode_addsteps!
using DiffEqBase, FastBroadcast, Polyester, MuladdMacro, RecursiveArrayTools
using DiffEqBase: @def, @tight_loop_macros
using Static: False

include("algorithms.jl")
include("alg_utils.jl")
include("feagin_tableaus.jl")
include("feagin_caches.jl")
include("feagin_rk_perform_step.jl")

export Feagin10, Feagin12, Feagin14

end
6 changes: 6 additions & 0 deletions lib/OrdinaryDiffEqFeagin/src/alg_utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
alg_order(alg::Feagin10) = 10
alg_order(alg::Feagin12) = 12
alg_order(alg::Feagin14) = 14

alg_adaptive_order(alg::Feagin10) = 8
alg_adaptive_order(alg::Feagin14) = 12
41 changes: 41 additions & 0 deletions lib/OrdinaryDiffEqFeagin/src/algorithms.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
@article{feagin2012high,
title={High-order explicit Runge-Kutta methods using m-symmetry},
author={Feagin, Terry},
year={2012},
publisher={Neural, Parallel \\& Scientific Computations}
}
Feagin10: Explicit Runge-Kutta Method
Feagin's 10th-order Runge-Kutta method.
"""
Base.@kwdef struct Feagin10{StepLimiter} <: OrdinaryDiffEqAdaptiveAlgorithm
step_limiter!::StepLimiter = trivial_limiter!
end

"""
@article{feagin2012high,
title={High-order explicit Runge-Kutta methods using m-symmetry},
author={Feagin, Terry},
year={2012},
publisher={Neural, Parallel \\& Scientific Computations}
}
Feagin12: Explicit Runge-Kutta Method
Feagin's 12th-order Runge-Kutta method.
"""
Base.@kwdef struct Feagin12{StepLimiter} <: OrdinaryDiffEqAdaptiveAlgorithm
step_limiter!::StepLimiter = trivial_limiter!
end

"""
Feagin, T., “An Explicit Runge-Kutta Method of Order Fourteen,” Numerical
Algorithms, 2009
Feagin14: Explicit Runge-Kutta Method
Feagin's 14th-order Runge-Kutta method.
"""
Base.@kwdef struct Feagin14{StepLimiter} <: OrdinaryDiffEqAdaptiveAlgorithm
step_limiter!::StepLimiter = trivial_limiter!
end

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1294,4 +1294,4 @@ end
end
f(integrator.fsallast, u, p, t + dt) # For the interpolation, needs k at the updated point
integrator.stats.nf += 1
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2647,4 +2647,4 @@ function Feagin14ConstantCache(T::Type, T2::Type)
b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18,
b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31,
b32, b33, b34, b35)
end
end
File renamed without changes.
Empty file.
9 changes: 5 additions & 4 deletions src/OrdinaryDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ include("composite_algs.jl")
include("caches/basic_caches.jl")
include("caches/low_order_rk_caches.jl")
include("caches/high_order_rk_caches.jl")
include("caches/feagin_caches.jl")
include("caches/verner_caches.jl")
include("caches/sdirk_caches.jl")
include("caches/firk_caches.jl")
Expand All @@ -170,7 +169,6 @@ include("tableaus/low_order_rk_tableaus.jl")
include("tableaus/high_order_rk_tableaus.jl")
include("tableaus/symplectic_tableaus.jl")
include("tableaus/verner_tableaus.jl")
include("tableaus/feagin_tableaus.jl")
include("tableaus/rosenbrock_tableaus.jl")
include("tableaus/sdirk_tableaus.jl")
include("tableaus/firk_tableaus.jl")
Expand All @@ -195,7 +193,6 @@ include("perform_step/explicit_rk_perform_step.jl")
include("perform_step/low_order_rk_perform_step.jl")
include("perform_step/high_order_rk_perform_step.jl")
include("perform_step/verner_rk_perform_step.jl")
include("perform_step/feagin_rk_perform_step.jl")
include("perform_step/sdirk_perform_step.jl")
include("perform_step/kencarp_kvaerno_perform_step.jl")
include("perform_step/firk_perform_step.jl")
Expand Down Expand Up @@ -265,6 +262,10 @@ export SSPRK53_2N2, SSPRK22, SSPRK53, SSPRK63, SSPRK83, SSPRK43, SSPRK432, SSPRK
SSPRK54, SSPRK53_2N1, SSPRK104, SSPRK932, SSPRKMSVS43, SSPRK73, SSPRK53_H,
SSPRK33, SHLDDRK_2N, KYKSSPRK42, SHLDDRK52

include("../lib/OrdinaryDiffEqFeagin/src/OrdinaryDiffEqFeagin.jl")
using ..OrdinaryDiffEqFeagin
export Feagin10, Feagin12, Feagin14

import PrecompileTools

PrecompileTools.@compile_workload begin
Expand Down Expand Up @@ -398,7 +399,7 @@ export constructDormandPrince
export FunctionMap, Euler, Heun, Ralston, Midpoint, RK4, ExplicitRK, OwrenZen3, OwrenZen4,
OwrenZen5,
BS3, BS5, DP5, Tsit5, DP8, Vern6, Vern7, Vern8, TanYam7, TsitPap8,
Vern9, Feagin10, Feagin12, Feagin14, CompositeAlgorithm, Anas5, RKO65, FRK65, PFRK87,
Vern9, CompositeAlgorithm, Anas5, RKO65, FRK65, PFRK87,
RKM, MSRK5, MSRK6, Stepanov5, SIR54, QPRK98, PSRK4p7q6, PSRK3p6q5, PSRK3p5q4

export RadauIIA3, RadauIIA5
Expand Down
5 changes: 0 additions & 5 deletions src/alg_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,6 @@ alg_order(alg::SFSDIRK7) = 4
alg_order(alg::SFSDIRK8) = 4
alg_order(alg::Hairer4) = 4
alg_order(alg::Hairer42) = 4
alg_order(alg::Feagin10) = 10
alg_order(alg::Feagin12) = 12
alg_order(alg::Feagin14) = 14
alg_order(alg::PFRK87) = 8

alg_order(alg::ROS2) = 2
Expand Down Expand Up @@ -621,8 +618,6 @@ alg_maximum_order(alg::CompositeAlgorithm) = maximum(alg_order(x) for x in alg.a

alg_adaptive_order(alg::ExplicitRK) = alg.tableau.adaptiveorder
alg_adaptive_order(alg::Union{OrdinaryDiffEqAlgorithm, DAEAlgorithm}) = alg_order(alg) - 1
alg_adaptive_order(alg::Feagin10) = 8
alg_adaptive_order(alg::Feagin14) = 12

alg_adaptive_order(alg::Rosenbrock23) = 3
alg_adaptive_order(alg::Rosenbrock32) = 2
Expand Down
1 change: 0 additions & 1 deletion src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ ExplicitRK(; tableau = ODE_DEFAULT_TABLEAU) = ExplicitRK(tableau)
TruncatedStacktraces.@truncate_stacktrace ExplicitRK

@inline trivial_limiter!(u, integrator, p, t) = nothing

"""
SIR54(; stage_limiter! = OrdinaryDiffEq.trivial_limiter!,
step_limiter! = OrdinaryDiffEq.trivial_limiter!,
Expand Down
41 changes: 0 additions & 41 deletions src/algorithms/explicit_rk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,47 +406,6 @@ function TsitPap8(stage_limiter!, step_limiter! = trivial_limiter!)
TsitPap8(stage_limiter!, step_limiter!, False())
end

"""
@article{feagin2012high,
title={High-order explicit Runge-Kutta methods using m-symmetry},
author={Feagin, Terry},
year={2012},
publisher={Neural, Parallel \\& Scientific Computations}
}
Feagin10: Explicit Runge-Kutta Method
Feagin's 10th-order Runge-Kutta method.
"""
Base.@kwdef struct Feagin10{StepLimiter} <: OrdinaryDiffEqAdaptiveAlgorithm
step_limiter!::StepLimiter = trivial_limiter!
end

"""
@article{feagin2012high,
title={High-order explicit Runge-Kutta methods using m-symmetry},
author={Feagin, Terry},
year={2012},
publisher={Neural, Parallel \\& Scientific Computations}
}
Feagin12: Explicit Runge-Kutta Method
Feagin's 12th-order Runge-Kutta method.
"""
Base.@kwdef struct Feagin12{StepLimiter} <: OrdinaryDiffEqAdaptiveAlgorithm
step_limiter!::StepLimiter = trivial_limiter!
end

"""
Feagin, T., “An Explicit Runge-Kutta Method of Order Fourteen,” Numerical
Algorithms, 2009
Feagin14: Explicit Runge-Kutta Method
Feagin's 14th-order Runge-Kutta method.
"""
Base.@kwdef struct Feagin14{StepLimiter} <: OrdinaryDiffEqAdaptiveAlgorithm
step_limiter!::StepLimiter = trivial_limiter!
end

@doc explicit_rk_docstring("Zero Dissipation Runge-Kutta of 6th order.", "FRK65",
extra_keyword_description = """- `omega`: a periodicity phase estimate,
when accurate this method results in zero numerical dissipation.
Expand Down
17 changes: 16 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ function activate_stabilized_irk()
Pkg.instantiate()
end

function activate_low_storage_rk()
Pkg.activate("../lib/OrdinaryDiffEqStabilizedIRK")
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
Pkg.instantiate()
end

function activate_low_storage_rk()
Pkg.activate("../lib/OrdinaryDiffEqLowStorageRK")
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
Expand All @@ -53,6 +59,12 @@ function activate_ssprk()
Pkg.instantiate()
end

function activate_feagin()
Pkg.activate("../lib/OrdinaryDiffEqFeagin")
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
Pkg.instantiate()
end

#Start Test Script

@time begin
Expand Down Expand Up @@ -187,7 +199,6 @@ end
@time @safetestset "FIRK Tests" include("algconvergence/ode_firk_tests.jl")
@time @safetestset "Linear-Nonlinear Methods Tests" include("algconvergence/linear_nonlinear_convergence_tests.jl")
@time @safetestset "Linear-Nonlinear Krylov Methods Tests" include("algconvergence/linear_nonlinear_krylov_tests.jl")
@time @safetestset "Feagin Tests" include("algconvergence/ode_feagin_tests.jl")
@time @safetestset "Symplectic Tests" include("algconvergence/symplectic_tests.jl")
@time @safetestset "Quadruple precision Runge-Kutta Tests" include("algconvergence/ode_quadruple_precision_tests.jl")
end
Expand All @@ -196,6 +207,10 @@ end
@time @safetestset "Extrapolation Tests" include("../lib/OrdinaryDiffEqExtrapolation/test/runtests.jl")
end

if !is_APPVEYOR && GROUP == "Feagin"
@time @safetestset "Feagin Tests" include("../lib/OrdinaryDiffEqFeagin/test/ode_feagin_tests.jl")
end

if !is_APPVEYOR && GROUP == "StabilizedRK"
@time @safetestset "StabilizedRK Tests" include("../lib/OrdinaryDiffEqStabilizedRK/test/runtests.jl")
end
Expand Down

0 comments on commit d8c625d

Please sign in to comment.