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

import AbstractController from OrdinaryDiffEq.jl #522

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/StochasticDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using DocStringExtensions
beta2_default, beta1_default, gamma_default,
qmin_default, qmax_default, qsteady_min_default, qsteady_max_default,
stepsize_controller!, accept_step_controller, step_accept_controller!,
step_reject_controller!, PIController, DummyController
step_reject_controller!, PIController, DummyController, AbstractController

using UnPack, RecursiveArrayTools, DataStructures
using DiffEqNoiseProcess, Random, ArrayInterface
Expand Down
5 changes: 5 additions & 0 deletions src/integrators/stepsize_controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ function stepsize_controller!(integrator::SDEIntegrator, controller::PIControlle
integrator.q11 = DiffEqBase.value(DiffEqBase.fastpow(integrator.EEst,controller.beta1))
integrator.q = DiffEqBase.value(integrator.q11/DiffEqBase.fastpow(integrator.qold,controller.beta2))
@fastmath integrator.q = DiffEqBase.value(max(inv(integrator.opts.qmax),min(inv(integrator.opts.qmin),integrator.q/integrator.opts.gamma)))
nothing
end

@inline function step_accept_controller!(integrator::SDEIntegrator, alg)
step_accept_controller!(integrator, integrator.opts.controller, alg)
nothing
end

function step_accept_controller!(integrator::SDEIntegrator, controller::PIController, alg)
integrator.dtnew = DiffEqBase.value(integrator.dt/integrator.q) * oneunit(integrator.dt)
nothing
end

function step_reject_controller!(integrator::SDEIntegrator, controller::PIController, alg)
integrator.dtnew = integrator.dt/min(inv(integrator.opts.qmin),integrator.q11/integrator.opts.gamma)
nothing
end


Expand All @@ -29,6 +33,7 @@ end

function step_reject_controller!(integrator::SDEIntegrator, alg::TauLeaping)
integrator.dt = integrator.opts.gamma * integrator.dt / integrator.EEst
nothing
end


Expand Down