Skip to content
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
12 changes: 6 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DynamicalSystemsBase"
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
version = "3.15.7"
version = "3.16.0"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand All @@ -24,12 +24,12 @@ StochasticSystemsBase = "StochasticDiffEq"

[compat]
ForwardDiff = "0.10, 1"
OrdinaryDiffEqTsit5 = "1.1"
OrdinaryDiffEqTsit5 = "2"
Reexport = "1"
Roots = "1, 2"
SciMLBase = "1.19.5, 2"
Roots = "2, 3"
SciMLBase = "3"
StateSpaceSets = "2.5"
Statistics = "1"
StochasticDiffEq = "6.66.0"
StochasticDiffEq = "7"
SymbolicIndexingInterface = "0.3.4"
julia = "1.9"
julia = "1.10"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![](https://img.shields.io/badge/DOI-10.1007%2F978--3--030--91032--7-purple)](https://link.springer.com/book/10.1007/978-3-030-91032-7)
[![CI](https://github.com/JuliaDynamics/DynamicalSystemsBase.jl/workflows/CI/badge.svg)](https://github.com/JuliaDynamics/DynamicalSystemsBase.jl/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/JuliaDynamics/DynamicalSystemsBase.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaDynamics/DynamicalSystemsBase.jl)
[![Package Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/DynamicalSystemsBase)](https://pkgs.genieframework.com?packages=DynamicalSystemsBase)
[![Downloads](https://img.shields.io/badge/dynamic/json?url=http%3A%2F%2Fjuliapkgstats.com%2Fapi%2Fv1%2Ftotal_downloads%2FDynamicalSystemsBase&query=total_requests&label=Downloads)](https://juliapkgstats.com/pkg/DynamicalSystemsBase)

A Julia package that defines the `DynamicalSystem` interface and many concrete implementations used in the DynamicalSystems.jl ecosystem.

Expand Down
2 changes: 1 addition & 1 deletion ext/StochasticSystemsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module StochasticSystemsBase
using DynamicalSystemsBase: DynamicalSystemsBase, SciMLBase, correct_state, CoupledODEs,
CoupledSDEs, StateSpaceSets, isinplace, _delete, set_parameter!,
set_parameters!, set_state!, dynamic_rule, isdeterministic, current_state,
DynamicalSystemsBase, _set_parameter!, u_modified!,
DynamicalSystemsBase, _set_parameter!, derivative_discontinuity!,
additional_details, referrenced_sciml_prob, DEFAULT_DIFFEQ,
SVector, SMatrix, current_parameters, initial_state, initial_time
using SciMLBase: SDEProblem, AbstractSDEIntegrator, __init, SDEFunction, step!
Expand Down
4 changes: 2 additions & 2 deletions ext/src/CoupledSDEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ function DynamicalSystemsBase.successful_step(integ::AbstractSDEIntegrator)
return rcode == SciMLBase.ReturnCode.Default || rcode == SciMLBase.ReturnCode.Success
end

# This is here to ensure that `u_modified!` is called
# This is here to ensure that `derivative_discontinuity!` is called
function DynamicalSystemsBase.set_parameter!(ds::CoupledSDEs, args...)
_set_parameter!(ds, args...)
u_modified!(ds.integ, true)
derivative_discontinuity!(ds.integ, true)
return nothing
end

Expand Down
4 changes: 2 additions & 2 deletions src/core/dynamicalsystem_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ Return the ModelingToolkit.jl structurally-simplified model referrenced by `ds`.
Return `nothing` if there is no referrenced model.
"""
referrenced_sciml_model(ds::DynamicalSystem) = referrenced_sciml_model(referrenced_sciml_prob(ds))
referrenced_sciml_model(prob::SciMLBase.DEProblem) = prob.f.sys
referrenced_sciml_model(prob::SciMLBase.AbstractDEProblem) = prob.f.sys
referrenced_sciml_model(::Nothing) = nothing

# return true if there is an actual referrenced system
has_referrenced_model(prob::SciMLBase.DEProblem) = has_referrenced_model(referrenced_sciml_model(prob))
has_referrenced_model(prob::SciMLBase.AbstractDEProblem) = has_referrenced_model(referrenced_sciml_model(prob))
has_referrenced_model(prob::DynamicalSystem) = has_referrenced_model(referrenced_sciml_model(prob))
has_referrenced_model(::Nothing) = false
has_referrenced_model(::SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing}) = false
Expand Down
8 changes: 4 additions & 4 deletions src/core_systems/continuous_time_ode.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using OrdinaryDiffEqTsit5: Tsit5
using SciMLBase: ODEProblem, DEIntegrator, u_modified!, __init
using SciMLBase: ODEProblem, DEIntegrator, derivative_discontinuity!, __init
export CoupledODEs, ContinuousDynamicalSystem

###########################################################################################
Expand Down Expand Up @@ -183,14 +183,14 @@ function set_state!(integ::DEIntegrator, u)
else
integ.u = recursivecopy(u)
end
u_modified!(integ, true)
derivative_discontinuity!(integ, true)
return
end

# This is here to ensure that `u_modified!` is called
# This is here to ensure that `derivative_discontinuity!` is called
function set_parameter!(ds::CoupledODEs, args...)
_set_parameter!(ds, args...)
u_modified!(ds.integ, true)
derivative_discontinuity!(ds.integ, true)
return
end

Expand Down
6 changes: 3 additions & 3 deletions src/derived_systems/parallel_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ initial_states(pdsa::PDSAM) = eachcol(initial_state(pdsa.ds))
(pdsa::PDSAM)(t::Real, i::Int = 1) = view(pdsa.ds(t), :, i)
function set_state!(pdsa::PDSAM, u::AbstractArray, i::Int = 1)
current_state(pdsa, i) .= u
u_modified!(pdsa.ds.integ, true)
derivative_discontinuity!(pdsa.ds.integ, true)
return pdsa
end


function set_state!(pdsa::PDSAM{<:StroboscopicMap}, u::AbstractArray, i::Int = 1)
current_state(pdsa, i) .= u
u_modified!(pdsa.ds.ds.integ, true)
derivative_discontinuity!(pdsa.ds.ds.integ, true)
return pdsa
end

Expand Down Expand Up @@ -248,7 +248,7 @@ set_parameter!(pdtds::PDTDS, index, value) = for ds in pdtds.systems
end
function set_state!(pdtds::PDTDS, u, i::Int = 1)
# We need to set state in all systems, in case this does
# some kind of resetting, e.g., the `u_modified!` stuff.
# some kind of resetting, e.g., the `derivative_discontinuity!` stuff.
for (k, ds) in enumerate(pdtds.systems)
if k == i
set_state!(ds, u)
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
ModelingToolkit = "10"
ModelingToolkit = "10, 11"
5 changes: 4 additions & 1 deletion test/continuous.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DynamicalSystemsBase, Test

using OrdinaryDiffEqTsit5: ODEProblem, Tsit5
using OrdinaryDiffEqTsit5.OrdinaryDiffEqCore: None
using OrdinaryDiffEqVerner: Vern9

include("test_system_function.jl")
Expand Down Expand Up @@ -39,7 +40,9 @@ end
@test lorenz_oop.integ.alg isa Tsit5

prob = lorenz_oop.integ.sol.prob
ds = CoupledODEs(prob, (alg = Vern9(), abstol = 0.0, reltol = 1.0e-6, verbose = false))
ds = CoupledODEs(
prob, (alg = Vern9(), abstol = 0.0, reltol = 1.0e-6, verbose = None())
)
@test ds.integ.alg isa Vern9
# SciML moved from Bool verbose to a `DEVerbosity` struct of per-toggle verbosities.
@test nameof(typeof(ds.integ.opts.verbose.linear_verbosity)) == :None
Expand Down
4 changes: 2 additions & 2 deletions test/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ end
@named sys = System(eqs, t)
sys = mtkcompile(sys)

prob = ODEProblem(sys, [1.0, 1.0], (0.0, 1.0); jac = true)
prob = ODEProblem(sys, [u[1] => 1.0, u[2] => 1.0], (0.0, 1.0); jac = true)
ds = CoupledODEs(prob)

jac = jacobian(ds)
Expand All @@ -60,7 +60,7 @@ end
]
@mtkcompile sys = System(eqs, t)

prob = SDEProblem(sys, [1.0, 1.0], (0.0, 1.0), jac = true)
prob = SDEProblem(sys, [u[1] => 1.0, u[2] => 1.0], (0.0, 1.0), jac = true)
sde = CoupledSDEs(prob)

jac = jacobian(sde)
Expand Down
30 changes: 9 additions & 21 deletions test/mtk_integration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,27 +141,15 @@ end

@independent_variables t
D = Differential(t)
@mtkmodel Roessler begin
@parameters begin
a = 0.2
b = 0.2
c = 5.7
end
@variables begin
x(t) = 1.0
y(t) = 0.0
z(t) = 0.0
nlt(t) # nonlinear term
end
@equations begin
D(x) ~ -y - z
D(y) ~ x + a * y
D(z) ~ b + nlt
nlt ~ z * (x - c)
end
end

@mtkcompile roessler_model = Roessler()
@parameters a = 0.2 b = 0.2 c = 5.7
@variables x(t) = 1.0 y(t) = 0.0 z(t) = 0.0 nlt(t)
eqs = [
D(x) ~ -y - z,
D(y) ~ x + a * y,
D(z) ~ b + nlt,
nlt ~ z * (x - c),
]
@mtkcompile roessler_model = System(eqs, t)

@testset "type: $(iip)" for iip in (true, false)
if iip
Expand Down
7 changes: 5 additions & 2 deletions test/stochastic.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DynamicalSystemsBase, Test
using OrdinaryDiffEqTsit5: Tsit5
using OrdinaryDiffEqTsit5.OrdinaryDiffEqCore: None
using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess, EM

StochasticSystemsBase = Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase)
Expand Down Expand Up @@ -70,7 +71,7 @@ end

lorenz_SRA = CoupledSDEs(
lorenz_rule, u0, p0;
diffeq = (alg = SRA(), abstol = 1.0e-3, reltol = 1.0e-3, verbose = false)
diffeq = (alg = SRA(), abstol = 1.0e-3, reltol = 1.0e-3, verbose = None())
)
@test lorenz_SRA.integ.alg isa SRA
# SciML moved from Bool verbose to a `DEVerbosity` struct of per-toggle verbosities.
Expand All @@ -79,7 +80,9 @@ end
# also test SDEproblem creation
prob = lorenz_SRA.integ.sol.prob

ds = CoupledSDEs(prob, (alg = SRA(), abstol = 0.0, reltol = 1.0e-3, verbose = false))
ds = CoupledSDEs(
prob, (alg = SRA(), abstol = 0.0, reltol = 1.0e-3, verbose = None())
)

@test ds.integ.alg isa SRA
@test nameof(typeof(ds.integ.opts.verbose.linear_verbosity)) == :None
Expand Down
Loading