diff --git a/src/systems/diffeqs/abstractodesystem.jl b/src/systems/diffeqs/abstractodesystem.jl index 88a1ed9bb3..97954a8661 100644 --- a/src/systems/diffeqs/abstractodesystem.jl +++ b/src/systems/diffeqs/abstractodesystem.jl @@ -822,6 +822,9 @@ function process_DEProblem(constructor, sys::AbstractODESystem, u0map, parammap; if p isa Tuple ps = Base.Fix1(getindex, parameters(sys)).(split_idxs) ps = (ps...,) #if p is Tuple, ps should be Tuple + else + # if there is only one type, we don't need split_idxs + split_idxs = nothing end if implicit_dae && du0map !== nothing diff --git a/src/variables.jl b/src/variables.jl index 964eaa7859..f5af839233 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -142,11 +142,19 @@ function SciMLBase.process_p_u0_symbolic(prob::Union{SciMLBase.AbstractDEProblem hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) || throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order.")) + p = [ + (symbolic_type(sym) != NotSymbolic() ? parameter_symbols(prob)[parameter_index(prob, sym)] : sym) => val + for (sym, val) in p + ] end if eltype(u0) <: Pair hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) || throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." * " Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order.")) + u0 = [ + (symbolic_type(sym) != NotSymbolic() ? variable_symbols(prob)[variable_index(prob, sym)] : sym) => val + for (sym, val) in u0 + ] end sys = prob.f.sys @@ -165,7 +173,10 @@ function SciMLBase.process_p_u0_symbolic(prob::Union{SciMLBase.AbstractDEProblem sts = states(sys) defs = mergedefaults(defs, prob.u0, sts) defs = mergedefaults(defs, u0, sts) - u0, p, defs = get_u0_p(sys, defs) + + u0_defs = Dict(sym => val for (sym, val) in defs if is_variable(prob, sym)) + ps_defs = Dict(sym => val for (sym, val) in defs if is_parameter(prob, sym)) + u0, p, defs = get_u0_p(sys, u0_defs, ps_defs) return p, u0 end