You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If no `constraints` are specified, the problem will be treated as an initial value problem.
893
-
894
-
If the `ODESystem` has algebraic equations like `x(t)^2 + y(t)^2`, the resulting
903
+
If the `ODESystem` has algebraic equations, like `x(t)^2 + y(t)^2`, the resulting
895
904
`BVProblem` must be solved using BVDAE solvers, such as Ascher.
896
905
"""
897
906
function SciMLBase.BVProblem(sys::AbstractODESystem, args...; kwargs...)
@@ -916,7 +925,7 @@ end
916
925
function SciMLBase.BVProblem{iip, specialize}(sys::AbstractODESystem, u0map = [],
917
926
tspan =get_tspan(sys),
918
927
parammap = DiffEqBase.NullParameters();
919
-
constraints =nothing, guesses =Dict(),
928
+
guesses =Dict(),
920
929
version =nothing, tgrad =false,
921
930
callback =nothing,
922
931
check_length =true,
@@ -930,21 +939,14 @@ function SciMLBase.BVProblem{iip, specialize}(sys::AbstractODESystem, u0map = []
930
939
end
931
940
!isnothing(callback) &&error("BVP solvers do not support callbacks.")
932
941
933
-
has_alg_eqs(sys) &&error("The BVProblem currently does not support ODESystems with algebraic equations.") # Remove this when the BVDAE solvers get updated, the codegen should work when it does.
942
+
has_alg_eqs(sys) &&error("The BVProblem constructor currently does not support ODESystems with algebraic equations.") # Remove this when the BVDAE solvers get updated, the codegen should work when it does.
934
943
935
-
constraintsts =nothing
936
-
constraintps =nothing
937
944
sts =unknowns(sys)
938
945
ps =parameters(sys)
939
946
940
-
# Constraint validation
941
947
if!isnothing(constraints)
942
-
constraints isa Equation ||
943
-
constraints isa Vector{Equation} ||
944
-
error("Constraints must be specified as an equation or a vector of equations.")
error("The BVProblem is overdetermined. The total number of conditions (# constraints + # fixed initial values given by u0map) cannot exceed the total number of states.")
949
+
@warn"The BVProblem is overdetermined. The total number of conditions (# constraints + # fixed initial values given by u0map) exceeds the total number of states. The BVP solvers will default to doing a nonlinear least-squares optimization."
948
950
end
949
951
950
952
# ODESystems without algebraic equations should use both fixed values + guesses
@@ -957,97 +959,60 @@ function SciMLBase.BVProblem{iip, specialize}(sys::AbstractODESystem, u0map = []
957
959
stidxmap =Dict([v => i for (i, v) inenumerate(sts)])
958
960
u0_idxs =has_alg_eqs(sys) ?collect(1:length(sts)) : [stidxmap[k] for (k,v) in u0map]
959
961
960
-
bc =process_constraints(sys, constraints, u0, u0_idxs, tspan, iip)
961
-
962
+
bc =generate_function_bc(sys, u0, u0_idxs, tspan, iip)
var ∈ sts ||error("Constraint equation $eq contains a variable $var that is not a variable of the ODESystem.")
974
-
error("Constraint equation $eq contains a variable $var that does not have a specified argument. Such equations should be specified as algebraic equations to the ODESystem rather than a boundary constraints.")
975
-
else
976
-
operation(var)(iv) ∈ sts ||error("Constraint equation $eq contains a variable $(operation(var)) that is not a variable of the ODESystem.")
977
-
end
978
-
end
979
-
980
-
for var in constraintps
981
-
if!iscall(var)
982
-
var ∈ ps ||error("Constraint equation $eq contains a parameter $var that is not a parameter of the ODESystem.")
983
-
else
984
-
length(arguments(var)) >1&&error("Too many arguments for parameter $var.")
985
-
operation(var) ∈ ps ||error("Constraint equations contain a parameter $var that is not a parameter of the ODESystem.")
0 commit comments