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

Diagonal noise not detected during lowering of System with @brownian variables #2490

Closed
AayushSabharwal opened this issue Feb 23, 2024 · 0 comments · Fixed by #2882
Closed
Labels
bug Something isn't working

Comments

@AayushSabharwal
Copy link
Member

Describe the bug 🐞

Lowering of stochastic systems using @brownian variables does not detect that the noise is diagonal.

Expected behavior

Diagonality is detected and the appropriate solvers are allowed.

Minimal Reproducible Example 👇

using ModelingToolkit, StochasticDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D

# Define some variables
@parameters σ ρ β
@variables x(t) y(t) z(t)
@brownian a
eqs = [D(x) ~ σ * (y - x) + 0.1a * x,
    D(y) ~ x *- z) - y + 0.1a * y,
    D(z) ~ x * y - β * z + 0.1a * z]

@mtkbuild de = System(eqs, t)

u0map = [
    x => 1.0,
    y => 0.0,
    z => 0.0
]

parammap = [
    σ => 10.0,
    β => 26.0,
    ρ => 2.33
]

prob = SDEProblem(de, u0map, (0.0, 100.0), parammap)
sol = solve(prob, SOSRI())

Error & Stacktrace ⚠️

ERROR: The algorithm is not compatible with the chosen noise type. Please see the documentation on the solver methods
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] __init(_prob::SDEProblem{…}, alg::SOSRI, timeseries_init::Vector{…}, ts_init::Vector{…}, ks_init::Type, recompile::Type{…}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_noise::Bool, save_on::Bool, save_start::Bool, save_end::Nothing, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, adaptive::Bool, gamma::Rational{…}, abstol::Nothing, reltol::Nothing, qmin::Rational{…}, qmax::Rational{…}, qsteady_min::Int64, qsteady_max::Int64, beta2::Nothing, beta1::Nothing, qoldinit::Rational{…}, controller::Nothing, fullnormalize::Bool, failfactor::Int64, delta::Rational{…}, maxiters::Int64, dtmax::Float64, dtmin::Float64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, force_dtmin::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), progress_id::Symbol, userdata::Nothing, initialize_integrator::Bool, seed::UInt64, alias_u0::Bool, alias_jumps::Bool, kwargs::@Kwargs{})
    @ StochasticDiffEq ~/.julia/packages/StochasticDiffEq/tdY4b/src/solve.jl:111
  [3] __solve(prob::SDEProblem{…}, alg::SOSRI, timeseries::Vector{…}, ts::Vector{…}, ks::Nothing, recompile::Type{…}; kwargs::@Kwargs{})
    @ StochasticDiffEq ~/.julia/packages/StochasticDiffEq/tdY4b/src/solve.jl:6
  [4] solve_call(_prob::SDEProblem{…}, args::SOSRI; merge_callbacks::Bool, kwargshandle::Nothing, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/Sueu7/src/solve.jl:612
  [5] solve_call(_prob::SDEProblem{…}, args::SOSRI)
    @ DiffEqBase ~/.julia/packages/DiffEqBase/Sueu7/src/solve.jl:569
  [6] solve_up(prob::SDEProblem{…}, sensealg::Nothing, u0::Vector{…}, p::ModelingToolkit.MTKParameters{…}, args::SOSRI; kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/Sueu7/src/solve.jl:1062
  [7] solve_up(prob::SDEProblem{…}, sensealg::Nothing, u0::Vector{…}, p::ModelingToolkit.MTKParameters{…}, args::SOSRI)
    @ DiffEqBase ~/.julia/packages/DiffEqBase/Sueu7/src/solve.jl:1048
  [8] solve(prob::SDEProblem{…}, args::SOSRI; sensealg::Nothing, u0::Nothing, p::Nothing, wrap::Val{…}, kwargs::@Kwargs{})
    @ DiffEqBase ~/.julia/packages/DiffEqBase/Sueu7/src/solve.jl:985
  [9] solve(prob::SDEProblem{…}, args::SOSRI)
    @ DiffEqBase ~/.julia/packages/DiffEqBase/Sueu7/src/solve.jl:975
 [10] top-level scope
    @ REPL[152]:1

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
Status `~/Julia/SciML/ModelingToolkit.jl/TestEnv/Project.toml`
  [4fba245c] ArrayInterface v7.7.1
  [687d7614] ControlSystemsMTK v1.1.0 `../../ControlSystemsMTK.jl`
  [2b5f629d] DiffEqBase v6.147.0
⌅ [06fc5a27] DynamicQuantities v0.11.3
  [f6369f11] ForwardDiff v0.10.36
  [ccbc3e58] JumpProcesses v9.10.1
  [961ee093] ModelingToolkit v9.0.1 `..`
  [16a59e39] ModelingToolkitStandardLibrary v2.4.0 `../../ModelingToolkitStandardLibrary.jl`
⌃ [8913a72c] NonlinearSolve v3.7.1
  [7f7a1694] Optimization v3.22.0 `../../Optimization.jl`
  [fd9f6733] OptimizationMOI v0.4.0 `../../Optimization.jl/lib/OptimizationMOI`
  [36348300] OptimizationOptimJL v0.2.2
  [1dea7af3] OrdinaryDiffEq v6.71.0
  [731186ca] RecursiveArrayTools v3.10.0
  [0bca4576] SciMLBase v2.26.1 `../../SciMLBase.jl`
  [53ae85a6] SciMLStructures v1.1.0
  [860ef19b] StableRNGs v1.0.1
  [9672c7b4] SteadyStateDiffEq v2.0.1
  [789caeaf] StochasticDiffEq v6.65.0
  [2efcf032] SymbolicIndexingInterface v0.3.7
  [d1185830] SymbolicUtils v1.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant