Skip to content

Commit 098c2a6

Browse files
feat: implement SteadyStateProblem for System
1 parent 9783277 commit 098c2a6

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/problems/odeproblem.jl

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,39 @@ end
7272
f, u0, tspan, p, StandardODEProblem(); kwargs...))
7373
end
7474

75+
"""
76+
```julia
77+
SciMLBase.SteadyStateProblem(sys::System, u0map,
78+
parammap = DiffEqBase.NullParameters();
79+
version = nothing, tgrad = false,
80+
jac = false,
81+
checkbounds = false, sparse = false,
82+
linenumbers = true, parallel = SerialForm(),
83+
kwargs...) where {iip}
84+
```
85+
86+
Generates an SteadyStateProblem from a `System` of ODEs and allows for automatically
87+
symbolically calculating numerical enhancements.
88+
"""
89+
@fallback_iip_specialize function DiffEqBase.SteadyStateProblem{iip, spec}(
90+
sys::System, u0map,
91+
parammap = SciMLBase.NullParameters(); check_length = true,
92+
check_compatibility = true, kwargs...) where {iip, spec}
93+
check_complete(sys, SteadyStateProblem)
94+
check_compatibility && check_compatible_system(SteadyStateProblem, sys)
95+
96+
f, u0, p = process_SciMLProblem(ODEFunction{iip}, sys, u0map, parammap;
97+
steady_state = true, check_length, check_compatibility,
98+
force_initialization_time_independent = true, kwargs...)
99+
100+
kwargs = process_kwargs(sys; kwargs...)
101+
# Call `remake` so it runs initialization if it is trivial
102+
remake(SteadyStateProblem{iip}(f, u0, p; kwargs...))
103+
end
104+
75105
function check_compatible_system(
76-
T::Union{Type{ODEFunction}, Type{ODEProblem}, Type{DAEFunction}, Type{DAEProblem}},
106+
T::Union{Type{ODEFunction}, Type{ODEProblem}, Type{DAEFunction},
107+
Type{DAEProblem}, Type{SteadyStateProblem}},
77108
sys::System)
78109
check_time_dependent(sys, T)
79110
check_not_dde(sys)

0 commit comments

Comments
 (0)