Skip to content

Commit 0a4fca7

Browse files
committed
add error
1 parent c27e1d8 commit 0a4fca7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/systems/diffeqs/sdesystem.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ function DiffEqBase.SDEProblem{iip, specialize}(
737737
if !iscomplete(sys)
738738
error("A completed `SDESystem` is required. Call `complete` or `structural_simplify` on the system before creating an `SDEProblem`")
739739
end
740+
740741
f, u0, p = process_SciMLProblem(
741742
SDEFunction{iip, specialize}, sys, u0map, parammap; check_length,
742743
t = tspan === nothing ? nothing : tspan[1], kwargs...)
@@ -767,6 +768,19 @@ function DiffEqBase.SDEProblem{iip, specialize}(
767768
noise_rate_prototype = noise_rate_prototype, kwargs...)
768769
end
769770

771+
function DiffEqBase.SDEProblem{iip, specialize}(
772+
sys::ODESystem, u0map = [], tspan = get_tspan(sys),
773+
parammap = DiffEqBase.NullParameters();
774+
sparsenoise = nothing, check_length = true,
775+
callback = nothing, kwargs...) where {iip, specialize}
776+
777+
if any(ModelingToolkit.isbrownian, unknowns(sys))
778+
error("SDESystem constructed by defining Brownian variables with @brownian must be simplified by calling `structural_simplify` before a SDEProblem can be constructed.")
779+
else
780+
error("Cannot construct SDEProblem from an ODESystem.")
781+
end
782+
end
783+
770784
"""
771785
```julia
772786
DiffEqBase.SDEProblem{iip}(sys::SDESystem, u0map, tspan, p = parammap;

0 commit comments

Comments
 (0)