-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
[WIP] Relaxation Runge-Kutta #2227
Changes from all commits
fbf962d
dc25f21
575826a
cdb53c9
7e2b73a
d0f8a22
229438f
9384053
a796157
eeda5a7
b3617ad
945b9d3
ef5238b
cb94460
4323a68
12e4a7a
e35d9fa
7fada13
653436b
730d4e1
db28be6
2ffd004
a180073
52f4461
b4d9c40
a01bc2a
3fd63fd
e926a61
2789e9f
89c10f3
2c387d8
83bd06c
8ff5be9
5138202
c884132
fa0d5c3
3287f82
1111c38
44ea89d
9af57f8
3d06894
f6557b4
ac1943d
5c9b8e6
2b0fb0a
f208a53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,6 +361,19 @@ function Tsit5(stage_limiter!, step_limiter! = trivial_limiter!) | |
Tsit5(stage_limiter!, step_limiter!, False()) | ||
end | ||
|
||
Base.@kwdef struct Tsit5_for_relaxation{StageLimiter, StepLimiter, Thread} <: | ||
OrdinaryDiffEqAdaptiveAlgorithm | ||
stage_limiter!::StageLimiter = trivial_limiter! | ||
step_limiter!::StepLimiter = trivial_limiter! | ||
thread::Thread = False() | ||
end | ||
|
||
# for backwards compatibility | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. backwards compatibility with what? |
||
function Tsit5_for_relaxation(stage_limiter!, step_limiter! = trivial_limiter!) | ||
Tsit5_for_relaxation(stage_limiter!, step_limiter!, False()) | ||
end | ||
|
||
|
||
@doc explicit_rk_docstring( | ||
"Hairer's 8/5/3 adaption of the Dormand-Prince Runge-Kutta method. (7th order interpolant).", | ||
"DP8", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,6 +448,44 @@ if isdefined(Base, :Experimental) && isdefined(Base.Experimental, :silence!) | |
Base.Experimental.silence!(Tsit5Cache) | ||
end | ||
|
||
@cache struct Tsit5Cache_for_relaxation{uType, rateType, uNoUnitsType, StageLimiter, StepLimiter, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could this just use the |
||
Thread} <: OrdinaryDiffEqMutableCache | ||
u::uType | ||
uprev::uType | ||
k1::rateType | ||
k2::rateType | ||
k3::rateType | ||
k4::rateType | ||
k5::rateType | ||
k6::rateType | ||
k7::rateType | ||
utilde::uType | ||
tmp::uType | ||
atmp::uNoUnitsType | ||
stage_limiter!::StageLimiter | ||
step_limiter!::StepLimiter | ||
thread::Thread | ||
end | ||
|
||
function alg_cache(alg::Tsit5_for_relaxation, u, rate_prototype, ::Type{uEltypeNoUnits}, | ||
::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, | ||
dt, reltol, p, calck, | ||
::Val{true}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits} | ||
k1 = zero(rate_prototype) | ||
k2 = zero(rate_prototype) | ||
k3 = zero(rate_prototype) | ||
k4 = zero(rate_prototype) | ||
k5 = zero(rate_prototype) | ||
k6 = zero(rate_prototype) | ||
k7 = zero(rate_prototype) | ||
utilde = zero(u) | ||
atmp = similar(u, uEltypeNoUnits) | ||
recursivefill!(atmp, false) | ||
tmp = zero(u) | ||
Tsit5Cache_for_relaxation(u, uprev, k1, k2, k3, k4, k5, k6, k7, utilde, tmp, atmp, | ||
alg.stage_limiter!, alg.step_limiter!, alg.thread) | ||
end | ||
|
||
@cache struct RK46NLCache{uType, rateType, TabType, StageLimiter, StepLimiter, Thread} <: | ||
OrdinaryDiffEqMutableCache | ||
u::uType | ||
|
@@ -547,6 +585,13 @@ function alg_cache(alg::Tsit5, u, rate_prototype, ::Type{uEltypeNoUnits}, | |
Tsit5ConstantCache() | ||
end | ||
|
||
function alg_cache(alg::Tsit5_for_relaxation, u, rate_prototype, ::Type{uEltypeNoUnits}, | ||
::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t, | ||
dt, reltol, p, calck, | ||
::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits} | ||
Tsit5ConstantCache_for_relaxation() | ||
end | ||
|
||
@cache struct DP5Cache{uType, rateType, uNoUnitsType, StageLimiter, StepLimiter, | ||
Thread} <: OrdinaryDiffEqMutableCache | ||
u::uType | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -506,3 +506,22 @@ function DiffEqBase.set_u!(integrator::ODEIntegrator, u) | |
end | ||
|
||
DiffEqBase.has_stats(i::ODEIntegrator) = true | ||
|
||
|
||
function change_dt!(integrator::ODEIntegrator, dt) | ||
integrator.dt_has_changed = true | ||
integrator.dt_changed = dt | ||
end | ||
|
||
function change_u!(integrator::ODEIntegrator, u) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this set |
||
integrator.u = u | ||
end | ||
|
||
function change_fsallast!(integrator::ODEIntegrator, fsallast) | ||
integrator.fsallast = fsallast | ||
end | ||
|
||
has_poststep_callback(integrator::ODEIntegrator) = has_poststep_callback(integrator.opts.performstepcallback) | ||
has_postfsal_callback(integrator::ODEIntegrator) = has_postfsal_callback(integrator.opts.performstepcallback) | ||
has_postEEst_callback(integrator::ODEIntegrator) = has_postEEst_callback(integrator.opts.performstepcallback) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these need to be exported?