Skip to content

Commit 83a8da3

Browse files
authored
Merge branch 'main' into named_param_error
2 parents ecda156 + f7fc41d commit 83a8da3

14 files changed

Lines changed: 59 additions & 53 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
access_token: ${{ github.token }}
3030

3131
# Do tests
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@v5
3333
- uses: julia-actions/setup-julia@v1
3434
with:
3535
version: ${{ matrix.version }}

.github/workflows/doccleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout gh-pages branch
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v5
1313
with:
1414
ref: gh-pages
1515

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
contents: write
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- uses: julia-actions/setup-julia@v1
1818
with:
1919
version: '1'

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# v3.14.0
77

88
- `set_parameter!` and `current_parameter` will now throw an informative error message explicitly naming the parameter if the user tries to get/set a symbolic parameter that does not exist in the MTK-generated dynamical system.
9+
- Fixed a plethora of bugs and test failures associated with updates in the SciML ecosystem.
910

1011
# v3.13.0
1112

Project.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ StateSpaceSets = "40b095a5-5852-4c12-98c7-d43bf788e795"
1515
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1616
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
1717

18+
[weakdeps]
19+
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
20+
21+
[extensions]
22+
StochasticSystemsBase = "StochasticDiffEq"
23+
1824
[compat]
19-
ForwardDiff = "0.10"
25+
ForwardDiff = "0.10, 1"
2026
OrdinaryDiffEqTsit5 = "1.1"
2127
Reexport = "1"
2228
Roots = "1, 2"
@@ -26,9 +32,3 @@ Statistics = "1"
2632
StochasticDiffEq = "6.66.0"
2733
SymbolicIndexingInterface = "0.3.4"
2834
julia = "1.9"
29-
30-
[weakdeps]
31-
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
32-
33-
[extensions]
34-
StochasticSystemsBase = "StochasticDiffEq"

src/core_systems/continuous_time_ode.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ set_state!(ds::CoupledODEs, u::AbstractArray) = (set_state!(ds.integ, u); ds)
142142
SciMLBase.step!(ds::CoupledODEs, args...) = (step!(ds.integ, args...); ds)
143143

144144
function SciMLBase.reinit!(ds::ContinuousTimeDynamicalSystem, u::AbstractArray = initial_state(ds);
145-
p = current_parameters(ds), t0 = initial_time(ds)
145+
p = current_parameters(ds), t0 = initial_time(ds), kw...
146146
)
147147
set_parameters!(ds, p)
148-
reinit!(ds.integ, u; reinit_dae = false, reset_dt = true, t0)
148+
reinit!(ds.integ, u; reinit_dae = false, reset_dt = true, t0, kw...)
149149
return ds
150150
end
151151

src/core_systems/continuous_time_sde.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ where
1313
``\\mathbf{u}(t)`` is the state vector at time ``t``, ``\\mathbf{f}`` describes the
1414
deterministic dynamics, and the noise term
1515
``\\mathbf{g}(\\mathbf{u}, p, t) \\text{d}\\mathcal{N}_t`` describes
16-
the stochastic forcing in terms of a noise function (or *diffusion function*)
16+
the stochastic forcing in terms of a noise function (or *diffusion function*)
1717
``\\mathbf{g}`` and a noise process ``\\mathcal{N}_t``. The parameters of the functions
1818
``\\mathcal{f}`` and ``\\mathcal{g}`` are contained in the vector ``p``.
1919
@@ -55,7 +55,7 @@ Commonly, this is a matrix or sparse matrix. If this is not given, it
5555
defaults to `nothing`, which means the `g` should be interpreted as being diagonal.
5656
5757
The noise process can be specified via `noise_process`. It defaults to a standard Wiener
58-
process (Gaussian white noise).
58+
process (Gaussian white noise).
5959
For details on defining noise processes, see the docs of [DiffEqNoiseProcess.jl
6060
](https://docs.sciml.ai/DiffEqNoiseProcess/stable/). A complete list of the pre-defined
6161
processes can be found [here](https://docs.sciml.ai/DiffEqNoiseProcess/stable/noise_processes/).
@@ -111,4 +111,12 @@ struct CoupledSDEs{IIP,D,I,P} <: ContinuousTimeDynamicalSystem
111111
p0::P
112112
diffeq # isn't parameterized because it is only used for display
113113
noise_type::NamedTuple
114+
end
115+
116+
function SciMLBase.reinit!(ds::CoupledSDEs, u::AbstractArray = initial_state(ds);
117+
p = current_parameters(ds), t0 = initial_time(ds), kw...
118+
)
119+
set_parameters!(ds, p)
120+
reinit!(ds.integ, u; t0, kw...)
121+
return ds
114122
end

src/core_systems/jacobian.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ForwardDiff
66
jacobian(ds::CoreDynamicalSystem)
77
88
Construct the Jacobian rule for the dynamical system `ds`.
9-
If the system already has a Jacobian rule constructed via ModelingToolkit it returns this,
9+
If the system already has a Jacobian rule constructed via ModelingToolkit.jl it returns this,
1010
otherwise it constructs the Jacobian rule with automatic differentiation using module
1111
[`ForwardDiff`](https://github.com/JuliaDiff/ForwardDiff.jl).
1212
@@ -21,6 +21,17 @@ at the state `u`, parameters `p` and time `t` and save the result in `J0`.
2121
"""
2222
function jacobian(ds::CoreDynamicalSystem{IIP}) where {IIP}
2323
if ds isa ContinuousTimeDynamicalSystem
24+
# TODO: This is the correct API way to obtain the Jacobian,
25+
# however it relies on MTK dependency, so we can't do it.
26+
# if has_referrenced_model(ds)
27+
# model = referrenced_sciml_model(ds)
28+
# Joop, Jiip = generate_jacobian(model; expression = Val{false})
29+
# if IIP
30+
# jac = Jiip
31+
# else
32+
# jac = Joop
33+
# end
34+
# end
2435
prob = referrenced_sciml_prob(ds)
2536
if prob.f isa SciMLBase.AbstractDiffEqFunction && !isnothing(prob.f.jac)
2637
jac = prob.f.jac

test/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503"
33
DynamicalSystemsBase = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
44
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
55
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
6-
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
6+
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
7+
OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2"
78
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
89
StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
910
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/continuous.jl

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using DynamicalSystemsBase, Test
22

3-
using OrdinaryDiffEq: Vern9, ODEProblem, Rodas5, Tsit5
3+
using OrdinaryDiffEqTsit5: ODEProblem, Tsit5
4+
using OrdinaryDiffEqVerner: Vern9
45

56
include("test_system_function.jl")
67

@@ -25,14 +26,9 @@ p0 = [10, 28, 8/3]
2526

2627
lorenz_oop = CoupledODEs(lorenz_rule, u0, p0)
2728
lorenz_iip = CoupledODEs(ODEProblem(lorenz_rule_iip, copy(u0), (0.0, Inf), p0))
28-
lorenz_vern = CoupledODEs(lorenz_rule, u0, p0;
29-
diffeq = (alg = Vern9(), abstol = 1e-9, reltol = 1e-9)
30-
)
3129

32-
for (ds, iip) in zip((lorenz_oop, lorenz_iip, lorenz_vern), (false, true, false))
33-
34-
name = (ds === lorenz_vern) ? "lorvern" : "lorenz"
35-
@testset "$(name) IIP=$(iip)" begin
30+
for (ds, iip) in zip((lorenz_oop, lorenz_iip), (false, true))
31+
@testset "IIP=$(iip)" begin
3632
@test dynamic_rule(ds) == (iip ? lorenz_rule_iip : lorenz_rule)
3733
test_dynamical_system(ds, u0, p0; idt = false, iip=iip)
3834
end
@@ -42,20 +38,9 @@ end
4238
lorenz_oop = CoupledODEs(lorenz_rule, u0, p0)
4339
@test lorenz_oop.integ.alg isa Tsit5
4440

45-
lorenz_vern = CoupledODEs(lorenz_rule, u0, p0;
46-
diffeq = (alg = Vern9(), verbose = false, abstol = 1e-9, reltol = 1e-9)
47-
)
48-
@test lorenz_vern.integ.alg isa Vern9
49-
@test lorenz_vern.integ.opts.verbose == false
50-
51-
# also test ODEproblem creation
52-
prob = lorenz_vern.integ.sol.prob
53-
54-
ds = CoupledODEs(prob, (alg=Rodas5(autodiff=false), abstol=0.0, reltol=1e-6, verbose=false))
55-
56-
@test ds.integ.alg isa Rodas5
41+
prob = lorenz_oop.integ.sol.prob
42+
ds = CoupledODEs(prob, (alg=Vern9(), abstol=0.0, reltol=1e-6, verbose=false))
43+
@test ds.integ.alg isa Vern9
5744
@test ds.integ.opts.verbose == false
5845

59-
@test_throws ArgumentError CoupledODEs(prob; diffeq = (alg=Rodas5(autodiff=false), ))
60-
6146
end

0 commit comments

Comments
 (0)