Skip to content

Commit

Permalink
add error
Browse files Browse the repository at this point in the history
  • Loading branch information
vyudu committed Jan 13, 2025
1 parent c27e1d8 commit 0a4fca7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/systems/diffeqs/sdesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0a4fca7

Please sign in to comment.