From 0a4fca7025004218018481818fc29c9e17808251 Mon Sep 17 00:00:00 2001 From: vyudu Date: Mon, 13 Jan 2025 11:21:15 -0500 Subject: [PATCH] add error --- src/systems/diffeqs/sdesystem.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/systems/diffeqs/sdesystem.jl b/src/systems/diffeqs/sdesystem.jl index 366e8a6d09..95b5a4cc59 100644 --- a/src/systems/diffeqs/sdesystem.jl +++ b/src/systems/diffeqs/sdesystem.jl @@ -737,6 +737,7 @@ function DiffEqBase.SDEProblem{iip, specialize}( if !iscomplete(sys) error("A completed `SDESystem` is required. Call `complete` or `structural_simplify` on the system before creating an `SDEProblem`") end + f, u0, p = process_SciMLProblem( SDEFunction{iip, specialize}, sys, u0map, parammap; check_length, t = tspan === nothing ? nothing : tspan[1], kwargs...) @@ -767,6 +768,19 @@ function DiffEqBase.SDEProblem{iip, specialize}( noise_rate_prototype = noise_rate_prototype, kwargs...) end +function DiffEqBase.SDEProblem{iip, specialize}( + sys::ODESystem, u0map = [], tspan = get_tspan(sys), + parammap = DiffEqBase.NullParameters(); + sparsenoise = nothing, check_length = true, + callback = nothing, kwargs...) where {iip, specialize} + + if any(ModelingToolkit.isbrownian, unknowns(sys)) + error("SDESystem constructed by defining Brownian variables with @brownian must be simplified by calling `structural_simplify` before a SDEProblem can be constructed.") + else + error("Cannot construct SDEProblem from an ODESystem.") + end +end + """ ```julia DiffEqBase.SDEProblem{iip}(sys::SDESystem, u0map, tspan, p = parammap;