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
error("The BVProblem is overdetermined. The total number of conditions (# constraints + # fixed initial values given by u0map) cannot exceed the total number of states.")
sub_u_p_into_symeq(cons.rhs-cons.lhs, u, p, stidxmap, pidxmap, iv, tspan)
983
+
end
984
+
resid =vcat(u[1][u0i] - u0[u0i], consresid)
927
985
end
928
986
end
929
987
else
@@ -941,32 +999,54 @@ end
941
999
942
1000
get_callback(prob::BVProblem) =error("BVP solvers do not support callbacks.")
943
1001
944
-
# Helper to create the dictionary that will substitute numeric values for u, p into the algebraic equations in the ODESystem. Used to construct the boundary condition function.
1002
+
# Validate that all the variables in the BVP constraints are well-formed states or parameters.
var ∈ sts ||error("Constraint equation $eq contains a variable $var that is not a variable of the ODESystem.")
1010
+
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.")
1011
+
else
1012
+
operation(var)(iv) ∈ sts ||error("Constraint equation $eq contains a variable $(operation(var)) that is not a variable of the ODESystem.")
1013
+
end
1014
+
end
1015
+
1016
+
for var in constraintps
1017
+
if!iscall(var)
1018
+
var ∈ ps ||error("Constraint equation $eq contains a parameter $var that is not a parameter of the ODESystem.")
1019
+
else
1020
+
operation(var) ∈ ps ||error("Constraint equations contain a parameter $var that is not a parameter of the ODESystem.")
1021
+
end
1022
+
end
1023
+
end
1024
+
1025
+
# Helper to substitute numeric values for u, p into the algebraic equations in the ODESystem. Used to construct the boundary condition function.
945
1026
# Take a system with variables x,y, parameters g
946
1027
#
947
-
# 1 + x + y → 1 + u[1][1] + u[1][2]
1028
+
# 1 + x(0) + y(0) → 1 + u[1][1] + u[1][2]
948
1029
# x(0.5) → u(0.5)[1]
949
1030
# x(0.5)*g(0.5) → u(0.5)[1]*p[1]
950
-
951
-
functionsub_u_p_into_symeq(eq, u, p, stidxmap, pidxmap)
952
-
iv = ModelingToolkit.get_iv(sys)
1031
+
functionsub_u_p_into_symeq(eq, u, p, stidxmap, pidxmap, iv, tspan)
0 commit comments